diff --git a/dumux/discretization/box/subcontrolvolume.hh b/dumux/discretization/box/subcontrolvolume.hh index b29f786ed3f55b478bca36bc98e2a6b89a11a91f..238ec13cb580bb492dc77d2445ec0e1e38cc1d41 100644 --- a/dumux/discretization/box/subcontrolvolume.hh +++ b/dumux/discretization/box/subcontrolvolume.hh @@ -83,7 +83,11 @@ public: // e.g. for integration Geometry geometry() const { +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) return Geometry(Dune::GeometryTypes::cube(dim), corners_); +#else + return Geometry(Dune::GeometryType(Dune::GeometryType::cube, dim), corners_); +#endif } //! The global index of this scv diff --git a/dumux/discretization/box/subcontrolvolumeface.hh b/dumux/discretization/box/subcontrolvolumeface.hh index 77af3b7ec4959af3525c070bb9dce48d7c107992..fe6066dc600ce21bca9e2730b7bd5d382d90094c 100644 --- a/dumux/discretization/box/subcontrolvolumeface.hh +++ b/dumux/discretization/box/subcontrolvolumeface.hh @@ -154,7 +154,11 @@ public: //! The geometry of the sub control volume face Geometry geometry() const { +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_); +#else + return Geometry(Dune::GeometryType(Dune::GeometryType::cube, Geometry::mydimension), corners_); +#endif } private: diff --git a/dumux/discretization/cellcentered/mpfa/helper.hh b/dumux/discretization/cellcentered/mpfa/helper.hh index 26fe069a77b2afc22108000b7d1eb26b766bf790..84e0248babf77e227a6a4c9b2a0e37b8b65335a1 100644 --- a/dumux/discretization/cellcentered/mpfa/helper.hh +++ b/dumux/discretization/cellcentered/mpfa/helper.hh @@ -23,6 +23,7 @@ #ifndef DUMUX_DISCRETIZATION_CC_MPFA_HELPER_HH #define DUMUX_DISCRETIZATION_CC_MPFA_HELPER_HH +#include <dune/common/version.hh> #include <dune/geometry/type.hh> #include "methods.hh" @@ -112,11 +113,19 @@ public: */ static std::size_t getGlobalNumScvf(const GridView& gridView) { +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) assert(gridView.size(Dune::GeometryTypes::triangle) + gridView.size(Dune::GeometryTypes::quadrilateral) == gridView.size(0)); return gridView.size(Dune::GeometryTypes::triangle)*6 + gridView.size(Dune::GeometryTypes::quadrilateral)*8; +#else + assert(gridView.size(Dune::GeometryType(Dune::GeometryType::simplex, 2)) + + gridView.size(Dune::GeometryType(Dune::GeometryType::cube, 2)) == gridView.size(0)); + + return gridView.size(Dune::GeometryType(Dune::GeometryType::simplex, 2))*6 + + gridView.size(Dune::GeometryType(Dune::GeometryType::cube, 2))*8; +#endif } /*! @@ -194,12 +203,21 @@ public: */ static std::size_t getNumLocalScvfs(const Dune::GeometryType gt) { +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) if (gt == Dune::GeometryTypes::triangle) return 6; else if (gt == Dune::GeometryTypes::quadrilateral) return 8; else DUNE_THROW(Dune::NotImplemented, "Mpfa for 2d geometry type " << gt); +#else + if (gt.isTriangle()) + return 6; + else if (gt.isQuadrilateral()) + return 8; + else + DUNE_THROW(Dune::NotImplemented, "Mpfa for 2d geometry type " << gt); +#endif } }; @@ -334,6 +352,7 @@ public: */ static std::size_t getGlobalNumScvf(const GridView& gridView) { +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) assert(gridView.size(Dune::GeometryTypes::tetrahedron) + gridView.size(Dune::GeometryTypes::pyramid) + gridView.size(Dune::GeometryTypes::prism) @@ -343,6 +362,17 @@ public: + gridView.size(Dune::GeometryTypes::pyramid)*16 + gridView.size(Dune::GeometryTypes::prism)*18 + gridView.size(Dune::GeometryTypes::cube)*24; +#else + assert(gridView.size(Dune::GeometryType(Dune::GeometryType::simplex, 3)) + + gridView.size(Dune::GeometryType(Dune::GeometryType::pyramid, 3)) + + gridView.size(Dune::GeometryType(Dune::GeometryType::prism, 3)) + + gridView.size(Dune::GeometryType(Dune::GeometryType::cube, 3)) == gridView.size(0)); + + return gridView.size(Dune::GeometryType(Dune::GeometryType::simplex, 3))*12 + + gridView.size(Dune::GeometryType(Dune::GeometryType::pyramid, 3))*16 + + gridView.size(Dune::GeometryType(Dune::GeometryType::prism, 3))*18 + + gridView.size(Dune::GeometryType(Dune::GeometryType::cube, 3))*24; +#endif } /*! diff --git a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh index 03bbd2356a77daa11bb7f4c55e2e1f2f7eeabbe2..bb13446711a137e8e252b51256a9c005bed9e84c 100644 --- a/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh +++ b/dumux/discretization/cellcentered/mpfa/subcontrolvolumeface.hh @@ -23,6 +23,7 @@ #ifndef DUMUX_DISCRETIZATION_CC_MPFA_SUBCONTROLVOLUMEFACE_HH #define DUMUX_DISCRETIZATION_CC_MPFA_SUBCONTROLVOLUMEFACE_HH +#include <dune/common/version.hh> #include "methods.hh" namespace Dumux @@ -144,7 +145,11 @@ public: const GlobalPosition& unitOuterNormal() const { return unitOuterNormal_; } //! The geometry of the sub control volume face +#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6) Geometry geometry() const { return Geometry(Dune::GeometryTypes::cube(Geometry::mydimension), corners_); } +#else + Geometry geometry() const { return Geometry(Dune::GeometryType(Dune::GeometryType::cube, Geometry::mydimension), corners_); } +#endif private: bool boundary_; diff --git a/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh b/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh index c9c3fbf61883782256b8e805bc1e2a60d2fd75fb..48568447d9c5fa4074e43b1b27d8426d700b2d80 100644 --- a/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh +++ b/test/porousmediumflow/3p/implicit/3pniconductionproblem.hh @@ -47,27 +47,25 @@ class ThreePNIConductionProblem; namespace Properties { -NEW_PROP_TAG(FVGridGeometry); - -NEW_TYPE_TAG(ThreePNIConductionProblem, INHERITS_FROM(ThreePNI)); -NEW_TYPE_TAG(ThreePNIConductionBoxProblem, INHERITS_FROM(BoxModel, ThreePNIConductionProblem, ThreePNISpatialParams)); -NEW_TYPE_TAG(ThreePNIConductionCCProblem, INHERITS_FROM(CCTpfaModel, ThreePNIConductionProblem, ThreePNISpatialParams)); -NEW_TYPE_TAG(ThreePNIConductionCCMpfaProblem, INHERITS_FROM(CCMpfaModel, ThreePNIConductionProblem, ThreePNISpatialParams)); +NEW_TYPE_TAG(ThreePNIConductionTypeTag, INHERITS_FROM(ThreePNI)); +NEW_TYPE_TAG(ThreePNIConductionBoxTypeTag, INHERITS_FROM(BoxModel, ThreePNIConductionTypeTag, ThreePNISpatialParams)); +NEW_TYPE_TAG(ThreePNIConductionCCTpfaTypeTag, INHERITS_FROM(CCTpfaModel, ThreePNIConductionTypeTag, ThreePNISpatialParams)); +NEW_TYPE_TAG(ThreePNIConductionCCMpfaTypeTag, INHERITS_FROM(CCMpfaModel, ThreePNIConductionTypeTag, ThreePNISpatialParams)); // Set the grid type -SET_TYPE_PROP(ThreePNIConductionProblem, Grid, Dune::YaspGrid<2>); +SET_TYPE_PROP(ThreePNIConductionTypeTag, Grid, Dune::YaspGrid<2>); // Set the problem property -SET_TYPE_PROP(ThreePNIConductionProblem, Problem, ThreePNIConductionProblem<TypeTag>); +SET_TYPE_PROP(ThreePNIConductionTypeTag, Problem, ThreePNIConductionProblem<TypeTag>); // Set the fluid system -SET_TYPE_PROP(ThreePNIConductionProblem, +SET_TYPE_PROP(ThreePNIConductionTypeTag, FluidSystem, FluidSystems::H2OAirMesitylene<typename GET_PROP_TYPE(TypeTag, Scalar)>); // Set the spatial parameters -SET_TYPE_PROP(ThreePNIConductionProblem, +SET_TYPE_PROP(ThreePNIConductionTypeTag, SpatialParams, ThreePNISpatialParams<TypeTag>); diff --git a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh index 1178f4d46e104db1257cbad3c9e36f0a8789a46a..bed0617a8dd8d669840904deede0b08cf46aa4de 100644 --- a/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh +++ b/test/porousmediumflow/3p/implicit/3pniconvectionproblem.hh @@ -45,25 +45,25 @@ class ThreePNIConvectionProblem; namespace Properties { -NEW_TYPE_TAG(ThreePNIConvectionProblem, INHERITS_FROM(ThreePNI, ThreePNISpatialParams)); -NEW_TYPE_TAG(ThreePNIConvectionBoxProblem, INHERITS_FROM(BoxModel, ThreePNIConvectionProblem)); -NEW_TYPE_TAG(ThreePNIConvectionCCProblem, INHERITS_FROM(CCTpfaModel, ThreePNIConvectionProblem)); -NEW_TYPE_TAG(ThreePNIConvectionCCMpfaProblem, INHERITS_FROM(CCMpfaModel, ThreePNIConvectionProblem)); +NEW_TYPE_TAG(ThreePNIConvectionTypeTag, INHERITS_FROM(ThreePNI, ThreePNISpatialParams)); +NEW_TYPE_TAG(ThreePNIConvectionBoxTypeTag, INHERITS_FROM(BoxModel, ThreePNIConvectionTypeTag)); +NEW_TYPE_TAG(ThreePNIConvectionCCTpfaTypeTag, INHERITS_FROM(CCTpfaModel, ThreePNIConvectionTypeTag)); +NEW_TYPE_TAG(ThreePNIConvectionCCMpfaTypeTag, INHERITS_FROM(CCMpfaModel, ThreePNIConvectionTypeTag)); // Set the grid type -SET_TYPE_PROP(ThreePNIConvectionProblem, Grid, Dune::YaspGrid<2>); +SET_TYPE_PROP(ThreePNIConvectionTypeTag, Grid, Dune::YaspGrid<2>); // Set the problem property -SET_TYPE_PROP(ThreePNIConvectionProblem, Problem, ThreePNIConvectionProblem<TypeTag>); +SET_TYPE_PROP(ThreePNIConvectionTypeTag, Problem, ThreePNIConvectionProblem<TypeTag>); // Set the fluid system -SET_TYPE_PROP(ThreePNIConvectionProblem, +SET_TYPE_PROP(ThreePNIConvectionTypeTag, FluidSystem, FluidSystems::H2OAirMesitylene<typename GET_PROP_TYPE(TypeTag, Scalar)>); // Set the spatial parameters -SET_TYPE_PROP(ThreePNIConvectionProblem, +SET_TYPE_PROP(ThreePNIConvectionTypeTag, SpatialParams, ThreePNISpatialParams<TypeTag>); } diff --git a/test/porousmediumflow/3p/implicit/CMakeLists.txt b/test/porousmediumflow/3p/implicit/CMakeLists.txt index deeff681559ef513a61288331c0bf8370f2bd68f..4c3385dfdc148b8fd2a9cd32ea329015ecbf5233 100644 --- a/test/porousmediumflow/3p/implicit/CMakeLists.txt +++ b/test/porousmediumflow/3p/implicit/CMakeLists.txt @@ -2,56 +2,62 @@ add_input_file_links() # isothermal tests dune_add_test(NAME test_box3p - SOURCES test_box3p.cc + SOURCES test_3p_fv.cc + COMPILE_DEFINITIONS TYPETAG=InfiltrationThreePBoxTypeTag COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/infiltration3pbox-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/infiltration3pbox-00008.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box3p") + ${CMAKE_CURRENT_BINARY_DIR}/infiltration3pbox-00008.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_box3p test_3p_fv.input -Problem.Name infiltration3pbox") dune_add_test(NAME test_cc3p - SOURCES test_cc3p.cc + SOURCES test_3p_fv.cc + COMPILE_DEFINITIONS TYPETAG=InfiltrationThreePCCTpfaTypeTag COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/infiltration3pcc-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/infiltration3pcc-00008.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc3p") + ${CMAKE_CURRENT_BINARY_DIR}/infiltration3pcc-00008.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc3p test_3p_fv.input -Problem.Name infiltration3pcc") # non-isothermal tests dune_add_test(NAME test_box3pniconvection - SOURCES test_box3pniconvection.cc + SOURCES test_3pni_fv_convection.cc + COMPILE_DEFINITIONS TYPETAG=ThreePNIConvectionBoxTypeTag COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/3pniconvectionbox-reference.vtu ${CMAKE_CURRENT_BINARY_DIR}/test_box3pniconvection-00010.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box3pniconvection" + --command "${CMAKE_CURRENT_BINARY_DIR}/test_box3pniconvection test_3pni_fv_convection.input -Problem.Name test_box3pniconvection" --zeroThreshold {"velocity_w \(m/s\)_1":1e-8}) dune_add_test(NAME test_cc3pniconvection - SOURCES test_cc3pniconvection.cc + SOURCES test_3pni_fv_convection.cc + COMPILE_DEFINITIONS TYPETAG=ThreePNIConvectionCCTpfaTypeTag COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/3pniconvectioncc-reference.vtu ${CMAKE_CURRENT_BINARY_DIR}/test_cc3pniconvection-00010.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc3pniconvection" + --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc3pniconvection test_3pni_fv_convection.input -Problem.Name test_cc3pniconvection" --zeroThreshold {"velocity_w \(m/s\)_1":1e-8}) dune_add_test(NAME test_box3pniconduction - SOURCES test_box3pniconduction.cc + SOURCES test_3pni_fv_conduction.cc + COMPILE_DEFINITIONS TYPETAG=ThreePNIConductionBoxTypeTag COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/3pniconductionbox-reference.vtu ${CMAKE_CURRENT_BINARY_DIR}/test_box3pniconduction-00006.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box3pniconduction" + --command "${CMAKE_CURRENT_BINARY_DIR}/test_box3pniconduction test_3pni_fv_conduction.input -Problem.Name test_box3pniconduction" --zeroThreshold {"velocity_w \(m/s\)_1":1e-8}) dune_add_test(NAME test_cc3pniconduction - SOURCES test_cc3pniconduction.cc + SOURCES test_3pni_fv_conduction.cc + COMPILE_DEFINITIONS TYPETAG=ThreePNIConductionCCTpfaTypeTag COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy --files ${CMAKE_SOURCE_DIR}/test/references/3pniconductioncc-reference.vtu ${CMAKE_CURRENT_BINARY_DIR}/test_cc3pniconduction-00006.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc3pniconduction" + --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc3pniconduction test_3pni_fv_conduction.input -Problem.Name test_cc3pniconduction" --zeroThreshold {"velocity_w \(m/s\)_1":1e-8}) #install sources diff --git a/test/porousmediumflow/3p/implicit/infiltration3pproblem.hh b/test/porousmediumflow/3p/implicit/infiltration3pproblem.hh index 5948e370ba2fb5d5479c54ad9aa5e8361af48dd5..18a4f6c27a116724b125ebb068a26ab0fe98da88 100644 --- a/test/porousmediumflow/3p/implicit/infiltration3pproblem.hh +++ b/test/porousmediumflow/3p/implicit/infiltration3pproblem.hh @@ -42,18 +42,18 @@ class InfiltrationThreePProblem; namespace Properties { -NEW_TYPE_TAG(InfiltrationThreePProblem, INHERITS_FROM(ThreeP, InfiltrationThreePSpatialParams)); -NEW_TYPE_TAG(InfiltrationThreePBoxProblem, INHERITS_FROM(BoxModel, InfiltrationThreePProblem)); -NEW_TYPE_TAG(InfiltrationThreePCCProblem, INHERITS_FROM(CCTpfaModel, InfiltrationThreePProblem)); +NEW_TYPE_TAG(InfiltrationThreePTypeTag, INHERITS_FROM(ThreeP, InfiltrationThreePSpatialParams)); +NEW_TYPE_TAG(InfiltrationThreePBoxTypeTag, INHERITS_FROM(BoxModel, InfiltrationThreePTypeTag)); +NEW_TYPE_TAG(InfiltrationThreePCCTpfaTypeTag, INHERITS_FROM(CCTpfaModel, InfiltrationThreePTypeTag)); // Set the grid type -SET_TYPE_PROP(InfiltrationThreePProblem, Grid, Dune::YaspGrid<2>); +SET_TYPE_PROP(InfiltrationThreePTypeTag, Grid, Dune::YaspGrid<2>); // Set the problem property -SET_TYPE_PROP(InfiltrationThreePProblem, Problem, InfiltrationThreePProblem<TypeTag>); +SET_TYPE_PROP(InfiltrationThreePTypeTag, Problem, InfiltrationThreePProblem<TypeTag>); // Set the fluid system -SET_TYPE_PROP(InfiltrationThreePProblem, +SET_TYPE_PROP(InfiltrationThreePTypeTag, FluidSystem, FluidSystems::H2OAirMesitylene<typename GET_PROP_TYPE(TypeTag, Scalar)>); diff --git a/test/porousmediumflow/3p/implicit/test_cc3p.cc b/test/porousmediumflow/3p/implicit/test_3p_fv.cc similarity index 97% rename from test/porousmediumflow/3p/implicit/test_cc3p.cc rename to test/porousmediumflow/3p/implicit/test_3p_fv.cc index 5f09e831f7cb37ce35d5484491b96d43be4a5218..f8bcf36e9ab7d8845ddb1c9447ae9e5cbeca45bc 100644 --- a/test/porousmediumflow/3p/implicit/test_cc3p.cc +++ b/test/porousmediumflow/3p/implicit/test_3p_fv.cc @@ -38,7 +38,7 @@ #include <dumux/common/dumuxmessage.hh> #include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/linear/amgbackend.hh> #include <dumux/nonlinear/newtonmethod.hh> #include <dumux/nonlinear/newtoncontroller.hh> @@ -86,7 +86,7 @@ int main(int argc, char** argv) try using namespace Dumux; // define the type tag for this problem - using TypeTag = TTAG(InfiltrationThreePCCProblem); + using TypeTag = TTAG(TYPETAG); // initialize MPI, finalize is done automatically on exit const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); @@ -121,7 +121,7 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(0)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -157,8 +157,8 @@ int main(int argc, char** argv) try auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver - using LinearSolver = UMFPackBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(); + using LinearSolver = Dumux::AMGBackend<TypeTag>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver using NewtonController = Dumux::NewtonController<TypeTag>; diff --git a/test/porousmediumflow/3p/implicit/test_cc3p.input b/test/porousmediumflow/3p/implicit/test_3p_fv.input similarity index 100% rename from test/porousmediumflow/3p/implicit/test_cc3p.input rename to test/porousmediumflow/3p/implicit/test_3p_fv.input diff --git a/test/porousmediumflow/3p/implicit/test_cc3pniconduction.cc b/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.cc similarity index 98% rename from test/porousmediumflow/3p/implicit/test_cc3pniconduction.cc rename to test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.cc index 858dbea7e6fbbd83103992f8541efb8d91fd5b6e..c3be2c2f3c5b62316679e84af87210f6e715aa11 100644 --- a/test/porousmediumflow/3p/implicit/test_cc3pniconduction.cc +++ b/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.cc @@ -86,7 +86,7 @@ int main(int argc, char** argv) try using namespace Dumux; // define the type tag for this problem - using TypeTag = TTAG(ThreePNIConductionCCProblem); + using TypeTag = TTAG(TYPETAG); // initialize MPI, finalize is done automatically on exit const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); @@ -121,7 +121,7 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(0)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -161,7 +161,7 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = Dumux::AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->elementMapper()); + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver using NewtonController = Dumux::NewtonController<TypeTag>; diff --git a/test/porousmediumflow/3p/implicit/test_cc3pniconduction.input b/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.input similarity index 56% rename from test/porousmediumflow/3p/implicit/test_cc3pniconduction.input rename to test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.input index 11dff4a2c571408c3a9079969f8aa1c93e9b7b72..9fc89f231cab09b1511eb9833cf795157d28c477 100644 --- a/test/porousmediumflow/3p/implicit/test_cc3pniconduction.input +++ b/test/porousmediumflow/3p/implicit/test_3pni_fv_conduction.input @@ -8,9 +8,9 @@ UpperRight = 5 1 Cells = 200 1 [Problem] -Name = test_cc3pniconduction # name passed to the output routines +Name = test_3pniconduction # name passed to the output routines OutputInterval = 5 # every 5th timestep an output file is written -EnableGravity = 0 # disable gravity +EnableGravity = false # disable gravity [Vtk] -AddVelocity = 1 #Enable velocity output +AddVelocity = true #Enable velocity output diff --git a/test/porousmediumflow/3p/implicit/test_cc3pniconvection.cc b/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.cc similarity index 98% rename from test/porousmediumflow/3p/implicit/test_cc3pniconvection.cc rename to test/porousmediumflow/3p/implicit/test_3pni_fv_convection.cc index 77ee4c8b207e1bd23a59e3c8aea041a531e8a872..15becc03f3da1d00f49c5f6359a76f4bb2a94284 100644 --- a/test/porousmediumflow/3p/implicit/test_cc3pniconvection.cc +++ b/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.cc @@ -86,7 +86,7 @@ int main(int argc, char** argv) try using namespace Dumux; // define the type tag for this problem - using TypeTag = TTAG(ThreePNIConvectionCCProblem); + using TypeTag = TTAG(TYPETAG); // initialize MPI, finalize is done automatically on exit const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); @@ -121,7 +121,7 @@ int main(int argc, char** argv) try // the solution vector using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(0)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -161,7 +161,7 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = Dumux::AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->elementMapper()); + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); // the non-linear solver using NewtonController = Dumux::NewtonController<TypeTag>; diff --git a/test/porousmediumflow/3p/implicit/test_box3pniconvection.input b/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.input similarity index 62% rename from test/porousmediumflow/3p/implicit/test_box3pniconvection.input rename to test/porousmediumflow/3p/implicit/test_3pni_fv_convection.input index 74c95f92a70ec36847d50733bb961979ed598397..8670882f2422304237826ef78bf37b51166e2d50 100644 --- a/test/porousmediumflow/3p/implicit/test_box3pniconvection.input +++ b/test/porousmediumflow/3p/implicit/test_3pni_fv_convection.input @@ -8,10 +8,10 @@ UpperRight = 20 1 Cells = 80 1 [Problem] -Name = test_box3pniconvection # name passed to the output routines +Name = test_3pniconvection # name passed to the output routines OutputInterval = 5 # every 5th timestep an output file is written DarcyVelocity = 1e-4 # [m/s] inflow at the left boundary -EnableGravity = 0 # disable gravity +EnableGravity = false # disable gravity [Vtk] -AddVelocity = 1 #Enable velocity output +AddVelocity = true #Enable velocity output diff --git a/test/porousmediumflow/3p/implicit/test_box3p.cc b/test/porousmediumflow/3p/implicit/test_box3p.cc deleted file mode 100644 index 1f2ae7a3d71f3f027cbc60441466ac7ea2cbe25c..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/3p/implicit/test_box3p.cc +++ /dev/null @@ -1,252 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief Test for the three-phase box model - */ -#include <config.h> -#include "infiltration3pproblem.hh" - -#include <ctime> -#include <iostream> - -#include <dune/common/parallel/mpihelper.hh> -#include <dune/common/timer.hh> -#include <dune/grid/io/file/dgfparser/dgfexception.hh> -#include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> - -#include <dumux/common/propertysystem.hh> -#include <dumux/common/parameters.hh> -#include <dumux/common/valgrind.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> - -#include <dumux/linear/amgbackend.hh> -#include <dumux/nonlinear/newtonmethod.hh> -#include <dumux/nonlinear/newtoncontroller.hh> - -#include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/methods.hh> - -#include <dumux/io/vtkoutputmodule.hh> - -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.File Name of the file containing the grid \n" - "\t definition in DGF format\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) try -{ - - using namespace Dumux; - - // define the type tag for this problem - using TypeTag = TTAG(InfiltrationThreePBoxProblem); - - //////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////// - - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); - - // parse command line arguments and input file - Parameters::init(argc, argv, usage); - - // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); - - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// - - // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); - - // create the finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); - - // the problem (initial and boundary conditions) - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); - - // the solution vector - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(GridView::dimension)); - problem->applyInitialSolution(x); - auto xOld = x; - - // the grid variables - using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); - gridVariables->init(x, xOld); - - // 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"); - - // check if we are about to restart a previously interrupted simulation - Scalar restartTime = 0; - if (Parameters::getTree().hasKey("Restart") || Parameters::getTree().hasKey("TimeLoop.Restart")) - restartTime = getParam<Scalar>("TimeLoop.Restart"); - - // intialize the vtk output module - using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); - VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); - VtkOutputFields::init(vtkWriter); //! Add model specific output fields - vtkWriter.write(0.0); - - // instantiate time loop - auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); - - // the assembler with time loop for instationary problem - using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); - - // the linear solver - using LinearSolver = Dumux::AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->elementMapper()); - - // the non-linear solver - using NewtonController = Dumux::NewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<NewtonController, Assembler, LinearSolver>; - auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); - NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); - - // time loop - timeLoop->start(); do - { - // 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."); - } - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - // write vtk output - vtkWriter.write(timeLoop->time()); - - // report statistics of this time step - timeLoop->reportTimeStep(); - - // set new dt as suggested by newton controller - timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize())); - problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); - - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } - - return 0; - -} -catch (Dumux::ParameterException &e) -{ - std::cerr << std::endl << e << " ---> Abort!" << std::endl; - return 1; -} -catch (Dune::DGFException & e) -{ - std::cerr << "DGF exception thrown (" << e << - "). Most likely, the DGF file name is wrong " - "or the DGF file is corrupted, " - "e.g. missing hash at end of file or wrong number (dimensions) of entries." - << " ---> Abort!" << std::endl; - return 2; -} -catch (Dune::Exception &e) -{ - std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; - return 3; -} -catch (...) -{ - std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; - return 4; -} diff --git a/test/porousmediumflow/3p/implicit/test_box3p.input b/test/porousmediumflow/3p/implicit/test_box3p.input deleted file mode 100644 index b41123ccc30639f2208a2dbab7db7c3dc771c2b2..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/3p/implicit/test_box3p.input +++ /dev/null @@ -1,22 +0,0 @@ -[TimeLoop] -DtInitial = 60 # [s] -TEnd = 3600 # [s] - -[Grid] -UpperRight = 500 10 -Cells = 50 10 - -[Problem] -Name = infiltration3pbox - -[SpatialParams] -permeability = 1.e-11 # m^2 -porosity = 0.40 -vanGenuchtenAlpha = 0.0005 -vanGenuchtenN = 4.0 - -[Output] -PlotFluidMatrixInteractions = false - -[Newton] -MaxRelativeShift = 1e-4 diff --git a/test/porousmediumflow/3p/implicit/test_box3pniconduction.cc b/test/porousmediumflow/3p/implicit/test_box3pniconduction.cc deleted file mode 100644 index bb5ab3447fe9ffc5114bfeedb8ba1b9a788ff602..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/3p/implicit/test_box3pniconduction.cc +++ /dev/null @@ -1,259 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief test for the 3pni box model - */ -#include <config.h> -#include "3pniconductionproblem.hh" - -#include <ctime> -#include <iostream> - -#include <dune/common/parallel/mpihelper.hh> -#include <dune/common/timer.hh> -#include <dune/grid/io/file/dgfparser/dgfexception.hh> -#include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> - -#include <dumux/common/propertysystem.hh> -#include <dumux/common/parameters.hh> -#include <dumux/common/valgrind.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> - -#include <dumux/linear/amgbackend.hh> -#include <dumux/nonlinear/newtonmethod.hh> -#include <dumux/nonlinear/newtoncontroller.hh> - -#include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/methods.hh> - -#include <dumux/io/vtkoutputmodule.hh> - -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.File Name of the file containing the grid \n" - "\t definition in DGF format\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) try -{ - - using namespace Dumux; - - // define the type tag for this problem - using TypeTag = TTAG(ThreePNIConductionBoxProblem); - - //////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////// - - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); - - // parse command line arguments and input file - Parameters::init(argc, argv, usage); - - // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); - - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// - - // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); - - // create the finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); - - // the problem (initial and boundary conditions) - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); - - // the solution vector - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(GridView::dimension)); - problem->applyInitialSolution(x); - auto xOld = x; - - // the grid variables - using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); - gridVariables->init(x, xOld); - - // 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"); - - // check if we are about to restart a previously interrupted simulation - Scalar restartTime = 0; - if (Parameters::getTree().hasKey("Restart") || Parameters::getTree().hasKey("TimeLoop.Restart")) - restartTime = getParam<Scalar>("TimeLoop.Restart"); - - // intialize the vtk output module - using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); - VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); - VtkOutputFields::init(vtkWriter); //! Add model specific output fields - vtkWriter.addField(problem->getExactTemperature(), "temperatureExact"); - vtkWriter.write(0.0); - // output every vtkOutputInterval time step - const auto vtkOutputInterval = getParam<int>("Problem.OutputInterval"); - - // instantiate time loop - auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); - - // the assembler with time loop for instationary problem - using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); - - // the linear solver - using LinearSolver = Dumux::AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->vertexMapper()); - - // the non-linear solver - using NewtonController = Dumux::NewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<NewtonController, Assembler, LinearSolver>; - auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); - NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); - - // time loop - timeLoop->start(); do - { - // 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."); - } - - // compute the new analytical temperature field for the output - problem->updateExactTemperature(x, timeLoop->time()+timeLoop->timeStepSize()); - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - // report statistics of this time step - timeLoop->reportTimeStep(); - - // set new dt as suggested by newton controller - timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize())); - - // write vtk output - if (timeLoop->timeStepIndex()==0 || timeLoop->timeStepIndex() % vtkOutputInterval == 0 || timeLoop->willBeFinished()) - vtkWriter.write(timeLoop->time()); - - - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } - - return 0; - -} -catch (Dumux::ParameterException &e) -{ - std::cerr << std::endl << e << " ---> Abort!" << std::endl; - return 1; -} -catch (Dune::DGFException & e) -{ - std::cerr << "DGF exception thrown (" << e << - "). Most likely, the DGF file name is wrong " - "or the DGF file is corrupted, " - "e.g. missing hash at end of file or wrong number (dimensions) of entries." - << " ---> Abort!" << std::endl; - return 2; -} -catch (Dune::Exception &e) -{ - std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; - return 3; -} -catch (...) -{ - std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; - return 4; -} diff --git a/test/porousmediumflow/3p/implicit/test_box3pniconduction.input b/test/porousmediumflow/3p/implicit/test_box3pniconduction.input deleted file mode 100644 index cddf9d588eb13142e985d6b7797882fd1d6a5f61..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/3p/implicit/test_box3pniconduction.input +++ /dev/null @@ -1,16 +0,0 @@ -[TimeLoop] -DtInitial = 1 # [s] -TEnd = 1e5 # [s] -MaxTimeStepSize = 1e10 - -[Grid] -UpperRight = 5 1 -Cells = 200 1 - -[Problem] -Name = test_box3pniconduction # name passed to the output routines -OutputInterval = 5 # every 5th timestep an output file is written -EnableGravity = 0 # disable gravity - -[Vtk] -AddVelocity = 1 #Enable velocity output diff --git a/test/porousmediumflow/3p/implicit/test_box3pniconvection.cc b/test/porousmediumflow/3p/implicit/test_box3pniconvection.cc deleted file mode 100644 index 7cca3428373c63fe449cef5ce1adaa6d4bd5c8b5..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/3p/implicit/test_box3pniconvection.cc +++ /dev/null @@ -1,257 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see <http://www.gnu.org/licenses/>. * - *****************************************************************************/ -/*! - * \file - * - * \brief test for the 3pni box model - */ -#include <config.h> -#include "3pniconvectionproblem.hh" - -#include <ctime> -#include <iostream> - -#include <dune/common/parallel/mpihelper.hh> -#include <dune/common/timer.hh> -#include <dune/grid/io/file/dgfparser/dgfexception.hh> -#include <dune/grid/io/file/vtk.hh> -#include <dune/istl/io.hh> - -#include <dumux/common/propertysystem.hh> -#include <dumux/common/parameters.hh> -#include <dumux/common/valgrind.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> - -#include <dumux/linear/amgbackend.hh> -#include <dumux/nonlinear/newtonmethod.hh> -#include <dumux/nonlinear/newtoncontroller.hh> - -#include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/methods.hh> - -#include <dumux/io/vtkoutputmodule.hh> - -/*! - * \brief Provides an interface for customizing error messages associated with - * reading in parameters. - * - * \param progName The name of the program, that was tried to be started. - * \param errorMsg The error message that was issued by the start function. - * Comprises the thing that went wrong and a general help message. - */ -void usage(const char *progName, const std::string &errorMsg) -{ - if (errorMsg.size() > 0) { - std::string errorMessageOut = "\nUsage: "; - errorMessageOut += progName; - errorMessageOut += " [options]\n"; - errorMessageOut += errorMsg; - errorMessageOut += "\n\nThe list of mandatory options for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.File Name of the file containing the grid \n" - "\t definition in DGF format\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) try -{ - - using namespace Dumux; - - // define the type tag for this problem - using TypeTag = TTAG(ThreePNIConvectionBoxProblem); - - //////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////// - - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); - - // parse command line arguments and input file - Parameters::init(argc, argv, usage); - - // try to create a grid (from the given grid file or the input file) - using GridCreator = typename GET_PROP_TYPE(TypeTag, GridCreator); - GridCreator::makeGrid(); - GridCreator::loadBalance(); - - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// - - // we compute on the leaf grid view - const auto& leafGridView = GridCreator::grid().leafGridView(); - - // create the finite volume grid geometry - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); - - // the problem (initial and boundary conditions) - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - auto problem = std::make_shared<Problem>(fvGridGeometry); - - // the solution vector - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); - SolutionVector x(leafGridView.size(GridView::dimension)); - problem->applyInitialSolution(x); - auto xOld = x; - - // the grid variables - using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); - gridVariables->init(x, xOld); - - // 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"); - - // check if we are about to restart a previously interrupted simulation - Scalar restartTime = 0; - if (Parameters::getTree().hasKey("Restart") || Parameters::getTree().hasKey("TimeLoop.Restart")) - restartTime = getParam<Scalar>("TimeLoop.Restart"); - - // intialize the vtk output module - using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields); - VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name()); - VtkOutputFields::init(vtkWriter); //! Add model specific output fields - vtkWriter.addField(problem->getExactTemperature(), "temperatureExact"); - vtkWriter.write(0.0); - // output every vtkOutputInterval time step - const int vtkOutputInterval = getParam<int>("Problem.OutputInterval"); - - // instantiate time loop - auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); - - // the assembler with time loop for instationary problem - using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); - - // the linear solver - using LinearSolver = Dumux::AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->vertexMapper()); - - // the non-linear solver - using NewtonController = Dumux::NewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<NewtonController, Assembler, LinearSolver>; - auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); - NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); - - // time loop - timeLoop->start(); do - { - // 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."); - } - - // compute the new analytical temperature field for the output - problem->updateExactTemperature(x, timeLoop->time()+timeLoop->timeStepSize()); - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - // report statistics of this time step - timeLoop->reportTimeStep(); - - // set new dt as suggested by newton controller - timeLoop->setTimeStepSize(newtonController->suggestTimeStepSize(timeLoop->timeStepSize())); - - if (timeLoop->timeStepIndex()==0 || timeLoop->timeStepIndex() % vtkOutputInterval == 0 || timeLoop->willBeFinished()) - vtkWriter.write(timeLoop->time()); - - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } - - return 0; - -} -catch (Dumux::ParameterException &e) -{ - std::cerr << std::endl << e << " ---> Abort!" << std::endl; - return 1; -} -catch (Dune::DGFException & e) -{ - std::cerr << "DGF exception thrown (" << e << - "). Most likely, the DGF file name is wrong " - "or the DGF file is corrupted, " - "e.g. missing hash at end of file or wrong number (dimensions) of entries." - << " ---> Abort!" << std::endl; - return 2; -} -catch (Dune::Exception &e) -{ - std::cerr << "Dune reported error: " << e << " ---> Abort!" << std::endl; - return 3; -} -catch (...) -{ - std::cerr << "Unknown exception thrown! ---> Abort!" << std::endl; - return 4; -} diff --git a/test/porousmediumflow/3p/implicit/test_cc3pniconvection.input b/test/porousmediumflow/3p/implicit/test_cc3pniconvection.input deleted file mode 100644 index fc7f8894399b094963f19235f7dbfec8cdaabeab..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/3p/implicit/test_cc3pniconvection.input +++ /dev/null @@ -1,18 +0,0 @@ -[TimeLoop] -DtInitial = 1 # [s] -TEnd = 3e4 # [s] -MaxTimeStepSize = 1e3 - -[Grid] -UpperRight = 20 1 -Cells = 80 1 - -[Problem] -Name = test_cc3pniconvection # name passed to the output routines -OutputInterval = 5 # every 5th timestep an output file is written -DarcyVelocity = 1e-4 # [m/s] inflow at the left boundary -EnableGravity = 0 # disable gravity - -[Vtk] -AddVelocity = 1 #Enable velocity output -