// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: /***************************************************************************** * See the file COPYING for full copying permissions. * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! * \ingroup TwoPTests * \brief The spatial params for the incompressible 2p test */ #ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH #define DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH #include <dumux/material/spatialparams/fv.hh> #include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh> #include <dumux/material/fluidmatrixinteractions/2p/efftoabslaw.hh> namespace Dumux { /*! * \ingroup TwoPTests * \brief The spatial params for the incompressible 2p test */ template<class FVGridGeometry, class Scalar> class TwoPTestSpatialParams : public FVSpatialParams<FVGridGeometry, Scalar, TwoPTestSpatialParams<FVGridGeometry, Scalar>> { using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using ThisType = TwoPTestSpatialParams<FVGridGeometry, Scalar>; using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using EffectiveLaw = RegularizedVanGenuchten<Scalar>; public: using MaterialLaw = EffToAbsLaw<EffectiveLaw>; using MaterialLawParams = typename MaterialLaw::Params; using PermeabilityType = Scalar; TwoPTestSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) : ParentType(fvGridGeometry) { lensLowerLeft_ = getParam<GlobalPosition>("SpatialParams.LensLowerLeft"); lensUpperRight_ = getParam<GlobalPosition>("SpatialParams.LensUpperRight"); // residual saturations lensMaterialParams_.setSwr(0.18); lensMaterialParams_.setSnr(0.0); outerMaterialParams_.setSwr(0.05); outerMaterialParams_.setSnr(0.0); // parameters for the Van Genuchten law // alpha and n lensMaterialParams_.setVgAlpha(0.00045); lensMaterialParams_.setVgn(7.3); outerMaterialParams_.setVgAlpha(0.0037); outerMaterialParams_.setVgn(4.7); lensK_ = 9.05e-12; outerK_ = 4.6e-10; } /*! * \brief Function for defining the (intrinsic) permeability \f$[m^2]\f$. * In this test, we use element-wise distributed permeabilities. * * \param element The current element * \param scv The sub-control volume inside the element. * \param elemSol The solution at the dofs connected to the element. * \return permeability */ template<class ElementSolution> PermeabilityType permeability(const Element& element, const SubControlVolume& scv, const ElementSolution& elemSol) const { if (isInLens_(element.geometry().center())) return lensK_; return outerK_; } /*! * \brief Returns the porosity \f$[-]\f$ * * \param globalPos The global position */ Scalar porosityAtPos(const GlobalPosition& globalPos) const { return 0.4; } /*! * \brief Returns the parameter object for the Brooks-Corey material law. * In this test, we use element-wise distributed material parameters. * * \param element The current element * \param scv The sub-control volume inside the element. * \param elemSol The solution at the dofs connected to the element. * \return the material parameters object */ template<class ElementSolution> const MaterialLawParams& materialLawParams(const Element& element, const SubControlVolume& scv, const ElementSolution& elemSol) const { if (isInLens_(element.geometry().center())) return lensMaterialParams_; return outerMaterialParams_; } /*! * \brief Function for defining which phase is to be considered as the wetting phase. * * \return the wetting phase index * \param globalPos The global position */ template<class FluidSystem> int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::phase0Idx; } private: bool isInLens_(const GlobalPosition &globalPos) const { for (int i = 0; i < dimWorld; ++i) { if (globalPos[i] < lensLowerLeft_[i] + eps_ || globalPos[i] > lensUpperRight_[i] - eps_) return false; } return true; } GlobalPosition lensLowerLeft_; GlobalPosition lensUpperRight_; Scalar lensK_; Scalar outerK_; MaterialLawParams lensMaterialParams_; MaterialLawParams outerMaterialParams_; static constexpr Scalar eps_ = 1.5e-7; }; } // end namespace Dumux #endif