diff --git a/test/porousmediumflow/1p/implicit/1ptestproblem.hh b/test/porousmediumflow/1p/implicit/1ptestproblem.hh index 67e13f329561d2117c5b6bf5c90c728fd4dddedf..dd4ac4ff71e62bd57317ca77320ff2241876fed2 100644 --- a/test/porousmediumflow/1p/implicit/1ptestproblem.hh +++ b/test/porousmediumflow/1p/implicit/1ptestproblem.hh @@ -44,7 +44,7 @@ namespace Properties { NEW_TYPE_TAG(OnePTestProblem, INHERITS_FROM(OneP, OnePTestSpatialParams)); NEW_TYPE_TAG(OnePTestBoxProblem, INHERITS_FROM(BoxModel, OnePTestProblem)); -NEW_TYPE_TAG(OnePTestCCProblem, INHERITS_FROM(CCTpfaModel, OnePTestProblem)); +NEW_TYPE_TAG(OnePTestCCTpfaProblem, INHERITS_FROM(CCTpfaModel, OnePTestProblem)); NEW_TYPE_TAG(OnePTestCCMpfaProblem, INHERITS_FROM(CCMpfaModel, OnePTestProblem)); SET_PROP(OnePTestProblem, Fluid) @@ -65,15 +65,6 @@ SET_TYPE_PROP(OnePTestProblem, Problem, OnePTestProblem<TypeTag> ); // Set the spatial parameters SET_TYPE_PROP(OnePTestProblem, SpatialParams, OnePTestSpatialParams<TypeTag> ); - -// Linear solver settings -// SET_TYPE_PROP(OnePTestProblem, LinearSolver, ILU0BiCGSTABBackend<TypeTag> ); - -NEW_TYPE_TAG(OnePTestBoxProblemWithAMG, INHERITS_FROM(OnePTestBoxProblem)); -NEW_TYPE_TAG(OnePTestCCProblemWithAMG, INHERITS_FROM(OnePTestCCProblem)); -// Solver settings for the tests using AMG -// SET_TYPE_PROP(OnePTestBoxProblemWithAMG, LinearSolver, AMGBackend<TypeTag> ); -// SET_TYPE_PROP(OnePTestCCProblemWithAMG, LinearSolver, AMGBackend<TypeTag> ); } /*! diff --git a/test/porousmediumflow/1p/implicit/CMakeLists.txt b/test/porousmediumflow/1p/implicit/CMakeLists.txt index 602a2072118bc0d7f7e4017f82ddee35d8e860bf..5689659d9f6fb9e4ecac0f38de10f3ab680b487b 100644 --- a/test/porousmediumflow/1p/implicit/CMakeLists.txt +++ b/test/porousmediumflow/1p/implicit/CMakeLists.txt @@ -8,98 +8,114 @@ add_gstat_file_links() dune_symlink_to_source_files(FILES "tubesconvergencetest.py") # isothermal tests -add_dumux_test(test_box1p test_box1p test_box1p.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1ptestbox-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1ptestbox-00001.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1p") - -add_dumux_test(test_cc1p test_cc1p test_cc1p.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1ptestcc-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1ptestcc-00001.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1p") - -add_dumux_test(test_ccmpfa1p test_ccmpfa1p test_ccmpfa1p.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1ptestccmpfa-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1ptestccmpfa-00001.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccmpfa1p") - -add_dumux_test(test_cc1pwithgstat test_cc1pwithgstat test_cc1pwithgstat.cc - ./test_cc1pwithgstat) - -# non-isothermal tests -add_dumux_test(test_box1pniconduction test_box1pniconduction test_box1pniconduction.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconduction-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/box1pniconduction-00006.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pniconduction" - --zeroThreshold {"velocity_H2O":1e-8}) - -add_dumux_test(test_box1pniconvection test_box1pniconvection test_box1pniconvection.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconvection-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/box1pniconvection-00010.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pniconvection" - --zeroThreshold {"velocity":1e-15}) - -add_dumux_test(test_cc1pniconduction test_cc1pniconduction test_cc1pniconduction.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconduction-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/cc1pniconduction-00006.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pniconduction" - --zeroThreshold {"velocity":1e-8}) - -add_dumux_test(test_cc1pniconvection test_cc1pniconvection test_cc1pniconvection.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconvection-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/cc1pniconvection-00010.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pniconvection") - -add_dumux_test(test_ccmpfa1pniconduction test_ccmpfa1pniconduction test_ccmpfa1pniconduction.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconduction-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/ccmpfa1pniconduction-00006.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccmpfa1pniconduction") - -add_dumux_test(test_ccmpfa1pniconvection test_ccmpfa1pniconvection test_ccmpfa1pniconvection.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconvection-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/ccmpfa1pniconvection-00010.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccmpfa1pniconvection") - +dune_add_test(NAME test_1pcctpfa + SOURCES test_1pfv.cc + COMPILE_DEFINITIONS TYPETAG=OnePTestCCTpfaProblem + COMMAND python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1ptestcc-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1ptestcctpfa-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pcctpfa test_1pfv.input -Problem.Name 1ptestcctpfa") + +dune_add_test(NAME test_1pccmpfa + SOURCES test_1pfv.cc + COMPILE_DEFINITIONS TYPETAG=OnePTestCCMpfaProblem + COMMAND python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1ptestcc-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1ptestccmpfa-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pccmpfa test_1pfv.input -Problem.Name 1ptestccmpfa") + +dune_add_test(NAME test_1pbox + SOURCES test_1pfv.cc + COMPILE_DEFINITIONS TYPETAG=OnePTestBoxProblem + COMMAND python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/1ptestbox-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/1ptestbox-00001.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/test_1pbox test_1pfv.input -Problem.Name 1ptestbox") + +# add_dumux_test(test_cc1pwithgstat test_cc1pwithgstat test_cc1pwithgstat.cc +# ./test_cc1pwithgstat) +# +# # non-isothermal tests +# add_dumux_test(test_box1pniconduction test_box1pniconduction test_box1pniconduction.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconduction-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/box1pniconduction-00006.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pniconduction" +# --zeroThreshold {"velocity_H2O":1e-8}) +# +# add_dumux_test(test_box1pniconvection test_box1pniconvection test_box1pniconvection.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/1pniboxconvection-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/box1pniconvection-00010.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pniconvection" +# --zeroThreshold {"velocity":1e-15}) +# +# add_dumux_test(test_cc1pniconduction test_cc1pniconduction test_cc1pniconduction.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconduction-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/cc1pniconduction-00006.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pniconduction" +# --zeroThreshold {"velocity":1e-8}) +# +# add_dumux_test(test_cc1pniconvection test_cc1pniconvection test_cc1pniconvection.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/1pniccconvection-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/cc1pniconvection-00010.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pniconvection") +# +# add_dumux_test(test_ccmpfa1pniconduction test_ccmpfa1pniconduction test_ccmpfa1pniconduction.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconduction-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/ccmpfa1pniconduction-00006.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccmpfa1pniconduction") +# +# add_dumux_test(test_ccmpfa1pniconvection test_ccmpfa1pniconvection test_ccmpfa1pniconvection.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/ccmpfa1pniconvection-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/ccmpfa1pniconvection-00010.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_ccmpfa1pniconvection") +# # dim < dimWorld tests with foamgrid -dune_add_test(SOURCES test_box1pnetwork1d3d.cc - NAME test_box1pnetwork1d3d - COMMAND ./tubesconvergencetest.py test_box1pnetwork1d3d) - -add_dumux_test(test_box1pfracture2d3d test_box1pfracture2d3d test_box1pfracture2d3d.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1pboxfracture2d3d-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1pboxfracture2d3d-00001.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pfracture2d3d") - -dune_add_test(SOURCES test_cc1pnetwork1d3d.cc - NAME test_cc1pnetwork1d3d - COMMAND ./tubesconvergencetest.py test_cc1pnetwork1d3d) - -add_dumux_test(test_cc1pfracture2d3d test_cc1pfracture2d3d test_cc1pfracture2d3d.cc - python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/1pccfracture2d3d-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/1pccfracture2d3d-00001.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pfracture2d3d") +dune_add_test(NAME test_1pcctpfa_network1d3d + SOURCES test_1pfv_network1d3d.cc + COMPILE_DEFINITIONS TYPETAG=TubesTestCCTpfaProblem + COMMAND ./tubesconvergencetest.py test_1pcctpfa_network1d3d test_1pfv_network1d3d.input -Problem.Name test_1pcctpfa_network1d3d) + +dune_add_test(NAME test_1pbox_network1d3d + SOURCES test_1pfv_network1d3d.cc + COMPILE_DEFINITIONS TYPETAG=TubesTestBoxProblem + COMMAND ./tubesconvergencetest.py test_1pbox_network1d3d test_1pfv_network1d3d.input -Problem.Name test_1pbox_network1d3d) + +# dune_add_test(SOURCES test_box1pnetwork1d3d.cc +# NAME test_box1pnetwork1d3d +# COMMAND ./tubesconvergencetest.py test_box1pnetwork1d3d) +# +# add_dumux_test(test_box1pfracture2d3d test_box1pfracture2d3d test_box1pfracture2d3d.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/1pboxfracture2d3d-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/1pboxfracture2d3d-00001.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_box1pfracture2d3d") +# +# dune_add_test(SOURCES test_cc1pnetwork1d3d.cc +# NAME test_cc1pnetwork1d3d +# COMMAND ./tubesconvergencetest.py test_cc1pnetwork1d3d) +# +# add_dumux_test(test_cc1pfracture2d3d test_cc1pfracture2d3d test_cc1pfracture2d3d.cc +# python ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py +# --script fuzzy +# --files ${CMAKE_SOURCE_DIR}/test/references/1pccfracture2d3d-reference.vtu +# ${CMAKE_CURRENT_BINARY_DIR}/1pccfracture2d3d-00001.vtu +# --command "${CMAKE_CURRENT_BINARY_DIR}/test_cc1pfracture2d3d") #install sources install(FILES diff --git a/test/porousmediumflow/1p/implicit/test_cc1p.cc b/test/porousmediumflow/1p/implicit/test_1pfv.cc similarity index 96% rename from test/porousmediumflow/1p/implicit/test_cc1p.cc rename to test/porousmediumflow/1p/implicit/test_1pfv.cc index 68dbad89779e74f186c153247c20c433783a68a6..1a2523307e25977cee6a7f8641b350898a72c999 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1p.cc +++ b/test/porousmediumflow/1p/implicit/test_1pfv.cc @@ -121,9 +121,8 @@ int main(int argc, char** argv) try 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)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -160,11 +159,11 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = 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 = NewtonController<TypeTag>; - using NewtonMethod = NewtonMethod<TypeTag, NewtonController, Assembler, LinearSolver>; + using NewtonController = Dumux::NewtonController<TypeTag>; + using NewtonMethod = NewtonMethod<NewtonController, Assembler, LinearSolver>; auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); diff --git a/test/porousmediumflow/1p/implicit/test_cc1p.input b/test/porousmediumflow/1p/implicit/test_1pfv.input similarity index 73% rename from test/porousmediumflow/1p/implicit/test_cc1p.input rename to test/porousmediumflow/1p/implicit/test_1pfv.input index bd21b5f555c67b6d7cf4624e7e8af6f29dc663aa..394ef0c4be80598d4e5071b43c52cc4a8acf984d 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1p.input +++ b/test/porousmediumflow/1p/implicit/test_1pfv.input @@ -1,4 +1,4 @@ -[TimeManager] +[TimeLoop] DtInitial = 1 # [s] TEnd = 1 # [s] @@ -8,7 +8,7 @@ UpperRight = 1 1 Cells = 10 10 [Problem] -Name = 1ptestcc # name passed to the output routines +Name = 1ptestfv # name passed to the output routines [SpatialParams] LensLowerLeft = 0.2 0.2 @@ -17,3 +17,4 @@ LensUpperRight = 0.8 0.8 Permeability = 1e-10 # [m^2] PermeabilityLens = 1e-12 # [m^2] +RandomField = false diff --git a/test/porousmediumflow/1p/implicit/test_cc1pnetwork1d3d.cc b/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.cc similarity index 96% rename from test/porousmediumflow/1p/implicit/test_cc1pnetwork1d3d.cc rename to test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.cc index 2b664734cc9680ec7e9eab7525a28c99ee3ef6a0..9c227751782e37e2eb8593f47455d63f72439b87 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pnetwork1d3d.cc +++ b/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.cc @@ -115,9 +115,8 @@ int main(int argc, char** argv) try 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)); + SolutionVector x(fvGridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; @@ -154,11 +153,11 @@ int main(int argc, char** argv) try // the linear solver using LinearSolver = 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 = NewtonController<TypeTag>; - using NewtonMethod = NewtonMethod<TypeTag, NewtonController, Assembler, LinearSolver>; + using NewtonController = Dumux::NewtonController<TypeTag>; + using NewtonMethod = NewtonMethod<NewtonController, Assembler, LinearSolver>; auto newtonController = std::make_shared<NewtonController>(leafGridView.comm(), timeLoop); NewtonMethod nonLinearSolver(newtonController, assembler, linearSolver); diff --git a/test/porousmediumflow/1p/implicit/test_cc1pnetwork1d3d.input b/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.input similarity index 82% rename from test/porousmediumflow/1p/implicit/test_cc1pnetwork1d3d.input rename to test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.input index 3fc22439d76a392e8e8d183bd382a2331f6caff2..cf1817b21b0aa127d9df1fbf89ebbdb25ab9c223 100644 --- a/test/porousmediumflow/1p/implicit/test_cc1pnetwork1d3d.input +++ b/test/porousmediumflow/1p/implicit/test_1pfv_network1d3d.input @@ -1,4 +1,4 @@ -[TimeManager] +[TimeLoop] DtInitial = 1 # [s] TEnd = 1 # [s] @@ -6,6 +6,6 @@ TEnd = 1 # [s] File = ./grids/network1d3d.msh [Problem] -Name = 1pccnetwork1d3d +Name = 1pfvnetwork1d3d LiquidDensity = 1050 # blood density LiquidKinematicViscosity = 4.0e-3 # blood viscosity diff --git a/test/porousmediumflow/1p/implicit/test_box1p.cc b/test/porousmediumflow/1p/implicit/test_box1p.cc deleted file mode 100644 index 321c1ce4d27be44e816de0af8153db8f72eb1542..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1p.cc +++ /dev/null @@ -1,255 +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 one-phase box model - */ -#include <config.h> - -#include <ctime> -#include <iostream> - -#include "1ptestproblem.hh" - -#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/common/parameterparser.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 arguments for this program is:\n" - "\t-TimeManager.TEnd End of the simulation [s] \n" - "\t-TimeManager.DtInitial Initial timestep size [s] \n" - "\t-Grid.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n" - "\t definition in DGF format\n" - "\t-SpatialParams.LensLowerLeft coordinates of the lower left corner of the lens [m] \n" - "\t-SpatialParams.LensUpperRight coordinates of the upper right corner of the lens [m] \n" - "\t-SpatialParams.Permeability Permeability of the domain [m^2] \n" - "\t-SpatialParams.PermeabilityLens Permeability of the lens [m^2] \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(OnePTestBoxProblem); - - // 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 = AMGBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->vertexMapper()); - - // the non-linear solver - using NewtonController = Dumux::NewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<TypeTag, 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())); - - } 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/1p/implicit/test_box1p.input b/test/porousmediumflow/1p/implicit/test_box1p.input deleted file mode 100644 index 25fd09103b2ec862ef32d4624c9b9d844092c060..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1p.input +++ /dev/null @@ -1,19 +0,0 @@ -[TimeLoop] -DtInitial = 1 # [s] -TEnd = 1 # [s] - -[Grid] -LowerLeft = 0 0 -UpperRight = 1 1 -Cells = 10 10 - -[Problem] -Name = 1ptestbox # name passed to the output routines - -[SpatialParams] -LensLowerLeft = 0.25 0.25 -LensUpperRight = 0.75 0.75 - -Permeability = 1e-10 # [m^2] -PermeabilityLens = 1e-12 # [m^2] -RandomField = false diff --git a/test/porousmediumflow/1p/implicit/test_box1pfracture2d3d.cc b/test/porousmediumflow/1p/implicit/test_box1pfracture2d3d.cc deleted file mode 100644 index 22f6fc6dbdd1f315c879ab925c0f6faf908d5dd4..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pfracture2d3d.cc +++ /dev/null @@ -1,254 +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 one-phase CC model - */ - - -#include <config.h> - -#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 "fractureproblem.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/seqsolverbackend.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 arguments 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 The grid file\n"; - - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) try -{ - using namespace Dumux; -#if HAVE_DUNE_FOAMGRID - // define the type tag for this problem - using TypeTag = TTAG(FractureBoxProblem); - - // 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 = ILU0BiCGSTABBackend<TypeTag>; - auto linearSolver = std::make_shared<LinearSolver>(); - - // the non-linear solver - using NewtonController = Dumux::NewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<TypeTag, 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())); - - } 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; - -#else -#warning External grid module dune-foamgrid needed to run this example. - std::cerr << "Test skipped, it needs dune-foamgrid!" << std::endl; - return 77; -#endif -}// end main -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/1p/implicit/test_box1pfracture2d3d.input b/test/porousmediumflow/1p/implicit/test_box1pfracture2d3d.input deleted file mode 100644 index 727b43c63c6bb98cbd9e0f5f4c78d75a95d1438e..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pfracture2d3d.input +++ /dev/null @@ -1,10 +0,0 @@ -[TimeLoop] -DtInitial = 1 # [s] -TEnd = 1 # [s] - -[Grid] -File = grids/fracture2d3d.msh - -[Problem] -Name = 1pboxfracture2d3d -EnableGravity = false diff --git a/test/porousmediumflow/1p/implicit/test_box1pnetwork1d3d.cc b/test/porousmediumflow/1p/implicit/test_box1pnetwork1d3d.cc deleted file mode 100644 index 0d698cbb6c692b2c29e9c9b0e55b435e05cd2b7e..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pnetwork1d3d.cc +++ /dev/null @@ -1,38 +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 one-phase CC model - */ -#include <config.h> -#include "tubesproblem.hh" -#include <dumux/common/start.hh> - -int main(int argc, char** argv) -{ -#if HAVE_DUNE_FOAMGRID - typedef TTAG(TubesTestBoxProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, [](const char *, const std::string &){}); -#else -#warning External grid module dune-foamgrid needed to run this example. - std::cerr << "Test skipped, it needs dune-foamgrid!" << std::endl; - return 77; -#endif -} diff --git a/test/porousmediumflow/1p/implicit/test_box1pnetwork1d3d.input b/test/porousmediumflow/1p/implicit/test_box1pnetwork1d3d.input deleted file mode 100644 index 7a12bc63d79e13ed232dbaba95c9337fe1c130da..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pnetwork1d3d.input +++ /dev/null @@ -1,11 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 1 # [s] - -[Grid] -File = ./grids/network1d3d.msh - -[Problem] -Name = 1pboxnetwork1d3d -LiquidDensity = 1050 # blood density -LiquidKinematicViscosity = 4.0e-3 # blood viscosity diff --git a/test/porousmediumflow/1p/implicit/test_box1pniconduction.cc b/test/porousmediumflow/1p/implicit/test_box1pniconduction.cc deleted file mode 100644 index b28a0696109bea7aea540eda55dc5851194357ea..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pniconduction.cc +++ /dev/null @@ -1,249 +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 1pni box model - */ -#include <config.h> - -#include <ctime> -#include <iostream> - -#include "1pniconductionproblem.hh" - -#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/common/parameterparser.hh> - -#include <dumux/linear/seqsolverbackend.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.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\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(OnePNIConductionBoxProblem); - - // 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(Parameters::getTree()); - 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->vertexMapper()); - - // the non-linear solver - using NewtonController = Dumux::NewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<TypeTag, 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())); - - } 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/1p/implicit/test_box1pniconduction.input b/test/porousmediumflow/1p/implicit/test_box1pniconduction.input deleted file mode 100644 index 3b0ad37fd2300b8c4b1d2e73fe46ac6bb83b4728..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pniconduction.input +++ /dev/null @@ -1,17 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 1e5 # [s] -MaxTimeStepSize = 1e10 - -[Grid] -LowerLeft = 0 0 -UpperRight = 5 1 -Cells = 200 1 - -[Problem] -Name = box1pniconduction # 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/1p/implicit/test_box1pniconvection.cc b/test/porousmediumflow/1p/implicit/test_box1pniconvection.cc deleted file mode 100644 index a7d8e086521e0bb6885957411e083144816276f9..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pniconvection.cc +++ /dev/null @@ -1,247 +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 1pni box model - */ -#include <config.h> - -#include <ctime> -#include <iostream> - -#include "1pniconvectionproblem.hh" - -#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/common/parameterparser.hh> - -#include <dumux/linear/seqsolverbackend.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.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\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(OnePNIConvectionBoxProblem); - - // 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(Parameters::getTree()); - 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->vertexMapper()); - - // the non-linear solver - using NewtonController = Dumux::NewtonController<TypeTag>; - using NewtonMethod = Dumux::NewtonMethod<TypeTag, 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())); - - } 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/1p/implicit/test_box1pniconvection.input b/test/porousmediumflow/1p/implicit/test_box1pniconvection.input deleted file mode 100644 index 46cfcf48d5d6c6e36098db57d5b70c06a1ebd625..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_box1pniconvection.input +++ /dev/null @@ -1,18 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 3e4 # [s] -MaxTimeStepSize = 1e3 - -[Grid] -LowerLeft = 0 0 -UpperRight = 20 1 -Cells = 80 1 - -[Problem] -Name = box1pniconvection # 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 diff --git a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconduction.cc b/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconduction.cc deleted file mode 100644 index 62a2fb3a496eabb695531f0a68483b2ce0b1427a..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconduction.cc +++ /dev/null @@ -1,58 +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 1pni CC model - */ -#include <config.h> -#include "1pniconductionproblem.hh" -#include <dumux/common/start.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.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n"; - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) -{ - typedef TTAG(OnePNIConductionCCMpfaProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); -} diff --git a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconduction.input b/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconduction.input deleted file mode 100644 index 145db6013982bbd428f112cf50b0b4fe068ddc64..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconduction.input +++ /dev/null @@ -1,17 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 1e5 # [s] -MaxTimeStepSize = 1e10 - -[Grid] -LowerLeft = 0 0 -UpperRight = 5 1 -Cells = 200 1 - -[Problem] -Name = ccmpfa1pniconduction # name passed to the output routines -OutputInterval = 5 # every 5th timestep an output file is written -EnableGravity = 0 # disable gravity - -[Vtk] -AddVelocity= 0 # enable velocity output diff --git a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconvection.cc b/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconvection.cc deleted file mode 100644 index 0c57aa535108ca5e0cc7a6cdf1b4c6d1dc1b3df1..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconvection.cc +++ /dev/null @@ -1,58 +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 1pni CC model - */ -#include <config.h> -#include "1pniconvectionproblem.hh" -#include <dumux/common/start.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.LowerLeft Lower left corner coordinates\n" - "\t-Grid.UpperRight Upper right corner coordinates\n" - "\t-Grid.Cells Number of cells in respective coordinate directions\n"; - std::cout << errorMessageOut - << "\n"; - } -} - -int main(int argc, char** argv) -{ - typedef TTAG(OnePNIConvectionCCMpfaProblem) ProblemTypeTag; - return Dumux::start<ProblemTypeTag>(argc, argv, usage); -} diff --git a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconvection.input b/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconvection.input deleted file mode 100644 index 5794931580dd78e8e0faf05b5d9fba61f4673598..0000000000000000000000000000000000000000 --- a/test/porousmediumflow/1p/implicit/test_ccmpfa1pniconvection.input +++ /dev/null @@ -1,18 +0,0 @@ -[TimeManager] -DtInitial = 1 # [s] -TEnd = 3e4 # [s] -MaxTimeStepSize = 1e3 - -[Grid] -LowerLeft = 0 0 -UpperRight = 20 1 -Cells = 80 1 - -[Problem] -Name = ccmpfa1pniconvection # 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 = 0 # enable velocity output