diff --git a/exercises/exercise-basic/2p2cmain.cc b/exercises/exercise-basic/2p2cmain.cc index 5467f9a78389f13e7f97ed63a8ce759064b047ea..b9a07f08e16dce4b177694c369dea916aac494cc 100644 --- a/exercises/exercise-basic/2p2cmain.cc +++ b/exercises/exercise-basic/2p2cmain.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -22,29 +22,22 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> #include <dumux/linear/linearsolvertraits.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> // The properties file, where the compile time options are defined #include "properties2p2c.hh" @@ -59,12 +52,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::Injection2p2cCC; - // 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); + // initialize MPI+X, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -99,13 +88,7 @@ int main(int argc, char** argv) auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); - // get some time loop parameters - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); - auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -114,6 +97,10 @@ int main(int argc, char** argv) vtkWriter.write(0.0); // instantiate time loop + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); + const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); + const auto dt = getParam<Scalar>("TimeLoop.DtInitial"); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); timeLoop->setMaxTimeStepSize(maxDt); @@ -122,8 +109,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver // using PrimaryVariableSwitch = GetPropType<TypeTag, Properties::PrimaryVariableSwitch>; @@ -134,9 +121,6 @@ int main(int argc, char** argv) timeLoop->start(); while (!timeLoop->finished()) { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - //set time in problem (is used in time-dependent Neumann boundary condition) problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); @@ -162,16 +146,9 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + // print parameter report + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/exercise-basic/2pmain.cc b/exercises/exercise-basic/2pmain.cc index fb0fb4846ac52983dff542eec068f5188d893f11..8faf14a899e6d42091ef98c599e103bcaeeb3d00 100644 --- a/exercises/exercise-basic/2pmain.cc +++ b/exercises/exercise-basic/2pmain.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -22,30 +22,22 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> #include <dumux/linear/linearsolvertraits.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> // The properties file, where the compile time options are defined #include "properties2p.hh" @@ -60,12 +52,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::Injection2pCC; - // 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); + /// initialize MPI+X, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -100,13 +88,7 @@ int main(int argc, char** argv) auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); - // get some time loop parameters - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); - auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; // use non-conforming output for the test with interface solver @@ -119,6 +101,10 @@ int main(int argc, char** argv) vtkWriter.write(0.0); // instantiate time loop + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); + const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); + const auto dt = getParam<Scalar>("TimeLoop.DtInitial"); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); timeLoop->setMaxTimeStepSize(maxDt); @@ -127,8 +113,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -138,9 +124,6 @@ int main(int argc, char** argv) timeLoop->start(); while (!timeLoop->finished()) { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - //set time in problem (is used in time-dependent Neumann boundary condition) problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); @@ -166,16 +149,9 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + // print parameter report + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/exercise-basic/injection2p2cproblem.hh b/exercises/exercise-basic/injection2p2cproblem.hh index 745d6925705e4455db54b2ae42190a313f71b038..2a25946d84356ff0af7a09a3c06e8cbdcf92ae90 100644 --- a/exercises/exercise-basic/injection2p2cproblem.hh +++ b/exercises/exercise-basic/injection2p2cproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -58,17 +58,17 @@ template<class TypeTag> class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag> { using ParentType = PorousMediumFlowProblem<TypeTag>; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; + using GridView = typename GridGeometry::GridView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -94,11 +94,6 @@ public: injectionDuration_ = getParam<Scalar>("Problem.InjectionDuration"); } - /*! - * \name Problem parameters - */ - // \{ - /*! * \brief Returns the problem name * @@ -107,13 +102,6 @@ public: std::string name() const { return name_+"-2p2c"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ - /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -169,14 +157,6 @@ public: return values; } - // \} - - - /*! - * \name Volume terms - */ - // \{ - /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. @@ -200,7 +180,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); @@ -218,8 +198,6 @@ public: return values; } - // \} - //! set the time for the time dependent boundary conditions (called from main) void setTime(Scalar time) { time_ = time; } diff --git a/exercises/exercise-basic/injection2pniproblem.hh b/exercises/exercise-basic/injection2pniproblem.hh index b70ad5adfcfcdd63f9d98cdb5e91804bd47a249f..2f4cceeaed651d807dba457db496677831ff4a24 100644 --- a/exercises/exercise-basic/injection2pniproblem.hh +++ b/exercises/exercise-basic/injection2pniproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -57,17 +57,17 @@ template<class TypeTag> class Injection2PNIProblem : public PorousMediumFlowProblem<TypeTag> { using ParentType = PorousMediumFlowProblem<TypeTag>; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; + using GridView = typename GridGeometry::GridView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -93,11 +93,6 @@ public: injectionDuration_ = getParam<Scalar>("Problem.InjectionDuration"); } - /*! - * \name Problem parameters - */ - // \{ - /*! * \brief Returns the problem name * @@ -106,13 +101,6 @@ public: std::string name() const { return "injection-2pni"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ - /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -187,14 +175,6 @@ public: return values; } - // \} - - - /*! - * \name Volume terms - */ - // \{ - /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. @@ -218,7 +198,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(283.15, 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); @@ -235,8 +215,6 @@ public: return values; } - // \} - //! set the time for the time dependent boundary conditions (called from main) void setTime(Scalar time) { time_ = time; } diff --git a/exercises/exercise-basic/injection2pproblem.hh b/exercises/exercise-basic/injection2pproblem.hh index 2d24777623bf9cabf2c4fa675deff40418fe3eba..7102aecf4f4d22fa05b9d34cbcdcbc22b956fcfe 100644 --- a/exercises/exercise-basic/injection2pproblem.hh +++ b/exercises/exercise-basic/injection2pproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -67,7 +67,7 @@ class Injection2PProblem : public PorousMediumFlowProblem<TypeTag> using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -93,10 +93,6 @@ public: injectionDuration_ = getParam<Scalar>("Problem.InjectionDuration"); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Returns the problem name @@ -106,12 +102,6 @@ public: std::string name() const { return name_+"-2p"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -169,13 +159,6 @@ public: return values; } - // \} - - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the source term for all phases within a given @@ -200,7 +183,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); diff --git a/exercises/exercise-basic/params.input b/exercises/exercise-basic/params.input index b2e574e86a66f24658de1c546fd93ceff72ec492..abd2b74379395e8b38c76340941ec521223bc749 100644 --- a/exercises/exercise-basic/params.input +++ b/exercises/exercise-basic/params.input @@ -3,13 +3,11 @@ DtInitial = 3600 # in seconds TEnd = 3.154e9 # in seconds, i.e one hundred years [Grid] -LowerLeft = 0 0 UpperRight = 60 40 Cells = 24 16 [Problem] Name = injection -OnlyPlotMaterialLaws = true AquiferDepth = 2700.0 # m InjectionDuration = 2.628e6 # in seconds, i.e. one month diff --git a/exercises/exercise-basic/properties2p.hh b/exercises/exercise-basic/properties2p.hh index 7f6b15ebce2cbf2301a4b7e7483e26c70275f5e6..b082ca1f8abebc13f6496ed0f15da6cbc4ec0c1a 100644 --- a/exercises/exercise-basic/properties2p.hh +++ b/exercises/exercise-basic/properties2p.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-basic/properties2p2c.hh b/exercises/exercise-basic/properties2p2c.hh index 997a815841e1916cdd4cb0a8c04adecaed44991c..3609c68e5dc86258f2ca7fb44ee0a427ae3da17b 100644 --- a/exercises/exercise-basic/properties2p2c.hh +++ b/exercises/exercise-basic/properties2p2c.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-basic/properties2pni.hh b/exercises/exercise-basic/properties2pni.hh index a7ddf5c623ec69da241e925f605c2eec76a8a835..6b51c6569144374356b470d502d378298b91b100 100644 --- a/exercises/exercise-basic/properties2pni.hh +++ b/exercises/exercise-basic/properties2pni.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-basic/spatialparams.hh b/exercises/exercise-basic/spatialparams.hh index df90c7e51f3fb5f3e360b418d8900645094b1bdb..5cc960a3902c0d01801ff9e0e7d61c7021cc0b49 100644 --- a/exercises/exercise-basic/spatialparams.hh +++ b/exercises/exercise-basic/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-biomineralization/README.md b/exercises/exercise-biomineralization/README.md index 8613e2571a09a11560a11c2c1b9c782d89918c32..94d6af62ce67b4623552f6687e2c4d2fec379f82 100644 --- a/exercises/exercise-biomineralization/README.md +++ b/exercises/exercise-biomineralization/README.md @@ -63,7 +63,7 @@ $`\displaystyle CO(NH_{2})_{2} + 2 H_{2}O -> 2 NH_{3} + H_{2}CO_{3}`$ $`\displaystyle Ca^{2+} + CO_{3}^{2-} -> CaCO_{3}`$ -Alternatively, it can be written in terms of the total chemical reaction equation, in which the appearence of inorganic carbon species cancels out: +Alternatively, it can be written in terms of the total chemical reaction equation, in which the appearance of inorganic carbon species cancels out: $`\displaystyle Ca^{2+} + CO(NH_{2})_{2} + 2 H_{2}O -> 2 NH_{4}^{+} + CaCO_{3}`$ diff --git a/exercises/exercise-biomineralization/biominproblem.hh b/exercises/exercise-biomineralization/biominproblem.hh index b0a0d0d4fd937dfa1c5436727f54c166bccb80d0..1f315088cffc6c94c75c07379f2d440e541f96c5 100644 --- a/exercises/exercise-biomineralization/biominproblem.hh +++ b/exercises/exercise-biomineralization/biominproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -54,11 +54,8 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; // Grid dimension - enum - { - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; + static constexpr int dim = GridView::dimension; + static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimension>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -69,28 +66,24 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> // TODO: dumux-course-task // set the chemistry TypeTag - enum - { - numComponents = FluidSystem::numComponents, - - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, //Saturation + static constexpr int numComponents = FluidSystem::numComponents; + static constexpr int pressureIdx = Indices::pressureIdx; + static constexpr int switchIdx = Indices::switchIdx; //Saturation - //Indices of the components - H2OIdx = FluidSystem::H2OIdx, - CO2Idx = FluidSystem::CO2Idx, - CaIdx = FluidSystem::CaIdx, - UreaIdx = FluidSystem::UreaIdx, + // Indices of the components + static constexpr int H2OIdx = FluidSystem::H2OIdx; + static constexpr int CO2Idx = FluidSystem::CO2Idx; + static constexpr int CaIdx = FluidSystem::CaIdx; + static constexpr int UreaIdx = FluidSystem::UreaIdx; - BiofilmIdx = SolidSystem::BiofilmIdx+numComponents, - CalciteIdx = SolidSystem::CalciteIdx+numComponents, + static constexpr int BiofilmIdx = SolidSystem::BiofilmIdx+numComponents; + static constexpr int CalciteIdx = SolidSystem::CalciteIdx+numComponents; - //Index of the primary component of wetting and nonwetting phase - conti0EqIdx = Indices::conti0EqIdx, + // Index of the primary component of wetting and nonwetting phase + static constexpr int conti0EqIdx = Indices::conti0EqIdx; - // Phase State - liquidPhaseOnly = Indices::firstPhaseOnly, - }; + // Phase State + static constexpr int liquidPhaseOnly = Indices::firstPhaseOnly; /*! * \brief The constructor @@ -132,10 +125,6 @@ public: time_ = time; } - /*! - * \name Problem parameters - */ - /*! * \brief The problem name. * @@ -145,13 +134,6 @@ public: { return name_; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ - /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. diff --git a/exercises/exercise-biomineralization/biominspatialparams.hh b/exercises/exercise-biomineralization/biominspatialparams.hh index a2eb8e65b582120ae38adb182b6126d9910d07be..263042195b6d29e031be13b6d16461cf5901dc52 100644 --- a/exercises/exercise-biomineralization/biominspatialparams.hh +++ b/exercises/exercise-biomineralization/biominspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -48,7 +48,7 @@ class BioMinSpatialparams using GridView = typename GridGeometry::GridView; using CoordScalar = typename GridView::ctype; - enum { dimWorld=GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; diff --git a/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh b/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh index 99cce503b46d018e2b541ef636033c72c8c2f5ac..da031db0d2e44db4f1a06a25de2fdd1b4c7d8eed 100644 --- a/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh +++ b/exercises/exercise-biomineralization/chemistry/simplebiominreactions.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-biomineralization/components/biofilm.hh b/exercises/exercise-biomineralization/components/biofilm.hh index 500c33eeff82da2530dac5307117691fd21f9eba..91f5358b70f27e7fc3a5aa9341afa1bf0f2182d8 100644 --- a/exercises/exercise-biomineralization/components/biofilm.hh +++ b/exercises/exercise-biomineralization/components/biofilm.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-biomineralization/components/urea.hh b/exercises/exercise-biomineralization/components/urea.hh index 1dc533034e6aa916663ce26efc8b45b6c8536d84..c085fcfa7ab28a56dfe80d19098a989658b8911c 100644 --- a/exercises/exercise-biomineralization/components/urea.hh +++ b/exercises/exercise-biomineralization/components/urea.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-biomineralization/fluidsystems/biomin.hh b/exercises/exercise-biomineralization/fluidsystems/biomin.hh index 7091e5dbe2eaf1595cd18be6218347dfebd057f0..b21f2dd3fd84358eddea3dea4a20aa1f93713522 100644 --- a/exercises/exercise-biomineralization/fluidsystems/biomin.hh +++ b/exercises/exercise-biomineralization/fluidsystems/biomin.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -48,7 +48,7 @@ namespace FluidSystems { * components in both, the liquid and the gas (supercritical) phase, * additional biomineralisation components (Ca and Urea) in the liquid phase * - * This class provides acess to the Bio fluid system when no property system is used. + * This class provides access to the Bio fluid system when no property system is used. * For Dumux users, using BioMinFluid<TypeTag> and the documentation therein is * recommended. * @@ -216,7 +216,7 @@ public: switch (compIdx) { case H2OIdx: return H2O::molarMass(); // actually, the molar mass of brine is only needed for diffusion - // but since solutes are accounted for seperately + // but since solutes are accounted for separately // only the molar mass of water is returned. case CO2Idx: return CO2::molarMass(); case CaIdx: return Ca::molarMass(); @@ -382,7 +382,7 @@ public: assert(temperature > 0); assert(pressure > 0); - // calulate the equilibrium composition for the given + // calculate the equilibrium composition for the given // temperature and pressure. Scalar xwH2O, xnH2O; Scalar xwCO2, xnCO2; @@ -446,7 +446,7 @@ public: else if (compJIdx < numComponents) //Calcium and urea return 1.587e-9; //[m²/s] educated guess, value for NaCl from J. Phys. D: Appl. Phys. 40 (2007) 2769-2776 else - DUNE_THROW(Dune::NotImplemented, "Binary difussion coefficient : Incorrect compIdx"); + DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient : Incorrect compIdx"); } else { @@ -457,7 +457,7 @@ public: else if (compJIdx <numComponents) //Calcium and urea will stay in brine, no gaseous calcium or urea! return 0.0; else - DUNE_THROW(Dune::NotImplemented, "Binary difussion coefficient : Incorrect compIdx"); + DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient : Incorrect compIdx"); } }; diff --git a/exercises/exercise-biomineralization/main.cc b/exercises/exercise-biomineralization/main.cc index 4bd443c413d3483e7cd6005a45a702c18092864b..8a8c057007e65750fe1a3bb5a140dcdbee1d2c4a 100644 --- a/exercises/exercise-biomineralization/main.cc +++ b/exercises/exercise-biomineralization/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,31 +23,22 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include "properties.hh" @@ -61,12 +52,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::ExerciseBioMinCCTpfa; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -75,10 +62,6 @@ int main(int argc, char** argv) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; gridManager.init(); - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// - // we compute on the leaf grid view const auto& leafGridView = gridManager.grid().leafGridView(); @@ -132,8 +115,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; @@ -142,9 +125,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); @@ -179,16 +159,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/exercise-biomineralization/properties.hh b/exercises/exercise-biomineralization/properties.hh index 3317f06ad2120d6ea9c4e6e7cf786e6d6fc05f4d..572dbea336d39325b800d412efaa37e67d89231f 100644 --- a/exercises/exercise-biomineralization/properties.hh +++ b/exercises/exercise-biomineralization/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-biomineralization/solidsystems/biominsolidphase.hh b/exercises/exercise-biomineralization/solidsystems/biominsolidphase.hh index b74567665f787c46d733426296c43ddfb2481435..cde4b02ada78e17de33f8fa68127702ea0b65bb9 100644 --- a/exercises/exercise-biomineralization/solidsystems/biominsolidphase.hh +++ b/exercises/exercise-biomineralization/solidsystems/biominsolidphase.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-coupling-ff-pm/1pspatialparams.hh b/exercises/exercise-coupling-ff-pm/1pspatialparams.hh index ce8734e350530087772143dcba98f6f4416ea321..fc7f7093f84961aed8bbe19ed6170aebd9cbe74c 100644 --- a/exercises/exercise-coupling-ff-pm/1pspatialparams.hh +++ b/exercises/exercise-coupling-ff-pm/1pspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-coupling-ff-pm/2pspatialparams.hh b/exercises/exercise-coupling-ff-pm/2pspatialparams.hh index 401e8828537295f729063289a91ed56fd67067ee..f1a4938b7f4faf89d2efba8b670e6ee394877f0f 100644 --- a/exercises/exercise-coupling-ff-pm/2pspatialparams.hh +++ b/exercises/exercise-coupling-ff-pm/2pspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index b666ee5a7950b27266fb707e76f11d2fa7ca6636..bfe67f022166e1c23874c7b3a8658c6d81bb3f14 100644 --- a/exercises/exercise-coupling-ff-pm/README.md +++ b/exercises/exercise-coupling-ff-pm/README.md @@ -400,6 +400,6 @@ For the grid convergence study, run various simulations with the following gradi * [Stokes.Grid] Grading1 = 1.6, [Darcy.Grid] Grading1 = -1.6 ``` -By changing the parameter `Problem.Name` for each grading factor, you avoid loosing the `.vtu` and `.pvd` files of the previous simulation runs. +By changing the parameter `Problem.Name` for each grading factor, you avoid losing the `.vtu` and `.pvd` files of the previous simulation runs. Check the first lines of the output to see how the grading factors change the height of your grid cells. Compare the velocity fields with Paraview. diff --git a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index 3478a08069db7e2d4fb9f989f6f0a33bb53079ae..a7984532a58d3c52b3ed907e7e275ce32980d687 100644 --- a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -66,10 +66,6 @@ public: deltaP_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.PressureDifference"); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Return the sources within the domain. @@ -78,12 +74,7 @@ public: */ NumEqVector sourceAtPos(const GlobalPosition &globalPos) const { return NumEqVector(0.0); } - // \} - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -172,7 +163,6 @@ public: return values; } - // \} //! Set the coupling manager void setCouplingManager(std::shared_ptr<CouplingManager> cm) @@ -182,10 +172,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/exercise-coupling-ff-pm/interface/main.cc b/exercises/exercise-coupling-ff-pm/interface/main.cc index 70aa5e4c7fca2634dc48e0f83e8474eaeeb7bd32..5cba8d6bd44c87c2a740dc31940b7001f94dc4fc 100644 --- a/exercises/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/exercise-coupling-ff-pm/interface/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -25,20 +25,22 @@ #include <iostream> -#include <dune/common/parallel/mpihelper.hh> -#include <dune/istl/io.hh> - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> + #include <dumux/common/partial.hh> -#include <dumux/linear/seqsolverbackend.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> + #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include <dumux/multidomain/staggeredtraits.hh> #include <dumux/multidomain/fvassembler.hh> @@ -52,12 +54,8 @@ int main(int argc, char** argv) { using namespace Dumux; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -178,7 +176,7 @@ int main(int argc, char** argv) auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); darcyGridVariables->init(sol[darcyIdx]); - // intialize the vtk output module + // initialize the vtk output module const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); @@ -209,7 +207,7 @@ int main(int argc, char** argv) couplingManager); // the linear solver - using LinearSolver = UMFPackBackend; + using LinearSolver = UMFPackIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver @@ -223,16 +221,7 @@ int main(int argc, char** argv) stokesVtkWriter.write(1.0); darcyVtkWriter.write(1.0); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } + Parameters::print(); return 0; } // end main diff --git a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index 3704dd4a2f2d628e237ada3d18daa14283a97778..836e041cbb39f40d35fd89b4deeaf6effb3170a3 100644 --- a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -64,17 +64,6 @@ public: : ParentType(fvGridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager) {} - /*! - * \name Simulation steering - */ - // \{ - - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -145,12 +134,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. diff --git a/exercises/exercise-coupling-ff-pm/interface/properties.hh b/exercises/exercise-coupling-ff-pm/interface/properties.hh index f4286b93db5eacdde1dbf4af67bac34d5f66b945..b1b82bbd158b8f77f84f25e01321dfdda4b9b02b 100644 --- a/exercises/exercise-coupling-ff-pm/interface/properties.hh +++ b/exercises/exercise-coupling-ff-pm/interface/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh index 5214551d1e5014268502a8c27fcab5a42b195980..57d749f2b05a1be9e324c66b18c7cf4b9181ead3 100644 --- a/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -77,10 +77,6 @@ public: moleFraction_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.MoleFraction"); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Return the sources within the domain. @@ -90,11 +86,6 @@ public: NumEqVector sourceAtPos(const GlobalPosition &globalPos) const { return NumEqVector(0.0); } - // \} - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -182,7 +173,6 @@ public: return values; } - // \} /*! * \brief Set the coupling manager @@ -196,10 +186,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/exercise-coupling-ff-pm/models/main.cc b/exercises/exercise-coupling-ff-pm/models/main.cc index 4a27aba71ce208aafc1968d2bfabd0ad7bda50b7..2fe38c8e2497454b3e6d5661d3687d79fd992d2e 100644 --- a/exercises/exercise-coupling-ff-pm/models/main.cc +++ b/exercises/exercise-coupling-ff-pm/models/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,25 +23,24 @@ */ #include <config.h> -#include <ctime> #include <iostream> #include <fstream> -#include <dune/common/parallel/mpihelper.hh> -#include <dune/common/timer.hh> -#include <dune/istl/io.hh> - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> #include <dumux/common/partial.hh> -#include <dumux/linear/seqsolverbackend.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> + #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include <dumux/multidomain/staggeredtraits.hh> #include <dumux/multidomain/fvassembler.hh> @@ -55,12 +54,8 @@ int main(int argc, char** argv) { using namespace Dumux; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -144,7 +139,7 @@ int main(int argc, char** argv) auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); darcyGridVariables->init(sol[darcyIdx]); - // intialize the vtk output module + // initialize the vtk output module const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); @@ -158,7 +153,7 @@ int main(int argc, char** argv) GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); darcyVtkWriter.write(0.0); - // intialize the subproblems + // initialize the subproblems darcyProblem->init(sol[darcyIdx], *darcyGridVariables); // the assembler with time loop for instationary problem @@ -174,7 +169,7 @@ int main(int argc, char** argv) timeLoop, solOld); // the linear solver - using LinearSolver = UMFPackBackend; + using LinearSolver = UMFPackIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); using NewtonSolver = MultiDomainNewtonSolver<Assembler, LinearSolver, CouplingManager>; @@ -186,9 +181,6 @@ int main(int argc, char** argv) timeLoop->setPeriodicCheckPoint(episodeLength); timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(solOld); - // solve the non-linear system with time step control nonLinearSolver.solve(sol, *timeLoop); @@ -221,16 +213,7 @@ int main(int argc, char** argv) timeLoop->finalize(stokesGridView.comm()); timeLoop->finalize(darcyGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } + Parameters::print(); return 0; } // end main diff --git a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index 38a3c3396df7a5018d5ff01673fc0dc76c6bd50f..01d64fdd8ca7064b080958e04a126dee25c0c5db 100644 --- a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -56,19 +56,17 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag> // copy some indices for convenience using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum { - // grid and world dimension - dim = GridView::dimension, - dimworld = GridView::dimensionworld, - - // primary variable indices - conti0EqIdx = Indices::conti0EqIdx, - pressureIdx = Indices::pressureIdx, - phaseIdx = 0, - // TODO: dumux-course-task 2.A - // set the `transportCompIdx` to `Indices::switchIdx`. - transportCompIdx = 1 - }; + // grid and world dimension + static constexpr int dim = GridView::dimension; + static constexpr int dimworld = GridView::dimensionworld; + + // primary variable indices + static constexpr int conti0EqIdx = Indices::conti0EqIdx; + static constexpr int pressureIdx = Indices::pressureIdx; + static constexpr int phaseIdx = 0; + // TODO: dumux-course-task 2.A + // set the `transportCompIdx` to `Indices::switchIdx`. + static constexpr int transportCompIdx = 1; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = Dune::FieldVector<Scalar, dimworld>; @@ -95,10 +93,6 @@ public: << std::endl; } - /*! - * \name Simulation steering - */ - // \{ /*! * \brief Initialize the problem. @@ -223,10 +217,6 @@ public: } } - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -271,12 +261,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. @@ -293,7 +277,6 @@ public: const SubControlVolume& scv) const { return NumEqVector(0.0); } - // \} /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/exercise-coupling-ff-pm/models/properties.hh b/exercises/exercise-coupling-ff-pm/models/properties.hh index 954869d048ab98f9ba1ae835f92f0ca28e4899ee..72b63dabf59ac4ae386451daa05a04e68f8617fc 100644 --- a/exercises/exercise-coupling-ff-pm/models/properties.hh +++ b/exercises/exercise-coupling-ff-pm/models/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -121,7 +121,7 @@ struct EffectiveDiffusivityModel<TypeTag, TTag::DarcyOnePNC> // TODO: dumux-course-task 2.A // Define new formulation for primary variables here. -// Set the spatial paramaters type +// Set the spatial parameters type template<class TypeTag> // TODO: dumux-course-task 2.A // Adapt the spatial params here. diff --git a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index 9a2e778e207dba8226fee359925bd38492317a07..4887b0962d62c58ef2b32dddc4245dceca01ad7b 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -87,10 +87,6 @@ public: getParamFromGroup<std::string>(this->paramGroup(), "Problem.InterfaceDiffusionCoefficientAvg")); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Return the sources within the domain. @@ -100,11 +96,6 @@ public: NumEqVector sourceAtPos(const GlobalPosition &globalPos) const { return NumEqVector(0.0); } - // \} - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -129,7 +120,7 @@ public: } // TODO: dumux-course-task 3.A -// set boundary conditions for the turbulence model at the wall (values.setWall()) at the upper and lower boudary +// set boundary conditions for the turbulence model at the wall (values.setWall()) at the upper and lower boundary if (onLowerBoundary_(globalPos)) { values.setDirichlet(Indices::velocityXIdx); @@ -210,7 +201,6 @@ public: return values; } - // \} /*! * \brief Set the coupling manager @@ -224,10 +214,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/exercise-coupling-ff-pm/turbulence/main.cc b/exercises/exercise-coupling-ff-pm/turbulence/main.cc index 0120de9ac93e89648641dea80735a4327068316b..769e1f4f78af35ce582cbbfbac1f3d8f60c659ff 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/main.cc +++ b/exercises/exercise-coupling-ff-pm/turbulence/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,25 +23,25 @@ */ #include <config.h> -#include <ctime> #include <iostream> #include <fstream> -#include <dune/common/parallel/mpihelper.hh> -#include <dune/common/timer.hh> -#include <dune/istl/io.hh> - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> + #include <dumux/common/partial.hh> -#include <dumux/linear/seqsolverbackend.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> + #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include <dumux/multidomain/staggeredtraits.hh> #include <dumux/multidomain/fvassembler.hh> @@ -55,12 +55,8 @@ int main(int argc, char** argv) { using namespace Dumux; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -152,7 +148,7 @@ int main(int argc, char** argv) auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); darcyGridVariables->init(sol[darcyIdx]); - // intialize the vtk output module + // initialize the vtk output module const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); @@ -179,7 +175,7 @@ int main(int argc, char** argv) timeLoop, solOld); // the linear solver - using LinearSolver = UMFPackBackend; + using LinearSolver = UMFPackIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver @@ -189,9 +185,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(solOld); - // solve the non-linear system with time step control nonLinearSolver.solve(sol, *timeLoop); @@ -226,16 +219,7 @@ int main(int argc, char** argv) timeLoop->finalize(stokesGridView.comm()); timeLoop->finalize(darcyGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } + Parameters::print(); return 0; } // end main diff --git a/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh index b37da81619cd214aca2247d7bcaa5e27b12fbb69..5d989c367192c6fe81776a07768e540357fe08c3 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -89,10 +89,6 @@ public: getParamFromGroup<std::string>(this->paramGroup(), "Problem.InterfaceDiffusionCoefficientAvg")); } - /*! - * \name Simulation steering - */ - // \{ template<class SolutionVector, class GridVariables> void postTimeStep(const SolutionVector& curSol, @@ -126,12 +122,6 @@ public: std::cout << "mass of water is: " << massWater << std::endl; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary control volume. @@ -197,12 +187,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. diff --git a/exercises/exercise-coupling-ff-pm/turbulence/properties.hh b/exercises/exercise-coupling-ff-pm/turbulence/properties.hh index 505b1d56519c7a63bfec7dbb3e4cf4626229c167..3d86bc5d12bf8207f61ffad6c292f9ae6e9f1d85 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/properties.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-fluidsystem/2p2cproblem.hh b/exercises/exercise-fluidsystem/2p2cproblem.hh index e28394cb943987918a16622fe50ebfddf356dc16..4e85ce272ba177bde489c7d4204f72828e588e10 100644 --- a/exercises/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/exercise-fluidsystem/2p2cproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -45,9 +45,8 @@ class ExerciseFluidsystemProblemTwoPTwoC : public PorousMediumFlowProblem<TypeTa using Scalar = GetPropType<TypeTag, Properties::Scalar>; // Grid dimension - enum { dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; + static constexpr int dim = GridView::dimension; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -73,10 +72,6 @@ public: depthBOR_ = this->gridGeometry().bBoxMax()[dimWorld-1]; } - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -137,12 +132,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -168,7 +157,6 @@ public: return values; } - // \} /*! * \brief Returns the source term diff --git a/exercises/exercise-fluidsystem/2p2cproperties.hh b/exercises/exercise-fluidsystem/2p2cproperties.hh index 18e45d9cb50c27f86a66a3cdf805f858d7ef1d00..9bb2561b1cec88b9963439a8d34e9f5c31a82769 100644 --- a/exercises/exercise-fluidsystem/2p2cproperties.hh +++ b/exercises/exercise-fluidsystem/2p2cproperties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-fluidsystem/2pproblem.hh b/exercises/exercise-fluidsystem/2pproblem.hh index 2a59fc424f4b728edfe94741db9f7169177de29d..c45608c687863c874f1bdd7e6759aa4175279899 100644 --- a/exercises/exercise-fluidsystem/2pproblem.hh +++ b/exercises/exercise-fluidsystem/2pproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -51,9 +51,8 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> using Scalar = GetPropType<TypeTag, Properties::Scalar>; // Grid dimension - enum { dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; + static constexpr int dim = GridView::dimension; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -67,12 +66,10 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> using FluidState = GetPropType<TypeTag, Properties::FluidState>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { - waterPressureIdx = Indices::pressureIdx, - naplSaturationIdx = Indices::saturationIdx, - contiWEqIdx = Indices::conti0EqIdx + FluidSystem::comp0Idx, // water transport equation index - contiNEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx // napl transport equation index - }; + static constexpr int waterPressureIdx = Indices::pressureIdx; + static constexpr int naplSaturationIdx = Indices::saturationIdx; + static constexpr int contiWEqIdx = Indices::conti0EqIdx + FluidSystem::comp0Idx; // water transport equation index + static constexpr int contiNEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx; // napl transport equation index public: ExerciseFluidsystemProblemTwoP(std::shared_ptr<const GridGeometry> gridGeometry) @@ -96,10 +93,6 @@ public: plotDensity_(); } - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -163,12 +156,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -189,7 +176,7 @@ public: return values; } - // \} + /*! * \brief Returns the source term diff --git a/exercises/exercise-fluidsystem/2pproperties.hh b/exercises/exercise-fluidsystem/2pproperties.hh index f924b70e571416ef1994e43e6adb733f8424e51b..0a23fd8e12f34988a102fce3ae95a4054cd7bc28 100644 --- a/exercises/exercise-fluidsystem/2pproperties.hh +++ b/exercises/exercise-fluidsystem/2pproperties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-fluidsystem/README.md b/exercises/exercise-fluidsystem/README.md index 90323dc3884749346417d5969172e60d31a8d00e..cf2065807a94964881adf53ecbb8b372fda190cb 100644 --- a/exercises/exercise-fluidsystem/README.md +++ b/exercises/exercise-fluidsystem/README.md @@ -175,7 +175,7 @@ Compare the gnuplot output to the following plot of the density function from ab ### 3. Implement a new fluid system -The problem file and properties file for this part of the exercise are `2p2cproblem.hh` and `2p2cproperties.hh`, respectively. +The problem file and properties file for this part of the exercise are `2p2cproblem.hh` and `2p2cproperties.hh`, respectively. We now want to implement a new fluid system consisting of two liquid phases,which are water and the previously implemented compressible component. We will consider compositional effects, which is why we now have to derive our _TypeTag_ (`ExerciseFluidsystemTwoPTwoC`) from a _TypeTag_ (`TwoPTwoC`) that holds the miscible two-phase two-component model properties: @@ -186,6 +186,7 @@ We now want to implement a new fluid system consisting of two liquid phases,whic ```c++ // Create a new type tag for the problem +namespace TTag { struct ExerciseFluidsystemTwoPTwoC { using InheritsFrom = std::tuple<TwoPTwoC, BoxModel>; }; } // end namespace TTag ``` diff --git a/exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh b/exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh index a1971b1c372f12506c0f4216130fbef50c0a12c9..4c091a37f4df330d8f69f1296c22a445052788cc 100644 --- a/exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh +++ b/exercises/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -19,7 +19,7 @@ /*! * \file * - * \brief Binary coefficients for water and a ficticious component implemented in exercise-fluidsystem a. + * \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem a. */ #ifndef DUMUX_BINARY_COEFF_H2O_MYCOMPRESSIBLECOMPONENT_HH #define DUMUX_BINARY_COEFF_H2O_MYCOMPRESSIBLECOMPONENT_HH @@ -30,7 +30,7 @@ namespace BinaryCoeff { /*! - * \brief Binary coefficients for water and a ficticious component implemented in exercise-fluidsystem a + * \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem a * The implementation of the missing methods in this file is part of exercise-fluidsystem b. */ class H2O_MyCompressibleComponent @@ -48,7 +48,7 @@ public: } /*! - * \brief Henry coefficient \f$[N/m^2]\f$ for water in the ficticious component. + * \brief Henry coefficient \f$[N/m^2]\f$ for water in the fictitious component. */ template <class Scalar> static Scalar henryWaterInMyCompressibleComponent(Scalar temperature) @@ -58,7 +58,7 @@ public: } /*! - * \brief Diffusion coefficient [m^2/s] for my ficticious component in liquid water or vice versa. + * \brief Diffusion coefficient [m^2/s] for my fictitious component in liquid water or vice versa. */ template <class Scalar> static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure) diff --git a/exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh b/exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh index ee8dc42c89e87e5fdfea9c3fb22810cd0968b4be..54302d2baa574353263e3c425409423ccfa2a15b 100644 --- a/exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh +++ b/exercises/exercise-fluidsystem/components/mycompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh b/exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh index fa6074b27cd367f4c09bf1d7c187cc52e281ff52..3fb82a427488385656eafaa551dfbb31a6f22f33 100644 --- a/exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh +++ b/exercises/exercise-fluidsystem/components/myincompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh b/exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh index f0ae0ea0f4fb361b8d767caf768738ea979fd0eb..b7c7573a0ad1b42e87c334363318a2933c510d69 100644 --- a/exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh +++ b/exercises/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -135,7 +135,7 @@ public: * * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase - * are indepent on the fluid composition. This assumtion is true + * are independent on the fluid composition. This assumption is true * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times @@ -236,7 +236,7 @@ public: } else { - // assume the density of the fictious component to be independent of the composition + // assume the density of the fictitious component to be independent of the composition return MyCompressibleComponent::liquidDensity(T, p); } } @@ -271,7 +271,7 @@ public: } else { - // assume the molar density of the fictious component to be independent of the composition + // assume the molar density of the fictitious component to be independent of the composition return MyCompressibleComponent::liquidMolarDensity(T, p); } } diff --git a/exercises/exercise-fluidsystem/main.cc b/exercises/exercise-fluidsystem/main.cc index c89c8182374f268fd14f0dd429d0aee8ef8984b8..2a543b88d178544887fa669e95c3e84cf6540d29 100644 --- a/exercises/exercise-fluidsystem/main.cc +++ b/exercises/exercise-fluidsystem/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,39 +23,28 @@ */ #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 "2pproperties.hh" -#include "2p2cproperties.hh" - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/common/partial.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> -#include <dumux/nonlinear/newtonsolver.hh> +#include "2pproperties.hh" +#include "2p2cproperties.hh" + +#include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> - -//////////////////////// -// the main function -//////////////////////// int main(int argc, char** argv) { using namespace Dumux; @@ -67,12 +56,8 @@ int main(int argc, char** argv) // and recompile the executable using TypeTag = Properties::TTag::TYPETAG; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -114,7 +99,7 @@ int main(int argc, char** argv) const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -130,19 +115,16 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); - // the non-linear solver + // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; NewtonSolver nonLinearSolver(assembler, linearSolver); // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); @@ -164,17 +146,10 @@ int main(int argc, char** argv) } while (!timeLoop->finished()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// timeLoop->finalize(leafGridView.comm()); - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/exercise-fluidsystem/spatialparams.hh b/exercises/exercise-fluidsystem/spatialparams.hh index c85b76492d24ed7a7dfc089d1051db836773bb33..9a056895ba4f8c92e38a9e6cc688baabf9dfeeef 100644 --- a/exercises/exercise-fluidsystem/spatialparams.hh +++ b/exercises/exercise-fluidsystem/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -28,7 +28,7 @@ // include parent spatialparameters #include <dumux/porousmediumflow/fvspatialparamsmp.hh> -//inlclude fluid matrix interaction relationship +//include fluid matrix interaction relationship #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh> diff --git a/exercises/exercise-fractures/fractureproblem.hh b/exercises/exercise-fractures/fractureproblem.hh index df925bae6f945f09549ae457c36e5446208fdf89..9a750147719d256083549dfa0baebc399c47dc10 100644 --- a/exercises/exercise-fractures/fractureproblem.hh +++ b/exercises/exercise-fractures/fractureproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -62,11 +62,8 @@ class FractureSubProblem : public PorousMediumFlowProblem<TypeTag> // some indices for convenience using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum - { - pressureIdx = Indices::pressureIdx, - saturationIdx = Indices::saturationIdx - }; + static constexpr int pressureIdx = Indices::pressureIdx; + static constexpr int saturationIdx = Indices::saturationIdx; public: //! The constructor diff --git a/exercises/exercise-fractures/fracturespatialparams.hh b/exercises/exercise-fractures/fracturespatialparams.hh index 1874ce704110e27a5e076c89b009e8c26c191f62..2516ef376102db305574257c3c3cf168c89d0090 100644 --- a/exercises/exercise-fractures/fracturespatialparams.hh +++ b/exercises/exercise-fractures/fracturespatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-fractures/main.cc b/exercises/exercise-fractures/main.cc index 2b4bba69db7c3a59cfc9f1cea286a729efc5bd67..12ecadca28e5b7fd89f2c55eeb85ebe1e54ebfed 100644 --- a/exercises/exercise-fractures/main.cc +++ b/exercises/exercise-fractures/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,19 +23,19 @@ #include <config.h> #include <iostream> -#include <dune/common/parallel/mpihelper.hh> - // include the properties header #include "properties.hh" +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> #include <dumux/common/timeloop.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> #include <dumux/multidomain/newtonsolver.hh> #include <dumux/multidomain/fvassembler.hh> #include <dumux/multidomain/traits.hh> @@ -57,8 +57,7 @@ using TheCouplingMapper = Dumux::FacetCouplingMapper<MatrixGridGeometry, Fractur using TheCouplingManager = Dumux::FacetCouplingManager<TheMultiDomainTraits, TheCouplingMapper>; // set the coupling manager property in the sub-problems -namespace Dumux { -namespace Properties { +namespace Dumux::Properties { template<class TypeTag> struct CouplingManager<TypeTag, TTag::MatrixProblem> { using type = TheCouplingManager; }; @@ -66,20 +65,15 @@ struct CouplingManager<TypeTag, TTag::MatrixProblem> { using type = TheCouplingM template<class TypeTag> struct CouplingManager<TypeTag, TTag::FractureProblem> { using type = TheCouplingManager; }; -} // end namespace Properties -} // end namespace Dumux +} // end namespace Dumux::Properties // main program int main(int argc, char** argv) { using namespace Dumux; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // initialize parameter tree Parameters::init(argc, argv); @@ -176,7 +170,7 @@ int main(int argc, char** argv) matrixGridVariables->init(x[matrixDomainId]); fractureGridVariables->init(x[fractureDomainId]); - // intialize the vtk output modules + // initialize the vtk output modules using MatrixVtkOutputModule = VtkOutputModule<MatrixGridVariables, GetPropType<MatrixTypeTag, Properties::SolutionVector>>; using FractureVtkOutputModule = VtkOutputModule<FractureGridVariables, GetPropType<FractureTypeTag, Properties::SolutionVector>>; MatrixVtkOutputModule matrixVtkWriter(*matrixGridVariables, x[matrixDomainId], matrixProblem->name()); @@ -221,7 +215,7 @@ int main(int argc, char** argv) timeLoop, xOld); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; + using LinearSolver = ILUBiCGSTABIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver @@ -231,9 +225,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control newtonSolver->solve(x, *timeLoop); @@ -263,9 +254,7 @@ int main(int argc, char** argv) // report time loop statistics timeLoop->finalize(); - // print dumux message to say goodbye - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); + Parameters::print(); return 0; }// end main diff --git a/exercises/exercise-fractures/matrixproblem.hh b/exercises/exercise-fractures/matrixproblem.hh index 4a9ca805fa5e1b05beb7dddb7c7115f5c2b14ca8..469c61ea362ea89f4e2f964fbea7633cf8e32f0c 100644 --- a/exercises/exercise-fractures/matrixproblem.hh +++ b/exercises/exercise-fractures/matrixproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -66,11 +66,8 @@ class MatrixSubProblem : public PorousMediumFlowProblem<TypeTag> // some indices for convenience using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum - { - pressureIdx = Indices::pressureIdx, - saturationIdx = Indices::saturationIdx - }; + static constexpr int pressureIdx = Indices::pressureIdx; + static constexpr int saturationIdx = Indices::saturationIdx; public: //! The constructor diff --git a/exercises/exercise-fractures/matrixspatialparams.hh b/exercises/exercise-fractures/matrixspatialparams.hh index 219bf8bfd56dad60cfb7e6c273e09884355da82e..56c7b29e062aa1ffc57a41d8e4507389aec062c1 100644 --- a/exercises/exercise-fractures/matrixspatialparams.hh +++ b/exercises/exercise-fractures/matrixspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-fractures/properties.hh b/exercises/exercise-fractures/properties.hh index bae6bc4e30d2301144e9f0f9750c62c2a4d3324b..7e998e902349beb544af508c708b696347eb098f 100644 --- a/exercises/exercise-fractures/properties.hh +++ b/exercises/exercise-fractures/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-grids/README.md b/exercises/exercise-grids/README.md index 17a73959907f6367938b03f97b24d5d94b7474a3..906e96e29af73423531edacf3cbfb21cfa4592ad 100644 --- a/exercises/exercise-grids/README.md +++ b/exercises/exercise-grids/README.md @@ -118,7 +118,7 @@ Negative values will make the cells closer to the start of the zone large, and t Considering that the majority of the action in this simulation will occur along the interface between the aquifer and the aquitard, and along the injection axis, we should provide more resolution in these areas, and less in the other areas. -* > __Task 3__: Using the Zone defintions described above, edit your grid to focus your simulation on the areas in greatest concern. +* > __Task 3__: Using the Zone definitions described above, edit your grid to focus your simulation on the areas in greatest concern. One example of this would be the following definition. @@ -152,7 +152,7 @@ Our `dim` and `dimworld` will both be 2, we can use `Dune::cube` as our `elType` There are two external structured grid files located in the `grid/` folder (`grid_structured.msh` and `grid_structured.dgf`). A path to one of these grids should be included in the input file. -* > __Task 4__: Edit the grid properties to set up an ALUGrid made of cubes. Call one of the strucutred meshes via the input file. +* > __Task 4__: Edit the grid properties to set up an ALUGrid made of cubes. Call one of the structured meshes via the input file. <br><br> diff --git a/exercises/exercise-grids/main.cc b/exercises/exercise-grids/main.cc index cd12fcd8ba836a95e80510232bb4eb1b85ad225d..d24be0dd167f6c4d881118e41d8a4b44bf5a012c 100644 --- a/exercises/exercise-grids/main.cc +++ b/exercises/exercise-grids/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -22,28 +22,20 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager.hh> @@ -60,12 +52,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::Injection2pCC; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -108,7 +96,7 @@ int main(int argc, char** argv) const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -125,8 +113,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -136,10 +124,7 @@ int main(int argc, char** argv) timeLoop->start(); while (!timeLoop->finished()) { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - //set time in problem (is used in time-dependent Neumann boundary condition) + // set time in problem (is used in time-dependent Neumann boundary condition) problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); // solve the non-linear system with time step control @@ -164,16 +149,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/exercise-grids/problem.hh b/exercises/exercise-grids/problem.hh index fe9b6bdee3f26a669524719206b45474e1d5582a..ad45de3f8498d1383539195482f2f61b357fdd1c 100644 --- a/exercises/exercise-grids/problem.hh +++ b/exercises/exercise-grids/problem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -67,7 +67,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -93,10 +93,6 @@ public: injectionDuration_ = getParam<Scalar>("Problem.InjectionDuration"); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Returns the problem name @@ -106,12 +102,6 @@ public: std::string name() const { return name_+"-2p"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -169,13 +159,6 @@ public: return values; } - // \} - - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -189,7 +172,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); diff --git a/exercises/exercise-grids/properties.hh b/exercises/exercise-grids/properties.hh index 4e2e0e7b939a9b38437c14010cfa32e821631ec3..13919c4144e3c2245aa171b959fe01f7e2aafdd9 100644 --- a/exercises/exercise-grids/properties.hh +++ b/exercises/exercise-grids/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-grids/spatialparams.hh b/exercises/exercise-grids/spatialparams.hh index 0160b1a628d53c4a2deb28ea993229289f8b4cd8..45440d7f1d4425ed96c601494ed4a3a8d2a8d727 100644 --- a/exercises/exercise-grids/spatialparams.hh +++ b/exercises/exercise-grids/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-mainfile/1pproblem.hh b/exercises/exercise-mainfile/1pproblem.hh index b2ac10a03ca709b11bf3ec36ab334fd23eb457f3..8f1ec58929232756025e5d14f8daffc7ae9cb8d8 100644 --- a/exercises/exercise-mainfile/1pproblem.hh +++ b/exercises/exercise-mainfile/1pproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-mainfile/1pspatialparams.hh b/exercises/exercise-mainfile/1pspatialparams.hh index 09d19d2a050df89e5d7f33b96572cde697a3d626..4d6746d16f62d3331e506255fb7a323ad1453540 100644 --- a/exercises/exercise-mainfile/1pspatialparams.hh +++ b/exercises/exercise-mainfile/1pspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-mainfile/README.md b/exercises/exercise-mainfile/README.md index c172212d74ed947634c79eceb0863eb0a2bd5f3e..0cd26b51fdc99e096b8854485f7a520b6b5e03ad 100644 --- a/exercises/exercise-mainfile/README.md +++ b/exercises/exercise-mainfile/README.md @@ -111,8 +111,8 @@ using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop); // the linear solver -using LinearSolver = ILU0BiCGSTABBackend; -auto linearSolver = std::make_shared<LinearSolver>(); +using LinearSolver = ILUBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; +auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -124,9 +124,6 @@ timeLoop->setPeriodicCheckPoint(tEnd/10.0); // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // linearize & solve nonLinearSolver.solve(x, *timeLoop); diff --git a/exercises/exercise-mainfile/exercise1pamain.cc b/exercises/exercise-mainfile/exercise1pamain.cc index 6bbc79d42a4c7b062b038516888678b993d75ca6..608418fc01ffa028ea33c9f8f1540c0639cf0342 100644 --- a/exercises/exercise-mainfile/exercise1pamain.cc +++ b/exercises/exercise-mainfile/exercise1pamain.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -25,26 +25,22 @@ #include "properties.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/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> int main(int argc, char** argv) { @@ -56,12 +52,8 @@ int main(int argc, char** argv) //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // initialize parameter tree Parameters::init(argc, argv); @@ -97,7 +89,7 @@ int main(int argc, char** argv) auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); - // intialize the vtk output module + // initialize the vtk output module VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); @@ -115,8 +107,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); + using LinearSolver = ILUBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the discretization matrices for stationary linear problems using JacobianMatrix = GetPropType<TypeTag, Properties::JacobianMatrix>; @@ -142,13 +134,8 @@ int main(int argc, char** argv) << comm.size() << " processes.\n" << "The cumulative CPU time was " << timer.elapsed()*comm.size() << " seconds.\n"; - //////////////////////////////////////////////////////////// - // print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); + if (leafGridView.comm().rank() == 0) + Parameters::print(); return 0; diff --git a/exercises/exercise-mainfile/exercise1pbmain.cc b/exercises/exercise-mainfile/exercise1pbmain.cc index 3517cccb7cd0e9f93a6bd5edb518591dc5e449ca..22bcb314fb19f4d03858c3755e2847d87827e905 100644 --- a/exercises/exercise-mainfile/exercise1pbmain.cc +++ b/exercises/exercise-mainfile/exercise1pbmain.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -25,27 +25,23 @@ #include "properties.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/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> -#include <dumux/linear/seqsolverbackend.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> int main(int argc, char** argv) { @@ -57,12 +53,8 @@ int main(int argc, char** argv) //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // initialize parameter tree Parameters::init(argc, argv); @@ -98,7 +90,7 @@ int main(int argc, char** argv) auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); - // intialize the vtk output module + // initialize the vtk output module VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); @@ -112,8 +104,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); + using LinearSolver = ILUBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -132,13 +124,8 @@ int main(int argc, char** argv) << comm.size() << " processes.\n" << "The cumulative CPU time was " << timer.elapsed()*comm.size() << " seconds.\n"; - //////////////////////////////////////////////////////////// - // print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); + if (leafGridView.comm().rank() == 0) + Parameters::print(); return 0; diff --git a/exercises/exercise-mainfile/exercise1pcmain.cc b/exercises/exercise-mainfile/exercise1pcmain.cc index 44203d74143d0aa3785f6bf748488dccfaca9810..97d840e48e15c047786923d4d8630f6ade7a8be4 100644 --- a/exercises/exercise-mainfile/exercise1pcmain.cc +++ b/exercises/exercise-mainfile/exercise1pcmain.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -25,27 +25,21 @@ #include "properties.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/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> -#include <dumux/linear/seqsolverbackend.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> int main(int argc, char** argv) { @@ -57,12 +51,8 @@ int main(int argc, char** argv) //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // initialize parameter tree Parameters::init(argc, argv); @@ -100,7 +90,7 @@ int main(int argc, char** argv) auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); - // intialize the vtk output module + // initialize the vtk output module VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); @@ -123,8 +113,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); + using LinearSolver = ILUBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -136,9 +126,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // linearize & solve nonLinearSolver.solve(x, *timeLoop); @@ -163,13 +150,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); + if (leafGridView.comm().rank() == 0) + Parameters::print(); return 0; diff --git a/exercises/exercise-mainfile/properties.hh b/exercises/exercise-mainfile/properties.hh index 512c16fd4cbe19b8987046238d9f46d79f8e9b6c..15544aeff65ef7c4da33b3095506544d1f845f24 100644 --- a/exercises/exercise-mainfile/properties.hh +++ b/exercises/exercise-mainfile/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-properties/main.cc b/exercises/exercise-properties/main.cc index 4195142f2d7ff936583a0d324117b9b2446e6de1..caa9afbdf67c775b64b7ef510695c7cd87b0676e 100644 --- a/exercises/exercise-properties/main.cc +++ b/exercises/exercise-properties/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,66 +23,24 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include "properties.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) { using namespace Dumux; @@ -90,15 +48,11 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::TwoPIncompressibleTpfa; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file - Parameters::init(argc, argv, usage); + Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; @@ -136,7 +90,7 @@ int main(int argc, char** argv) const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -153,8 +107,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -163,9 +117,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); @@ -192,16 +143,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/exercise-properties/mylocalresidual.hh b/exercises/exercise-properties/mylocalresidual.hh index 23a3a12bfb42bd51894a0f6801a4860f997f57ab..f027941becf2c9454608d21ab7186cfc8b08916c 100644 --- a/exercises/exercise-properties/mylocalresidual.hh +++ b/exercises/exercise-properties/mylocalresidual.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -105,7 +105,7 @@ public: * \param fvGeometry The finite volume geometry context * \param elemVolVars The volume variables for all flux stencil elements * \param scvf The sub control volume face to compute the flux on - * \param elemFluxVarsCache The cache related to flux compuation + * \param elemFluxVarsCache The cache related to flux computation */ // TODO: dumux-course-task // Eliminate the density from the flux term diff --git a/exercises/exercise-properties/problem.hh b/exercises/exercise-properties/problem.hh index e0c15fd867f2bb0e0d8005361d4e51e6c9f8c560..8e130df74388a19e89c31b2ca3607b82e03167ab 100644 --- a/exercises/exercise-properties/problem.hh +++ b/exercises/exercise-properties/problem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -48,13 +48,11 @@ class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum { - pressureH2OIdx = Indices::pressureIdx, - saturationDNAPLIdx = Indices::saturationIdx, - contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx, - waterPhaseIdx = FluidSystem::phase0Idx, - dnaplPhaseIdx = FluidSystem::phase1Idx - }; + static constexpr int pressureH2OIdx = Indices::pressureIdx; + static constexpr int saturationDNAPLIdx = Indices::saturationIdx; + static constexpr int contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx; + static constexpr int waterPhaseIdx = FluidSystem::phase0Idx; + static constexpr int dnaplPhaseIdx = FluidSystem::phase1Idx; public: TwoPTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) diff --git a/exercises/exercise-properties/properties.hh b/exercises/exercise-properties/properties.hh index 7b818f39420a24bfd28b4283cc08ae3acd70c49e..76717b64e0b933156012f32167c1747b7ccafd45 100644 --- a/exercises/exercise-properties/properties.hh +++ b/exercises/exercise-properties/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-properties/spatialparams.hh b/exercises/exercise-properties/spatialparams.hh index 045c4f9824f741da18b5c24713ab6f3640472c31..afa612d3101891c56e992048db2e1d0a79604eec 100644 --- a/exercises/exercise-properties/spatialparams.hh +++ b/exercises/exercise-properties/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-runtimeparams/README.md b/exercises/exercise-runtimeparams/README.md index 595f2bb62db96869d02dcfe4845b652fd4aef0c0..9d6129fcc3c874c8f1584f61897774d63e07b147 100644 --- a/exercises/exercise-runtimeparams/README.md +++ b/exercises/exercise-runtimeparams/README.md @@ -78,7 +78,7 @@ or variable_ = getParamFromGroup<TYPE>("GROUPNAME", "PARAMNAME"); ``` -`<TYPE>`,`<GROUPNAME>`,`<PARAMNAME>` should be appropriatly defined for your variable: +`<TYPE>`,`<GROUPNAME>`,`<PARAMNAME>` should be appropriately defined for your variable: * `<TYPE>` is the type of the parameter to read * `<GROUPNAME>` is the group in the input file * `<PARAMNAME>` is the name of the parameter in the input file @@ -134,7 +134,7 @@ loggingparametertree.hh:316: Key Problem.TotalAreaSpecificInflow not found in the parameter tree ---> Abort! ``` -To avoid this, we can place a default value in the variable defintion. Whenever the parameter is specified in the input file, this default value in your class will be overwritten, but in the case that no value is provided in the input file, this default value will be used. In order to do this, follow the following template. +To avoid this, we can place a default value in the variable definition. Whenever the parameter is specified in the input file, this default value in your class will be overwritten, but in the case that no value is provided in the input file, this default value will be used. In order to do this, follow the following template. ```c++ variable_ = getParam<TYPE>("GROUPNAME.PARAMNAME", DEFAULTVALUE); diff --git a/exercises/exercise-runtimeparams/main.cc b/exercises/exercise-runtimeparams/main.cc index b80387709c3d76673cacd4eecf4f40c0397c65c2..25300dd316c4ee05889e45c3d1d646f637649e7f 100644 --- a/exercises/exercise-runtimeparams/main.cc +++ b/exercises/exercise-runtimeparams/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -22,37 +22,25 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> // The properties file, where compile time definitions are made #include "properties.hh" -//////////////////////// -// the main function -//////////////////////// int main(int argc, char** argv) { using namespace Dumux; @@ -60,12 +48,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::Injection2pCC; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -108,7 +92,7 @@ int main(int argc, char** argv) const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -125,8 +109,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -136,10 +120,7 @@ int main(int argc, char** argv) timeLoop->start(); while (!timeLoop->finished()) { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - //set time in problem (is used in time-dependent Neumann boundary condition) + // set time in problem (is used in time-dependent Neumann boundary condition) problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); // solve the non-linear system with time step control @@ -164,16 +145,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/exercise-runtimeparams/problem.hh b/exercises/exercise-runtimeparams/problem.hh index 54a1ddf22e4177493494fac92d55841cc7de914d..c46be79111444b01512ade6af151fde6dcfff9b7 100644 --- a/exercises/exercise-runtimeparams/problem.hh +++ b/exercises/exercise-runtimeparams/problem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -67,7 +67,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -101,10 +101,6 @@ public: // Provide output describing where the parameter value comes from using parameter bool functions. } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Returns the problem name @@ -114,12 +110,6 @@ public: std::string name() const { return name_+"-2p"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -179,12 +169,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -198,7 +182,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); diff --git a/exercises/exercise-runtimeparams/properties.hh b/exercises/exercise-runtimeparams/properties.hh index 5cb1c0bc0fc95f90e37f0bf6dd7fa70014d3f618..2c8162bc40b9384cc6cd4d3578d5a10dcb5f9294 100644 --- a/exercises/exercise-runtimeparams/properties.hh +++ b/exercises/exercise-runtimeparams/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/exercise-runtimeparams/spatialparams.hh b/exercises/exercise-runtimeparams/spatialparams.hh index e92f90b7ea2dbb9e3c2743b51dc10cd848773e58..0559af1cb4b4c76dc77ca6a34d8fca5d173845e5 100644 --- a/exercises/exercise-runtimeparams/spatialparams.hh +++ b/exercises/exercise-runtimeparams/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-basic/2pnimain.cc b/exercises/solution/exercise-basic/2pnimain.cc index 671dc6a20a6cf5369fce826a5e6a1b87a77862e4..e41a7c104f7827d4877cf77a113323d1713b6748 100644 --- a/exercises/solution/exercise-basic/2pnimain.cc +++ b/exercises/solution/exercise-basic/2pnimain.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -22,37 +22,26 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> #include <dumux/linear/linearsolvertraits.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> // The properties file, where the compile time options are defined #include "properties2pni.hh" -//////////////////////// -// the main function -//////////////////////// int main(int argc, char** argv) { using namespace Dumux; @@ -60,12 +49,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::Injection2pNICC; - // 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); + // initialize MPI+X, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -100,13 +85,7 @@ int main(int argc, char** argv) auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); - // get some time loop parameters - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); - const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); - auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -115,6 +94,10 @@ int main(int argc, char** argv) vtkWriter.write(0.0); // instantiate time loop + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); + const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); + const auto dt = getParam<Scalar>("TimeLoop.DtInitial"); auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd); timeLoop->setMaxTimeStepSize(maxDt); @@ -123,8 +106,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -134,9 +117,6 @@ int main(int argc, char** argv) timeLoop->start(); while (!timeLoop->finished()) { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - //set time in problem (is used in time-dependent Neumann boundary condition) problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); @@ -162,16 +142,9 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + // print parameter report + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/solution/exercise-basic/injection2pniproblem.hh b/exercises/solution/exercise-basic/injection2pniproblem.hh index 4d387896880caf5fb534718f1fbeb70e249e35a6..6c45f8d2c1064df24dbef107744b365adbf55855 100644 --- a/exercises/solution/exercise-basic/injection2pniproblem.hh +++ b/exercises/solution/exercise-basic/injection2pniproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -66,7 +66,7 @@ class Injection2PNIProblem : public PorousMediumFlowProblem<TypeTag> using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -92,11 +92,6 @@ public: injectionDuration_ = getParam<Scalar>("Problem.InjectionDuration"); } - /*! - * \name Problem parameters - */ - // \{ - /*! * \brief Returns the problem name * @@ -105,13 +100,6 @@ public: std::string name() const { return "injection-2pni"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ - /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary segment. @@ -165,14 +153,6 @@ public: return values; } - // \} - - - /*! - * \name Volume terms - */ - // \{ - /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. @@ -196,7 +176,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(283.15, 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); @@ -210,8 +190,6 @@ public: return values; } - // \} - //! set the time for the time dependent boundary conditions (called from main) void setTime(Scalar time) { time_ = time; } diff --git a/exercises/solution/exercise-basic/params.input b/exercises/solution/exercise-basic/params.input index 06e9e0374497805a62fdaf976670d1a8b5f8d3ab..6b1b2d2b4e7818e4ed15c507d863e065f741cd79 100644 --- a/exercises/solution/exercise-basic/params.input +++ b/exercises/solution/exercise-basic/params.input @@ -9,7 +9,6 @@ Cells = 24 16 [Problem] Name = injection -OnlyPlotMaterialLaws = true AquiferDepth = 2700.0 # m InjectionDuration = 2.628e6 # in seconds, i.e. one month diff --git a/exercises/solution/exercise-basic/properties2pni.hh b/exercises/solution/exercise-basic/properties2pni.hh index 4f367702544d1f19eb154937a460eae78deabf10..947ebff4860577ad731fd579a608d4737fa318e3 100644 --- a/exercises/solution/exercise-basic/properties2pni.hh +++ b/exercises/solution/exercise-basic/properties2pni.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-basic/spatialparams.hh b/exercises/solution/exercise-basic/spatialparams.hh index a03c6ccbbc01fda3519c8a5ff0a9063e68d0d5d9..1382ea0c580815e7dbd661e6f4a3f92158fea617 100644 --- a/exercises/solution/exercise-basic/spatialparams.hh +++ b/exercises/solution/exercise-basic/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-biomineralization/biominproblem.hh b/exercises/solution/exercise-biomineralization/biominproblem.hh index a51759cea16f5ed5ea74a94ff8497443c56f9f89..1bad9aeed66da725935084c5abcdaca4fff36c43 100644 --- a/exercises/solution/exercise-biomineralization/biominproblem.hh +++ b/exercises/solution/exercise-biomineralization/biominproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -56,11 +56,8 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; // Grid dimension - enum - { - dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; + static constexpr int dim = GridView::dimension; + static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimension>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -72,28 +69,24 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> // set the chemistry TypeTag using Chemistry = typename Dumux::SimpleBiominReactions<NumEqVector, VolumeVariables>; - enum - { - numComponents = FluidSystem::numComponents, - - pressureIdx = Indices::pressureIdx, - switchIdx = Indices::switchIdx, //Saturation + static constexpr int numComponents = FluidSystem::numComponents; + static constexpr int pressureIdx = Indices::pressureIdx; + static constexpr int switchIdx = Indices::switchIdx; //Saturation - //Indices of the components - H2OIdx = FluidSystem::H2OIdx, - CO2Idx = FluidSystem::CO2Idx, - CaIdx = FluidSystem::CaIdx, - UreaIdx = FluidSystem::UreaIdx, + // Indices of the components + static constexpr int H2OIdx = FluidSystem::H2OIdx; + static constexpr int CO2Idx = FluidSystem::CO2Idx; + static constexpr int CaIdx = FluidSystem::CaIdx; + static constexpr int UreaIdx = FluidSystem::UreaIdx; - BiofilmIdx = SolidSystem::BiofilmIdx+numComponents, - CalciteIdx = SolidSystem::CalciteIdx+numComponents, + static constexpr int BiofilmIdx = SolidSystem::BiofilmIdx+numComponents; + static constexpr int CalciteIdx = SolidSystem::CalciteIdx+numComponents; - //Index of the primary component of wetting and nonwetting phase - conti0EqIdx = Indices::conti0EqIdx, + // Index of the primary component of wetting and nonwetting phase + static constexpr int conti0EqIdx = Indices::conti0EqIdx; - // Phase State - liquidPhaseOnly = Indices::firstPhaseOnly, - }; + // Phase State + static constexpr int liquidPhaseOnly = Indices::firstPhaseOnly; /*! * \brief The constructor @@ -135,10 +128,6 @@ public: time_ = time; } - /*! - * \name Problem parameters - */ - /*! * \brief The problem name. * @@ -147,12 +136,6 @@ public: const std::string name() const { return name_; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be diff --git a/exercises/solution/exercise-biomineralization/biominspatialparams.hh b/exercises/solution/exercise-biomineralization/biominspatialparams.hh index a2eb8e65b582120ae38adb182b6126d9910d07be..263042195b6d29e031be13b6d16461cf5901dc52 100644 --- a/exercises/solution/exercise-biomineralization/biominspatialparams.hh +++ b/exercises/solution/exercise-biomineralization/biominspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -48,7 +48,7 @@ class BioMinSpatialparams using GridView = typename GridGeometry::GridView; using CoordScalar = typename GridView::ctype; - enum { dimWorld=GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; diff --git a/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh b/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh index e5c6083570cfcda61a59473f019ff8cd25d54db0..2939773c0e3fec6e21a080b79ce370cf0d549951 100644 --- a/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh +++ b/exercises/solution/exercise-biomineralization/chemistry/simplebiominreactions.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-biomineralization/components/biofilm.hh b/exercises/solution/exercise-biomineralization/components/biofilm.hh index 89784cf14d2d755827d9e03a1460242318cd1bb4..3f263c9497f9d70c8f6f3bfe08d7220924e07a52 100644 --- a/exercises/solution/exercise-biomineralization/components/biofilm.hh +++ b/exercises/solution/exercise-biomineralization/components/biofilm.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-biomineralization/components/urea.hh b/exercises/solution/exercise-biomineralization/components/urea.hh index 6d94c979c67bf0b39982f10f484395be4edf4d8c..4227a9ee5ced16538b982ed9ea83f041ce25bd4a 100644 --- a/exercises/solution/exercise-biomineralization/components/urea.hh +++ b/exercises/solution/exercise-biomineralization/components/urea.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-biomineralization/fluidsystems/biomin.hh b/exercises/solution/exercise-biomineralization/fluidsystems/biomin.hh index 0ef40f34993ca5b146da7666e473c9036d839414..d8ba414ca694abd27b8eff01bb1af16c80bab733 100644 --- a/exercises/solution/exercise-biomineralization/fluidsystems/biomin.hh +++ b/exercises/solution/exercise-biomineralization/fluidsystems/biomin.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -48,7 +48,7 @@ namespace FluidSystems { * components in both, the liquid and the gas (supercritical) phase, * additional biomineralisation components (Ca and Urea) in the liquid phase * - * This class provides acess to the Bio fluid system when no property system is used. + * This class provides access to the Bio fluid system when no property system is used. * For Dumux users, using BioMinFluid<TypeTag> and the documentation therein is * recommended. * @@ -216,7 +216,7 @@ public: switch (compIdx) { case H2OIdx: return H2O::molarMass(); // actually, the molar mass of brine is only needed for diffusion - // but since solutes are accounted for seperately + // but since solutes are accounted for separately // only the molar mass of water is returned. case CO2Idx: return CO2::molarMass(); case CaIdx: return Ca::molarMass(); @@ -382,7 +382,7 @@ public: assert(temperature > 0); assert(pressure > 0); - // calulate the equilibrium composition for the given + // calculate the equilibrium composition for the given // temperature and pressure. Scalar xwH2O, xnH2O; Scalar xwCO2, xnCO2; @@ -446,7 +446,7 @@ public: else if (compJIdx < numComponents) //Calcium and urea return 1.587e-9; //[m²/s] educated guess, value for NaCl from J. Phys. D: Appl. Phys. 40 (2007) 2769-2776 else - DUNE_THROW(Dune::NotImplemented, "Binary difussion coefficient : Incorrect compIdx"); + DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient : Incorrect compIdx"); } else { @@ -457,7 +457,7 @@ public: else if (compJIdx <numComponents) //Calcium and urea will stay in brine, no gaseous calcium or urea! return 0.0; else - DUNE_THROW(Dune::NotImplemented, "Binary difussion coefficient : Incorrect compIdx"); + DUNE_THROW(Dune::NotImplemented, "Binary diffusion coefficient : Incorrect compIdx"); } }; diff --git a/exercises/solution/exercise-biomineralization/main.cc b/exercises/solution/exercise-biomineralization/main.cc index 4bd443c413d3483e7cd6005a45a702c18092864b..8a8c057007e65750fe1a3bb5a140dcdbee1d2c4a 100644 --- a/exercises/solution/exercise-biomineralization/main.cc +++ b/exercises/solution/exercise-biomineralization/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,31 +23,22 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include "properties.hh" @@ -61,12 +52,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::ExerciseBioMinCCTpfa; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -75,10 +62,6 @@ int main(int argc, char** argv) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; gridManager.init(); - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// - // we compute on the leaf grid view const auto& leafGridView = gridManager.grid().leafGridView(); @@ -132,8 +115,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; @@ -142,9 +125,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); @@ -179,16 +159,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/solution/exercise-biomineralization/properties.hh b/exercises/solution/exercise-biomineralization/properties.hh index 2822014674a9b3b43bf7f6f5d1ebd94b2338a663..bc4cde06c399897c19fb694b9d363e7a3496301e 100644 --- a/exercises/solution/exercise-biomineralization/properties.hh +++ b/exercises/solution/exercise-biomineralization/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-biomineralization/solidsystems/biominsolidphase.hh b/exercises/solution/exercise-biomineralization/solidsystems/biominsolidphase.hh index be3a1f656c75d5cb320c5bdee2759b6b2fc3b976..c4c337cde7292a6cb7501539320329673762565f 100644 --- a/exercises/solution/exercise-biomineralization/solidsystems/biominsolidphase.hh +++ b/exercises/solution/exercise-biomineralization/solidsystems/biominsolidphase.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh b/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh index 1078364520ec34450fadf114688121c1570e86cd..b8b230fb4a8daba93cb3e5824947703a84044c88 100644 --- a/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh +++ b/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh b/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh index 359c320b2208efb68fbe73a6fda5e93257eeb8a5..1b6cc619770f4eb52dc2f38e15e1e985b092cc53 100644 --- a/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh +++ b/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index 453b857233f18a65488a09a061a857e94da2550e..2438cadae30a813c3e5c6fa65a360f832bfd6a5d 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -67,10 +67,6 @@ public: deltaP_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.PressureDifference"); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Return the sources within the domain. @@ -79,12 +75,7 @@ public: */ NumEqVector sourceAtPos(const GlobalPosition &globalPos) const { return NumEqVector(0.0); } - // \} - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -191,7 +182,6 @@ public: return values; } - // \} //! Set the coupling manager void setCouplingManager(std::shared_ptr<CouplingManager> cm) @@ -201,10 +191,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc index d9e53dc70db2acdc320337dddcc633cd1b6921be..73426d92eae6dc2f7db1e3066dc1a96e77aa7aca 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -25,21 +25,21 @@ #include <iostream> -#include <dune/common/parallel/mpihelper.hh> -#include <dune/istl/io.hh> -#include <dune/grid/yaspgrid.hh> - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> #include <dumux/common/partial.hh> -#include <dumux/linear/seqsolverbackend.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> + #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include <dumux/multidomain/staggeredtraits.hh> #include <dumux/multidomain/fvassembler.hh> @@ -53,12 +53,8 @@ int main(int argc, char** argv) { using namespace Dumux; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -171,7 +167,7 @@ int main(int argc, char** argv) auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); darcyGridVariables->init(sol[darcyIdx]); - // intialize the vtk output module + // initialize the vtk output module const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); @@ -202,7 +198,7 @@ int main(int argc, char** argv) couplingManager); // the linear solver - using LinearSolver = UMFPackBackend; + using LinearSolver = UMFPackIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver @@ -216,16 +212,7 @@ int main(int argc, char** argv) stokesVtkWriter.write(1.0); darcyVtkWriter.write(1.0); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } + Parameters::print(); return 0; } // end main diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index 3f3248c6f077c99a21d6fcbed42c690fff91250d..173c5c9d5a0b20f5fb8ce097d75ff6b445206434 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -64,17 +64,6 @@ public: : ParentType(fvGridGeometry, "Darcy"), eps_(1e-7), couplingManager_(couplingManager) {} - /*! - * \name Simulation steering - */ - // \{ - - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -140,12 +129,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh b/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh index e062663aa57b789db2ef34bbb444f21a503bfa7a..642c815f4cc4c9261b12f7430e7cb68e6af046dd 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh index 109473e7cadf7cd311616a29c3c96a9be49ca2f5..fca504852d8783857b8b50bc90fadee323ed6c45 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -80,10 +80,6 @@ public: moleFraction_ = getParamFromGroup<Scalar>(this->paramGroup(), "Problem.MoleFraction"); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Return the sources within the domain. @@ -93,11 +89,6 @@ public: NumEqVector sourceAtPos(const GlobalPosition &globalPos) const { return NumEqVector(0.0); } - // \} - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -185,7 +176,6 @@ public: return values; } - // \} /*! * \brief Set the coupling manager @@ -199,10 +189,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/solution/exercise-coupling-ff-pm/models/main.cc b/exercises/solution/exercise-coupling-ff-pm/models/main.cc index a6ed0a0249e5a02a81b3cd103fc91706ebb7349a..f1d4b67a1c57f766d413af2343f42e3dddceb703 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/models/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,25 +23,24 @@ */ #include <config.h> -#include <ctime> #include <iostream> #include <fstream> -#include <dune/common/parallel/mpihelper.hh> -#include <dune/common/timer.hh> -#include <dune/istl/io.hh> - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> #include <dumux/common/partial.hh> -#include <dumux/linear/seqsolverbackend.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> + #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include <dumux/multidomain/staggeredtraits.hh> #include <dumux/multidomain/fvassembler.hh> @@ -58,9 +57,8 @@ int main(int argc, char** argv) // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -144,7 +142,7 @@ int main(int argc, char** argv) auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); darcyGridVariables->init(sol[darcyIdx]); - // intialize the vtk output module + // initialize the vtk output module #if EXNUMBER >= 1 const std::array<std::string, 3> part = {"a", "b", "c"}; const auto stokesName = "sol_" + part[EXNUMBER-1] + "_" + getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); @@ -164,7 +162,7 @@ int main(int argc, char** argv) GetPropType<DarcyTypeTag, Properties::IOFields>::initOutputModule(darcyVtkWriter); darcyVtkWriter.write(0.0); - // intialize the subproblems + // initialize the subproblems darcyProblem->init(sol[darcyIdx], *darcyGridVariables); // the assembler with time loop for instationary problem @@ -180,7 +178,7 @@ int main(int argc, char** argv) timeLoop, solOld); // the linear solver - using LinearSolver = UMFPackBackend; + using LinearSolver = UMFPackIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); using NewtonSolver = MultiDomainNewtonSolver<Assembler, LinearSolver, CouplingManager>; @@ -192,9 +190,6 @@ int main(int argc, char** argv) timeLoop->setPeriodicCheckPoint(episodeLength); timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(solOld); - // solve the non-linear system with time step control nonLinearSolver.solve(sol, *timeLoop); @@ -227,16 +222,7 @@ int main(int argc, char** argv) timeLoop->finalize(stokesGridView.comm()); timeLoop->finalize(darcyGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } + Parameters::print(); return 0; } // end main diff --git a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index 0fd807fb2d49a4087eff688a1542ce6eaf7e5043..e49f63bbc13d6e9863b31863fb9b42a5f5390314 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -55,24 +55,23 @@ class PorousMediumSubProblem : public PorousMediumFlowProblem<TypeTag> // copy some indices for convenience using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum { - // grid and world dimension - dim = GridView::dimension, - dimworld = GridView::dimensionworld, - - // primary variable indices - conti0EqIdx = Indices::conti0EqIdx, - pressureIdx = Indices::pressureIdx, + + // grid and world dimension + static constexpr int dim = GridView::dimension; + static constexpr int dimworld = GridView::dimensionworld; + + // primary variable indices + static constexpr int conti0EqIdx = Indices::conti0EqIdx; + static constexpr int pressureIdx = Indices::pressureIdx; #if EXNUMBER >= 3 - saturationIdx = Indices::switchIdx, - transportCompIdx = Indices::switchIdx + static constexpr int saturationIdx = Indices::switchIdx; + static constexpr int transportCompIdx = Indices::switchIdx; #elif EXNUMBER >= 1 - transportCompIdx = Indices::switchIdx + static constexpr int transportCompIdx = Indices::switchIdx; #else - phaseIdx = 0, - transportCompIdx = 1 + static constexpr int phaseIdx = 0; + static constexpr int transportCompIdx = 1; #endif - }; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = Dune::FieldVector<Scalar, dimworld>; @@ -103,10 +102,6 @@ public: << std::endl; } - /*! - * \name Simulation steering - */ - // \{ /*! * \brief Initialize the problem. @@ -244,10 +239,6 @@ public: } } - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -292,12 +283,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. @@ -314,7 +299,6 @@ public: const SubControlVolume& scv) const { return NumEqVector(0.0); } - // \} /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/solution/exercise-coupling-ff-pm/models/properties.hh b/exercises/solution/exercise-coupling-ff-pm/models/properties.hh index 0d18bb09487126cad33e07d7afa7eea951316753..aa66bfb1565a86c24f7d33b6326fa4d4942cef40 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/properties.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -128,7 +128,7 @@ struct Formulation<TypeTag, TTag::DarcyOnePNC> { static constexpr auto value = TwoPFormulation::p1s0; }; #endif -// Set the spatial paramaters type +// Set the spatial parameters type #if EXNUMBER >= 1 template<class TypeTag> struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index 6aecc5c2dd881a00d14936a1951b693e8a95810b..cfba40383d607ea9797221682cbe1fd7b2e1fe56 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -97,10 +97,6 @@ public: getParamFromGroup<std::string>(this->paramGroup(), "Problem.InterfaceDiffusionCoefficientAvg")); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Return the sources within the domain. @@ -110,11 +106,6 @@ public: NumEqVector sourceAtPos(const GlobalPosition &globalPos) const { return NumEqVector(0.0); } - // \} - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -230,7 +221,6 @@ public: return values; } - // \} /*! * \brief Set the coupling manager @@ -244,10 +234,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc index 668e08b21668e00efe9c24c7b037d14313953e8c..c8974ad84a70a8b501b07f11dbbb73ae90c4daac 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,25 +23,25 @@ */ #include <config.h> -#include <ctime> #include <iostream> #include <fstream> -#include <dune/common/parallel/mpihelper.hh> -#include <dune/common/timer.hh> -#include <dune/istl/io.hh> - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> + #include <dumux/common/partial.hh> -#include <dumux/linear/seqsolverbackend.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> + #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> #include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/staggeredvtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include <dumux/multidomain/staggeredtraits.hh> #include <dumux/multidomain/fvassembler.hh> @@ -55,12 +55,8 @@ int main(int argc, char** argv) { using namespace Dumux; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -152,7 +148,7 @@ int main(int argc, char** argv) auto darcyGridVariables = std::make_shared<DarcyGridVariables>(darcyProblem, darcyFvGridGeometry); darcyGridVariables->init(sol[darcyIdx]); - // intialize the vtk output module + // initialize the vtk output module const auto stokesName = getParam<std::string>("Problem.Name") + "_" + stokesProblem->name(); const auto darcyName = getParam<std::string>("Problem.Name") + "_" + darcyProblem->name(); @@ -179,7 +175,7 @@ int main(int argc, char** argv) timeLoop, solOld); // the linear solver - using LinearSolver = UMFPackBackend; + using LinearSolver = UMFPackIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver @@ -189,9 +185,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(solOld); - // solve the non-linear system with time step control nonLinearSolver.solve(sol, *timeLoop); @@ -228,16 +221,7 @@ int main(int argc, char** argv) timeLoop->finalize(stokesGridView.comm()); timeLoop->finalize(darcyGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } + Parameters::print(); return 0; } // end main diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh index eec4de6b0cd23864bc6619b1830efbe8cd570129..456f9b14fac589d5b233dfb87c073f5ad3a054d5 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -89,10 +89,6 @@ public: getParamFromGroup<std::string>(this->paramGroup(), "Problem.InterfaceDiffusionCoefficientAvg")); } - /*! - * \name Simulation steering - */ - // \{ template<class SolutionVector, class GridVariables> void postTimeStep(const SolutionVector& curSol, @@ -126,12 +122,6 @@ public: std::cout << "mass of water is: " << massWater << std::endl; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be * used for which equation on a given boundary control volume. @@ -197,12 +187,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the source term for all phases within a given * sub-control-volume. diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh index dc4d3dc05c24fbd3b02668c7324ced359c7943bd..d0108365644dbf0a584544168a6c8976fde7e8a4 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh index 4b552abd068f3b8a81eb9e897d624e9e38a02247..5f53e54f14abaafa749bbff45a433a5ffdc5c7c8 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -45,9 +45,8 @@ class ExerciseFluidsystemProblemTwoPTwoC : public PorousMediumFlowProblem<TypeTa using Scalar = GetPropType<TypeTag, Properties::Scalar>; // Grid dimension - enum { dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; + static constexpr int dim = GridView::dimension; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -72,10 +71,6 @@ public: depthBOR_ = this->gridGeometry().bBoxMax()[dimWorld-1]; } - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -142,12 +137,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -174,7 +163,6 @@ public: return values; } - // \} /*! * \brief Returns the source term diff --git a/exercises/solution/exercise-fluidsystem/2p2cproperties.hh b/exercises/solution/exercise-fluidsystem/2p2cproperties.hh index 18e45d9cb50c27f86a66a3cdf805f858d7ef1d00..9bb2561b1cec88b9963439a8d34e9f5c31a82769 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproperties.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproperties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-fluidsystem/2pproblem.hh b/exercises/solution/exercise-fluidsystem/2pproblem.hh index 3242e7b203f51d247f151ea77971f7fe42c760a0..1a81df2bdb84d6dfcbcf39207b024790e447809e 100644 --- a/exercises/solution/exercise-fluidsystem/2pproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2pproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -51,9 +51,8 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> using Scalar = GetPropType<TypeTag, Properties::Scalar>; // Grid dimension - enum { dim = GridView::dimension, - dimWorld = GridView::dimensionworld - }; + static constexpr int dim = GridView::dimension; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -67,12 +66,10 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> using FluidState = GetPropType<TypeTag, Properties::FluidState>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { - waterPressureIdx = Indices::pressureIdx, - naplSaturationIdx = Indices::saturationIdx, - contiWEqIdx = Indices::conti0EqIdx + FluidSystem::comp0Idx, // water transport equation index - contiNEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx // napl transport equation index - }; + static constexpr int waterPressureIdx = Indices::pressureIdx; + static constexpr int naplSaturationIdx = Indices::saturationIdx; + static constexpr int contiWEqIdx = Indices::conti0EqIdx + FluidSystem::comp0Idx; // water transport equation index + static constexpr int contiNEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx; // napl transport equation index public: ExerciseFluidsystemProblemTwoP(std::shared_ptr<const GridGeometry> gridGeometry) @@ -96,10 +93,6 @@ public: plotDensity_(); } - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -166,12 +159,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -192,7 +179,7 @@ public: return values; } - // \} + /*! * \brief Returns the source term diff --git a/exercises/solution/exercise-fluidsystem/2pproperties.hh b/exercises/solution/exercise-fluidsystem/2pproperties.hh index 026263009593554b9ca2b7346cc54596f3ab9f7b..d9eb7036d3ee9b867c3db709d23c93ed8bc1cdf6 100644 --- a/exercises/solution/exercise-fluidsystem/2pproperties.hh +++ b/exercises/solution/exercise-fluidsystem/2pproperties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh b/exercises/solution/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh index a1971b1c372f12506c0f4216130fbef50c0a12c9..4c091a37f4df330d8f69f1296c22a445052788cc 100644 --- a/exercises/solution/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh +++ b/exercises/solution/exercise-fluidsystem/binarycoefficients/h2omycompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -19,7 +19,7 @@ /*! * \file * - * \brief Binary coefficients for water and a ficticious component implemented in exercise-fluidsystem a. + * \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem a. */ #ifndef DUMUX_BINARY_COEFF_H2O_MYCOMPRESSIBLECOMPONENT_HH #define DUMUX_BINARY_COEFF_H2O_MYCOMPRESSIBLECOMPONENT_HH @@ -30,7 +30,7 @@ namespace BinaryCoeff { /*! - * \brief Binary coefficients for water and a ficticious component implemented in exercise-fluidsystem a + * \brief Binary coefficients for water and a fictitious component implemented in exercise-fluidsystem a * The implementation of the missing methods in this file is part of exercise-fluidsystem b. */ class H2O_MyCompressibleComponent @@ -48,7 +48,7 @@ public: } /*! - * \brief Henry coefficient \f$[N/m^2]\f$ for water in the ficticious component. + * \brief Henry coefficient \f$[N/m^2]\f$ for water in the fictitious component. */ template <class Scalar> static Scalar henryWaterInMyCompressibleComponent(Scalar temperature) @@ -58,7 +58,7 @@ public: } /*! - * \brief Diffusion coefficient [m^2/s] for my ficticious component in liquid water or vice versa. + * \brief Diffusion coefficient [m^2/s] for my fictitious component in liquid water or vice versa. */ template <class Scalar> static Scalar liquidDiffCoeff(Scalar temperature, Scalar pressure) diff --git a/exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh b/exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh index eeb4d82b73ff7343c642f40fc62d0482a146656f..2eb93134dc63c9c33c90afe1d9ec14267c772bcc 100644 --- a/exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh +++ b/exercises/solution/exercise-fluidsystem/components/mycompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-fluidsystem/components/myincompressiblecomponent.hh b/exercises/solution/exercise-fluidsystem/components/myincompressiblecomponent.hh index 6e544d2667ae9d7e7070e5a617eecf712b85c69b..dd279a1289a48f90f1ed81008de607fc96e3fc84 100644 --- a/exercises/solution/exercise-fluidsystem/components/myincompressiblecomponent.hh +++ b/exercises/solution/exercise-fluidsystem/components/myincompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh b/exercises/solution/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh index 4ff5595721564d460fcf466d04f618adf255de0f..fc75fd83f4830b9b68c7375f4f6640b2b5aa3f62 100644 --- a/exercises/solution/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh +++ b/exercises/solution/exercise-fluidsystem/fluidsystems/h2omycompressiblecomponent.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -137,7 +137,7 @@ public: * * We define an ideal mixture as a fluid phase where the fugacity * coefficients of all components times the pressure of the phase - * are indepent on the fluid composition. This assumtion is true + * are independent on the fluid composition. This assumption is true * if Henry's law and Raoult's law apply. If you are unsure what * this function should return, it is safe to return false. The * only damage done will be (slightly) increased computation times @@ -235,7 +235,7 @@ public: } else { - // assume the density of the fictious component to be independent of the composition + // assume the density of the fictitious component to be independent of the composition return MyCompressibleComponent::liquidDensity(T, p); } } @@ -270,7 +270,7 @@ public: } else { - // assume the molar density of the fictious component to be independent of the composition + // assume the molar density of the fictitious component to be independent of the composition return MyCompressibleComponent::liquidMolarDensity(T, p); } } diff --git a/exercises/solution/exercise-fluidsystem/main.cc b/exercises/solution/exercise-fluidsystem/main.cc index 4fc271921ad20a5c5fd54f02d8007db3241adf68..a9351abbffb2293c8af84fe395f9071d73d32a81 100644 --- a/exercises/solution/exercise-fluidsystem/main.cc +++ b/exercises/solution/exercise-fluidsystem/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,38 +23,28 @@ */ #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 "2pproperties.hh" -#include "2p2cproperties.hh" - +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/common/partial.hh> + +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> -#include <dumux/nonlinear/newtonsolver.hh> +#include "2pproperties.hh" +#include "2p2cproperties.hh" + +#include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> -//////////////////////// -// the main function -//////////////////////// int main(int argc, char** argv) { using namespace Dumux; @@ -66,12 +56,8 @@ int main(int argc, char** argv) // and recompile the executable using TypeTag = Properties::TTag::TYPETAG; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -111,7 +97,7 @@ int main(int argc, char** argv) const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -127,19 +113,16 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); - // the non-linear solver + // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; NewtonSolver nonLinearSolver(assembler, linearSolver); // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); @@ -161,17 +144,10 @@ int main(int argc, char** argv) } while (!timeLoop->finished()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// timeLoop->finalize(leafGridView.comm()); - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/solution/exercise-fluidsystem/spatialparams.hh b/exercises/solution/exercise-fluidsystem/spatialparams.hh index 5949547bd23578e79b9ddd80af1e60a8e5d6f160..954efd91f979b9a976dc8b5dd891a2266d7c7c4d 100644 --- a/exercises/solution/exercise-fluidsystem/spatialparams.hh +++ b/exercises/solution/exercise-fluidsystem/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -28,7 +28,7 @@ // include parent spatialparameters #include <dumux/porousmediumflow/fvspatialparamsmp.hh> -//inlclude fluid matrix interaction relationship +//include fluid matrix interaction relationship #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh> diff --git a/exercises/solution/exercise-fractures/fractureproblem.hh b/exercises/solution/exercise-fractures/fractureproblem.hh index ba3dbd70d70ffab0059307f3f0f8998d854a4a64..e3cb830fd57d644fb97ce20498b6765b3909667b 100644 --- a/exercises/solution/exercise-fractures/fractureproblem.hh +++ b/exercises/solution/exercise-fractures/fractureproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -62,11 +62,8 @@ class FractureSubProblem : public PorousMediumFlowProblem<TypeTag> // some indices for convenience using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum - { - pressureIdx = Indices::pressureIdx, - saturationIdx = Indices::saturationIdx - }; + static constexpr int pressureIdx = Indices::pressureIdx; + static constexpr int saturationIdx = Indices::saturationIdx; public: //! The constructor diff --git a/exercises/solution/exercise-fractures/fracturespatialparams.hh b/exercises/solution/exercise-fractures/fracturespatialparams.hh index 93c87d3edd21dd6e8797363d7cbe6f293194ee87..6c5969d4f4394abd0be52c723a3c2fffd638bcbc 100644 --- a/exercises/solution/exercise-fractures/fracturespatialparams.hh +++ b/exercises/solution/exercise-fractures/fracturespatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-fractures/main.cc b/exercises/solution/exercise-fractures/main.cc index c3e74540fe2127b9f71159ad2dd92bc082f79109..3abc40bd4724906b179fb3097dcb014121ecb9b5 100644 --- a/exercises/solution/exercise-fractures/main.cc +++ b/exercises/solution/exercise-fractures/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,19 +23,19 @@ #include <config.h> #include <iostream> -#include <dune/common/parallel/mpihelper.hh> - // include the properties header #include "properties.hh" +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> #include <dumux/common/timeloop.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> #include <dumux/multidomain/newtonsolver.hh> #include <dumux/multidomain/fvassembler.hh> #include <dumux/multidomain/traits.hh> @@ -57,8 +57,7 @@ using TheCouplingMapper = Dumux::FacetCouplingMapper<MatrixGridGeometry, Fractur using TheCouplingManager = Dumux::FacetCouplingManager<TheMultiDomainTraits, TheCouplingMapper>; // set the coupling manager property in the sub-problems -namespace Dumux { -namespace Properties { +namespace Dumux::Properties { template<class TypeTag> struct CouplingManager<TypeTag, TTag::MatrixProblem> { using type = TheCouplingManager; }; @@ -66,20 +65,15 @@ struct CouplingManager<TypeTag, TTag::MatrixProblem> { using type = TheCouplingM template<class TypeTag> struct CouplingManager<TypeTag, TTag::FractureProblem> { using type = TheCouplingManager; }; -} // end namespace Properties -} // end namespace Dumux +} // end namespace Dumux::Properties // main program int main(int argc, char** argv) { using namespace Dumux; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // initialize parameter tree Parameters::init(argc, argv); @@ -176,7 +170,7 @@ int main(int argc, char** argv) matrixGridVariables->init(x[matrixDomainId]); fractureGridVariables->init(x[fractureDomainId]); - // intialize the vtk output modules + // initialize the vtk output modules using MatrixVtkOutputModule = VtkOutputModule<MatrixGridVariables, GetPropType<MatrixTypeTag, Properties::SolutionVector>>; using FractureVtkOutputModule = VtkOutputModule<FractureGridVariables, GetPropType<FractureTypeTag, Properties::SolutionVector>>; MatrixVtkOutputModule matrixVtkWriter(*matrixGridVariables, x[matrixDomainId], matrixProblem->name()); @@ -221,7 +215,7 @@ int main(int argc, char** argv) timeLoop, xOld); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; + using LinearSolver = ILUBiCGSTABIstlSolver<SeqLinearSolverTraits, LinearAlgebraTraitsFromAssembler<Assembler>>; auto linearSolver = std::make_shared<LinearSolver>(); // the non-linear solver @@ -231,9 +225,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control newtonSolver->solve(x, *timeLoop); @@ -263,9 +254,7 @@ int main(int argc, char** argv) // report time loop statistics timeLoop->finalize(); - // print dumux message to say goodbye - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); + Parameters::print(); return 0; diff --git a/exercises/solution/exercise-fractures/matrixproblem.hh b/exercises/solution/exercise-fractures/matrixproblem.hh index a4c5eda86612bbf5e8da255079bd37e0b246fb30..430b3a5628408c10456934810eeada74b6bc2a5f 100644 --- a/exercises/solution/exercise-fractures/matrixproblem.hh +++ b/exercises/solution/exercise-fractures/matrixproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -66,11 +66,8 @@ class MatrixSubProblem : public PorousMediumFlowProblem<TypeTag> // some indices for convenience using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum - { - pressureIdx = Indices::pressureIdx, - saturationIdx = Indices::saturationIdx - }; + static constexpr int pressureIdx = Indices::pressureIdx; + static constexpr int saturationIdx = Indices::saturationIdx; public: //! The constructor diff --git a/exercises/solution/exercise-fractures/matrixspatialparams.hh b/exercises/solution/exercise-fractures/matrixspatialparams.hh index 49a689ee3eb8e0084562ea914b89ce0d48a39c70..f0358a60019bd181336678b5e38f5a22aa5b40c0 100644 --- a/exercises/solution/exercise-fractures/matrixspatialparams.hh +++ b/exercises/solution/exercise-fractures/matrixspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-fractures/properties.hh b/exercises/solution/exercise-fractures/properties.hh index d6b8164a083398883e1c62cdd01788dcf7502839..9a7b83e13ee5d03683289fbd6a3eb7a263a86f43 100644 --- a/exercises/solution/exercise-fractures/properties.hh +++ b/exercises/solution/exercise-fractures/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-grids/main.cc b/exercises/solution/exercise-grids/main.cc index 9d3e4d29bce3bcb3ef5690256ca47203e4667fd4..9e6cef9919a4d8ea3ede6580115a00322277b57e 100644 --- a/exercises/solution/exercise-grids/main.cc +++ b/exercises/solution/exercise-grids/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -22,28 +22,20 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/assembly/diffmethod.hh> -#include <dumux/discretization/method.hh> - #include <dumux/io/vtkoutputmodule.hh> #include <dumux/io/grid/gridmanager.hh> @@ -60,12 +52,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::Injection2pCC; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -108,7 +96,7 @@ int main(int argc, char** argv) const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -125,8 +113,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -136,10 +124,7 @@ int main(int argc, char** argv) timeLoop->start(); while (!timeLoop->finished()) { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - //set time in problem (is used in time-dependent Neumann boundary condition) + // set time in problem (is used in time-dependent Neumann boundary condition) problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); // solve the non-linear system with time step control @@ -164,16 +149,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/solution/exercise-grids/problem.hh b/exercises/solution/exercise-grids/problem.hh index 168ddc8ab0959959c1229e5800bba95f2b7d08c6..2eb4594e53d5af7285ffa0798daa8da4dcb9a789 100644 --- a/exercises/solution/exercise-grids/problem.hh +++ b/exercises/solution/exercise-grids/problem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -67,7 +67,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -93,10 +93,6 @@ public: injectionDuration_ = getParam<Scalar>("Problem.InjectionDuration"); } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Returns the problem name @@ -106,12 +102,6 @@ public: std::string name() const { return name_+"-2p"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -169,13 +159,6 @@ public: return values; } - // \} - - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -189,7 +172,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); diff --git a/exercises/solution/exercise-grids/properties.hh b/exercises/solution/exercise-grids/properties.hh index dc883b1763fcf0a9517d78879438acc4df64c106..fbc4efb077ba53dd42897fbd135cd7b2ce9bd4e5 100644 --- a/exercises/solution/exercise-grids/properties.hh +++ b/exercises/solution/exercise-grids/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-grids/spatialparams.hh b/exercises/solution/exercise-grids/spatialparams.hh index 0160b1a628d53c4a2deb28ea993229289f8b4cd8..45440d7f1d4425ed96c601494ed4a3a8d2a8d727 100644 --- a/exercises/solution/exercise-grids/spatialparams.hh +++ b/exercises/solution/exercise-grids/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-mainfile/1pproblem.hh b/exercises/solution/exercise-mainfile/1pproblem.hh index 4532e978a9bfe9ac4889d48176f892e1f7a85f11..c59565097b35efb053895b9a96f2747963c3650b 100644 --- a/exercises/solution/exercise-mainfile/1pproblem.hh +++ b/exercises/solution/exercise-mainfile/1pproblem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-mainfile/1pspatialparams.hh b/exercises/solution/exercise-mainfile/1pspatialparams.hh index 09d19d2a050df89e5d7f33b96572cde697a3d626..4d6746d16f62d3331e506255fb7a323ad1453540 100644 --- a/exercises/solution/exercise-mainfile/1pspatialparams.hh +++ b/exercises/solution/exercise-mainfile/1pspatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc b/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc index 687c8d75d6e2eb80daf561b0e0d8cb35792cc700..22d8495b519bb647aa03d5f5242578c77941c7fd 100644 --- a/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc +++ b/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -24,29 +24,24 @@ #include <config.h> #include "1pproblem.hh" +#include "properties.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/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/seqsolverbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> +#include <dumux/linear/linearsolvertraits.hh> #include <dumux/assembly/fvassembler.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> - -#include "properties.hh" +#include <dumux/io/grid/gridmanager_yasp.hh> int main(int argc, char** argv) { @@ -58,12 +53,8 @@ int main(int argc, char** argv) //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // initialize parameter tree Parameters::init(argc, argv); @@ -99,7 +90,7 @@ int main(int argc, char** argv) auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); - // intialize the vtk output module + // initialize the vtk output module VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables)); @@ -117,8 +108,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables); // the linear solver - using LinearSolver = ILU0BiCGSTABBackend; - auto linearSolver = std::make_shared<LinearSolver>(); + using LinearSolver = ILUBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the discretization matrices for stationary linear problems using JacobianMatrix = GetPropType<TypeTag, Properties::JacobianMatrix>; @@ -144,13 +135,8 @@ int main(int argc, char** argv) << comm.size() << " processes.\n" << "The cumulative CPU time was " << timer.elapsed()*comm.size() << " seconds.\n"; - //////////////////////////////////////////////////////////// - // print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/false); + if (leafGridView.comm().rank() == 0) + Parameters::print(); return 0; diff --git a/exercises/solution/exercise-mainfile/properties.hh b/exercises/solution/exercise-mainfile/properties.hh index eac29a3feb68fe4fc418731d66bf80208688c0db..e6f9e93cc7966dc5209c2934248c51dbf24692be 100644 --- a/exercises/solution/exercise-mainfile/properties.hh +++ b/exercises/solution/exercise-mainfile/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-properties/main.cc b/exercises/solution/exercise-properties/main.cc index ef218fe5cd826a96317404f07e6e372f8824afd3..d38362445a34253badd117f41f8f2bf5dbf3c04f 100644 --- a/exercises/solution/exercise-properties/main.cc +++ b/exercises/solution/exercise-properties/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -23,67 +23,26 @@ */ #include <config.h> -#include <ctime> -#include <iostream> +#include <config.h> -#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 <iostream> +#include <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> -#include <dumux/io/loadsolution.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> #include "properties.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) { using namespace Dumux; @@ -91,15 +50,11 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::TwoPIncompressibleTpfa; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file - Parameters::init(argc, argv, usage); + Parameters::init(argc, argv); // try to create a grid (from the given grid file or the input file) GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager; @@ -137,7 +92,7 @@ int main(int argc, char** argv) const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -154,8 +109,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -164,9 +119,6 @@ int main(int argc, char** argv) // time loop timeLoop->start(); do { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - // solve the non-linear system with time step control nonLinearSolver.solve(x, *timeLoop); @@ -193,16 +145,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/solution/exercise-properties/mylocalresidual.hh b/exercises/solution/exercise-properties/mylocalresidual.hh index 02a4b50cbad05279b5bbd0391fa12af92750985d..6c2f1fe980f2416c4ededcc572e5c1e384f4e303 100644 --- a/exercises/solution/exercise-properties/mylocalresidual.hh +++ b/exercises/solution/exercise-properties/mylocalresidual.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -102,7 +102,7 @@ public: * \param fvGeometry The finite volume geometry context * \param elemVolVars The volume variables for all flux stencil elements * \param scvf The sub control volume face to compute the flux on - * \param elemFluxVarsCache The cache related to flux compuation + * \param elemFluxVarsCache The cache related to flux computation */ NumEqVector computeFlux(const Problem& problem, const Element& element, diff --git a/exercises/solution/exercise-properties/problem.hh b/exercises/solution/exercise-properties/problem.hh index c00acd02b47ed1ed4038db7b3933e1c74f60411d..d210df125b7e812a7dbe0658144db50d4957669d 100644 --- a/exercises/solution/exercise-properties/problem.hh +++ b/exercises/solution/exercise-properties/problem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -49,13 +49,11 @@ class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - enum { - pressureH2OIdx = Indices::pressureIdx, - saturationDNAPLIdx = Indices::saturationIdx, - contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx, - waterPhaseIdx = FluidSystem::phase0Idx, - dnaplPhaseIdx = FluidSystem::phase1Idx - }; + static constexpr int pressureH2OIdx = Indices::pressureIdx; + static constexpr int saturationDNAPLIdx = Indices::saturationIdx; + static constexpr int contiDNAPLEqIdx = Indices::conti0EqIdx + FluidSystem::comp1Idx; + static constexpr int waterPhaseIdx = FluidSystem::phase0Idx; + static constexpr int dnaplPhaseIdx = FluidSystem::phase1Idx; public: TwoPTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) diff --git a/exercises/solution/exercise-properties/properties.hh b/exercises/solution/exercise-properties/properties.hh index f4ea3272001f183ad65c65de675fd5caf3ee69db..dcabcbf848f06767c42d8066582f0f422c9ddb98 100644 --- a/exercises/solution/exercise-properties/properties.hh +++ b/exercises/solution/exercise-properties/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-properties/spatialparams.hh b/exercises/solution/exercise-properties/spatialparams.hh index 045c4f9824f741da18b5c24713ab6f3640472c31..afa612d3101891c56e992048db2e1d0a79604eec 100644 --- a/exercises/solution/exercise-properties/spatialparams.hh +++ b/exercises/solution/exercise-properties/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-runtimeparams/main.cc b/exercises/solution/exercise-runtimeparams/main.cc index b80387709c3d76673cacd4eecf4f40c0397c65c2..25300dd316c4ee05889e45c3d1d646f637649e7f 100644 --- a/exercises/solution/exercise-runtimeparams/main.cc +++ b/exercises/solution/exercise-runtimeparams/main.cc @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -22,37 +22,25 @@ */ #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 <dumux/common/initialize.hh> #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> -#include <dumux/common/dumuxmessage.hh> -#include <dumux/common/defaultusagemessage.hh> -#include <dumux/linear/amgbackend.hh> +#include <dumux/linear/istlsolvers.hh> +#include <dumux/linear/linearalgebratraits.hh> #include <dumux/linear/linearsolvertraits.hh> #include <dumux/nonlinear/newtonsolver.hh> #include <dumux/assembly/fvassembler.hh> -#include <dumux/assembly/diffmethod.hh> - -#include <dumux/discretization/method.hh> #include <dumux/io/vtkoutputmodule.hh> -#include <dumux/io/grid/gridmanager.hh> +#include <dumux/io/grid/gridmanager_yasp.hh> // The properties file, where compile time definitions are made #include "properties.hh" -//////////////////////// -// the main function -//////////////////////// int main(int argc, char** argv) { using namespace Dumux; @@ -60,12 +48,8 @@ int main(int argc, char** argv) // define the type tag for this problem using TypeTag = Properties::TTag::Injection2pCC; - // 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); + // initialize MPI+x, finalize is done automatically on exit + Dumux::initialize(argc, argv); // parse command line arguments and input file Parameters::init(argc, argv); @@ -108,7 +92,7 @@ int main(int argc, char** argv) const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize"); auto dt = getParam<Scalar>("TimeLoop.DtInitial"); - // intialize the vtk output module + // initialize the vtk output module using IOFields = GetPropType<TypeTag, Properties::IOFields>; VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name()); using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>; @@ -125,8 +109,8 @@ int main(int argc, char** argv) auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>, LinearAlgebraTraitsFromAssembler<Assembler>>; + auto linearSolver = std::make_shared<LinearSolver>(gridGeometry->gridView(), gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; @@ -136,10 +120,7 @@ int main(int argc, char** argv) timeLoop->start(); while (!timeLoop->finished()) { - // set previous solution for storage evaluations - assembler->setPreviousSolution(xOld); - - //set time in problem (is used in time-dependent Neumann boundary condition) + // set time in problem (is used in time-dependent Neumann boundary condition) problem->setTime(timeLoop->time()+timeLoop->timeStepSize()); // solve the non-linear system with time step control @@ -164,16 +145,8 @@ int main(int argc, char** argv) timeLoop->finalize(leafGridView.comm()); - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { + if (leafGridView.comm().rank() == 0) Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } return 0; } // end main diff --git a/exercises/solution/exercise-runtimeparams/problem.hh b/exercises/solution/exercise-runtimeparams/problem.hh index f5454f6443627615645054679d728dab57fc6142..b413b6fd405e5f8c2d2ba5506c6932aa7b560ddc 100644 --- a/exercises/solution/exercise-runtimeparams/problem.hh +++ b/exercises/solution/exercise-runtimeparams/problem.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * @@ -67,7 +67,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; - enum { dimWorld = GridView::dimensionworld }; + static constexpr int dimWorld = GridView::dimensionworld; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -102,10 +102,6 @@ public: // std::cout << "Using the default parameter value." << std::endl; } - /*! - * \name Problem parameters - */ - // \{ /*! * \brief Returns the problem name @@ -115,12 +111,6 @@ public: std::string name() const { return name_+"-2p"; } - // \} - - /*! - * \name Boundary conditions - */ - // \{ /*! * \brief Specifies which kind of boundary condition should be @@ -179,12 +169,6 @@ public: return values; } - // \} - - /*! - * \name Volume terms - */ - // \{ /*! * \brief Evaluate the initial value for a control volume. @@ -198,7 +182,7 @@ public: // get the water density at atmospheric conditions const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); - // assume an intially hydrostatic liquid pressure profile + // assume an initially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative const Scalar pw = 1.0e5 - densityW*this->spatialParams().gravity(globalPos)[dimWorld-1]*(aquiferDepth_ - globalPos[dimWorld-1]); diff --git a/exercises/solution/exercise-runtimeparams/properties.hh b/exercises/solution/exercise-runtimeparams/properties.hh index 3f7a2ae43f565bc223d6dff83ef60e4499249496..7577bd654a7291857d5f6c716ec1e71b91927379 100644 --- a/exercises/solution/exercise-runtimeparams/properties.hh +++ b/exercises/solution/exercise-runtimeparams/properties.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * diff --git a/exercises/solution/exercise-runtimeparams/spatialparams.hh b/exercises/solution/exercise-runtimeparams/spatialparams.hh index ab72c284ec40ba0d924625c23a6707cb96a70f69..696c3ec58ec5a2ed0bdb0f18268286541d1453ca 100644 --- a/exercises/solution/exercise-runtimeparams/spatialparams.hh +++ b/exercises/solution/exercise-runtimeparams/spatialparams.hh @@ -5,7 +5,7 @@ * * * 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 * + * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, *