28 #ifndef EWOMS_TUTORIAL1_PROBLEM_HH
29 #define EWOMS_TUTORIAL1_PROBLEM_HH
38 #include <opm/material/components/SimpleH2O.hpp>
39 #include <opm/material/components/Lnapl.hpp>
42 #include <opm/material/fluidmatrixinteractions/RegularizedBrooksCorey.hpp>
43 #include <opm/material/fluidmatrixinteractions/EffToAbsLaw.hpp>
44 #include <opm/material/fluidmatrixinteractions/MaterialTraits.hpp>
47 #include <dune/grid/yaspgrid.hh>
51 #include <dune/common/fmatrix.hh>
52 #include <dune/common/version.hh>
56 template <
class TypeTag>
61 namespace Properties {
96 typedef typename
GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
97 enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
98 enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
99 typedef Opm::TwoPhaseMaterialTraits<Scalar, wettingPhaseIdx, nonWettingPhaseIdx> Traits;
103 typedef Opm::RegularizedBrooksCorey<Traits> RawMaterialLaw;
108 typedef Opm::EffToAbsLaw<RawMaterialLaw> type;
134 template <
class TypeTag>
135 class Tutorial1Problem
138 typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
139 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
140 typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
143 enum { dimWorld = GridView::dimensionworld };
146 typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
149 typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
150 typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
151 typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
152 typedef typename GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector;
153 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
154 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
155 typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
156 typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
159 enum { numPhases = FluidSystem::numPhases };
160 enum { wettingPhaseIdx = FluidSystem::wettingPhaseIdx };
161 enum { nonWettingPhaseIdx = FluidSystem::nonWettingPhaseIdx };
164 enum { contiWettingEqIdx = Indices::conti0EqIdx + wettingPhaseIdx };
165 enum { contiNonWettingEqIdx = Indices::conti0EqIdx + nonWettingPhaseIdx };
171 : ParentType(simulator)
180 ParentType::finishInit();
183 K_ = this->toDimMatrix_(1e-7);
186 materialParams_.setEntryPressure(500.0 );
187 materialParams_.setLambda(2);
190 materialParams_.setResidualSaturation(wettingPhaseIdx, 0.0);
191 materialParams_.setResidualSaturation(nonWettingPhaseIdx, 0.0);
194 materialParams_.finalize();
199 {
return "tutorial1"; }
202 template <
class Context>
204 unsigned ,
unsigned )
const
208 template <
class Context>
210 unsigned ,
unsigned )
const
214 template <
class Context>
216 unsigned ,
unsigned ) const
220 template <
class Context>
222 unsigned ,
unsigned )
const
223 {
return materialParams_; }
226 template <
class Context>
227 void boundary(BoundaryRateVector& values,
const Context& context,
228 unsigned spaceIdx,
unsigned timeIdx)
const
230 const auto& pos = context.pos(spaceIdx, timeIdx);
233 const auto& materialParams = this->
materialLawParams(context, spaceIdx, timeIdx);
235 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
237 fs.setSaturation(wettingPhaseIdx, Sw);
238 fs.setSaturation(nonWettingPhaseIdx, 1.0 - Sw);
239 fs.setTemperature(
temperature(context, spaceIdx, timeIdx));
241 Scalar pC[numPhases];
242 MaterialLaw::capillaryPressures(pC, materialParams, fs);
243 fs.setPressure(wettingPhaseIdx, 200e3);
244 fs.setPressure(nonWettingPhaseIdx, 200e3 + pC[nonWettingPhaseIdx] - pC[nonWettingPhaseIdx]);
246 values.setFreeFlow(context, spaceIdx, timeIdx, fs);
248 else if (pos[0] > this->boundingBoxMax()[0] - eps_) {
250 RateVector massRate(0.0);
252 massRate[contiWettingEqIdx] = 0.0;
253 massRate[contiNonWettingEqIdx] = 3e-2;
255 values.setMassRate(massRate);
264 template <
class Context>
266 unsigned ,
unsigned )
const
268 source[contiWettingEqIdx] = 0.0;
269 source[contiNonWettingEqIdx] = 0.0;
273 template <
class Context>
274 void initial(PrimaryVariables& values,
const Context& context,
275 unsigned spaceIdx,
unsigned timeIdx)
const
277 Opm::ImmiscibleFluidState<Scalar, FluidSystem> fs;
281 fs.setSaturation(wettingPhaseIdx, Sw);
282 fs.setSaturation(nonWettingPhaseIdx, 1.0 - Sw);
285 fs.setTemperature(
temperature(context, spaceIdx, timeIdx));
288 Scalar pC[numPhases];
289 MaterialLaw::capillaryPressures(pC,
materialLawParams(context, spaceIdx, timeIdx),
291 fs.setPressure(wettingPhaseIdx, 200e3);
292 fs.setPressure(nonWettingPhaseIdx, 200e3 + pC[nonWettingPhaseIdx] - pC[nonWettingPhaseIdx]);
294 values.assignNaive(fs);
300 MaterialLawParams materialParams_;
void source(RateVector &source, const Context &, unsigned, unsigned) const
Evaluates the source term for all conserved quantities at a given position of the domain [kg/(m^3 * s...
Definition: tutorial1problem.hh:265
#define SET_BOOL_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant boolean value.
Definition: propertysystem.hh:361
The base class for the vertex centered finite volume discretization scheme.
Definition: vcfvdiscretization.hh:49
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluates the boundary conditions.
Definition: tutorial1problem.hh:227
void finishInit()
This method initializes the data structures allocated by the problem constructor. ...
Definition: tutorial1problem.hh:178
#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_TAG_PROP(EffTypeTagName, PropTagName, ValueTypeTagName)
Define a property containing a type tag.
Definition: propertysystem.hh:436
#define INHERITS_FROM(...)
Syntactic sugar for NEW_TYPE_TAG.
Definition: propertysystem.hh:230
#define SET_INT_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant integer value.
Definition: propertysystem.hh:345
The base class for the vertex centered finite volume discretization scheme.
void initial(PrimaryVariables &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluates the initial value at a given position in the domain.
Definition: tutorial1problem.hh:274
const MaterialLawParams & materialLawParams(const Context &, unsigned, unsigned) const
Returns the parameter object for the material law at a given position.
Definition: tutorial1problem.hh:221
Scalar temperature(const Context &, unsigned, unsigned) const
Returns the temperature at a given position.
Definition: tutorial1problem.hh:203
Provides a grid manager which a regular grid made of quadrilaterals.
#define SET_PROP(EffTypeTagName, PropTagName)
Set a property for a specific type tag.
Definition: propertysystem.hh:297
Tutorial1Problem(Simulator &simulator)
The constructor of the problem.
Definition: tutorial1problem.hh:170
Tutorial problem using the "immiscible" model.
Definition: tutorial1problem.hh:57
Scalar porosity(const Context &, unsigned, unsigned) const
Defines the porosity [-] of the medium at a given position.
Definition: tutorial1problem.hh:215
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:75
const DimMatrix & intrinsicPermeability(const Context &, unsigned, unsigned) const
Returns the intrinsic permeability tensor [m^2] at a position.
Definition: tutorial1problem.hh:209
#define SET_TYPE_PROP(EffTypeTagName, PropTagName,...)
Set a property which defines a type.
Definition: propertysystem.hh:377
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.
#define SET_SCALAR_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant scalar value.
Definition: propertysystem.hh:394
std::string name() const
Specifies the problem name. This is used for files generated by the simulation.
Definition: tutorial1problem.hh:198