27 #ifndef EWOMS_OUTFLOW_PROBLEM_HH
28 #define EWOMS_OUTFLOW_PROBLEM_HH
32 #include <opm/material/fluidstates/CompositionalFluidState.hpp>
33 #include <opm/material/fluidsystems/H2ON2LiquidPhaseFluidSystem.hpp>
34 #include <opm/common/Unused.hpp>
36 #include <dune/grid/yaspgrid.hh>
37 #include <dune/grid/io/file/dgfparser/dgfyasp.hh>
39 #include <dune/common/version.hh>
40 #include <dune/common/fvector.hh>
41 #include <dune/common/fmatrix.hh>
44 template <
class TypeTag>
49 namespace Properties {
59 SET_PROP(OutflowBaseProblem, FluidSystem)
66 typedef Opm::FluidSystems::H2ON2LiquidPhase<Scalar> type;
73 SET_BOOL_PROP(OutflowBaseProblem, VtkWriteMassFractions, true);
104 template <
class TypeTag>
107 typedef typename GET_PROP_TYPE(TypeTag, BaseProblem) ParentType;
111 typedef typename
GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
113 typedef typename
GET_PROP_TYPE(TypeTag, RateVector) RateVector;
114 typedef typename
GET_PROP_TYPE(TypeTag, BoundaryRateVector) BoundaryRateVector;
116 typedef typename
GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
117 typedef typename
GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
122 dim = GridView::dimension,
123 dimWorld = GridView::dimensionworld,
126 H2OIdx = FluidSystem::H2OIdx,
127 N2Idx = FluidSystem::N2Idx
130 typedef typename GridView::ctype CoordScalar;
131 typedef Dune::FieldVector<CoordScalar, dimWorld> GlobalPosition;
133 typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
140 : ParentType(simulator)
149 ParentType::finishInit();
151 temperature_ = 273.15 + 20;
152 FluidSystem::init(temperature_ - 1, temperature_ + 2,
157 perm_ = this->toDimMatrix_(1e-10);
171 {
return "outflow"; }
179 this->model().checkConservativeness();
183 this->model().globalStorage(storage);
186 if (this->gridView().comm().rank() == 0) {
187 std::cout <<
"Storage: " << storage << std::endl << std::flush;
197 template <
class Context>
199 unsigned spaceIdx OPM_UNUSED,
200 unsigned timeIdx OPM_UNUSED)
const
201 {
return temperature_; }
208 template <
class Context>
210 unsigned spaceIdx OPM_UNUSED,
211 unsigned timeIdx OPM_UNUSED)
const
219 template <
class Context>
221 unsigned spaceIdx OPM_UNUSED,
222 unsigned timeIdx OPM_UNUSED)
const
223 {
return porosity_; }
230 template <
class Context>
231 Scalar tortuosity(
const Context& context,
unsigned spaceIdx,
unsigned timeIdx)
const
232 {
return tortuosity_; }
238 template <
class Context>
239 Scalar dispersivity(
const Context& context,
240 unsigned spaceIdx,
unsigned timeIdx)
const
254 template <
class Context>
255 void boundary(BoundaryRateVector& values,
const Context& context,
256 unsigned spaceIdx,
unsigned timeIdx)
const
258 const GlobalPosition& globalPos = context.pos(spaceIdx, timeIdx);
260 if (onLeftBoundary_(globalPos)) {
261 Opm::CompositionalFluidState<Scalar, FluidSystem,
263 initialFluidState_(fs, context, spaceIdx, timeIdx);
264 fs.setPressure(0, fs.pressure(0) + 1e5);
267 fs.setMoleFraction(0, N2Idx, xlN2);
268 fs.setMoleFraction(0, H2OIdx, 1 - xlN2);
271 values.setFreeFlow(context, spaceIdx, timeIdx, fs);
273 else if (onRightBoundary_(globalPos)) {
274 Opm::CompositionalFluidState<Scalar, FluidSystem,
276 initialFluidState_(fs, context, spaceIdx, timeIdx);
279 values.setOutFlow(context, spaceIdx, timeIdx, fs);
296 template <
class Context>
298 const Context& context,
300 unsigned timeIdx)
const
302 Opm::CompositionalFluidState<Scalar, FluidSystem,
false> fs;
303 initialFluidState_(fs, context, spaceIdx, timeIdx);
305 values.assignNaive(fs);
314 template <
class Context>
316 const Context& context OPM_UNUSED,
317 unsigned spaceIdx OPM_UNUSED,
318 unsigned timeIdx OPM_UNUSED)
const
319 { rate = Scalar(0.0); }
324 bool onLeftBoundary_(
const GlobalPosition& pos)
const
325 {
return pos[0] < eps_; }
327 bool onRightBoundary_(
const GlobalPosition& pos)
const
328 {
return pos[0] > this->boundingBoxMax()[0] - eps_; }
330 template <
class Flu
idState,
class Context>
331 void initialFluidState_(FluidState& fs,
const Context& context,
332 unsigned spaceIdx,
unsigned timeIdx)
const
334 Scalar T = temperature(context, spaceIdx, timeIdx);
341 fs.setSaturation(0, 1.0);
342 fs.setPressure(0, 1e5 );
343 fs.setMoleFraction(0, H2OIdx, 1.0);
344 fs.setMoleFraction(0, N2Idx, 0);
345 fs.setTemperature(T);
350 MaterialLawParams materialParams_;
#define SET_BOOL_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant boolean value.
Definition: propertysystem.hh:361
void initial(PrimaryVariables &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the initial value for a control volume.
Definition: outflowproblem.hh:297
Scalar porosity(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: outflowproblem.hh:220
std::string name() const
The problem name.
Definition: outflowproblem.hh:170
#define NEW_TYPE_TAG(...)
Define a new type tag.
Definition: propertysystem.hh:169
Scalar temperature(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: outflowproblem.hh:198
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:486
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: outflowproblem.hh:315
void finishInit()
Called by the Ewoms::Simulator in order to initialize the problem.
Definition: outflowproblem.hh:147
#define SET_PROP(EffTypeTagName, PropTagName)
Set a property for a specific type tag.
Definition: propertysystem.hh:297
void endTimeStep()
Called by the simulator after each time integration.
Definition: outflowproblem.hh:176
const DimMatrix & intrinsicPermeability(const Context &context OPM_UNUSED, unsigned spaceIdx OPM_UNUSED, unsigned timeIdx OPM_UNUSED) const
Definition: outflowproblem.hh:209
Declares the properties required for the compositional multi-phase primary variable switching model...
OutflowProblem(Simulator &simulator)
Definition: outflowproblem.hh:139
void boundary(BoundaryRateVector &values, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the boundary conditions for a boundary segment.
Definition: outflowproblem.hh:255
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
#define SET_STRING_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant string value.
Definition: propertysystem.hh:416
Problem where dissolved nitrogen is transported with the water phase from the left side to the right...
Definition: outflowproblem.hh:45
#define SET_SCALAR_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant scalar value.
Definition: propertysystem.hh:394