29 #ifndef EWOMS_QUANTITY_CALLBACKS_HH 30 #define EWOMS_QUANTITY_CALLBACKS_HH 34 #include <opm/material/common/MathToolbox.hpp> 35 #include <opm/common/Valgrind.hpp> 37 #include <type_traits> 46 template <
class TypeTag>
49 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
50 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
52 typedef decltype(std::declval<IntensiveQuantities>().fluidState()) IQFluidState;
53 typedef decltype(std::declval<IQFluidState>().temperature(0)) ResultRawType;
56 typedef typename std::remove_const<typename std::remove_reference<ResultRawType>::type>::type ResultType;
57 typedef typename Opm::MathToolbox<ResultType>::ValueType ResultValueType;
71 {
return elemCtx_.intensiveQuantities(dofIdx, 0).fluidState().temperature(0); }
74 const ElementContext& elemCtx_;
82 template <
class TypeTag>
85 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
86 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
88 typedef decltype(std::declval<IntensiveQuantities>().fluidState()) IQFluidState;
89 typedef decltype(std::declval<IQFluidState>().pressure(0)) ResultRawType;
92 typedef typename std::remove_const<typename std::remove_reference<ResultRawType>::type>::type ResultType;
93 typedef typename Opm::MathToolbox<ResultType>::ValueType ResultValueType;
97 { Opm::Valgrind::SetUndefined(phaseIdx_); }
101 , phaseIdx_(static_cast<unsigned short>(phaseIdx))
109 { phaseIdx_ =
static_cast<unsigned short>(phaseIdx); }
117 Opm::Valgrind::CheckDefined(phaseIdx_);
118 return elemCtx_.intensiveQuantities(dofIdx, 0).fluidState().pressure(phaseIdx_);
122 const ElementContext& elemCtx_;
123 unsigned short phaseIdx_;
131 template <
class TypeTag,
class Flu
idState>
134 typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
135 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
136 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
138 typedef decltype(std::declval<IntensiveQuantities>().fluidState()) IQRawFluidState;
139 typedef typename std::remove_const<typename std::remove_reference<IQRawFluidState>::type>::type IQFluidState;
140 typedef typename IQFluidState::Scalar IQScalar;
141 typedef Opm::MathToolbox<IQScalar> Toolbox;
144 typedef IQScalar ResultType;
148 , boundaryFs_(boundaryFs)
149 { Opm::Valgrind::SetUndefined(phaseIdx_); }
152 const FluidState& boundaryFs,
155 , boundaryFs_(boundaryFs)
156 , phaseIdx_(static_cast<unsigned short>(phaseIdx))
164 { phaseIdx_ =
static_cast<unsigned short>(phaseIdx); }
172 Opm::Valgrind::CheckDefined(phaseIdx_);
173 return elemCtx_.intensiveQuantities(dofIdx, 0).fluidState().pressure(phaseIdx_);
176 IQScalar boundaryValue()
const 178 Opm::Valgrind::CheckDefined(phaseIdx_);
179 return boundaryFs_.pressure(phaseIdx_);
183 const ElementContext& elemCtx_;
184 const FluidState& boundaryFs_;
185 unsigned short phaseIdx_;
193 template <
class TypeTag>
196 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
197 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
199 typedef decltype(std::declval<IntensiveQuantities>().fluidState()) IQFluidState;
200 typedef decltype(std::declval<IQFluidState>().density(0)) ResultRawType;
203 typedef typename std::remove_const<typename std::remove_reference<ResultRawType>::type>::type ResultType;
204 typedef typename Opm::MathToolbox<ResultType>::ValueType ResultValueType;
208 { Opm::Valgrind::SetUndefined(phaseIdx_); }
212 , phaseIdx_(static_cast<unsigned short>(phaseIdx))
220 { phaseIdx_ =
static_cast<unsigned short>(phaseIdx); }
228 Opm::Valgrind::CheckDefined(phaseIdx_);
229 return elemCtx_.intensiveQuantities(dofIdx, 0).fluidState().density(phaseIdx_);
233 const ElementContext& elemCtx_;
234 unsigned short phaseIdx_;
242 template <
class TypeTag>
245 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
246 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
248 typedef decltype(std::declval<IntensiveQuantities>().fluidState()) IQFluidState;
251 typedef decltype(std::declval<IQFluidState>().molarDensity(0)) ResultType;
252 typedef typename Opm::MathToolbox<ResultType>::ValueType ResultValueType;
256 { Opm::Valgrind::SetUndefined(phaseIdx_); }
260 , phaseIdx_(static_cast<unsigned short>(phaseIdx))
268 { phaseIdx_ =
static_cast<unsigned short>(phaseIdx); }
276 Opm::Valgrind::CheckDefined(phaseIdx_);
277 return elemCtx_.intensiveQuantities(dofIdx, 0).fluidState().molarDensity(phaseIdx_);
281 const ElementContext& elemCtx_;
282 unsigned short phaseIdx_;
290 template <
class TypeTag>
293 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
294 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
296 typedef decltype(std::declval<IntensiveQuantities>().fluidState()) IQFluidState;
297 typedef decltype(std::declval<IQFluidState>().viscosity(0)) ResultRawType;
300 typedef typename std::remove_const<typename std::remove_reference<ResultRawType>::type>::type ResultType;
301 typedef typename Opm::MathToolbox<ResultType>::ValueType ResultValueType;
305 { Opm::Valgrind::SetUndefined(phaseIdx_); }
309 , phaseIdx_(static_cast<unsigned short>(phaseIdx))
317 { phaseIdx_ =
static_cast<unsigned short>(phaseIdx); }
325 Opm::Valgrind::CheckDefined(phaseIdx_);
326 return elemCtx_.intensiveQuantities(dofIdx, 0).fluidState().viscosity(phaseIdx_);
330 const ElementContext& elemCtx_;
331 unsigned short phaseIdx_;
339 template <
class TypeTag>
342 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
343 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
344 typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
346 typedef decltype(IntensiveQuantities().velocityCenter()) ResultRawType;
348 enum { dim = GridView::dimensionworld };
351 typedef typename std::remove_const<typename std::remove_reference<ResultRawType>::type>::type ResultType;
352 typedef typename ResultType::field_type ResultFieldType;
353 typedef typename Opm::MathToolbox<ResultFieldType>::ValueType ResultFieldValueType;
364 {
return elemCtx_.intensiveQuantities(dofIdx, 0).velocityCenter(); }
367 const ElementContext& elemCtx_;
375 template <
class TypeTag>
378 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
379 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
381 typedef decltype(IntensiveQuantities().velocityCenter()[0]) ResultRawType;
384 typedef typename std::remove_const<typename std::remove_reference<ResultRawType>::type>::type ResultType;
385 typedef typename Opm::MathToolbox<ResultType>::ValueType ResultValueType;
389 { Opm::Valgrind::SetUndefined(dimIdx_); }
401 { dimIdx_ = dimIdx; }
409 Opm::Valgrind::CheckDefined(dimIdx_);
410 return elemCtx_.intensiveQuantities(dofIdx, 0).velocityCenter()[dimIdx_];
414 const ElementContext& elemCtx_;
423 template <
class TypeTag>
426 typedef typename GET_PROP_TYPE(TypeTag, ElementContext) ElementContext;
427 typedef typename GET_PROP_TYPE(TypeTag, IntensiveQuantities) IntensiveQuantities;
429 typedef decltype(std::declval<IntensiveQuantities>().fluidState()) IQFluidState;
430 typedef decltype(std::declval<IQFluidState>().moleFraction(0, 0)) ResultRawType;
433 typedef typename std::remove_const<typename std::remove_reference<ResultRawType>::type>::type ResultType;
434 typedef typename Opm::MathToolbox<ResultType>::ValueType ResultValueType;
439 Opm::Valgrind::SetUndefined(phaseIdx_);
440 Opm::Valgrind::SetUndefined(compIdx_);
445 , phaseIdx_(static_cast<unsigned short>(phaseIdx))
446 , compIdx_(static_cast<unsigned short>(compIdx))
454 { phaseIdx_ =
static_cast<unsigned short>(phaseIdx); }
461 { compIdx_ =
static_cast<unsigned short>(compIdx); }
469 Opm::Valgrind::CheckDefined(phaseIdx_);
470 Opm::Valgrind::CheckDefined(compIdx_);
471 return elemCtx_.intensiveQuantities(dofIdx, 0).fluidState().moleFraction(phaseIdx_, compIdx_);
475 const ElementContext& elemCtx_;
476 unsigned short phaseIdx_;
477 unsigned short compIdx_;
ResultType operator()(unsigned dofIdx) const
Return the density of a phase given the index of a degree of freedom within an element context...
Definition: quantitycallbacks.hh:226
ResultType operator()(unsigned dofIdx) const
Return the temperature given the index of a degree of freedom within an element context.
Definition: quantitycallbacks.hh:70
void setPhaseIndex(unsigned phaseIdx)
Set the index of the fluid phase for which the viscosity should be returned.
Definition: quantitycallbacks.hh:316
void setPhaseIndex(unsigned phaseIdx)
Set the index of the fluid phase for which the pressure should be returned.
Definition: quantitycallbacks.hh:163
ResultType operator()(unsigned dofIdx) const
Return the pressure of a phase given the index of a degree of freedom within an element context...
Definition: quantitycallbacks.hh:170
Callback class for the molar density of a phase.
Definition: quantitycallbacks.hh:243
ResultType operator()(unsigned dofIdx) const
Return the mole fraction of a component in a phase given the index of a degree of freedom within an e...
Definition: quantitycallbacks.hh:467
Definition: baseauxiliarymodule.hh:37
Callback class for a phase pressure.
Definition: quantitycallbacks.hh:132
ResultType operator()(unsigned dofIdx) const
Return the viscosity of a phase given the index of a degree of freedom within an element context...
Definition: quantitycallbacks.hh:323
void setPhaseIndex(unsigned phaseIdx)
Set the index of the fluid phase for which the molar density should be returned.
Definition: quantitycallbacks.hh:267
Callback class for the viscosity of a phase.
Definition: quantitycallbacks.hh:291
ResultType operator()(unsigned dofIdx) const
Return the pressure of the specified phase given the index of a degree of freedom within an element c...
Definition: quantitycallbacks.hh:115
void setPhaseIndex(unsigned phaseIdx)
Set the index of the fluid phase for which the density should be returned.
Definition: quantitycallbacks.hh:219
Declare the properties used by the infrastructure code of the finite volume discretizations.
ResultType operator()(unsigned dofIdx) const
Return the velocity of a phase given the index of a degree of freedom within an element context...
Definition: quantitycallbacks.hh:363
void setPhaseIndex(unsigned phaseIdx)
Set the index of the fluid phase for which the pressure should be returned.
Definition: quantitycallbacks.hh:108
Callback class for a phase pressure.
Definition: quantitycallbacks.hh:83
ResultType operator()(unsigned dofIdx) const
Return the molar density of a phase given the index of a degree of freedom within an element context...
Definition: quantitycallbacks.hh:274
void setComponentIndex(unsigned compIdx)
Set the index of the component for which the mole fraction should be returned.
Definition: quantitycallbacks.hh:460
Callback class for the density of a phase.
Definition: quantitycallbacks.hh:194
Callback class for temperature.
Definition: quantitycallbacks.hh:47
Callback class for the velocity of a phase at the center of a DOF.
Definition: quantitycallbacks.hh:376
void setPhaseIndex(unsigned phaseIdx)
Set the index of the fluid phase for which a mole fraction should be returned.
Definition: quantitycallbacks.hh:453
Callback class for a mole fraction of a component in a phase.
Definition: quantitycallbacks.hh:424
void setDimIndex(unsigned dimIdx)
Set the index of the component of the velocity which should be returned.
Definition: quantitycallbacks.hh:400
ResultType operator()(unsigned dofIdx) const
Return the velocity of a phase given the index of a degree of freedom within an element context...
Definition: quantitycallbacks.hh:407
Callback class for the velocity of a phase at the center of a DOF.
Definition: quantitycallbacks.hh:340