28 #ifndef EWOMS_GROUND_WATER_PROBLEM_HH
29 #define EWOMS_GROUND_WATER_PROBLEM_HH
31 #include <opm/models/immiscible/immiscibleproperties.hh>
32 #include <opm/simulators/linalg/parallelistlbackend.hh>
34 #include <opm/material/components/SimpleH2O.hpp>
35 #include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
36 #include <opm/material/fluidsystems/LiquidPhase.hpp>
38 #include <dune/grid/yaspgrid.hh>
39 #include <dune/grid/io/file/dgfparser/dgfyasp.hh>
41 #include <dune/common/version.hh>
42 #include <dune/common/fmatrix.hh>
43 #include <dune/common/fvector.hh>
49 template <
class TypeTag>
50 class GroundWaterProblem;
53 namespace Opm::Properties {
59 template<
class TypeTag,
class MyTypeTag>
61 template<
class TypeTag,
class MyTypeTag>
63 template<
class TypeTag,
class MyTypeTag>
65 template<
class TypeTag,
class MyTypeTag>
67 template<
class TypeTag,
class MyTypeTag>
69 template<
class TypeTag,
class MyTypeTag>
71 template<
class TypeTag,
class MyTypeTag>
73 template<
class TypeTag,
class MyTypeTag>
76 template<
class TypeTag>
77 struct Fluid<TypeTag, TTag::GroundWaterBaseProblem>
80 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
83 using type = Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> >;
87 template<
class TypeTag>
88 struct Grid<TypeTag, TTag::GroundWaterBaseProblem> {
using type = Dune::YaspGrid<2>; };
91 template<
class TypeTag>
92 struct Problem<TypeTag, TTag::GroundWaterBaseProblem>
95 template<
class TypeTag>
98 using type = GetPropType<TypeTag, Scalar>;
99 static constexpr type value = 0.25;
101 template<
class TypeTag>
104 using type = GetPropType<TypeTag, Scalar>;
105 static constexpr type value = 0.25;
107 template<
class TypeTag>
110 using type = GetPropType<TypeTag, Scalar>;
111 static constexpr type value = 0.25;
113 template<
class TypeTag>
116 using type = GetPropType<TypeTag, Scalar>;
117 static constexpr type value = 0.75;
119 template<
class TypeTag>
122 using type = GetPropType<TypeTag, Scalar>;
123 static constexpr type value = 0.75;
125 template<
class TypeTag>
128 using type = GetPropType<TypeTag, Scalar>;
129 static constexpr type value = 0.75;
131 template<
class TypeTag>
134 using type = GetPropType<TypeTag, Scalar>;
135 static constexpr type value = 1e-10;
137 template<
class TypeTag>
140 using type = GetPropType<TypeTag, Scalar>;
141 static constexpr type value = 1e-12;
145 template<
class TypeTag>
146 struct EnableGravity<TypeTag, TTag::GroundWaterBaseProblem> {
static constexpr
bool value =
true; };
149 template<
class TypeTag>
150 struct EndTime<TypeTag, TTag::GroundWaterBaseProblem>
152 using type = GetPropType<TypeTag, Scalar>;
153 static constexpr type value = 1;
157 template<
class TypeTag>
158 struct InitialTimeStepSize<TypeTag, TTag::GroundWaterBaseProblem>
160 using type = GetPropType<TypeTag, Scalar>;
161 static constexpr type value = 1;
165 template<
class TypeTag>
166 struct GridFile<TypeTag, TTag::GroundWaterBaseProblem> {
static constexpr
auto value =
"./data/groundwater_2d.dgf"; };
170 template<
class TypeTag>
171 struct LinearSolverSplice<TypeTag, TTag::GroundWaterBaseProblem> {
using type = TTag::ParallelIstlLinearSolver; };
173 template<
class TypeTag>
174 struct LinearSolverWrapper<TypeTag, TTag::GroundWaterBaseProblem>
175 {
using type = Opm::Linear::SolverWrapperConjugatedGradients<TypeTag>; };
192 template <
class TypeTag>
195 using ParentType = GetPropType<TypeTag, Properties::BaseProblem>;
197 using GridView = GetPropType<TypeTag, Properties::GridView>;
198 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
199 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
202 using Indices = GetPropType<TypeTag, Properties::Indices>;
204 numPhases = FluidSystem::numPhases,
207 dim = GridView::dimension,
208 dimWorld = GridView::dimensionworld,
211 pressure0Idx = Indices::pressure0Idx
214 using Simulator = GetPropType<TypeTag, Properties::Simulator>;
215 using EqVector = GetPropType<TypeTag, Properties::EqVector>;
216 using RateVector = GetPropType<TypeTag, Properties::RateVector>;
217 using BoundaryRateVector = GetPropType<TypeTag, Properties::BoundaryRateVector>;
218 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
219 using Model = GetPropType<TypeTag, Properties::Model>;
221 using CoordScalar =
typename GridView::ctype;
222 using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
224 using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
231 : ParentType(simulator)
239 ParentType::finishInit();
243 lensLowerLeft_[0] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftX);
245 lensLowerLeft_[1] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftY);
247 lensLowerLeft_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftY);
249 lensUpperRight_[0] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightX);
251 lensUpperRight_[1] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY);
253 lensUpperRight_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY);
255 intrinsicPerm_ = this->toDimMatrix_(EWOMS_GET_PARAM(TypeTag, Scalar, Permeability));
256 intrinsicPermLens_ = this->toDimMatrix_(EWOMS_GET_PARAM(TypeTag, Scalar, PermeabilityLens));
264 ParentType::registerParameters();
266 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftX,
267 "The x-coordinate of the lens' lower-left corner "
269 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightX,
270 "The x-coordinate of the lens' upper-right corner "
274 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftY,
275 "The y-coordinate of the lens' lower-left "
277 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightY,
278 "The y-coordinate of the lens' upper-right "
283 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftZ,
284 "The z-coordinate of the lens' lower-left "
286 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightZ,
287 "The z-coordinate of the lens' upper-right "
291 EWOMS_REGISTER_PARAM(TypeTag, Scalar, Permeability,
292 "The intrinsic permeability [m^2] of the ambient "
294 EWOMS_REGISTER_PARAM(TypeTag, Scalar, PermeabilityLens,
295 "The intrinsic permeability [m^2] of the lens.");
308 std::ostringstream oss;
309 oss <<
"groundwater_" << Model::name();
319 this->model().checkConservativeness();
323 this->model().globalStorage(storage);
326 if (this->gridView().comm().rank() == 0) {
327 std::cout <<
"Storage: " << storage << std::endl << std::flush;
335 template <
class Context>
339 {
return 273.15 + 10; }
344 template <
class Context>
353 template <
class Context>
356 unsigned timeIdx)
const
358 if (isInLens_(context.pos(spaceIdx, timeIdx)))
359 return intrinsicPermLens_;
361 return intrinsicPerm_;
373 template <
class Context>
374 void boundary(BoundaryRateVector& values,
const Context& context,
375 unsigned spaceIdx,
unsigned timeIdx)
const
377 const GlobalPosition& globalPos = context.pos(spaceIdx, timeIdx);
379 if (onLowerBoundary_(globalPos) || onUpperBoundary_(globalPos)) {
381 Scalar T =
temperature(context, spaceIdx, timeIdx);
382 if (onLowerBoundary_(globalPos))
387 Opm::ImmiscibleFluidState<Scalar, FluidSystem,
389 fs.setSaturation(0, 1.0);
390 fs.setPressure(0, pressure);
391 fs.setTemperature(T);
393 typename FluidSystem::template ParameterCache<Scalar> paramCache;
394 paramCache.updateAll(fs);
395 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
396 fs.setDensity(phaseIdx, FluidSystem::density(fs, paramCache, phaseIdx));
397 fs.setViscosity(phaseIdx, FluidSystem::viscosity(fs, paramCache, phaseIdx));
401 values.setFreeFlow(context, spaceIdx, timeIdx, fs);
419 template <
class Context>
426 values[pressure0Idx] = 1.0e+5;
432 template <
class Context>
437 { rate = Scalar(0.0); }
442 bool onLowerBoundary_(
const GlobalPosition& pos)
const
443 {
return pos[dim - 1] < eps_; }
445 bool onUpperBoundary_(
const GlobalPosition& pos)
const
446 {
return pos[dim - 1] > this->boundingBoxMax()[dim - 1] - eps_; }
448 bool isInLens_(
const GlobalPosition& pos)
const
450 return lensLowerLeft_[0] <= pos[0] && pos[0] <= lensUpperRight_[0]
451 && lensLowerLeft_[1] <= pos[1] && pos[1] <= lensUpperRight_[1];
454 GlobalPosition lensLowerLeft_;
455 GlobalPosition lensUpperRight_;
457 DimMatrix intrinsicPerm_;
458 DimMatrix intrinsicPermLens_;
Test for the immisicible VCVF discretization with only a single phase.
Definition: groundwaterproblem.hh:194
Scalar porosity(const Context &, unsigned, unsigned) const
Definition: groundwaterproblem.hh:345
void endTimeStep()
Definition: groundwaterproblem.hh:316
GroundWaterProblem(Simulator &simulator)
Definition: groundwaterproblem.hh:230
static void registerParameters()
Definition: groundwaterproblem.hh:262
std::string name() const
Definition: groundwaterproblem.hh:306
Scalar temperature(const Context &, unsigned, unsigned) const
Definition: groundwaterproblem.hh:336
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: groundwaterproblem.hh:374
void source(RateVector &rate, const Context &, unsigned, unsigned) const
Definition: groundwaterproblem.hh:433
void finishInit()
Definition: groundwaterproblem.hh:237
void initial(PrimaryVariables &values, const Context &, unsigned, unsigned) const
Definition: groundwaterproblem.hh:420
const DimMatrix & intrinsicPermeability(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: groundwaterproblem.hh:354
Definition: groundwaterproblem.hh:60
Definition: groundwaterproblem.hh:62
Definition: groundwaterproblem.hh:64
Definition: groundwaterproblem.hh:66
Definition: groundwaterproblem.hh:68
Definition: groundwaterproblem.hh:70
Definition: groundwaterproblem.hh:74
Definition: groundwaterproblem.hh:72
Definition: groundwaterproblem.hh:56