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>
43#include <dune/grid/yaspgrid.hh>
45#include <dune/common/version.hh>
46#include <dune/common/fvector.hh>
47#include <dune/common/fmatrix.hh>
55template <
class TypeTag>
56class PowerInjectionProblem;
66template<
class TypeTag>
67struct Grid<TypeTag, TTag::PowerInjectionBaseProblem> {
using type = Dune::YaspGrid<1>; };
70template<
class TypeTag>
74template<
class TypeTag>
78template<
class TypeTag>
85 using type = Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> >;
89template<
class TypeTag>
96 using type = Opm::GasPhase<Scalar, Opm::Air<Scalar> >;
100template<
class TypeTag>
105 enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
106 enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
109 using Traits = Opm::TwoPhaseMaterialTraits<Scalar,
110 FluidSystem::wettingPhaseIdx,
111 FluidSystem::nonWettingPhaseIdx>;
115 using EffectiveLaw = Opm::RegularizedVanGenuchten<Traits>;
119 using type = Opm::EffToAbsLaw<EffectiveLaw>;
137template <
class TypeTag>
156 numPhases = FluidSystem::numPhases,
159 wettingPhaseIdx = FluidSystem::wettingPhaseIdx,
160 nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx,
163 contiNEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx,
166 dim = GridView::dimension,
167 dimWorld = GridView::dimensionworld
173 using CoordScalar =
typename GridView::ctype;
174 using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
176 using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
183 : ParentType(simulator)
191 ParentType::finishInit();
196 temperature_ = 273.15 + 26.6;
200 materialParams_.setVgAlpha(0.00045);
201 materialParams_.setVgN(7.3);
202 materialParams_.finalize();
204 K_ = this->toDimMatrix_(5.73e-08);
206 setupInitialFluidState_();
214 ParentType::registerParameters();
216 Parameters::SetDefault<Parameters::CellsX>(250);
217 Parameters::SetDefault<Parameters::DomainSizeX<Scalar>>(100.0);
219 if constexpr (dim > 1) {
220 Parameters::SetDefault<Parameters::CellsY>(1);
221 Parameters::SetDefault<Parameters::DomainSizeY<Scalar>>(1.0);
223 if constexpr (dim == 3) {
224 Parameters::SetDefault<Parameters::CellsZ>(1);
225 Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
228 Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
229 Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1e-3);
230 Parameters::SetDefault<Parameters::VtkWriteFilterVelocities>(
true);
243 std::ostringstream oss;
244 oss <<
"powerinjection_";
249 oss <<
"forchheimer";
266 this->model().checkConservativeness();
270 this->model().globalStorage(storage);
273 if (this->gridView().comm().rank() == 0) {
274 std::cout <<
"Storage: " << storage << std::endl << std::flush;
288 template <
class Context>
297 template <
class Context>
306 template <
class Context>
315 template <
class Context>
316 const MaterialLawParams&
320 {
return materialParams_; }
325 template <
class Context>
329 {
return temperature_; }
344 template <
class Context>
346 const Context& context,
348 unsigned timeIdx)
const
350 const GlobalPosition& pos = context.pos(spaceIdx, timeIdx);
352 if (onLeftBoundary_(pos)) {
353 RateVector massRate(0.0);
355 massRate[contiNEqIdx] = -1.00;
358 values.setMassRate(massRate);
360 else if (onRightBoundary_(pos))
362 values.setFreeFlow(context, spaceIdx, timeIdx, initialFluidState_);
377 template <
class Context>
384 values.assignNaive(initialFluidState_);
393 template <
class Context>
398 { rate = Scalar(0.0); }
403 bool onLeftBoundary_(
const GlobalPosition& pos)
const
404 {
return pos[0] < this->boundingBoxMin()[0] + eps_; }
406 bool onRightBoundary_(
const GlobalPosition& pos)
const
407 {
return pos[0] > this->boundingBoxMax()[0] - eps_; }
409 void setupInitialFluidState_()
411 initialFluidState_.setTemperature(temperature_);
414 initialFluidState_.setSaturation(wettingPhaseIdx, Sw);
415 initialFluidState_.setSaturation(nonWettingPhaseIdx, 1 - Sw);
418 initialFluidState_.setPressure(wettingPhaseIdx, p);
419 initialFluidState_.setPressure(nonWettingPhaseIdx, p);
421 typename FluidSystem::template ParameterCache<Scalar> paramCache;
422 paramCache.updateAll(initialFluidState_);
423 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
424 initialFluidState_.setDensity(phaseIdx,
425 FluidSystem::density(initialFluidState_, paramCache, phaseIdx));
426 initialFluidState_.setViscosity(phaseIdx,
427 FluidSystem::viscosity(initialFluidState_, paramCache, phaseIdx));
432 MaterialLawParams materialParams_;
434 Opm::ImmiscibleFluidState<Scalar, FluidSystem> initialFluidState_;
Provides a simulator vanguad which creates a regular grid made of quadrilaterals.
Definition: cubegridvanguard.hh:53
1D Problem with very fast injection of gas on the left.
Definition: powerinjectionproblem.hh:139
void finishInit()
Called by the Opm::Simulator in order to initialize the problem.
Definition: powerinjectionproblem.hh:189
Scalar porosity(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:307
static void registerParameters()
Definition: powerinjectionproblem.hh:212
Scalar temperature(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:326
void endTimeStep()
Called by the simulator after each time integration.
Definition: powerinjectionproblem.hh:263
void initial(PrimaryVariables &values, const Context &, unsigned, unsigned) const
Evaluate the initial value for a control volume.
Definition: powerinjectionproblem.hh:378
Scalar ergunCoefficient(const Context &, unsigned, unsigned) const
Returns the Ergun coefficient.
Definition: powerinjectionproblem.hh:298
const MaterialLawParams & materialLawParams(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:317
std::string name() const
The problem name.
Definition: powerinjectionproblem.hh:241
void source(RateVector &rate, const Context &, unsigned, unsigned) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: powerinjectionproblem.hh:394
PowerInjectionProblem(Simulator &simulator)
Definition: powerinjectionproblem.hh:182
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the boundary conditions for a boundary segment.
Definition: powerinjectionproblem.hh:345
const DimMatrix & intrinsicPermeability(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:289
Definition: blackoilmodel.hh:72
Definition: blackoilboundaryratevector.hh:37
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:235
Specifies a flux module which uses the Darcy relation.
Definition: darcyfluxmodule.hh:61
Dune::YaspGrid< 1 > type
Definition: powerinjectionproblem.hh:67
The type of the DUNE grid.
Definition: basicproperties.hh:100
Opm::EffToAbsLaw< EffectiveLaw > type
Definition: powerinjectionproblem.hh:119
The material law which ought to be used (extracted from the spatial parameters)
Definition: multiphasebaseproperties.hh:51
Opm::GasPhase< Scalar, Opm::Air< Scalar > > type
Definition: powerinjectionproblem.hh:96
The non-wetting phase for two-phase models.
Definition: immiscibleproperties.hh:44
The type of the problem.
Definition: fvbaseproperties.hh:81
Definition: fvbaseadlocallinearizer.hh:53
Definition: powerinjectionproblem.hh:62
Property which provides a Vanguard (manages grids)
Definition: basicproperties.hh:96
Opm::LiquidPhase< Scalar, Opm::SimpleH2O< Scalar > > type
Definition: powerinjectionproblem.hh:85
The wetting phase for two-phase models.
Definition: immiscibleproperties.hh:41