diff --git a/tutorial/ex1/exercise1_2p.cc b/tutorial/ex1/exercise1_2p.cc index b7655dac87ecae2ece2ff2d22b752f3949480d42..9cba2e73b24ccfb432e32ef27b140bd7be5f401c 100644 --- a/tutorial/ex1/exercise1_2p.cc +++ b/tutorial/ex1/exercise1_2p.cc @@ -46,6 +46,7 @@ #include <dumux/io/vtkoutputmodule.hh> +// The problem file, where setup-specific boundary and initial conditions are defined. #include "injection2pproblem.hh" //////////////////////// @@ -101,6 +102,8 @@ int main(int argc, char** argv) try gridVariables->init(x, xOld); // get some time loop parameters + // getParam<TYPE>("GROUPNAME.PARAMNAME") reads and sets parameter PARAMNAME + // of type TYPE given in the group GROUPNAME from the input file using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); const auto maxDivisions = getParam<int>("TimeLoop.MaxTimeStepDivisions"); diff --git a/tutorial/ex1/exercise1_2p2c.cc b/tutorial/ex1/exercise1_2p2c.cc index 313486242dd1ff4880cd67647268cbf6b1c9b410..a0b5ebb0355f62ab47f1197d96e56c3605845448 100644 --- a/tutorial/ex1/exercise1_2p2c.cc +++ b/tutorial/ex1/exercise1_2p2c.cc @@ -46,6 +46,7 @@ #include <dumux/io/vtkoutputmodule.hh> +// The problem file, where setup-specific boundary and initial conditions are defined. #include "injection2p2cproblem.hh" //////////////////////// @@ -101,6 +102,8 @@ int main(int argc, char** argv) try gridVariables->init(x, xOld); // get some time loop parameters + // getParam<TYPE>("GROUPNAME.PARAMNAME") reads and sets parameter PARAMNAME + // of type TYPE given in the group GROUPNAME from the input file using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); const auto tEnd = getParam<Scalar>("TimeLoop.TEnd"); const auto maxDivisions = getParam<int>("TimeLoop.MaxTimeStepDivisions"); diff --git a/tutorial/ex1/injection2p2cproblem.hh b/tutorial/ex1/injection2p2cproblem.hh index 80f43f81c6d7a060957684fc1e1628e720834191..c0abe7fff8a5a80ab6129ca2b6e394d10fbd108b 100644 --- a/tutorial/ex1/injection2p2cproblem.hh +++ b/tutorial/ex1/injection2p2cproblem.hh @@ -105,6 +105,8 @@ public: /*numP=*/300); // name of the problem and output file + // getParam<TYPE>("GROUPNAME.PARAMNAME") reads and sets parameter PARAMNAME + // of type TYPE given in the group GROUPNAME from the input file name_ = getParam<std::string>("Problem.Name"); // depth of the aquifer, units: m aquiferDepth_ = getParam<Scalar>("Problem.AquiferDepth"); diff --git a/tutorial/ex1/injection2pniproblem.hh b/tutorial/ex1/injection2pniproblem.hh index b85587c0c25c72a3958405f84e4dd9f6e57eaeda..6e55b7b56f79b7cc159f59f702d99366ef054cd9 100644 --- a/tutorial/ex1/injection2pniproblem.hh +++ b/tutorial/ex1/injection2pniproblem.hh @@ -107,6 +107,8 @@ public: /*numP=*/300); // name of the problem and output file + // getParam<TYPE>("GROUPNAME.PARAMNAME") reads and sets parameter PARAMNAME + // of type TYPE given in the group GROUPNAME from the input file name_ = getParam<std::string>("Problem.Name"); // depth of the aquifer, units: m aquiferDepth_ = getParam<Scalar>("Problem.AquiferDepth"); @@ -234,7 +236,7 @@ public: * set a temperature gradient of 0.03 K per m beginning at 283 K here. * Hint: you can use aquiferDepth_ and the globalPos similar to the pressure gradient * use globalPos[0] and globalPos[1] to implement the high temperature lens with 380 K - * Hint : use Indices::temperatureIdx + * Hint : use Indices::temperatureIdx to address the initial values for temperature */ return values; } diff --git a/tutorial/ex1/injection2pproblem.hh b/tutorial/ex1/injection2pproblem.hh index e35c94d8596b33438c30d1231f931392cac12a24..999cc87e56e843adf2370dadf8bd7dd3ae5bf79c 100644 --- a/tutorial/ex1/injection2pproblem.hh +++ b/tutorial/ex1/injection2pproblem.hh @@ -40,6 +40,7 @@ class InjectionProblem2P; namespace Properties { +// define the TypeTag for this problem with a cell-centered two-point flux approximation spatial discretization. NEW_TYPE_TAG(Injection2pTypeTag, INHERITS_FROM(TwoP, InjectionSpatialParamsTypeTag)); NEW_TYPE_TAG(Injection2pCCTypeTag, INHERITS_FROM(CCTpfaModel, Injection2pTypeTag)); @@ -103,6 +104,8 @@ public: /*numP=*/300); // name of the problem and output file + // getParam<TYPE>("GROUPNAME.PARAMNAME") reads and sets parameter PARAMNAME + // of type TYPE given in the group GROUPNAME from the input file name_ = getParam<std::string>("Problem.Name"); // depth of the aquifer, units: m aquiferDepth_ = getParam<Scalar>("Problem.AquiferDepth"); @@ -147,9 +150,11 @@ public: */ BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const { - BoundaryTypes bcTypes; + BoundaryTypes bcTypes; + // set the left of the domain (with the global position in "0 = x" direction as a Dirichlet boundary if (globalPos[0] < eps_) bcTypes.setAllDirichlet(); + // set all other as Neumann boundaries else bcTypes.setAllNeumann(); @@ -184,6 +189,8 @@ public: PrimaryVariables values(0.0); // if we are inside the injection zone set inflow Neumann boundary conditions + // using < boundary + eps_ or > boundary - eps_ is safer for floating point comparisons + // than using <= or >= as it is robust with regard to imprecision introduced by rounding errors. if (time_ < injectionDuration_ && globalPos[1] < 15 + eps_ && globalPos[1] > 7 - eps_ && globalPos[0] > 0.9*this->fvGridGeometry().bBoxMax()[0]) { diff --git a/tutorial/ex1/injection2pspatialparams.hh b/tutorial/ex1/injection2pspatialparams.hh index 30de88989388cc0782e955a5676702b4c80fc96a..8449b258539d80b5506ff5295ffd88ef1115d27b 100644 --- a/tutorial/ex1/injection2pspatialparams.hh +++ b/tutorial/ex1/injection2pspatialparams.hh @@ -70,6 +70,7 @@ class InjectionSpatialParams : public FVSpatialParams<TypeTag> using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + // get the dimensions of the simulation domain from GridView static const int dimWorld = GridView::dimensionworld; using GlobalPosition = Dune::FieldVector<Scalar, dimWorld>; @@ -118,8 +119,8 @@ public: * \param globalPos The global position */ PermeabilityType permeabilityAtPos(const GlobalPosition& globalPos) const - { + // here, either aquitard or aquifer permeability are returned, depending on the global position if (isInAquitard_(globalPos)) return aquitardK_; return aquiferK_; @@ -132,6 +133,7 @@ public: */ Scalar porosityAtPos(const GlobalPosition& globalPos) const { + // here, either aquitard or aquifer porosity are returned, depending on the global position if (isInAquitard_(globalPos)) return aquitardPorosity_; return aquiferPorosity_; @@ -193,8 +195,12 @@ private: static constexpr Scalar eps_ = 1e-6; + // provides a convenient way distinguishing whether a given location is inside the aquitard bool isInAquitard_(const GlobalPosition &globalPos) const - { return globalPos[dimWorld-1] > aquiferHeightFromBottom_ + eps_; } + { + // globalPos[dimWorld-1] is the y direction for 2D grids or the z direction for 3D grids + return globalPos[dimWorld-1] > aquiferHeightFromBottom_ + eps_; + } Scalar aquitardK_; Scalar aquiferK_;