28#ifndef EWOMS_GROUND_WATER_PROBLEM_HH 
   29#define EWOMS_GROUND_WATER_PROBLEM_HH 
   31#include <dune/common/fmatrix.hh> 
   32#include <dune/common/fvector.hh> 
   33#include <dune/common/version.hh> 
   35#include <dune/grid/yaspgrid.hh> 
   36#include <dune/grid/io/file/dgfparser/dgfyasp.hh> 
   38#include <opm/material/components/SimpleH2O.hpp> 
   39#include <opm/material/fluidstates/ImmiscibleFluidState.hpp> 
   40#include <opm/material/fluidsystems/LiquidPhase.hpp> 
   52template <
class TypeTag>
 
   53class GroundWaterProblem;
 
   62template<
class TypeTag>
 
   63struct Fluid<TypeTag, TTag::GroundWaterBaseProblem>
 
   69    using type = Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> >;
 
   73template<
class TypeTag>
 
   74struct Grid<TypeTag, TTag::GroundWaterBaseProblem> { 
using type = Dune::YaspGrid<2>; };
 
   77template<
class TypeTag>
 
   78struct Problem<TypeTag, TTag::GroundWaterBaseProblem>
 
   83template<
class TypeTag>
 
   86template<
class TypeTag>
 
   88{ 
using type = Opm::Linear::SolverWrapperConjugatedGradients<TypeTag>; };
 
  100template<
class Scalar>
 
  103template<
class Scalar>
 
  106template<
class Scalar>
 
  109template<
class Scalar>
 
  112template<
class Scalar>
 
  115template<
class Scalar>
 
  133template <
class TypeTag>
 
  145        numPhases = FluidSystem::numPhases,
 
  148        dim = GridView::dimension,
 
  149        dimWorld = GridView::dimensionworld,
 
  152        pressure0Idx = Indices::pressure0Idx
 
  162    using CoordScalar = 
typename GridView::ctype;
 
  163    using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
 
  165    using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
 
  172        : ParentType(simulator)
 
  180        ParentType::finishInit();
 
  184        lensLowerLeft_[0] = Parameters::Get<Parameters::LensLowerLeftX<Scalar>>();
 
  186            lensLowerLeft_[1] = Parameters::Get<Parameters::LensLowerLeftY<Scalar>>();
 
  188            lensLowerLeft_[2] = Parameters::Get<Parameters::LensLowerLeftY<Scalar>>();
 
  190        lensUpperRight_[0] = Parameters::Get<Parameters::LensUpperRightX<Scalar>>();
 
  192            lensUpperRight_[1] = Parameters::Get<Parameters::LensUpperRightY<Scalar>>();
 
  194            lensUpperRight_[2] = Parameters::Get<Parameters::LensUpperRightY<Scalar>>();
 
  205        ParentType::registerParameters();
 
  207        Parameters::Register<Parameters::LensLowerLeftX<Scalar>>
 
  208            (
"The x-coordinate of the lens' lower-left corner [m].");
 
  209        Parameters::Register<Parameters::LensUpperRightX<Scalar>>
 
  210            (
"The x-coordinate of the lens' upper-right corner [m].");
 
  213            Parameters::Register<Parameters::LensLowerLeftY<Scalar>>
 
  214                (
"The y-coordinate of the lens' lower-left corner [m].");
 
  215            Parameters::Register<Parameters::LensUpperRightY<Scalar>>
 
  216                (
"The y-coordinate of the lens' upper-right corner [m].");
 
  220            Parameters::Register<Parameters::LensLowerLeftZ<Scalar>>
 
  221                (
"The z-coordinate of the lens' lower-left corner [m].");
 
  222            Parameters::Register<Parameters::LensUpperRightZ<Scalar>>
 
  223                (
"The z-coordinate of the lens' upper-right corner [m].");
 
  226        Parameters::Register<Parameters::Permeability<Scalar>>
 
  227            (
"The intrinsic permeability [m^2] of the ambient material.");
 
  228        Parameters::Register<Parameters::PermeabilityLens<Scalar>>
 
  229            (
"The intrinsic permeability [m^2] of the lens.");
 
  231        Parameters::SetDefault<Parameters::GridFile>(
"./data/groundwater_2d.dgf");
 
  232        Parameters::SetDefault<Parameters::EndTime<Scalar>>(1.0);
 
  233        Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1.0);
 
  234        Parameters::SetDefault<Parameters::EnableGravity>(
true);
 
  247        std::ostringstream oss;
 
  248        oss << 
"groundwater_" << Model::name();
 
  258        this->model().checkConservativeness();
 
  262        this->model().globalStorage(storage);
 
  265        if (this->gridView().comm().rank() == 0) {
 
  266            std::cout << 
"Storage: " << storage << std::endl << std::flush;
 
  274    template <
class Context>
 
  278    { 
return 273.15 + 10; } 
 
  283    template <
class Context>
 
  292    template <
class Context>
 
  295                                           unsigned timeIdx)
 const 
  297        if (isInLens_(context.pos(spaceIdx, timeIdx)))
 
  298            return intrinsicPermLens_;
 
  300            return intrinsicPerm_;
 
  312    template <
class Context>
 
  313    void boundary(BoundaryRateVector& values, 
const Context& context,
 
  314                  unsigned spaceIdx, 
unsigned timeIdx)
 const 
  316        const GlobalPosition& globalPos = context.pos(spaceIdx, timeIdx);
 
  318        if (onLowerBoundary_(globalPos) || onUpperBoundary_(globalPos)) {
 
  320            Scalar T = 
temperature(context, spaceIdx, timeIdx);
 
  321            if (onLowerBoundary_(globalPos))
 
  326            Opm::ImmiscibleFluidState<Scalar, FluidSystem,
 
  328            fs.setSaturation(0, 1.0);
 
  329            fs.setPressure(0, pressure);
 
  330            fs.setTemperature(T);
 
  332            typename FluidSystem::template ParameterCache<Scalar> paramCache;
 
  333            paramCache.updateAll(fs);
 
  334            for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
 
  335                fs.setDensity(phaseIdx, FluidSystem::density(fs, paramCache, phaseIdx));
 
  336                fs.setViscosity(phaseIdx, FluidSystem::viscosity(fs, paramCache, phaseIdx));
 
  340            values.setFreeFlow(context, spaceIdx, timeIdx, fs);
 
  358    template <
class Context>
 
  365        values[pressure0Idx] = 1.0e+5; 
 
  371    template <
class Context>
 
  376    { rate = Scalar(0.0); }
 
  381    bool onLowerBoundary_(
const GlobalPosition& pos)
 const 
  382    { 
return pos[dim - 1] < eps_; }
 
  384    bool onUpperBoundary_(
const GlobalPosition& pos)
 const 
  385    { 
return pos[dim - 1] > this->boundingBoxMax()[dim - 1] - eps_; }
 
  387    bool isInLens_(
const GlobalPosition& pos)
 const 
  389        return lensLowerLeft_[0] <= pos[0] && pos[0] <= lensUpperRight_[0]
 
  390               && lensLowerLeft_[1] <= pos[1] && pos[1] <= lensUpperRight_[1];
 
  393    GlobalPosition lensLowerLeft_;
 
  394    GlobalPosition lensUpperRight_;
 
  396    DimMatrix intrinsicPerm_;
 
  397    DimMatrix intrinsicPermLens_;
 
Test for the immisicible VCVF discretization with only a single phase.
Definition: groundwaterproblem.hh:135
Scalar porosity(const Context &, unsigned, unsigned) const
Definition: groundwaterproblem.hh:284
void endTimeStep()
Called by the simulator after each time integration.
Definition: groundwaterproblem.hh:255
GroundWaterProblem(Simulator &simulator)
Definition: groundwaterproblem.hh:171
static void registerParameters()
Definition: groundwaterproblem.hh:203
std::string name() const
The problem name.
Definition: groundwaterproblem.hh:245
Scalar temperature(const Context &, unsigned, unsigned) const
Definition: groundwaterproblem.hh:275
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the boundary conditions for a boundary segment.
Definition: groundwaterproblem.hh:313
void source(RateVector &rate, const Context &, unsigned, unsigned) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: groundwaterproblem.hh:372
const DimMatrix & intrinsicPermeability(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: groundwaterproblem.hh:293
void finishInit()
Called by the Opm::Simulator in order to initialize the problem.
Definition: groundwaterproblem.hh:178
void initial(PrimaryVariables &values, const Context &, unsigned, unsigned) const
Evaluate the initial value for a control volume.
Definition: groundwaterproblem.hh:359
Defines the properties required for the immiscible multi-phase model.
Defines the common parameters for the porous medium multi-phase models.
Definition: blackoilnewtonmethodparams.hpp:31
auto Get(bool errorIfNotRegistered=true)
Retrieve a runtime parameter.
Definition: parametersystem.hpp:187
Definition: blackoilmodel.hh:80
Definition: blackoilbioeffectsmodules.hh:43
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:233
Definition: groundwaterproblem.hh:95
static constexpr Scalar value
Definition: groundwaterproblem.hh:95
Definition: groundwaterproblem.hh:98
static constexpr Scalar value
Definition: groundwaterproblem.hh:98
Definition: groundwaterproblem.hh:101
static constexpr Scalar value
Definition: groundwaterproblem.hh:101
Definition: groundwaterproblem.hh:104
static constexpr Scalar value
Definition: groundwaterproblem.hh:104
Definition: groundwaterproblem.hh:107
static constexpr Scalar value
Definition: groundwaterproblem.hh:107
Definition: groundwaterproblem.hh:110
static constexpr Scalar value
Definition: groundwaterproblem.hh:110
Definition: groundwaterproblem.hh:116
static constexpr Scalar value
Definition: groundwaterproblem.hh:116
Definition: groundwaterproblem.hh:113
static constexpr Scalar value
Definition: groundwaterproblem.hh:113
Opm::LiquidPhase< Scalar, Opm::SimpleH2O< Scalar > > type
Definition: groundwaterproblem.hh:69
The fluid used by the model.
Definition: immiscibleproperties.hh:49
Dune::YaspGrid< 2 > type
Definition: groundwaterproblem.hh:74
The type of the DUNE grid.
Definition: basicproperties.hh:100
Definition: fvbaseproperties.hh:53
Opm::Linear::SolverWrapperConjugatedGradients< TypeTag > type
Definition: groundwaterproblem.hh:88
Definition: linalgproperties.hh:57
The type of the problem.
Definition: fvbaseproperties.hh:81
Definition: groundwaterproblem.hh:59
Definition: parallelistlbackend.hh:40