26 #ifndef EWOMS_PVS_BOUNDARY_RATE_VECTOR_HH
27 #define EWOMS_PVS_BOUNDARY_RATE_VECTOR_HH
32 #include <opm/material/common/Valgrind.hpp>
43 template <
class TypeTag>
46 typedef typename GET_PROP_TYPE(TypeTag, RateVector) ParentType;
47 typedef typename GET_PROP_TYPE(TypeTag, ExtensiveQuantities) ExtensiveQuantities;
48 typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
49 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
50 typedef typename GET_PROP_TYPE(TypeTag, Evaluation) Evaluation;
51 typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
56 enum { conti0EqIdx = Indices::conti0EqIdx };
60 typedef Opm::MathToolbox<Evaluation> Toolbox;
86 template <
class Context,
class Flu
idState>
87 void setFreeFlow(
const Context &context,
int bfIdx,
int timeIdx,
const FluidState &fluidState)
89 typename FluidSystem::ParameterCache paramCache;
90 paramCache.updateAll(fluidState);
92 ExtensiveQuantities extQuants;
93 extQuants.updateBoundary(context, bfIdx, timeIdx, fluidState, paramCache);
94 const auto &insideIntQuants = context.intensiveQuantities(bfIdx, timeIdx);
99 (*this) = Toolbox::createConstant(0.0);
100 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
101 Evaluation meanMBoundary = 0;
102 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
104 fluidState.moleFraction(phaseIdx, compIdx)*FluidSystem::molarMass(compIdx);
107 if (fluidState.pressure(phaseIdx) > insideIntQuants.fluidState().pressure(phaseIdx))
108 density = FluidSystem::density(fluidState, paramCache, phaseIdx);
110 density = insideIntQuants.fluidState().density(phaseIdx);
112 for (
int compIdx = 0; compIdx < numComponents; ++compIdx) {
114 if (fluidState.pressure(phaseIdx) > insideIntQuants.fluidState().pressure(phaseIdx))
115 molarity = fluidState.moleFraction(phaseIdx, compIdx)*density/meanMBoundary;
117 molarity = insideIntQuants.fluidState().molarity(phaseIdx, compIdx);
121 (*this)[conti0EqIdx + compIdx] += extQuants.volumeFlux(phaseIdx)*molarity;
125 Evaluation specificEnthalpy;
126 if (fluidState.pressure(phaseIdx) > insideIntQuants.fluidState().pressure(phaseIdx))
127 specificEnthalpy = FluidSystem::enthalpy(fluidState, paramCache, phaseIdx);
129 specificEnthalpy = insideIntQuants.fluidState().enthalpy(phaseIdx);
132 Evaluation enthalpyRate = density*extQuants.volumeFlux(phaseIdx)*specificEnthalpy;
133 EnergyModule::addToEnthalpyRate(*
this, enthalpyRate);
137 EnergyModule::addToEnthalpyRate(*
this, EnergyModule::heatConductionRate(extQuants));
140 for (
int i = 0; i < numEq; ++i)
141 Valgrind::CheckDefined((*
this)[i]);
148 template <
class Context,
class Flu
idState>
149 void setInFlow(
const Context &context,
int bfIdx,
int timeIdx,
150 const FluidState &fluidState)
152 this->
setFreeFlow(context, bfIdx, timeIdx, fluidState);
155 for (
int eqIdx = 0; eqIdx < numEq; ++eqIdx) {
156 Evaluation &val = this->operator[](eqIdx);
157 val = Toolbox::min(0.0, val);
164 template <
class Context,
class Flu
idState>
165 void setOutFlow(
const Context &context,
int bfIdx,
int timeIdx,
166 const FluidState &fluidState)
168 this->
setFreeFlow(context, bfIdx, timeIdx, fluidState);
171 for (
int eqIdx = 0; eqIdx < numEq; ++eqIdx) {
172 Evaluation &val = this->operator[](eqIdx);
173 val = Toolbox::max(0.0, val);
181 { (*this) = Toolbox::createConstant(0.0); }
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:468
Implements a rate vector on the boundary for the fully implicit compositional multi-phase primary var...
Definition: pvsboundaryratevector.hh:44
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:485
void setOutFlow(const Context &context, int bfIdx, int timeIdx, const FluidState &fluidState)
Specify an outflow boundary.
Definition: pvsboundaryratevector.hh:165
void setNoFlow()
Specify a no-flow boundary for all conserved quantities.
Definition: pvsboundaryratevector.hh:180
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:54
Definition: baseauxiliarymodule.hh:35
PvsBoundaryRateVector(const Evaluation &value)
Definition: pvsboundaryratevector.hh:71
void setInFlow(const Context &context, int bfIdx, int timeIdx, const FluidState &fluidState)
Specify an inflow boundary.
Definition: pvsboundaryratevector.hh:149
PvsBoundaryRateVector(const PvsBoundaryRateVector &value)
Definition: pvsboundaryratevector.hh:79
Declares the properties required for the compositional multi-phase primary variable switching model...
void setFreeFlow(const Context &context, int bfIdx, int timeIdx, const FluidState &fluidState)
Specify a free-flow boundary.
Definition: pvsboundaryratevector.hh:87
PvsBoundaryRateVector()
Definition: pvsboundaryratevector.hh:63
Contains the classes required to consider energy as a conservation quantity in a multi-phase module...