diff --git a/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc b/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc index e8835a9e6d45fb52696e8a450d7e4b903460f2b8..6d481bae8a91015375be13b0530b793d6c3441c8 100644 --- a/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc +++ b/test/porousmediumflow/2p2c/implicit/mpnccomparison/test_2p2c_comparison_fv.cc @@ -38,8 +38,7 @@ #include <dumux/common/defaultusagemessage.hh> #include <dumux/linear/amgbackend.hh> -#include <dumux/nonlinear/newtonmethod.hh> -#include <dumux/porousmediumflow/compositional/privarswitchnewtoncontroller.hh> +#include <dumux/nonlinear/privarswitchnewtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> @@ -129,7 +128,6 @@ int main(int argc, char** argv) try // get some time loop parameters using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - const auto maxDivisions = getParam<int>("TimeLoop.MaxTimeStepDivisions"); const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); @@ -157,10 +155,9 @@ int main(int argc, char** argv) try auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver - using NewtonController = PriVarSwitchNewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<NewtonController, Assembler, LinearSolver>; - auto newtonController = std::make_shared<NewtonController>(timeLoop); - NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); + using NewtonSolver = PriVarSwitchNewtonSolver<Assembler, LinearSolver, + typename GET_PROP_TYPE(TypeTag, PrimaryVariableSwitch)>; + NewtonSolver nonLinearSolver(assembler, linearSolver); // time loop timeLoop->start(); do @@ -168,24 +165,8 @@ int main(int argc, char** argv) try // set previous solution for storage evaluations assembler->setPreviousSolution(xOld); - // try solving the non-linear system - for (int i = 0; i < maxDivisions; ++i) - { - // linearize & solve - auto converged = nonLinearSolver.solve(x); - - if (converged) - break; - - if (!converged && i == maxDivisions-1) - DUNE_THROW(Dune::MathError, - "Newton solver didn't converge after " - << maxDivisions - << " time-step divisions. dt=" - << timeLoop->timeStepSize() - << ".\nThe solutions of the current and the previous time steps " - << "have been saved to restart files."); - } + // solve the non-linear system with time step control + nonLinearSolver.solve(x, *timeLoop); // make the new solution the old solution xOld = x; @@ -200,8 +181,8 @@ int main(int argc, char** argv) try // report statistics of this time step timeLoop->reportTimeStep(); - // set new dt as suggested by newton controller - timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize())); + // set new dt as suggested by the newton solver + timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); } while (!timeLoop->finished()); diff --git a/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc b/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc index c7fc2a9a98d281fe268b3a2de6e079494535c446..1b86e04ba7cc00ff355e3f9513ed3c0ede80ef9b 100644 --- a/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc +++ b/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc @@ -153,7 +153,7 @@ int main(int argc, char** argv) try // report statistics of this time step timeLoop->reportTimeStep(); - // set new dt as suggested by newton controller + // set new dt as suggested by the newton solver timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); // write vtk output