diff --git a/examples/2pinfiltration/intro.md b/examples/2pinfiltration/intro.md new file mode 100644 index 0000000000000000000000000000000000000000..f682ee04bbd5cdb12d29a51240d30cb727e5527f --- /dev/null +++ b/examples/2pinfiltration/intro.md @@ -0,0 +1,45 @@ +This tutorial is similar to tests/porousmediumflow/2p/adaptive and restricted to the cell-centered finite volume TPFA discretization scheme. +You need [ALUGrid][0] in order to compile and run it. + +# Two-phase flow with infiltration and adaptive grid + +## Problem set-up +This example models a soil contamination problem where DNAPL infiltrates a porous medium. The initial distribution of DNAPL is known and can be read from a txt-file. + +The problem uses a two phase model of two immiscible fluids with the multiphase Darcy's law as the description of momentum, i.e.: + +$$ + v_\alpha = - \frac{k_{r\alpha}}{\mu_\alpha} \textbf{K} + \left(\textbf{grad}\, p_\alpha - \varrho_{\alpha} {\textbf g} \right) +$$ + +Inserting this into the conservation equations for each phase $$\alpha$$ leads to: + +$$\phi \frac{\partial \varrho_\alpha S_\alpha}{\partial t} + -\textbf{div} \left\{ \varrho_\alpha \frac{k_{r\alpha}}{\mu_\alpha} \mathbf{K} \left(\textbf{grad}\, p_\alpha - \varrho_{\alpha} \mbox{\bf g} \right) + \right\} - q_\alpha = 0$$ + +As closure relations for this equations a $$pc - S_w $$ as well as a $$k_r - S_w$$ - relationship are used. This problem uses a Van-Genuchten parameterization for that. The parameters are specified in the `spatialparams.hh` file. + +With the constraint that $$S_w + S_n = 1$$ the number of primary variables reduces to two. +This problem uses the wetting phase pressure $$p0$$ and the saturation of the non-wetting phase $$S_1$$ as primary variables. It is also possible to switch that formulation to the non-wetting pressure and the wetting saturation. + +The two-dimensional model domain is 6m x 4m and contains a lens with a lower permeability and porosity. The initial values for the DNAPL saturation and the water pressure are read from a file. +The lens and the initial saturation can be seen in Figures 1 and 2. + + + + + +A linear pressure gradient is given as a Dirichlet boundary condition at the left and the right boundary. +Neumann boundary conditions are set at the upper and lower boundary. +DNAPL enters the model domain at the upper boundary between 1.75m ≤ x ≤ 2m with a rate of 0.04 kg/ms, the rest of the upper and lower boundary are no-flow boundaries. +In addition, the DNAPL is injected at a point source at x = 0.502 and y = 3.02 with a rate of 0.1 kg/s. + +## Discretization +The equations are discretized with a cell-centered finete volume TPFA scheme in space and an implicit Euler scheme in time. Newton's method is used to solve the system of nonlinear equations. For more information about the discretization please have a look at the handbook. + +## Adaptive grid +The grid is adapitvely refined around the injection. The adaptive behaviour can be changed with input parameters in the `params.input` file. + +[0]: https://gitlab.dune-project.org/extensions/dune-alugrid diff --git a/examples/2pinfiltration/main.cc b/examples/2pinfiltration/main.cc index ef5e0db1091117b0f4e1a147c9c56cb89dfd730b..1fbcf30419f95fe087ec7278bb863cb463df32fd 100644 --- a/examples/2pinfiltration/main.cc +++ b/examples/2pinfiltration/main.cc @@ -55,7 +55,6 @@ #include <dumux/porousmediumflow/2p/griddatatransfer.hh> #include <dumux/porousmediumflow/2p/gridadaptindicator.hh> -#include <test/porousmediumflow/2p/implicit/incompressible/problem.hh> #include "problem.hh" int main(int argc, char** argv) try diff --git a/examples/2pinfiltration/params.input b/examples/2pinfiltration/params.input index a650f89187e66c1618c6670a2079aa1e037920b4..1da8c1707326528c2eb289697fe990f945a05a22 100644 --- a/examples/2pinfiltration/params.input +++ b/examples/2pinfiltration/params.input @@ -1,6 +1,6 @@ [TimeLoop] DtInitial = 100 # [s] -TEnd = 100 # [s] +TEnd = 500 # [s] [Grid] UpperRight = 6 4 diff --git a/examples/2pinfiltration/problem.hh b/examples/2pinfiltration/problem.hh index 7ad2b69bee1a05c10bb34310e74034af01be0eaa..3a760790704aec9b96eee820baa13f76d22f9fee 100644 --- a/examples/2pinfiltration/problem.hh +++ b/examples/2pinfiltration/problem.hh @@ -188,7 +188,7 @@ public: Scalar factor = (width*alpha + (1.0 - alpha)*globalPos[0])/width; // hydrostatic pressure scaled by alpha - values[pressureH2OIdx] = 1e5 - factor*densityW*this->gravity()[1]*depth; + values[pressureH2OIdx] = 1e5 - factor*densityW*this->spatialParams().gravity(globalPos)[1]*depth; values[saturationDNAPLIdx] = 0.0; return values; diff --git a/examples/2pinfiltration/results.md b/examples/2pinfiltration/results.md new file mode 100644 index 0000000000000000000000000000000000000000..9b4dcfeecb0590f8357ecbe55f1904973ab9bbdf --- /dev/null +++ b/examples/2pinfiltration/results.md @@ -0,0 +1,3 @@ +## Results + + diff --git a/examples/2pinfiltration/spatialparams.hh b/examples/2pinfiltration/spatialparams.hh index 0e56dbd50553bb645c5b889f1e8fe5409556a07b..b808236d6c0d5eeeb18e8b232a30d02cf5cfe722 100644 --- a/examples/2pinfiltration/spatialparams.hh +++ b/examples/2pinfiltration/spatialparams.hh @@ -18,23 +18,21 @@ *****************************************************************************/ /*! * \ingroup TwoPTests - * \brief The spatial params for the incompressible 2p test. + * \brief The spatial params for the incompressible 2p point source example. */ -#ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH -#define DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH +#ifndef DUMUX_TWOP_INCOMPRESSIBLE_EXAMPLE_SPATIAL_PARAMS_HH +#define DUMUX_TWOP_INCOMPRESSIBLE_EXAMPLE_SPATIAL_PARAMS_HH #include <dumux/material/spatialparams/fv.hh> #include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh> #include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh> -#include <dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh> - namespace Dumux { /*! * \ingroup TwoPTests - * \brief The spatial params for the incompressible 2p test. + * \brief The spatial params for the incompressible 2p point source example. */ template<class FVGridGeometry, class Scalar> class TwoPTestSpatialParams @@ -60,8 +58,6 @@ public: TwoPTestSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : ParentType(fvGridGeometry) { - lensIsOilWet_ = getParam<bool>("SpatialParams.LensIsOilWet", false); - lensLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensLowerLeft"); lensUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensUpperRight"); @@ -96,9 +92,7 @@ public: const SubControlVolume& scv, const ElementSolution& elemSol) const { - - // do not use a less permeable lens in the test with inverted wettability - if (isInLens_(element.geometry().center()) && !lensIsOilWet_) + if (isInLens_(element.geometry().center())) return lensK_; return outerK_; } @@ -109,7 +103,11 @@ public: * \param globalPos The global position */ Scalar porosityAtPos(const GlobalPosition& globalPos) const - { return 0.4; } + { + if (isInLens_(globalPos)) + return 0.2; + return 0.4; + } /*! * \brief Returns the parameter object for the Brooks-Corey material law. @@ -127,7 +125,7 @@ public: const ElementSolution& elemSol) const { // do not use different parameters in the test with inverted wettability - if (isInLens_(element.geometry().center()) && !lensIsOilWet_) + if (isInLens_(element.geometry().center())) return lensMaterialParams_; return outerMaterialParams_; } @@ -140,26 +138,7 @@ public: */ template<class FluidSystem> int wettingPhaseAtPos(const GlobalPosition& globalPos) const - { - if (isInLens_(globalPos) && lensIsOilWet_) - return FluidSystem::phase1Idx; - return FluidSystem::phase0Idx; - } - - //! Updates the map of which material parameters are associated with a nodal dof. - template<class SolutionVector> - void updateMaterialInterfaceParams(const SolutionVector& x) - { - if (FVGridGeometry::discMethod == DiscretizationMethod::box) - materialInterfaceParams_.update(this->fvGridGeometry(), *this, x); - } - - //! Returns the material parameters associated with a nodal dof - const BoxMaterialInterfaceParams<ThisType>& materialInterfaceParams() const - { return materialInterfaceParams_; } - - //! Returns whether or not the lens is oil wet - bool lensIsOilWet() const { return lensIsOilWet_; } + { return FluidSystem::phase0Idx; } private: bool isInLens_(const GlobalPosition &globalPos) const @@ -171,7 +150,6 @@ private: return true; } - bool lensIsOilWet_; GlobalPosition lensLowerLeft_; GlobalPosition lensUpperRight_; @@ -180,9 +158,6 @@ private: MaterialLawParams lensMaterialParams_; MaterialLawParams outerMaterialParams_; - // Determines the parameters associated with the dofs at material interfaces - BoxMaterialInterfaceParams<ThisType> materialInterfaceParams_; - static constexpr Scalar eps_ = 1.5e-7; }; diff --git a/examples/2pinfiltration/test_2p_pointsource_adaptive.png b/examples/2pinfiltration/test_2p_pointsource_adaptive.png index 6ca28d25c8bb3af5cfa5e04d044516506a9b638c..0ba6b997ffc938a7b318615cf1dfc06718af6da6 100644 Binary files a/examples/2pinfiltration/test_2p_pointsource_adaptive.png and b/examples/2pinfiltration/test_2p_pointsource_adaptive.png differ diff --git a/examples/2pinfiltration/test_2p_pointsource_initial.png b/examples/2pinfiltration/test_2p_pointsource_initial.png new file mode 100644 index 0000000000000000000000000000000000000000..e9bb688c32dc26ef851a5887aa390c50c971971c Binary files /dev/null and b/examples/2pinfiltration/test_2p_pointsource_initial.png differ diff --git a/examples/2pinfiltration/test_2p_pointsource_lens.png b/examples/2pinfiltration/test_2p_pointsource_lens.png new file mode 100644 index 0000000000000000000000000000000000000000..679b652d174c9bc7de691c247d3bba8902d18ff1 Binary files /dev/null and b/examples/2pinfiltration/test_2p_pointsource_lens.png differ