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>
37 #include <opm/material/common/Unused.hpp>
39 #include <dune/grid/yaspgrid.hh>
40 #include <dune/grid/io/file/dgfparser/dgfyasp.hh>
42 #include <dune/common/version.hh>
43 #include <dune/common/fmatrix.hh>
44 #include <dune/common/fvector.hh>
50 template <
class TypeTag>
51 class GroundWaterProblem;
54 namespace Opm::Properties {
60 template<
class TypeTag,
class MyTypeTag>
62 template<
class TypeTag,
class MyTypeTag>
64 template<
class TypeTag,
class MyTypeTag>
66 template<
class TypeTag,
class MyTypeTag>
68 template<
class TypeTag,
class MyTypeTag>
70 template<
class TypeTag,
class MyTypeTag>
72 template<
class TypeTag,
class MyTypeTag>
74 template<
class TypeTag,
class MyTypeTag>
77 template<
class TypeTag>
78 struct Fluid<TypeTag, TTag::GroundWaterBaseProblem>
81 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
84 using type = Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> >;
88 template<
class TypeTag>
89 struct Grid<TypeTag, TTag::GroundWaterBaseProblem> {
using type = Dune::YaspGrid<2>; };
92 template<
class TypeTag>
93 struct Problem<TypeTag, TTag::GroundWaterBaseProblem>
96 template<
class TypeTag>
99 using type = GetPropType<TypeTag, Scalar>;
100 static constexpr type value = 0.25;
102 template<
class TypeTag>
105 using type = GetPropType<TypeTag, Scalar>;
106 static constexpr type value = 0.25;
108 template<
class TypeTag>
111 using type = GetPropType<TypeTag, Scalar>;
112 static constexpr type value = 0.25;
114 template<
class TypeTag>
117 using type = GetPropType<TypeTag, Scalar>;
118 static constexpr type value = 0.75;
120 template<
class TypeTag>
123 using type = GetPropType<TypeTag, Scalar>;
124 static constexpr type value = 0.75;
126 template<
class TypeTag>
129 using type = GetPropType<TypeTag, Scalar>;
130 static constexpr type value = 0.75;
132 template<
class TypeTag>
135 using type = GetPropType<TypeTag, Scalar>;
136 static constexpr type value = 1e-10;
138 template<
class TypeTag>
141 using type = GetPropType<TypeTag, Scalar>;
142 static constexpr type value = 1e-12;
146 template<
class TypeTag>
147 struct EnableGravity<TypeTag, TTag::GroundWaterBaseProblem> {
static constexpr
bool value =
true; };
150 template<
class TypeTag>
151 struct EndTime<TypeTag, TTag::GroundWaterBaseProblem>
153 using type = GetPropType<TypeTag, Scalar>;
154 static constexpr type value = 1;
158 template<
class TypeTag>
159 struct InitialTimeStepSize<TypeTag, TTag::GroundWaterBaseProblem>
161 using type = GetPropType<TypeTag, Scalar>;
162 static constexpr type value = 1;
166 template<
class TypeTag>
167 struct GridFile<TypeTag, TTag::GroundWaterBaseProblem> {
static constexpr
auto value =
"./data/groundwater_2d.dgf"; };
171 template<
class TypeTag>
172 struct LinearSolverSplice<TypeTag, TTag::GroundWaterBaseProblem> {
using type = TTag::ParallelIstlLinearSolver; };
174 template<
class TypeTag>
175 struct LinearSolverWrapper<TypeTag, TTag::GroundWaterBaseProblem>
176 {
using type = Opm::Linear::SolverWrapperConjugatedGradients<TypeTag>; };
193 template <
class TypeTag>
196 using ParentType = GetPropType<TypeTag, Properties::BaseProblem>;
198 using GridView = GetPropType<TypeTag, Properties::GridView>;
199 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
200 using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
203 using Indices = GetPropType<TypeTag, Properties::Indices>;
205 numPhases = FluidSystem::numPhases,
208 dim = GridView::dimension,
209 dimWorld = GridView::dimensionworld,
212 pressure0Idx = Indices::pressure0Idx
215 using Simulator = GetPropType<TypeTag, Properties::Simulator>;
216 using EqVector = GetPropType<TypeTag, Properties::EqVector>;
217 using RateVector = GetPropType<TypeTag, Properties::RateVector>;
218 using BoundaryRateVector = GetPropType<TypeTag, Properties::BoundaryRateVector>;
219 using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
220 using Model = GetPropType<TypeTag, Properties::Model>;
222 using CoordScalar =
typename GridView::ctype;
223 using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
225 using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
232 : ParentType(simulator)
240 ParentType::finishInit();
244 lensLowerLeft_[0] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftX);
246 lensLowerLeft_[1] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftY);
248 lensLowerLeft_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensLowerLeftY);
250 lensUpperRight_[0] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightX);
252 lensUpperRight_[1] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY);
254 lensUpperRight_[2] = EWOMS_GET_PARAM(TypeTag, Scalar, LensUpperRightY);
256 intrinsicPerm_ = this->toDimMatrix_(EWOMS_GET_PARAM(TypeTag, Scalar, Permeability));
257 intrinsicPermLens_ = this->toDimMatrix_(EWOMS_GET_PARAM(TypeTag, Scalar, PermeabilityLens));
265 ParentType::registerParameters();
267 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftX,
268 "The x-coordinate of the lens' lower-left corner "
270 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightX,
271 "The x-coordinate of the lens' upper-right corner "
275 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftY,
276 "The y-coordinate of the lens' lower-left "
278 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightY,
279 "The y-coordinate of the lens' upper-right "
284 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensLowerLeftZ,
285 "The z-coordinate of the lens' lower-left "
287 EWOMS_REGISTER_PARAM(TypeTag, Scalar, LensUpperRightZ,
288 "The z-coordinate of the lens' upper-right "
292 EWOMS_REGISTER_PARAM(TypeTag, Scalar, Permeability,
293 "The intrinsic permeability [m^2] of the ambient "
295 EWOMS_REGISTER_PARAM(TypeTag, Scalar, PermeabilityLens,
296 "The intrinsic permeability [m^2] of the lens.");
309 std::ostringstream oss;
310 oss <<
"groundwater_" << Model::name();
320 this->model().checkConservativeness();
324 this->model().globalStorage(storage);
327 if (this->gridView().comm().rank() == 0) {
328 std::cout <<
"Storage: " << storage << std::endl << std::flush;
336 template <
class Context>
338 unsigned spaceIdx OPM_UNUSED,
339 unsigned timeIdx OPM_UNUSED)
const
340 {
return 273.15 + 10; }
345 template <
class Context>
347 unsigned spaceIdx OPM_UNUSED,
348 unsigned timeIdx OPM_UNUSED)
const
354 template <
class Context>
357 unsigned timeIdx)
const
359 if (isInLens_(context.pos(spaceIdx, timeIdx)))
360 return intrinsicPermLens_;
362 return intrinsicPerm_;
374 template <
class Context>
375 void boundary(BoundaryRateVector& values,
const Context& context,
376 unsigned spaceIdx,
unsigned timeIdx)
const
378 const GlobalPosition& globalPos = context.pos(spaceIdx, timeIdx);
380 if (onLowerBoundary_(globalPos) || onUpperBoundary_(globalPos)) {
382 Scalar T =
temperature(context, spaceIdx, timeIdx);
383 if (onLowerBoundary_(globalPos))
388 Opm::ImmiscibleFluidState<Scalar, FluidSystem,
390 fs.setSaturation(0, 1.0);
391 fs.setPressure(0, pressure);
392 fs.setTemperature(T);
394 typename FluidSystem::template ParameterCache<Scalar> paramCache;
395 paramCache.updateAll(fs);
396 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
397 fs.setDensity(phaseIdx, FluidSystem::density(fs, paramCache, phaseIdx));
398 fs.setViscosity(phaseIdx, FluidSystem::viscosity(fs, paramCache, phaseIdx));
402 values.setFreeFlow(context, spaceIdx, timeIdx, fs);
420 template <
class Context>
422 const Context& context OPM_UNUSED,
423 unsigned spaceIdx OPM_UNUSED,
424 unsigned timeIdx OPM_UNUSED)
const
427 values[pressure0Idx] = 1.0e+5;
433 template <
class Context>
435 const Context& context OPM_UNUSED,
436 unsigned spaceIdx OPM_UNUSED,
437 unsigned timeIdx OPM_UNUSED)
const
438 { rate = Scalar(0.0); }
443 bool onLowerBoundary_(
const GlobalPosition& pos)
const
444 {
return pos[dim - 1] < eps_; }
446 bool onUpperBoundary_(
const GlobalPosition& pos)
const
447 {
return pos[dim - 1] > this->boundingBoxMax()[dim - 1] - eps_; }
449 bool isInLens_(
const GlobalPosition& pos)
const
451 return lensLowerLeft_[0] <= pos[0] && pos[0] <= lensUpperRight_[0]
452 && lensLowerLeft_[1] <= pos[1] && pos[1] <= lensUpperRight_[1];
455 GlobalPosition lensLowerLeft_;
456 GlobalPosition lensUpperRight_;
458 DimMatrix intrinsicPerm_;
459 DimMatrix intrinsicPermLens_;
Test for the immisicible VCVF discretization with only a single phase.
Definition: groundwaterproblem.hh:195
void endTimeStep()
Definition: groundwaterproblem.hh:317
GroundWaterProblem(Simulator &simulator)
Definition: groundwaterproblem.hh:231
void source(RateVector &rate, const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: groundwaterproblem.hh:434
static void registerParameters()
Definition: groundwaterproblem.hh:263
std::string name() const
Definition: groundwaterproblem.hh:307
void initial(PrimaryVariables &values, const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: groundwaterproblem.hh:421
Scalar porosity(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: groundwaterproblem.hh:346
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: groundwaterproblem.hh:375
Scalar temperature(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: groundwaterproblem.hh:337
void finishInit()
Definition: groundwaterproblem.hh:238
const DimMatrix & intrinsicPermeability(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition: groundwaterproblem.hh:355
Definition: groundwaterproblem.hh:61
Definition: groundwaterproblem.hh:63
Definition: groundwaterproblem.hh:65
Definition: groundwaterproblem.hh:67
Definition: groundwaterproblem.hh:69
Definition: groundwaterproblem.hh:71
Definition: groundwaterproblem.hh:75
Definition: groundwaterproblem.hh:73
Definition: groundwaterproblem.hh:57