From f885c2d73f7364e5ff42ae3780df4b73e36c3339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Gl=C3=A4ser?= <dennis.glaeser@iws.uni-stuttgart.de> Date: Mon, 9 Jul 2018 20:40:52 +0200 Subject: [PATCH] [ex3-a] improve docu and indentations in problem --- exercises/exercise-fluidsystem/2pproblem.hh | 88 +++++++++------------ 1 file changed, 36 insertions(+), 52 deletions(-) diff --git a/exercises/exercise-fluidsystem/2pproblem.hh b/exercises/exercise-fluidsystem/2pproblem.hh index fd3e3767..9a9a4b5f 100644 --- a/exercises/exercise-fluidsystem/2pproblem.hh +++ b/exercises/exercise-fluidsystem/2pproblem.hh @@ -27,10 +27,10 @@ // The numerical model #include <dumux/porousmediumflow/2p/model.hh> -//The box discretization +// The box discretization #include <dumux/discretization/box/properties.hh> -//The grid managers +// The grid managers #if HAVE_DUNE_ALUGRID #include <dune/alugrid/grid.hh> #elif HAVE_UG @@ -39,7 +39,7 @@ #include <dune/grid/yaspgrid.hh> #endif -// The base porous media box problem +// The porous media base problem #include <dumux/porousmediumflow/problem.hh> // Spatially dependent parameters @@ -76,7 +76,7 @@ SET_TYPE_PROP(ExerciseThreeTwoPTypeTag, SpatialParams, ExerciseThreeSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), typename GET_PROP_TYPE(TypeTag, Scalar)>); -// Set grid and the grid creator to be used +// Set grid to be used #if HAVE_DUNE_ALUGRID SET_TYPE_PROP(ExerciseThreeTwoPTypeTag, Grid, Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>); #elif HAVE_UG @@ -107,7 +107,6 @@ public: /*! * \ingroup TwoPBoxModel - * * \brief Tutorial problem for a fully coupled twophase box model. */ template <class TypeTag> @@ -142,26 +141,23 @@ class ExerciseThreeProblemTwoP : public PorousMediumFlowProblem<TypeTag> public: ExerciseThreeProblemTwoP(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : ParentType(fvGridGeometry) - , eps_(3e-6) + , eps_(3e-6) { #if !(HAVE_DUNE_ALUGRID || HAVE_UG) - std::cout << "If you want to use simplices instead of cubes, install and use dune-ALUGrid or UGGrid." << std::endl; + std::cout << "If you want to use simplices instead of cubes, install and use dune-ALUGrid or UGGrid." << std::endl; #endif // !(HAVE_DUNE_ALUGRID || HAVE_UG) - // initialize the tables for the water properties - std::cout << "Initializing the tables for the water properties" << std::endl; - Components::TabulatedComponent<Components::H2O<Scalar>>::init(/*tempMin=*/273.15, - /*tempMax=*/623.15, - /*numTemp=*/100, - /*pMin=*/0.0, - /*pMax=*/20e6, - /*numP=*/200); - - // set the depth of the bottom of the reservoir - depthBOR_ = this->fvGridGeometry().bBoxMax()[dimWorld-1]; - - // name of the problem and output file - name_ = getParam<std::string>("Problem.Name"); + // initialize the tables for the water properties + std::cout << "Initializing the tables for the water properties" << std::endl; + Components::TabulatedComponent<Components::H2O<Scalar>>::init(/*tempMin=*/273.15, + /*tempMax=*/623.15, + /*numTemp=*/100, + /*pMin=*/0.0, + /*pMax=*/20e6, + /*numP=*/200); + + // set the depth of the bottom of the reservoir + depthBOR_ = this->fvGridGeometry().bBoxMax()[dimWorld-1]; } /*! @@ -169,15 +165,6 @@ public: */ // \{ - /*! - * \brief Returns the problem name - * - * This is used as a prefix for files generated by the simulation. - */ - const std::string name() const - { return name_; } - - /*! * \brief Returns the temperature \f$ K \f$ */ @@ -214,13 +201,10 @@ public: * * \param globalPos The global position */ - PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const + PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const { - PrimaryVariables priVars; - - priVars[waterPressureIdx] = 200.0e3 + 9.81*1000*(depthBOR_ - globalPos[dimWorld-1]); // 200 kPa = 2 bar - priVars[naplSaturationIdx] = 0.0; // 0 % oil saturation on left boundary - return priVars; + // use the initial values as Dirichlet values + return initialAtPos(globalPos); } /*! @@ -234,18 +218,21 @@ public: * For this method, the \a values parameter stores the mass flux * in normal direction of each phase. Negative values mean influx. */ - PrimaryVariables neumannAtPos(const GlobalPosition &globalPos) const + PrimaryVariables neumannAtPos(const GlobalPosition& globalPos) const { // initialize values to zero, i.e. no-flow Neumann boundary conditions PrimaryVariables values(0.0); Scalar up = this->fvGridGeometry().bBoxMax()[dimWorld-1]; - // extraction of oil on the right boundary for approx. 1.e6 seconds - if (globalPos[dimWorld-1] > up - eps_ && globalPos[0] > 20 && globalPos[0] < 40) { - // oil outflux of 30 g/(m * s) on the right boundary. + + // influx of oil (30 g/m/s) over a segment of the top boundary + if (globalPos[dimWorld-1] > up - eps_ && globalPos[0] > 20 && globalPos[0] < 40) + { values[contiWEqIdx] = 0; values[contiNEqIdx] = -3e-2; - } else { + } + else + { // no-flow on the remaining Neumann-boundaries. values[contiWEqIdx] = 0; values[contiNEqIdx] = 0; @@ -269,13 +256,14 @@ public: * For this method, the \a values parameter stores primary * variables. */ - PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const + PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const { PrimaryVariables values(0.0); - values[waterPressureIdx] = 200.0e3 + 9.81*1000*(depthBOR_ - globalPos[dimWorld-1]); // 200 kPa = 2 bar (pw) - values[naplSaturationIdx] = 0.0; // (sn) + // use hydrostatic pressure distribution with 2 bar at the top and zero saturation + values[waterPressureIdx] = 200.0e3 + 9.81*1000*(depthBOR_ - globalPos[dimWorld-1]); + values[naplSaturationIdx] = 0.0; return values; } @@ -288,20 +276,16 @@ public: * \f$ [ \textnormal{unit of primary variable} / (m^\textrm{dim} \cdot s )] \f$ * \param globalPos The global position */ - PrimaryVariables sourceAtPos(const GlobalPosition &globalPos) const + PrimaryVariables sourceAtPos(const GlobalPosition& globalPos) const { + // we define no source term here PrimaryVariables values(0.0); - return values; } private: - // small epsilon value - Scalar eps_; - std::string name_; //! Problem name - - // depth at the bottom of the reservoir - Scalar depthBOR_; + Scalar eps_; //! small epsilon value + Scalar depthBOR_; //! depth at the bottom of the reservoir }; } -- GitLab