28#ifndef EWOMS_POWER_INJECTION_PROBLEM_HH
29#define EWOMS_POWER_INJECTION_PROBLEM_HH
31#include <opm/material/fluidmatrixinteractions/RegularizedVanGenuchten.hpp>
32#include <opm/material/fluidmatrixinteractions/LinearMaterial.hpp>
33#include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
34#include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
35#include <opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp>
36#include <opm/material/fluidstates/ImmiscibleFluidState.hpp>
37#include <opm/material/components/SimpleH2O.hpp>
38#include <opm/material/components/Air.hpp>
45#include <dune/grid/yaspgrid.hh>
47#include <dune/common/version.hh>
48#include <dune/common/fvector.hh>
49#include <dune/common/fmatrix.hh>
57template <
class TypeTag>
58class PowerInjectionProblem;
68template<
class TypeTag>
69struct Grid<TypeTag, TTag::PowerInjectionBaseProblem>
70{
using type = Dune::YaspGrid<1>; };
73template<
class TypeTag>
74struct Vanguard<TypeTag, TTag::PowerInjectionBaseProblem>
78template<
class TypeTag>
79struct Problem<TypeTag, TTag::PowerInjectionBaseProblem>
83template<
class TypeTag>
90 using type = Opm::LiquidPhase<Scalar, Opm::SimpleH2O<Scalar> >;
94template<
class TypeTag>
101 using type = Opm::GasPhase<Scalar, Opm::Air<Scalar> >;
105template<
class TypeTag>
110 enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
111 enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
114 using Traits = Opm::TwoPhaseMaterialTraits<Scalar,
115 FluidSystem::wettingPhaseIdx,
116 FluidSystem::nonWettingPhaseIdx>;
120 using EffectiveLaw = Opm::RegularizedVanGenuchten<Traits>;
124 using type = Opm::EffToAbsLaw<EffectiveLaw>;
142template <
class TypeTag>
161 numPhases = FluidSystem::numPhases,
164 wettingPhaseIdx = FluidSystem::wettingPhaseIdx,
165 nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx,
168 contiNEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx,
171 dim = GridView::dimension,
172 dimWorld = GridView::dimensionworld
178 using CoordScalar =
typename GridView::ctype;
179 using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>;
181 using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
188 : ParentType(simulator)
196 ParentType::finishInit();
201 temperature_ = 273.15 + 26.6;
205 materialParams_.setVgAlpha(0.00045);
206 materialParams_.setVgN(7.3);
207 materialParams_.finalize();
209 K_ = this->toDimMatrix_(5.73e-08);
211 setupInitialFluidState_();
219 ParentType::registerParameters();
221 Parameters::SetDefault<Parameters::CellsX>(250);
222 Parameters::SetDefault<Parameters::DomainSizeX<Scalar>>(100.0);
224 if constexpr (dim > 1) {
225 Parameters::SetDefault<Parameters::CellsY>(1);
226 Parameters::SetDefault<Parameters::DomainSizeY<Scalar>>(1.0);
228 if constexpr (dim == 3) {
229 Parameters::SetDefault<Parameters::CellsZ>(1);
230 Parameters::SetDefault<Parameters::DomainSizeZ<Scalar>>(1.0);
233 Parameters::SetDefault<Parameters::EndTime<Scalar>>(100.0);
234 Parameters::SetDefault<Parameters::InitialTimeStepSize<Scalar>>(1e-3);
235 Parameters::SetDefault<Parameters::VtkWriteFilterVelocities>(
true);
248 std::ostringstream oss;
249 oss <<
"powerinjection_";
254 oss <<
"forchheimer";
271 this->model().checkConservativeness();
275 this->model().globalStorage(storage);
278 if (this->gridView().comm().rank() == 0) {
279 std::cout <<
"Storage: " << storage << std::endl << std::flush;
293 template <
class Context>
302 template <
class Context>
311 template <
class Context>
320 template <
class Context>
321 const MaterialLawParams&
325 {
return materialParams_; }
330 template <
class Context>
334 {
return temperature_; }
349 template <
class Context>
351 const Context& context,
353 unsigned timeIdx)
const
355 const GlobalPosition& pos = context.pos(spaceIdx, timeIdx);
357 if (onLeftBoundary_(pos)) {
358 RateVector massRate(0.0);
360 massRate[contiNEqIdx] = -1.00;
363 values.setMassRate(massRate);
365 else if (onRightBoundary_(pos))
367 values.setFreeFlow(context, spaceIdx, timeIdx, initialFluidState_);
382 template <
class Context>
389 values.assignNaive(initialFluidState_);
398 template <
class Context>
403 { rate = Scalar(0.0); }
408 bool onLeftBoundary_(
const GlobalPosition& pos)
const
409 {
return pos[0] < this->boundingBoxMin()[0] + eps_; }
411 bool onRightBoundary_(
const GlobalPosition& pos)
const
412 {
return pos[0] > this->boundingBoxMax()[0] - eps_; }
414 void setupInitialFluidState_()
416 initialFluidState_.setTemperature(temperature_);
419 initialFluidState_.setSaturation(wettingPhaseIdx, Sw);
420 initialFluidState_.setSaturation(nonWettingPhaseIdx, 1 - Sw);
423 initialFluidState_.setPressure(wettingPhaseIdx, p);
424 initialFluidState_.setPressure(nonWettingPhaseIdx, p);
426 typename FluidSystem::template ParameterCache<Scalar> paramCache;
427 paramCache.updateAll(initialFluidState_);
428 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
429 initialFluidState_.setDensity(phaseIdx,
430 FluidSystem::density(initialFluidState_, paramCache, phaseIdx));
431 initialFluidState_.setViscosity(phaseIdx,
432 FluidSystem::viscosity(initialFluidState_, paramCache, phaseIdx));
437 MaterialLawParams materialParams_;
439 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:144
void finishInit()
Called by the Opm::Simulator in order to initialize the problem.
Definition: powerinjectionproblem.hh:194
Scalar porosity(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:312
static void registerParameters()
Definition: powerinjectionproblem.hh:217
Scalar temperature(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:331
void endTimeStep()
Called by the simulator after each time integration.
Definition: powerinjectionproblem.hh:268
void initial(PrimaryVariables &values, const Context &, unsigned, unsigned) const
Evaluate the initial value for a control volume.
Definition: powerinjectionproblem.hh:383
Scalar ergunCoefficient(const Context &, unsigned, unsigned) const
Returns the Ergun coefficient.
Definition: powerinjectionproblem.hh:303
const MaterialLawParams & materialLawParams(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:322
std::string name() const
The problem name.
Definition: powerinjectionproblem.hh:246
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:399
PowerInjectionProblem(Simulator &simulator)
Definition: powerinjectionproblem.hh:187
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the boundary conditions for a boundary segment.
Definition: powerinjectionproblem.hh:350
const DimMatrix & intrinsicPermeability(const Context &, unsigned, unsigned) const
Definition: powerinjectionproblem.hh:294
This file contains the necessary classes to calculate the volumetric fluxes out of a pressure potenti...
Definition: blackoilmodel.hh:74
Definition: blackoilbioeffectsmodules.hh:45
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
Specifies a flux module which uses the Darcy relation.
Definition: darcyfluxmodule.hh:67
Dune::YaspGrid< 1 > type
Definition: powerinjectionproblem.hh:70
The type of the DUNE grid.
Definition: basicproperties.hh:104
Opm::EffToAbsLaw< EffectiveLaw > type
Definition: powerinjectionproblem.hh:124
The material law which ought to be used (extracted from the spatial parameters)
Definition: multiphasebaseproperties.hh:55
Opm::GasPhase< Scalar, Opm::Air< Scalar > > type
Definition: powerinjectionproblem.hh:101
The non-wetting phase for two-phase models.
Definition: immiscibleproperties.hh:44
The type of the problem.
Definition: fvbaseproperties.hh:86
Definition: fvbaseadlocallinearizer.hh:58
Definition: powerinjectionproblem.hh:64
Property which provides a Vanguard (manages grids)
Definition: basicproperties.hh:100
Opm::LiquidPhase< Scalar, Opm::SimpleH2O< Scalar > > type
Definition: powerinjectionproblem.hh:90
The wetting phase for two-phase models.
Definition: immiscibleproperties.hh:41