From 6b7ff1015762e14ae001e77fe28749238c98693c Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Tue, 30 Jan 2018 16:55:18 +0100
Subject: [PATCH] [test] Use the new newton solver in some tests

* 1p2c, 2p2c, test_donea (NavierStokes)
---
 dumux/porousmediumflow/2p2c/model.hh                |  1 -
 test/freeflow/navierstokes/test_donea.cc            | 11 +++--------
 test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc |  9 +++------
 test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc | 11 ++++-------
 4 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/dumux/porousmediumflow/2p2c/model.hh b/dumux/porousmediumflow/2p2c/model.hh
index 5817137f90..d97f2bcc03 100644
--- a/dumux/porousmediumflow/2p2c/model.hh
+++ b/dumux/porousmediumflow/2p2c/model.hh
@@ -88,7 +88,6 @@
 
 #include <dumux/porousmediumflow/compositional/localresidual.hh>
 #include <dumux/porousmediumflow/compositional/switchableprimaryvariables.hh>
-#include <dumux/porousmediumflow/compositional/privarswitchnewtoncontroller.hh>
 
 #include "indices.hh"
 #include "volumevariables.hh"
diff --git a/test/freeflow/navierstokes/test_donea.cc b/test/freeflow/navierstokes/test_donea.cc
index c29346f65b..2403a71cb3 100644
--- a/test/freeflow/navierstokes/test_donea.cc
+++ b/test/freeflow/navierstokes/test_donea.cc
@@ -43,12 +43,10 @@
 #include <dumux/common/defaultusagemessage.hh>
 
 #include <dumux/linear/seqsolverbackend.hh>
-#include <dumux/nonlinear/newtonmethod.hh>
-#include <dumux/nonlinear/newtoncontroller.hh>
+#include <dumux/nonlinear/newtonsolver.hh>
 
 #include <dumux/assembly/staggeredfvassembler.hh>
 #include <dumux/assembly/diffmethod.hh>
-#include <dumux/nonlinear/staggerednewtoncontroller.hh>
 
 #include <dumux/discretization/methods.hh>
 
@@ -158,11 +156,8 @@ int main(int argc, char** argv) try
     auto linearSolver = std::make_shared<LinearSolver>();
 
     // the non-linear solver
-    using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
-    using NewtonController = StaggeredNewtonController<Scalar>;
-    using NewtonMethod = Dumux::NewtonMethod<NewtonController, Assembler, LinearSolver>;
-    auto newtonController = std::make_shared<NewtonController>();
-    NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver);
+    using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>;
+    NewtonSolver nonLinearSolver(assembler, linearSolver);
 
     // linearize & solve
     Dune::Timer timer;
diff --git a/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc b/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc
index 50fd7f1ce8..0109b9ccab 100644
--- a/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc
+++ b/test/porousmediumflow/1pnc/implicit/test_1p2c_fv.cc
@@ -41,9 +41,8 @@
  #include <dumux/common/dumuxmessage.hh>
  #include <dumux/common/defaultusagemessage.hh>
 
- #include <dumux/nonlinear/newtoncontroller.hh>
  #include <dumux/linear/seqsolverbackend.hh>
- #include <dumux/nonlinear/newtonmethod.hh>
+ #include <dumux/nonlinear/newtonsolver.hh>
 
  #include <dumux/assembly/fvassembler.hh>
 
@@ -130,9 +129,7 @@
      auto linearSolver = std::make_shared<LinearSolver>();
 
      // the non-linear solver
-     using NewtonController = Dumux::NewtonController<Scalar>;
-     auto newtonController = std::make_shared<NewtonController>(timeLoop);
-     NewtonMethod<NewtonController, Assembler, LinearSolver> nonLinearSolver(newtonController, assembler, linearSolver);
+     NewtonSolver<Assembler, LinearSolver> nonLinearSolver(assembler, linearSolver, timeLoop);
 
      // time loop
      timeLoop->start(); do
@@ -173,7 +170,7 @@
          timeLoop->reportTimeStep();
 
          // set new dt as suggested by newton controller
-         timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize()));
+         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 5651d2a05c..48414c9f14 100644
--- a/test/porousmediumflow/2p2c/implicit/test_2p2c_fv.cc
+++ b/test/porousmediumflow/2p2c/implicit/test_2p2c_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>
@@ -132,10 +131,8 @@ 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 NewtonMethod = Dumux::PriVarSwitchNewtonSolver<TypeTag, Assembler, LinearSolver>;
+    NewtonMethod nonLinearSolver(assembler, linearSolver);
 
     // time loop
     timeLoop->start(); do
@@ -173,7 +170,7 @@ int main(int argc, char** argv) try
         timeLoop->reportTimeStep();
 
         // set new dt as suggested by newton controller
-        timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize()));
+        timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize()));
 
         // write vtk output
         vtkWriter.write(timeLoop->time());
-- 
GitLab