28 #ifndef EWOMS_POWER_INJECTION_PROBLEM_HH
29 #define EWOMS_POWER_INJECTION_PROBLEM_HH
34 #include <opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp>
35 #include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
36 #include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
37 #include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
38 #include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
39 #include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
40 #include <opm/material/components/SimpleH2O.hpp>
41 #include <opm/material/components/Air.hpp>
42 #include <opm/common/Unused.hpp>
44 #include <dune/grid/yaspgrid.hh>
46 #include <dune/common/version.hh>
47 #include <dune/common/fvector.hh>
48 #include <dune/common/fmatrix.hh>
52 #include <type_traits>
56 template <
class TypeTag>
61 namespace Properties {
65 SET_TYPE_PROP(PowerInjectionBaseProblem, Grid, Dune::YaspGrid</*dim=*/1>);
76 SET_PROP(PowerInjectionBaseProblem, WettingPhase)
82 typedef Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> > type;
86 SET_PROP(PowerInjectionBaseProblem, NonwettingPhase)
92 typedef Opm::GasPhase<Scalar, Opm::Air<Scalar> > type;
96 SET_PROP(PowerInjectionBaseProblem, MaterialLaw)
99 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
100 enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
101 enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
104 typedef Opm::TwoPhaseMaterialTraits<Scalar,
105 FluidSystem::wettingPhaseIdx,
106 FluidSystem::nonWettingPhaseIdx>
111 typedef Opm::RegularizedVanGenuchten<Traits> EffectiveLaw;
115 typedef Opm::EffToAbsLaw<EffectiveLaw> type;
119 SET_BOOL_PROP(PowerInjectionBaseProblem, VtkWriteFilterVelocities, true);
122 SET_BOOL_PROP(PowerInjectionBaseProblem, EnableGravity, false);
154 template <
class TypeTag>
155 class PowerInjectionProblem :
public GET_PROP_TYPE(TypeTag, BaseProblem)
157 typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
162 typedef typename
GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
163 typedef typename
GET_PROP_TYPE(TypeTag, WettingPhase) WettingPhase;
164 typedef typename
GET_PROP_TYPE(TypeTag, NonwettingPhase) NonwettingPhase;
165 typedef typename
GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
167 typedef typename
GET_PROP_TYPE(TypeTag, RateVector) RateVector;
168 typedef typename
GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector;
169 typedef typename
GET_PROP_TYPE(TypeTag, Simulator) Simulator;
175 wettingPhaseIdx = FluidSystem::wettingPhaseIdx,
176 nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx,
179 contiNEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx,
182 dim = GridView::dimension,
183 dimWorld = GridView::dimensionworld
186 typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
187 typedef typename
GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
189 typedef typename GridView::ctype CoordScalar;
190 typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
192 typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
199 : ParentType(simulator)
207 ParentType::finishInit();
212 temperature_ = 273.15 + 26.6;
216 materialParams_.setVgAlpha(0.00045);
217 materialParams_.setVgN(7.3);
218 materialParams_.finalize();
220 K_ = this->toDimMatrix_(5.73e-08);
222 setupInitialFluidState_();
235 std::ostringstream oss;
236 oss <<
"powerinjection_";
237 if (std::is_same<
typename GET_PROP_TYPE(TypeTag, FluxModule),
241 oss <<
"forchheimer";
243 if (std::is_same<
typename GET_PROP_TYPE(TypeTag, LocalLinearizerSplice),
244 TTAG(AutoDiffLocalLinearizer)>::value)
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;
280 template <
class Context>
282 unsigned spaceIdx OPM_UNUSED,
283 unsigned timeIdx OPM_UNUSED)
const
289 template <
class Context>
291 unsigned spaceIdx OPM_UNUSED,
292 unsigned timeIdx OPM_UNUSED)
const
298 template <
class Context>
300 unsigned spaceIdx OPM_UNUSED,
301 unsigned timeIdx OPM_UNUSED)
const
307 template <
class Context>
308 const MaterialLawParams&
310 unsigned spaceIdx OPM_UNUSED,
311 unsigned timeIdx OPM_UNUSED)
const
312 {
return materialParams_; }
317 template <
class Context>
319 unsigned spaceIdx OPM_UNUSED,
320 unsigned timeIdx OPM_UNUSED)
const
321 {
return temperature_; }
336 template <
class Context>
338 const Context& context,
340 unsigned timeIdx)
const
342 const GlobalPosition& pos = context.pos(spaceIdx, timeIdx);
344 if (onLeftBoundary_(pos)) {
345 RateVector massRate(0.0);
347 massRate[contiNEqIdx] = -1.00;
350 values.setMassRate(massRate);
352 else if (onRightBoundary_(pos))
354 values.setFreeFlow(context, spaceIdx, timeIdx, initialFluidState_);
369 template <
class Context>
371 const Context& context OPM_UNUSED,
372 unsigned spaceIdx OPM_UNUSED,
373 unsigned timeIdx OPM_UNUSED)
const
376 values.assignNaive(initialFluidState_);
385 template <
class Context>
387 const Context& context OPM_UNUSED,
388 unsigned spaceIdx OPM_UNUSED,
389 unsigned timeIdx OPM_UNUSED)
const
390 { rate = Scalar(0.0); }
395 bool onLeftBoundary_(
const GlobalPosition& pos)
const
396 {
return pos[0] < this->boundingBoxMin()[0] + eps_; }
398 bool onRightBoundary_(
const GlobalPosition& pos)
const
399 {
return pos[0] > this->boundingBoxMax()[0] - eps_; }
401 void setupInitialFluidState_()
403 initialFluidState_.setTemperature(temperature_);
406 initialFluidState_.setSaturation(wettingPhaseIdx, Sw);
407 initialFluidState_.setSaturation(nonWettingPhaseIdx, 1 - Sw);
410 initialFluidState_.setPressure(wettingPhaseIdx, p);
411 initialFluidState_.setPressure(nonWettingPhaseIdx, p);
415 MaterialLawParams materialParams_;
417 Opm::ImmiscibleFluidState<Scalar, FluidSystem> initialFluidState_;
#define SET_BOOL_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant boolean value.
Definition: propertysystem.hh:361
Specifies a flux module which uses the Darcy relation.
Definition: darcyfluxmodule.hh:65
std::string name() const
The problem name.
Definition: powerinjectionproblem.hh:233
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the boundary conditions for a boundary segment.
Definition: powerinjectionproblem.hh:337
void source(RateVector &rate, const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: powerinjectionproblem.hh:386
#define NEW_TYPE_TAG(...)
Define a new type tag.
Definition: propertysystem.hh:169
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:486
#define SET_INT_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant integer value.
Definition: propertysystem.hh:345
void initial(PrimaryVariables &values, const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Evaluate the initial value for a control volume.
Definition: powerinjectionproblem.hh:370
Provides a grid manager which a regular grid made of quadrilaterals.
void endTimeStep()
Called by the simulator after each time integration.
Definition: powerinjectionproblem.hh:255
Scalar ergunCoefficient(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Returns the Ergun coefficient.
Definition: powerinjectionproblem.hh:290
#define SET_PROP(EffTypeTagName, PropTagName)
Set a property for a specific type tag.
Definition: propertysystem.hh:297
Scalar temperature(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: powerinjectionproblem.hh:318
#define TTAG(TypeTagName)
Convert a type tag name to a type.
Definition: propertysystem.hh:138
Scalar porosity(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: powerinjectionproblem.hh:299
void finishInit()
Called by the Ewoms::Simulator in order to initialize the problem.
Definition: powerinjectionproblem.hh:205
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:75
#define SET_TYPE_PROP(EffTypeTagName, PropTagName,...)
Set a property which defines a type.
Definition: propertysystem.hh:377
const MaterialLawParams & materialLawParams(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: powerinjectionproblem.hh:309
Provides a grid manager which a regular grid made of quadrilaterals.
Definition: cubegridmanager.hh:65
A fully-implicit multi-phase flow model which assumes immiscibility of the phases.
const DimMatrix & intrinsicPermeability(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: powerinjectionproblem.hh:281
1D Problem with very fast injection of gas on the left.
Definition: powerinjectionproblem.hh:57
#define SET_SCALAR_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant scalar value.
Definition: propertysystem.hh:394