26 #ifndef EWOMS_FLASH_BOUNDARY_RATE_VECTOR_HH
27 #define EWOMS_FLASH_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;
84 template <
class Context,
class Flu
idState>
85 void setFreeFlow(
const Context &context,
int bfIdx,
int timeIdx,
86 const FluidState &fluidState)
88 typename FluidSystem::ParameterCache paramCache;
89 paramCache.updateAll(fluidState);
91 ExtensiveQuantities extQuants;
92 extQuants.updateBoundary(context, bfIdx, timeIdx, fluidState, paramCache);
93 const auto &insideIntQuants = context.intensiveQuantities(bfIdx, timeIdx);
98 (*this) = Toolbox::createConstant(0.0);
99 for (
int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
100 Evaluation meanMBoundary = 0;
101 for (
int compIdx = 0; compIdx < numComponents; ++compIdx)
103 fluidState.moleFraction(phaseIdx, compIdx)*FluidSystem::molarMass(compIdx);
106 if (fluidState.pressure(phaseIdx) > insideIntQuants.fluidState().pressure(phaseIdx))
107 density = FluidSystem::density(fluidState, paramCache, phaseIdx);
109 density = insideIntQuants.fluidState().density(phaseIdx);
111 for (
int compIdx = 0; compIdx < numComponents; ++compIdx) {
113 if (fluidState.pressure(phaseIdx) > insideIntQuants.fluidState().pressure(phaseIdx))
114 molarity = fluidState.moleFraction(phaseIdx, compIdx)*density/meanMBoundary;
116 molarity = insideIntQuants.fluidState().molarity(phaseIdx, compIdx);
120 (*this)[conti0EqIdx + compIdx] += extQuants.volumeFlux(phaseIdx)*molarity;
124 Evaluation specificEnthalpy;
125 if (fluidState.pressure(phaseIdx) > insideIntQuants.fluidState().pressure(phaseIdx))
126 specificEnthalpy = FluidSystem::enthalpy(fluidState, paramCache, phaseIdx);
128 specificEnthalpy = insideIntQuants.fluidState().enthalpy(phaseIdx);
131 Evaluation enthalpyRate = density*extQuants.volumeFlux(phaseIdx)*specificEnthalpy;
132 EnergyModule::addToEnthalpyRate(*
this, enthalpyRate);
136 EnergyModule::addToEnthalpyRate(*
this, EnergyModule::heatConductionRate(extQuants));
139 for (
int i = 0; i < numEq; ++i) {
140 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
#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: flashboundaryratevector.hh:165
void setInFlow(const Context &context, int bfIdx, int timeIdx, const FluidState &fluidState)
Specify an inflow boundary.
Definition: flashboundaryratevector.hh:149
Implements a boundary vector for the fully implicit compositional multi-phase model which is based on...
Definition: flashboundaryratevector.hh:44
FlashBoundaryRateVector(const Evaluation &value)
Definition: flashboundaryratevector.hh:70
Provides the auxiliary methods required for consideration of the energy equation. ...
Definition: energymodule.hh:54
Definition: baseauxiliarymodule.hh:35
FlashBoundaryRateVector()
Definition: flashboundaryratevector.hh:63
Declares the properties required by the compositional multi-phase model based on flash calculations...
void setNoFlow()
Specify a no-flow boundary for all conserved quantities.
Definition: flashboundaryratevector.hh:180
FlashBoundaryRateVector(const FlashBoundaryRateVector &value)
Definition: flashboundaryratevector.hh:77
void setFreeFlow(const Context &context, int bfIdx, int timeIdx, const FluidState &fluidState)
Specify a free-flow boundary.
Definition: flashboundaryratevector.hh:85
Contains the classes required to consider energy as a conservation quantity in a multi-phase module...