fluid systems: make the ParameterCache mechanism work with Evaluation<>

so far, using function evaluation objects instead of primitive
floating point scalars only worked for trivial parameter caches which
do not store any values (most of the time, this means that the
ParameterCache is `NullParameterCache`), or it explicitly did not work
(like for `Spe5ParameterCache`). this patch fixes the problem by
making the parameter caches of fluid systems template classes which
are templated on the type of scalar values. On the flipside, this
requires changes to all downstream modules that use fluid systems.
This commit is contained in:
Andreas Lauser 2016-04-17 11:28:04 +02:00
parent d44dd50cb7
commit 6f9451ba06
20 changed files with 252 additions and 243 deletions

View File

@ -297,18 +297,19 @@ void checkFluidSystem()
" as the one passed to the checkFluidSystem() function"); " as the one passed to the checkFluidSystem() function");
// check whether the parameter cache adheres to the API // check whether the parameter cache adheres to the API
typedef typename FluidSystem::ParameterCache PC; typedef typename FluidSystem::template ParameterCache<LhsEval> ParameterCache;
PC paramCache;
ParameterCache paramCache;
try { paramCache.updateAll(fs); } catch (...) {}; try { paramCache.updateAll(fs); } catch (...) {};
try { paramCache.updateAll(fs, /*except=*/PC::None); } catch (...) {}; try { paramCache.updateAll(fs, /*except=*/ParameterCache::None); } catch (...) {};
try { paramCache.updateAll(fs, /*except=*/PC::Temperature | PC::Pressure | PC::Composition); } catch (...) {}; try { paramCache.updateAll(fs, /*except=*/ParameterCache::Temperature | ParameterCache::Pressure | ParameterCache::Composition); } catch (...) {};
try { paramCache.updateAllPressures(fs); } catch (...) {}; try { paramCache.updateAllPressures(fs); } catch (...) {};
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
fs.restrictToPhase(static_cast<int>(phaseIdx)); fs.restrictToPhase(static_cast<int>(phaseIdx));
try { paramCache.updatePhase(fs, phaseIdx); } catch (...) {}; try { paramCache.updatePhase(fs, phaseIdx); } catch (...) {};
try { paramCache.updatePhase(fs, phaseIdx, /*except=*/PC::None); } catch (...) {}; try { paramCache.updatePhase(fs, phaseIdx, /*except=*/ParameterCache::None); } catch (...) {};
try { paramCache.updatePhase(fs, phaseIdx, /*except=*/PC::Temperature | PC::Pressure | PC::Composition); } catch (...) {}; try { paramCache.updatePhase(fs, phaseIdx, /*except=*/ParameterCache::Temperature | ParameterCache::Pressure | ParameterCache::Composition); } catch (...) {};
try { paramCache.updateTemperature(fs, phaseIdx); } catch (...) {}; try { paramCache.updateTemperature(fs, phaseIdx); } catch (...) {};
try { paramCache.updatePressure(fs, phaseIdx); } catch (...) {}; try { paramCache.updatePressure(fs, phaseIdx); } catch (...) {};
try { paramCache.updateComposition(fs, phaseIdx); } catch (...) {}; try { paramCache.updateComposition(fs, phaseIdx); } catch (...) {};

View File

@ -55,8 +55,6 @@ class CompositionFromFugacities
{ {
enum { numComponents = FluidSystem::numComponents }; enum { numComponents = FluidSystem::numComponents };
typedef typename FluidSystem::ParameterCache ParameterCache;
public: public:
typedef Dune::FieldVector<Evaluation, numComponents> ComponentVector; typedef Dune::FieldVector<Evaluation, numComponents> ComponentVector;
@ -65,7 +63,6 @@ public:
*/ */
template <class FluidState> template <class FluidState>
static void guessInitial(FluidState &fluidState, static void guessInitial(FluidState &fluidState,
ParameterCache &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
const ComponentVector &/*fugVec*/) const ComponentVector &/*fugVec*/)
{ {
@ -89,7 +86,7 @@ public:
*/ */
template <class FluidState> template <class FluidState>
static void solve(FluidState &fluidState, static void solve(FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
unsigned phaseIdx, unsigned phaseIdx,
const ComponentVector &targetFug) const ComponentVector &targetFug)
{ {
@ -195,7 +192,7 @@ protected:
// independent of the phase's composition. // independent of the phase's composition.
template <class FluidState> template <class FluidState>
static void solveIdealMix_(FluidState &fluidState, static void solveIdealMix_(FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
unsigned phaseIdx, unsigned phaseIdx,
const ComponentVector &fugacities) const ComponentVector &fugacities)
{ {
@ -223,7 +220,7 @@ protected:
static Scalar linearize_(Dune::FieldMatrix<Evaluation, numComponents, numComponents> &J, static Scalar linearize_(Dune::FieldMatrix<Evaluation, numComponents, numComponents> &J,
Dune::FieldVector<Evaluation, numComponents> &defect, Dune::FieldVector<Evaluation, numComponents> &defect,
FluidState &fluidState, FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
unsigned phaseIdx, unsigned phaseIdx,
const ComponentVector &targetFug) const ComponentVector &targetFug)
{ {
@ -295,7 +292,7 @@ protected:
template <class FluidState> template <class FluidState>
static Scalar update_(FluidState &fluidState, static Scalar update_(FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
Dune::FieldVector<Evaluation, numComponents> &x, Dune::FieldVector<Evaluation, numComponents> &x,
Dune::FieldVector<Evaluation, numComponents> &/*b*/, Dune::FieldVector<Evaluation, numComponents> &/*b*/,
unsigned phaseIdx, unsigned phaseIdx,

View File

@ -105,9 +105,9 @@ public:
* enthalpy/internal energy of each phase * enthalpy/internal energy of each phase
* should also be set. * should also be set.
*/ */
template <class FluidState, class ParameterCache> template <class FluidState>
static void solve(FluidState &fluidState, static void solve(FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar> &paramCache,
unsigned refPhaseIdx, unsigned refPhaseIdx,
bool setViscosity, bool setViscosity,
bool setEnthalpy) bool setEnthalpy)

View File

@ -74,7 +74,6 @@ class ImmiscibleFlash
"Immiscibility assumes that the number of phases" "Immiscibility assumes that the number of phases"
" is equal to the number of components"); " is equal to the number of components");
typedef typename FluidSystem::ParameterCache ParameterCache;
static const int numEq = numPhases; static const int numEq = numPhases;
@ -87,16 +86,10 @@ public:
/*! /*!
* \brief Guess initial values for all quantities. * \brief Guess initial values for all quantities.
*/ */
template <class FluidState> template <class FluidState, class Evaluation = typename FluidState::Scalar>
static void guessInitial(FluidState &fluidState, static void guessInitial(FluidState &fluidState,
ParameterCache &/*paramCache*/, const Dune::FieldVector<Evaluation, numComponents>& /*globalMolarities*/)
const ComponentVector &globalMolarities)
{ {
// the sum of all molarities
Scalar sumMoles = 0;
for (unsigned compIdx = 0; compIdx < numComponents; ++compIdx)
sumMoles += globalMolarities[compIdx];
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
// pressure. use atmospheric pressure as initial guess // pressure. use atmospheric pressure as initial guess
fluidState.setPressure(phaseIdx, 2e5); fluidState.setPressure(phaseIdx, 2e5);
@ -114,12 +107,14 @@ public:
*/ */
template <class MaterialLaw, class FluidState> template <class MaterialLaw, class FluidState>
static void solve(FluidState &fluidState, static void solve(FluidState &fluidState,
ParameterCache &paramCache,
const typename MaterialLaw::Params &matParams, const typename MaterialLaw::Params &matParams,
const ComponentVector &globalMolarities) typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
const Dune::FieldVector<typename FluidState::Scalar, numComponents>& globalMolarities)
{ {
Dune::FMatrixPrecision<Scalar>::set_singular_limit(1e-25); Dune::FMatrixPrecision<Scalar>::set_singular_limit(1e-25);
paramCache.updateAll(fluidState);
///////////////////////// /////////////////////////
// Check if all fluid phases are incompressible // Check if all fluid phases are incompressible
///////////////////////// /////////////////////////
@ -132,7 +127,6 @@ public:
}; };
if (allIncompressible) { if (allIncompressible) {
paramCache.updateAll(fluidState);
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
Scalar rho = FluidSystem::density(fluidState, paramCache, phaseIdx); Scalar rho = FluidSystem::density(fluidState, paramCache, phaseIdx);
fluidState.setDensity(phaseIdx, rho); fluidState.setDensity(phaseIdx, rho);
@ -159,12 +153,12 @@ public:
Valgrind::SetUndefined(deltaX); Valgrind::SetUndefined(deltaX);
Valgrind::SetUndefined(b); Valgrind::SetUndefined(b);
completeFluidState_<MaterialLaw>(fluidState, paramCache, matParams); completeFluidState_<MaterialLaw>(fluidState, matParams, paramCache);
const int nMax = 50; // <- maximum number of newton iterations const int nMax = 50; // <- maximum number of newton iterations
for (int nIdx = 0; nIdx < nMax; ++nIdx) { for (int nIdx = 0; nIdx < nMax; ++nIdx) {
// calculate Jacobian matrix and right hand side // calculate Jacobian matrix and right hand side
linearize_<MaterialLaw>(J, b, fluidState, paramCache, matParams, globalMolarities); linearize_<MaterialLaw>(J, b, fluidState, matParams, paramCache, globalMolarities);
Valgrind::CheckDefined(J); Valgrind::CheckDefined(J);
Valgrind::CheckDefined(b); Valgrind::CheckDefined(b);
@ -205,7 +199,7 @@ public:
*/ */
// update the fluid quantities. // update the fluid quantities.
Scalar relError = update_<MaterialLaw>(fluidState, paramCache, matParams, deltaX); Scalar relError = update_<MaterialLaw>(fluidState, matParams, paramCache, deltaX);
if (relError < 1e-9) if (relError < 1e-9)
return; return;
@ -260,12 +254,13 @@ protected:
static void linearize_(Matrix &J, static void linearize_(Matrix &J,
Vector &b, Vector &b,
FluidState &fluidState, FluidState &fluidState,
ParameterCache &paramCache,
const typename MaterialLaw::Params &matParams, const typename MaterialLaw::Params &matParams,
typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
const ComponentVector &globalMolarities) const ComponentVector &globalMolarities)
{ {
// copy the undisturbed fluid state and parameter cache
FluidState origFluidState(fluidState); FluidState origFluidState(fluidState);
ParameterCache origParamCache(paramCache); auto origParamCache(paramCache);
Vector tmp; Vector tmp;
@ -287,7 +282,7 @@ protected:
// deviate the mole fraction of the i-th component // deviate the mole fraction of the i-th component
Scalar xI = getQuantity_(fluidState, pvIdx); Scalar xI = getQuantity_(fluidState, pvIdx);
const Scalar eps = 1e-10/quantityWeight_(fluidState, pvIdx); const Scalar eps = 1e-10/quantityWeight_(fluidState, pvIdx);
setQuantity_<MaterialLaw>(fluidState, paramCache, matParams, pvIdx, xI + eps); setQuantity_<MaterialLaw>(fluidState, matParams, paramCache, pvIdx, xI + eps);
assert(std::abs(getQuantity_(fluidState, pvIdx) - (xI + eps)) assert(std::abs(getQuantity_(fluidState, pvIdx) - (xI + eps))
<= std::max<Scalar>(1.0, std::abs(xI))*std::numeric_limits<Scalar>::epsilon()*100); <= std::max<Scalar>(1.0, std::abs(xI))*std::numeric_limits<Scalar>::epsilon()*100);
@ -324,11 +319,11 @@ protected:
} }
} }
template <class MaterialLaw, class FluidState> template <class MaterialLaw, class FlashFluidState, class EvalVector>
static Scalar update_(FluidState &fluidState, static Scalar update_(FlashFluidState& fluidState,
ParameterCache &paramCache,
const typename MaterialLaw::Params& matParams, const typename MaterialLaw::Params& matParams,
const Vector &deltaX) typename FluidSystem::template ParameterCache<typename FlashFluidState::Scalar>& paramCache,
const EvalVector& deltaX)
{ {
Scalar relError = 0; Scalar relError = 0;
for (unsigned pvIdx = 0; pvIdx < numEq; ++ pvIdx) { for (unsigned pvIdx = 0; pvIdx < numEq; ++ pvIdx) {
@ -352,16 +347,18 @@ protected:
setQuantityRaw_(fluidState, pvIdx, tmp - delta); setQuantityRaw_(fluidState, pvIdx, tmp - delta);
} }
completeFluidState_<MaterialLaw>(fluidState, paramCache, matParams); completeFluidState_<MaterialLaw>(fluidState, matParams, paramCache);
return relError; return relError;
} }
template <class MaterialLaw, class FluidState> template <class MaterialLaw, class FluidState>
static void completeFluidState_(FluidState &fluidState, static void completeFluidState_(FluidState &fluidState,
ParameterCache &paramCache, const typename MaterialLaw::Params &matParams,
const typename MaterialLaw::Params &matParams) typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache)
{ {
typedef typename FluidSystem::template ParameterCache<typename FluidState::Scalar> ParamCache;
// calculate the saturation of the last phase as a function of // calculate the saturation of the last phase as a function of
// the other saturations // the other saturations
Scalar sumSat = 0.0; Scalar sumSat = 0.0;
@ -393,7 +390,7 @@ protected:
+ (pC[phaseIdx] - pC[0])); + (pC[phaseIdx] - pC[0]));
// update the parameter cache // update the parameter cache
paramCache.updateAll(fluidState, /*except=*/ParameterCache::Temperature|ParameterCache::Composition); paramCache.updateAll(fluidState, /*except=*/ParamCache::Temperature|ParamCache::Composition);
// update all densities // update all densities
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
@ -430,8 +427,8 @@ protected:
// set a quantity in the fluid state // set a quantity in the fluid state
template <class MaterialLaw, class FluidState> template <class MaterialLaw, class FluidState>
static void setQuantity_(FluidState &fs, static void setQuantity_(FluidState &fs,
ParameterCache &paramCache,
const typename MaterialLaw::Params &matParams, const typename MaterialLaw::Params &matParams,
typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
unsigned pvIdx, unsigned pvIdx,
Scalar value) Scalar value)
{ {
@ -445,6 +442,8 @@ protected:
// pressure does not depend on absolute pressure. // pressure does not depend on absolute pressure.
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
fs.setPressure(phaseIdx, fs.pressure(phaseIdx) + delta); fs.setPressure(phaseIdx, fs.pressure(phaseIdx) + delta);
// update the parameter cache
paramCache.updateAllPressures(fs); paramCache.updateAllPressures(fs);
// update all densities // update all densities
@ -473,6 +472,8 @@ protected:
fs.setPressure(phaseIdx, fs.setPressure(phaseIdx,
fs.pressure(0) fs.pressure(0)
+ (pC[phaseIdx] - pC[0])); + (pC[phaseIdx] - pC[0]));
// update the parameter cache
paramCache.updateAllPressures(fs); paramCache.updateAllPressures(fs);
// update all densities // update all densities

View File

@ -88,8 +88,6 @@ class NcpFlash
enum { numPhases = FluidSystem::numPhases }; enum { numPhases = FluidSystem::numPhases };
enum { numComponents = FluidSystem::numComponents }; enum { numComponents = FluidSystem::numComponents };
typedef typename FluidSystem::ParameterCache ParameterCache;
static const int numEq = numPhases*(numComponents + 1); static const int numEq = numPhases*(numComponents + 1);
public: public:
@ -98,7 +96,6 @@ public:
*/ */
template <class FluidState, class Evaluation = typename FluidState::Scalar> template <class FluidState, class Evaluation = typename FluidState::Scalar>
static void guessInitial(FluidState &fluidState, static void guessInitial(FluidState &fluidState,
ParameterCache &paramCache,
const Dune::FieldVector<Evaluation, numComponents>& globalMolarities) const Dune::FieldVector<Evaluation, numComponents>& globalMolarities)
{ {
// the sum of all molarities // the sum of all molarities
@ -121,6 +118,7 @@ public:
} }
// set the fugacity coefficients of all components in all phases // set the fugacity coefficients of all components in all phases
typename FluidSystem::template ParameterCache<Evaluation> paramCache;
paramCache.updateAll(fluidState); paramCache.updateAll(fluidState);
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
for (unsigned compIdx = 0; compIdx < numComponents; ++ compIdx) { for (unsigned compIdx = 0; compIdx < numComponents; ++ compIdx) {
@ -139,8 +137,8 @@ public:
*/ */
template <class MaterialLaw, class FluidState> template <class MaterialLaw, class FluidState>
static void solve(FluidState &fluidState, static void solve(FluidState &fluidState,
ParameterCache &paramCache,
const typename MaterialLaw::Params &matParams, const typename MaterialLaw::Params &matParams,
typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
const Dune::FieldVector<typename FluidState::Scalar, numComponents>& globalMolarities, const Dune::FieldVector<typename FluidState::Scalar, numComponents>& globalMolarities,
Scalar tolerance = -1.0) Scalar tolerance = -1.0)
{ {
@ -265,15 +263,12 @@ public:
const ComponentVector &globalMolarities, const ComponentVector &globalMolarities,
Scalar tolerance = 0.0) Scalar tolerance = 0.0)
{ {
ParameterCache paramCache;
paramCache.updateAll(fluidState);
typedef NullMaterialTraits<Scalar, numPhases> MaterialTraits; typedef NullMaterialTraits<Scalar, numPhases> MaterialTraits;
typedef NullMaterial<MaterialTraits> MaterialLaw; typedef NullMaterial<MaterialTraits> MaterialLaw;
typedef typename MaterialLaw::Params MaterialLawParams; typedef typename MaterialLaw::Params MaterialLawParams;
MaterialLawParams matParams; MaterialLawParams matParams;
solve<MaterialLaw>(fluidState, paramCache, matParams, globalMolarities, tolerance); solve<MaterialLaw>(fluidState, matParams, globalMolarities, tolerance);
} }
@ -331,14 +326,14 @@ protected:
static void linearize_(Matrix &J, static void linearize_(Matrix &J,
Vector &b, Vector &b,
FluidState &fluidState, FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
const typename MaterialLaw::Params &matParams, const typename MaterialLaw::Params &matParams,
const ComponentVector &globalMolarities) const ComponentVector &globalMolarities)
{ {
typedef typename FluidState::Scalar Evaluation; typedef typename FluidState::Scalar Evaluation;
FluidState origFluidState(fluidState); FluidState origFluidState(fluidState);
ParameterCache origParamCache(paramCache); auto origParamCache(paramCache);
Vector tmp; Vector tmp;
@ -444,7 +439,7 @@ protected:
template <class MaterialLaw, class FluidState, class Vector> template <class MaterialLaw, class FluidState, class Vector>
static Scalar update_(FluidState &fluidState, static Scalar update_(FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
const typename MaterialLaw::Params &matParams, const typename MaterialLaw::Params &matParams,
const Vector &deltaX) const Vector &deltaX)
{ {
@ -522,10 +517,11 @@ protected:
template <class MaterialLaw, class FluidState> template <class MaterialLaw, class FluidState>
static void completeFluidState_(FluidState &fluidState, static void completeFluidState_(FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
const typename MaterialLaw::Params &matParams) const typename MaterialLaw::Params &matParams)
{ {
typedef typename FluidState::Scalar Evaluation; typedef typename FluidState::Scalar Evaluation;
typedef typename FluidSystem::template ParameterCache<Evaluation> ParameterCache;
// calculate the saturation of the last phase as a function of // calculate the saturation of the last phase as a function of
// the other saturations // the other saturations
@ -596,7 +592,7 @@ protected:
// set a quantity in the fluid state // set a quantity in the fluid state
template <class MaterialLaw, class FluidState> template <class MaterialLaw, class FluidState>
static void setQuantity_(FluidState &fluidState, static void setQuantity_(FluidState &fluidState,
ParameterCache &paramCache, typename FluidSystem::template ParameterCache<typename FluidState::Scalar>& paramCache,
const typename MaterialLaw::Params &matParams, const typename MaterialLaw::Params &matParams,
unsigned pvIdx, unsigned pvIdx,
const typename FluidState::Scalar& value) const typename FluidState::Scalar& value)

View File

@ -51,12 +51,14 @@ public:
/*! /*!
* \brief The type of the fluid system's parameter cache * \brief The type of the fluid system's parameter cache
* *
* The parameter cache can be used to avoid re-calculating * The parameter cache can be used to avoid re-calculating expensive parameters for
* expensive parameters for multiple quantities. Be aware that * multiple quantities. Be aware that what the parameter cache actually does is
* what the parameter cache actually does is specific for each * specific for each fluid system and that it is opaque outside the fluid system.
* fluid system and that it is opaque outside the fluid system.
*/ */
typedef NullParameterCache ParameterCache; template <class Evaluation>
struct ParameterCache {
ParameterCache() = delete; // derived fluid systems must specify this class!
};
//! Number of chemical species in the fluid system //! Number of chemical species in the fluid system
static const int numComponents = -1000; static const int numComponents = -1000;
@ -167,9 +169,9 @@ public:
* \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::fluidSystemBaseParams
* \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::phaseIdxParam
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParameterCache = NullParameterCache> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCache>
static LhsEval density(const FluidState& /*fluidState*/, static LhsEval density(const FluidState& /*fluidState*/,
const ParameterCache &/*paramCache*/, const ParamCache& /*paramCache*/,
unsigned /*phaseIdx*/) unsigned /*phaseIdx*/)
{ {
OPM_THROW(std::runtime_error, OPM_THROW(std::runtime_error,
@ -190,9 +192,9 @@ public:
* \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::phaseIdxParam
* \copydoc Doxygen::compIdxParam * \copydoc Doxygen::compIdxParam
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParameterCache = NullParameterCache> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCache>
static LhsEval fugacityCoefficient(const FluidState& /*fluidState*/, static LhsEval fugacityCoefficient(const FluidState& /*fluidState*/,
const ParameterCache &/*paramCache*/, ParamCache& /*paramCache*/,
unsigned /*phaseIdx*/, unsigned /*phaseIdx*/,
unsigned /*compIdx*/) unsigned /*compIdx*/)
{ {
@ -205,9 +207,9 @@ public:
* \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::fluidSystemBaseParams
* \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::phaseIdxParam
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParameterCache = NullParameterCache> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCache>
static LhsEval viscosity(const FluidState& /*fluidState*/, static LhsEval viscosity(const FluidState& /*fluidState*/,
const ParameterCache &/*paramCache*/, ParamCache& /*paramCache*/,
unsigned /*phaseIdx*/) unsigned /*phaseIdx*/)
{ {
OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide a viscosity() method!"); OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide a viscosity() method!");
@ -230,9 +232,9 @@ public:
* \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::phaseIdxParam
* \copydoc Doxygen::compIdxParam * \copydoc Doxygen::compIdxParam
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParameterCache = NullParameterCache> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCache>
static LhsEval diffusionCoefficient(const FluidState& /*fluidState*/, static LhsEval diffusionCoefficient(const FluidState& /*fluidState*/,
const ParameterCache &/*paramCache*/, ParamCache& /*paramCache*/,
unsigned /*phaseIdx*/, unsigned /*phaseIdx*/,
unsigned /*compIdx*/) unsigned /*compIdx*/)
{ {
@ -246,9 +248,9 @@ public:
* \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::fluidSystemBaseParams
* \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::phaseIdxParam
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParameterCache = NullParameterCache> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCache>
static LhsEval enthalpy(const FluidState& /*fluidState*/, static LhsEval enthalpy(const FluidState& /*fluidState*/,
const ParameterCache &/*paramCache*/, ParamCache& /*paramCache*/,
unsigned /*phaseIdx*/) unsigned /*phaseIdx*/)
{ {
OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide an enthalpy() method!"); OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide an enthalpy() method!");
@ -260,9 +262,9 @@ public:
* \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::fluidSystemBaseParams
* \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::phaseIdxParam
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParameterCache = NullParameterCache> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCache>
static LhsEval thermalConductivity(const FluidState& /*fluidState*/, static LhsEval thermalConductivity(const FluidState& /*fluidState*/,
const ParameterCache &/*paramCache*/, ParamCache& /*paramCache*/,
unsigned /*phaseIdx*/) unsigned /*phaseIdx*/)
{ {
OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide a thermalConductivity() method!"); OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide a thermalConductivity() method!");
@ -274,9 +276,9 @@ public:
* \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::fluidSystemBaseParams
* \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::phaseIdxParam
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParameterCache = NullParameterCache> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCache>
static LhsEval heatCapacity(const FluidState& /*fluidState*/, static LhsEval heatCapacity(const FluidState& /*fluidState*/,
const ParameterCache &/*paramCache*/, ParamCache& /*paramCache*/,
unsigned /*phaseIdx*/) unsigned /*phaseIdx*/)
{ {
OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide a heatCapacity() method!"); OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className<Implementation>() << "' does not provide a heatCapacity() method!");

View File

@ -113,7 +113,8 @@ public:
typedef Opm::WaterPvtMultiplexer<Scalar> WaterPvt; typedef Opm::WaterPvtMultiplexer<Scalar> WaterPvt;
//! \copydoc BaseFluidSystem::ParameterCache //! \copydoc BaseFluidSystem::ParameterCache
class ParameterCache : public Opm::NullParameterCache template <class Evaluation>
struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{ {
public: public:
ParameterCache(int /*regionIdx*/=0) ParameterCache(int /*regionIdx*/=0)
@ -396,24 +397,24 @@ public:
* thermodynamic quantities (generic version, only isothermal) * thermodynamic quantities (generic version, only isothermal)
****************************************/ ****************************************/
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
ParameterCache &paramCache, const ParameterCache<ParamCacheEval> &paramCache,
unsigned phaseIdx) unsigned phaseIdx)
{ return density<FluidState, LhsEval>(fluidState, phaseIdx, paramCache.regionIndex()); } { return density<FluidState, LhsEval>(fluidState, phaseIdx, paramCache.regionIndex()); }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &paramCache, const ParameterCache<ParamCacheEval> &paramCache,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ return fugacityCoefficient<FluidState, LhsEval>(fluidState, phaseIdx, compIdx, paramCache.regionIndex()); } { return fugacityCoefficient<FluidState, LhsEval>(fluidState, phaseIdx, compIdx, paramCache.regionIndex()); }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &paramCache, const ParameterCache<ParamCacheEval> &paramCache,
unsigned phaseIdx) unsigned phaseIdx)
{ return viscosity<FluidState, LhsEval>(fluidState, phaseIdx, paramCache.regionIndex()); } { return viscosity<FluidState, LhsEval>(fluidState, phaseIdx, paramCache.regionIndex()); }

View File

@ -69,12 +69,13 @@ class BrineCO2
typedef H2O_Tabulated H2O; typedef H2O_Tabulated H2O;
public: public:
template <class Evaluation>
struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{};
//! The binary coefficients for brine and CO2 used by this fluid system //! The binary coefficients for brine and CO2 used by this fluid system
typedef Opm::BinaryCoeff::Brine_CO2<Scalar, CO2Tables> BinaryCoeffBrineCO2; typedef Opm::BinaryCoeff::Brine_CO2<Scalar, CO2Tables> BinaryCoeffBrineCO2;
//! \copydoc BaseFluidSystem::ParameterCache
typedef Opm::NullParameterCache ParameterCache;
/**************************************** /****************************************
* Fluid phase related static parameters * Fluid phase related static parameters
****************************************/ ****************************************/
@ -228,9 +229,9 @@ public:
/*! /*!
* \copydoc BaseFluidSystem::density * \copydoc BaseFluidSystem::density
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -282,9 +283,9 @@ public:
/*! /*!
* \copydoc BaseFluidSystem::viscosity * \copydoc BaseFluidSystem::viscosity
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -311,9 +312,9 @@ public:
/*! /*!
* \copydoc BaseFluidSystem::fugacityCoefficient * \copydoc BaseFluidSystem::fugacityCoefficient
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -368,9 +369,9 @@ public:
/*! /*!
* \copydoc BaseFluidSystem::diffusionCoefficient * \copydoc BaseFluidSystem::diffusionCoefficient
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval diffusionCoefficient(const FluidState &fluidState, static LhsEval diffusionCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned /*compIdx*/) unsigned /*compIdx*/)
{ {
@ -388,9 +389,9 @@ public:
/*! /*!
* \copydoc BaseFluidSystem::enthalpy * \copydoc BaseFluidSystem::enthalpy
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -425,9 +426,9 @@ public:
/*! /*!
* \copydoc BaseFluidSystem::thermalConductivity * \copydoc BaseFluidSystem::thermalConductivity
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval thermalConductivity(const FluidState &/*fluidState*/, static LhsEval thermalConductivity(const FluidState &/*fluidState*/,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<LhsEval> LhsToolbox; typedef MathToolbox<LhsEval> LhsToolbox;
@ -452,9 +453,9 @@ public:
* \param phaseIdx The index of the fluid phase to consider * \param phaseIdx The index of the fluid phase to consider
* \tparam FluidState the fluid state class * \tparam FluidState the fluid state class
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval heatCapacity(const FluidState &fluidState, static LhsEval heatCapacity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -67,8 +67,9 @@ class H2OAir
typedef Opm::IdealGas<Scalar> IdealGas; typedef Opm::IdealGas<Scalar> IdealGas;
public: public:
//! \copydoc BaseFluidSystem::ParameterCache template <class Evaluation>
typedef NullParameterCache ParameterCache; struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{};
//! The type of the water component used for this fluid system //! The type of the water component used for this fluid system
typedef H2Otype H2O; typedef H2Otype H2O;
@ -253,9 +254,9 @@ public:
} }
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -319,9 +320,9 @@ public:
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<LhsEval> LhsToolbox; typedef Opm::MathToolbox<LhsEval> LhsToolbox;
@ -388,9 +389,9 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -414,9 +415,9 @@ public:
} }
//! \copydoc BaseFluidSystem::diffusionCoefficient //! \copydoc BaseFluidSystem::diffusionCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval binaryDiffusionCoefficient(const FluidState &fluidState, static LhsEval binaryDiffusionCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned /*compIdx*/) unsigned /*compIdx*/)
{ {
@ -433,9 +434,9 @@ public:
} }
//! \copydoc BaseFluidSystem::enthalpy //! \copydoc BaseFluidSystem::enthalpy
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -467,9 +468,9 @@ public:
} }
//! \copydoc BaseFluidSystem::thermalConductivity //! \copydoc BaseFluidSystem::thermalConductivity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval thermalConductivity(const FluidState &fluidState, static LhsEval thermalConductivity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -63,8 +63,9 @@ class H2OAirMesitylene
typedef Opm::TabulatedComponent<Scalar, IapwsH2O, /*alongVaporPressure=*/false> TabulatedH2O; typedef Opm::TabulatedComponent<Scalar, IapwsH2O, /*alongVaporPressure=*/false> TabulatedH2O;
public: public:
//! \copydoc BaseFluidSystem::ParameterCache template <class Evaluation>
typedef NullParameterCache ParameterCache; struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{};
//! The type of the mesithylene/napl component //! The type of the mesithylene/napl component
typedef Opm::Mesitylene<Scalar> NAPL; typedef Opm::Mesitylene<Scalar> NAPL;
@ -197,9 +198,9 @@ public:
} }
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -244,9 +245,9 @@ public:
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -308,9 +309,9 @@ public:
} }
//! \copydoc BaseFluidSystem::diffusionCoefficient //! \copydoc BaseFluidSystem::diffusionCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval diffusionCoefficient(const FluidState &/*fluidState*/, static LhsEval diffusionCoefficient(const FluidState &/*fluidState*/,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned /*phaseIdx*/, unsigned /*phaseIdx*/,
unsigned /*compIdx*/) unsigned /*compIdx*/)
{ {
@ -369,9 +370,9 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -418,9 +419,9 @@ public:
//! \copydoc BaseFluidSystem::enthalpy //! \copydoc BaseFluidSystem::enthalpy
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -447,9 +448,9 @@ public:
} }
//! \copydoc BaseFluidSystem::thermalConductivity //! \copydoc BaseFluidSystem::thermalConductivity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval thermalConductivity(const FluidState &fluidState, static LhsEval thermalConductivity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -56,8 +56,9 @@ class H2OAirXylene
typedef BaseFluidSystem<Scalar, ThisType> Base; typedef BaseFluidSystem<Scalar, ThisType> Base;
public: public:
//! \copydoc BaseFluidSystem::ParameterCache template <class Evaluation>
typedef NullParameterCache ParameterCache; struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{};
//! The type of the water component //! The type of the water component
typedef Opm::H2O<Scalar> H2O; typedef Opm::H2O<Scalar> H2O;
@ -164,9 +165,9 @@ public:
} }
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -207,9 +208,9 @@ public:
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -271,9 +272,9 @@ public:
} }
//! \copydoc BaseFluidSystem::diffusionCoefficient //! \copydoc BaseFluidSystem::diffusionCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval diffusionCoefficient(const FluidState &fluidState, static LhsEval diffusionCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -325,9 +326,9 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -370,9 +371,9 @@ public:
} }
//! \copydoc BaseFluidSystem::enthalpy //! \copydoc BaseFluidSystem::enthalpy
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -67,7 +67,8 @@ class H2ON2
public: public:
//! \copydoc BaseFluidSystem::ParameterCache //! \copydoc BaseFluidSystem::ParameterCache
typedef NullParameterCache ParameterCache; template <class Evaluation>
using ParameterCache = NullParameterCache<Evaluation>;
/**************************************** /****************************************
* Fluid phase related static parameters * Fluid phase related static parameters
@ -264,9 +265,9 @@ public:
* of a multiphase multicomponent model for PEMFC - Technical report: IRTG-NUPUS", * of a multiphase multicomponent model for PEMFC - Technical report: IRTG-NUPUS",
* University of Stuttgart, 2008 * University of Stuttgart, 2008
*/ */
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
assert(0 <= phaseIdx && phaseIdx < numPhases); assert(0 <= phaseIdx && phaseIdx < numPhases);
@ -321,9 +322,9 @@ public:
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
assert(0 <= phaseIdx && phaseIdx < numPhases); assert(0 <= phaseIdx && phaseIdx < numPhases);
@ -382,9 +383,9 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -411,9 +412,9 @@ public:
} }
//! \copydoc BaseFluidSystem::diffusionCoefficient //! \copydoc BaseFluidSystem::diffusionCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval diffusionCoefficient(const FluidState &fluidState, static LhsEval diffusionCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned /*compIdx*/) unsigned /*compIdx*/)
@ -433,9 +434,9 @@ public:
} }
//! \copydoc BaseFluidSystem::enthalpy //! \copydoc BaseFluidSystem::enthalpy
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -467,9 +468,9 @@ public:
} }
//! \copydoc BaseFluidSystem::thermalConductivity //! \copydoc BaseFluidSystem::thermalConductivity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval thermalConductivity(const FluidState &fluidState, static LhsEval thermalConductivity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
assert(0 <= phaseIdx && phaseIdx < numPhases); assert(0 <= phaseIdx && phaseIdx < numPhases);
@ -502,9 +503,9 @@ public:
} }
//! \copydoc BaseFluidSystem::heatCapacity //! \copydoc BaseFluidSystem::heatCapacity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval heatCapacity(const FluidState &fluidState, static LhsEval heatCapacity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -67,7 +67,9 @@ class H2ON2LiquidPhase
public: public:
//! \copydoc BaseFluidSystem::ParameterCache //! \copydoc BaseFluidSystem::ParameterCache
typedef NullParameterCache ParameterCache; template <class Evaluation>
struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{};
/**************************************** /****************************************
* Fluid phase related static parameters * Fluid phase related static parameters
@ -248,9 +250,9 @@ public:
} }
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -285,9 +287,9 @@ public:
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -302,9 +304,9 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -322,9 +324,9 @@ public:
} }
//! \copydoc BaseFluidSystem::diffusionCoefficient //! \copydoc BaseFluidSystem::diffusionCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval diffusionCoefficient(const FluidState &fluidState, static LhsEval diffusionCoefficient(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned /*compIdx*/) unsigned /*compIdx*/)
@ -340,9 +342,9 @@ public:
} }
//! \copydoc BaseFluidSystem::enthalpy //! \copydoc BaseFluidSystem::enthalpy
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -359,9 +361,9 @@ public:
} }
//! \copydoc BaseFluidSystem::thermalConductivity //! \copydoc BaseFluidSystem::thermalConductivity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval thermalConductivity(const FluidState &fluidState, static LhsEval thermalConductivity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
const unsigned phaseIdx) const unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -378,9 +380,9 @@ public:
} }
//! \copydoc BaseFluidSystem::heatCapacity //! \copydoc BaseFluidSystem::heatCapacity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval heatCapacity(const FluidState &fluidState, static LhsEval heatCapacity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -35,7 +35,8 @@ namespace Opm {
* \ingroup Fluidsystems * \ingroup Fluidsystems
* \brief A parameter cache which does nothing * \brief A parameter cache which does nothing
*/ */
class NullParameterCache : public ParameterCacheBase<NullParameterCache> template <class Evaluation>
class NullParameterCache : public ParameterCacheBase<NullParameterCache<Evaluation> >
{ {
public: public:
NullParameterCache() NullParameterCache()

View File

@ -63,7 +63,9 @@ class SinglePhase
public: public:
//! \copydoc BaseFluidSystem::ParameterCache //! \copydoc BaseFluidSystem::ParameterCache
typedef NullParameterCache ParameterCache; template <class Evaluation>
struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{};
/**************************************** /****************************************
* Fluid phase related static parameters * Fluid phase related static parameters
@ -183,9 +185,9 @@ public:
{ } { }
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -198,9 +200,9 @@ public:
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -213,9 +215,9 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &/*fluidState*/, static LhsEval fugacityCoefficient(const FluidState &/*fluidState*/,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -232,9 +234,9 @@ public:
} }
//! \copydoc BaseFluidSystem::enthalpy //! \copydoc BaseFluidSystem::enthalpy
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -247,9 +249,9 @@ public:
} }
//! \copydoc BaseFluidSystem::thermalConductivity //! \copydoc BaseFluidSystem::thermalConductivity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval thermalConductivity(const FluidState &fluidState, static LhsEval thermalConductivity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -262,9 +264,9 @@ public:
} }
//! \copydoc BaseFluidSystem::heatCapacity //! \copydoc BaseFluidSystem::heatCapacity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval heatCapacity(const FluidState &fluidState, static LhsEval heatCapacity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox; typedef Opm::MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -64,7 +64,9 @@ class Spe5
public: public:
//! \copydoc BaseFluidSystem::ParameterCache //! \copydoc BaseFluidSystem::ParameterCache
typedef Opm::Spe5ParameterCache<Scalar, ThisType> ParameterCache; template <class Evaluation>
struct ParameterCache : public Opm::Spe5ParameterCache<Evaluation, ThisType>
{};
/**************************************** /****************************************
* Fluid phase parameters * Fluid phase parameters
@ -356,27 +358,23 @@ public:
} }
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class Evaluation = Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static Scalar density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &paramCache, const ParameterCache<ParamCacheEval> &paramCache,
unsigned phaseIdx) unsigned phaseIdx)
{ {
assert(0 <= phaseIdx && phaseIdx < numPhases); assert(0 <= phaseIdx && phaseIdx < numPhases);
static_assert(std::is_same<Evaluation, Scalar>::value,
"The SPE-5 fluid system is currently only implemented for the scalar case.");
return fluidState.averageMolarMass(phaseIdx)/paramCache.molarVolume(phaseIdx); return fluidState.averageMolarMass(phaseIdx)/paramCache.molarVolume(phaseIdx);
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class Evaluation = Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static Scalar viscosity(const FluidState &/*fluidState*/, static LhsEval viscosity(const FluidState &/*fluidState*/,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
assert(0 <= phaseIdx && phaseIdx <= numPhases); assert(0 <= phaseIdx && phaseIdx <= numPhases);
static_assert(std::is_same<Evaluation, Scalar>::value,
"The SPE-5 fluid system is currently only implemented for the scalar case.");
if (phaseIdx == gasPhaseIdx) { if (phaseIdx == gasPhaseIdx) {
// given by SPE-5 in table on page 64. we use a constant // given by SPE-5 in table on page 64. we use a constant
@ -395,16 +393,14 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class Evaluation = Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static Scalar fugacityCoefficient(const FluidState &fluidState, static LhsEval fugacityCoefficient(const FluidState &fluidState,
const ParameterCache &paramCache, const ParameterCache<ParamCacheEval> &paramCache,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
assert(0 <= phaseIdx && phaseIdx <= numPhases); assert(0 <= phaseIdx && phaseIdx <= numPhases);
assert(0 <= compIdx && compIdx <= numComponents); assert(0 <= compIdx && compIdx <= numComponents);
static_assert(std::is_same<Evaluation, Scalar>::value,
"The SPE-5 fluid system is currently only implemented for the scalar case.");
if (phaseIdx == oilPhaseIdx || phaseIdx == gasPhaseIdx) if (phaseIdx == oilPhaseIdx || phaseIdx == gasPhaseIdx)
return PengRobinsonMixture::computeFugacityCoefficient(fluidState, return PengRobinsonMixture::computeFugacityCoefficient(fluidState,
@ -420,7 +416,8 @@ public:
} }
protected: protected:
static Scalar henryCoeffWater_(unsigned compIdx, Scalar temperature) template <class LhsEval>
static LhsEval henryCoeffWater_(unsigned compIdx, const LhsEval& temperature)
{ {
// use henry's law for the solutes and the vapor pressure for // use henry's law for the solutes and the vapor pressure for
// the solvent. // the solvent.

View File

@ -63,9 +63,11 @@ class TwoPhaseImmiscible
typedef TwoPhaseImmiscible<Scalar, WettingPhase, NonwettingPhase> ThisType; typedef TwoPhaseImmiscible<Scalar, WettingPhase, NonwettingPhase> ThisType;
typedef BaseFluidSystem<Scalar, ThisType> Base; typedef BaseFluidSystem<Scalar, ThisType> Base;
public: public:
//! \copydoc BaseFluidSystem::ParameterCache template <class Evaluation>
typedef NullParameterCache ParameterCache; struct ParameterCache : public Opm::NullParameterCache<Evaluation>
{};
/**************************************** /****************************************
* Fluid phase related static parameters * Fluid phase related static parameters
@ -219,9 +221,9 @@ public:
} }
//! \copydoc BaseFluidSystem::density //! \copydoc BaseFluidSystem::density
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval density(const FluidState &fluidState, static LhsEval density(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -236,9 +238,9 @@ public:
} }
//! \copydoc BaseFluidSystem::viscosity //! \copydoc BaseFluidSystem::viscosity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval viscosity(const FluidState &fluidState, static LhsEval viscosity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -253,9 +255,9 @@ public:
} }
//! \copydoc BaseFluidSystem::fugacityCoefficient //! \copydoc BaseFluidSystem::fugacityCoefficient
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval fugacityCoefficient(const FluidState &/*fluidState*/, static LhsEval fugacityCoefficient(const FluidState &/*fluidState*/,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx, unsigned phaseIdx,
unsigned compIdx) unsigned compIdx)
{ {
@ -274,9 +276,9 @@ public:
} }
//! \copydoc BaseFluidSystem::enthalpy //! \copydoc BaseFluidSystem::enthalpy
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval enthalpy(const FluidState &fluidState, static LhsEval enthalpy(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -291,9 +293,9 @@ public:
} }
//! \copydoc BaseFluidSystem::thermalConductivity //! \copydoc BaseFluidSystem::thermalConductivity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval thermalConductivity(const FluidState &fluidState, static LhsEval thermalConductivity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;
@ -308,9 +310,9 @@ public:
} }
//! \copydoc BaseFluidSystem::heatCapacity //! \copydoc BaseFluidSystem::heatCapacity
template <class FluidState, class LhsEval = typename FluidState::Scalar> template <class FluidState, class LhsEval = typename FluidState::Scalar, class ParamCacheEval = LhsEval>
static LhsEval heatCapacity(const FluidState &fluidState, static LhsEval heatCapacity(const FluidState &fluidState,
const ParameterCache &/*paramCache*/, const ParameterCache<ParamCacheEval> &/*paramCache*/,
unsigned phaseIdx) unsigned phaseIdx)
{ {
typedef MathToolbox<typename FluidState::Scalar> FsToolbox; typedef MathToolbox<typename FluidState::Scalar> FsToolbox;

View File

@ -108,9 +108,9 @@ void checkImmiscibleFlash(const FluidState &fsRef,
fsFlash.setTemperature(fsRef.temperature(/*phaseIdx=*/0)); fsFlash.setTemperature(fsRef.temperature(/*phaseIdx=*/0));
// run the flash calculation // run the flash calculation
typename FluidSystem::ParameterCache paramCache; ImmiscibleFlash::guessInitial(fsFlash, globalMolarities);
ImmiscibleFlash::guessInitial(fsFlash, paramCache, globalMolarities); typename FluidSystem::template ParameterCache<typename FluidState::Scalar> paramCache;
ImmiscibleFlash::template solve<MaterialLaw>(fsFlash, paramCache, matParams, globalMolarities); ImmiscibleFlash::template solve<MaterialLaw>(fsFlash, matParams, paramCache, globalMolarities);
// compare the "flashed" fluid state with the reference one // compare the "flashed" fluid state with the reference one
checkSame<Scalar>(fsRef, fsFlash); checkSame<Scalar>(fsRef, fsFlash);
@ -138,7 +138,7 @@ void completeReferenceFluidState(FluidState &fs,
+ (pC[otherPhaseIdx] - pC[refPhaseIdx])); + (pC[otherPhaseIdx] - pC[refPhaseIdx]));
// set all phase densities // set all phase densities
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::template ParameterCache<typename FluidState::Scalar> paramCache;
paramCache.updateAll(fs); paramCache.updateAll(fs);
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
Scalar rho = FluidSystem::density(fs, paramCache, phaseIdx); Scalar rho = FluidSystem::density(fs, paramCache, phaseIdx);

View File

@ -90,6 +90,7 @@ void checkNcpFlash(const FluidState &fsRef,
enum { numPhases = FluidSystem::numPhases }; enum { numPhases = FluidSystem::numPhases };
enum { numComponents = FluidSystem::numComponents }; enum { numComponents = FluidSystem::numComponents };
typedef Dune::FieldVector<Scalar, numComponents> ComponentVector; typedef Dune::FieldVector<Scalar, numComponents> ComponentVector;
typedef typename FluidSystem::template ParameterCache<typename FluidState::Scalar> ParameterCache;
// calculate the total amount of stuff in the reference fluid // calculate the total amount of stuff in the reference fluid
// phase // phase
@ -108,9 +109,10 @@ void checkNcpFlash(const FluidState &fsRef,
fsFlash.setTemperature(fsRef.temperature(/*phaseIdx=*/0)); fsFlash.setTemperature(fsRef.temperature(/*phaseIdx=*/0));
// run the flash calculation // run the flash calculation
typename FluidSystem::ParameterCache paramCache; ParameterCache paramCache;
NcpFlash::guessInitial(fsFlash, paramCache, globalMolarities); paramCache.updateAll(fsFlash);
NcpFlash::template solve<MaterialLaw>(fsFlash, paramCache, matParams, globalMolarities); NcpFlash::guessInitial(fsFlash, globalMolarities);
NcpFlash::template solve<MaterialLaw>(fsFlash, matParams, paramCache, globalMolarities);
// compare the "flashed" fluid state with the reference one // compare the "flashed" fluid state with the reference one
checkSame<Scalar>(fsRef, fsFlash); checkSame<Scalar>(fsRef, fsFlash);
@ -141,7 +143,7 @@ void completeReferenceFluidState(FluidState &fs,
// make the fluid state consistent with local thermodynamic // make the fluid state consistent with local thermodynamic
// equilibrium // equilibrium
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::template ParameterCache<typename FluidState::Scalar> paramCache;
ComputeFromReferencePhase::solve(fs, ComputeFromReferencePhase::solve(fs,
paramCache, paramCache,
refPhaseIdx, refPhaseIdx,
@ -251,7 +253,7 @@ inline void testAll()
fsRef.setPressure(liquidPhaseIdx, 1e6); fsRef.setPressure(liquidPhaseIdx, 1e6);
fsRef.setPressure(gasPhaseIdx, 1e6); fsRef.setPressure(gasPhaseIdx, 1e6);
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::template ParameterCache<Scalar> paramCache;
typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MiscibleMultiPhaseComposition; typedef Opm::MiscibleMultiPhaseComposition<Scalar, FluidSystem> MiscibleMultiPhaseComposition;
MiscibleMultiPhaseComposition::solve(fsRef, paramCache, MiscibleMultiPhaseComposition::solve(fsRef, paramCache,
/*setViscosity=*/false, /*setViscosity=*/false,

View File

@ -59,7 +59,7 @@ void createSurfaceGasFluidSystem(FluidState &gasFluidState)
gasFluidState.setMoleFraction(gasPhaseIdx, FluidSystem::C20Idx, 0.00); gasFluidState.setMoleFraction(gasPhaseIdx, FluidSystem::C20Idx, 0.00);
// gas density // gas density
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::template ParameterCache<typename FluidState::Scalar> paramCache;
paramCache.updatePhase(gasFluidState, gasPhaseIdx); paramCache.updatePhase(gasFluidState, gasPhaseIdx);
gasFluidState.setDensity(gasPhaseIdx, gasFluidState.setDensity(gasPhaseIdx,
FluidSystem::density(gasFluidState, paramCache, gasPhaseIdx)); FluidSystem::density(gasFluidState, paramCache, gasPhaseIdx));
@ -210,7 +210,7 @@ Scalar bringOilToSurface(FluidState &surfaceFluidState, Scalar alpha, const Flui
surfaceFluidState.setSaturation(gasPhaseIdx, 1.0 - surfaceFluidState.saturation(oilPhaseIdx)); surfaceFluidState.setSaturation(gasPhaseIdx, 1.0 - surfaceFluidState.saturation(oilPhaseIdx));
} }
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::template ParameterCache<Scalar> paramCache;
paramCache.updateAll(surfaceFluidState); paramCache.updateAll(surfaceFluidState);
// increase volume until we are at surface pressure. use the // increase volume until we are at surface pressure. use the
@ -224,7 +224,7 @@ Scalar bringOilToSurface(FluidState &surfaceFluidState, Scalar alpha, const Flui
// calculate the deviation from the standard pressure // calculate the deviation from the standard pressure
tmpMolarities = molarities; tmpMolarities = molarities;
tmpMolarities /= alpha; tmpMolarities /= alpha;
Flash::template solve<MaterialLaw>(surfaceFluidState, paramCache, matParams, tmpMolarities); Flash::template solve<MaterialLaw>(surfaceFluidState, matParams, paramCache, tmpMolarities);
Scalar f = surfaceFluidState.pressure(gasPhaseIdx) - refPressure; Scalar f = surfaceFluidState.pressure(gasPhaseIdx) - refPressure;
// calculate the derivative of the deviation from the standard // calculate the derivative of the deviation from the standard
@ -232,7 +232,7 @@ Scalar bringOilToSurface(FluidState &surfaceFluidState, Scalar alpha, const Flui
Scalar eps = alpha*1e-10; Scalar eps = alpha*1e-10;
tmpMolarities = molarities; tmpMolarities = molarities;
tmpMolarities /= alpha + eps; tmpMolarities /= alpha + eps;
Flash::template solve<MaterialLaw>(surfaceFluidState, paramCache, matParams, tmpMolarities); Flash::template solve<MaterialLaw>(surfaceFluidState, matParams, paramCache, tmpMolarities);
Scalar fStar = surfaceFluidState.pressure(gasPhaseIdx) - refPressure; Scalar fStar = surfaceFluidState.pressure(gasPhaseIdx) - refPressure;
Scalar fPrime = (fStar - f)/eps; Scalar fPrime = (fStar - f)/eps;
@ -247,7 +247,7 @@ Scalar bringOilToSurface(FluidState &surfaceFluidState, Scalar alpha, const Flui
// calculate the final result // calculate the final result
tmpMolarities = molarities; tmpMolarities = molarities;
tmpMolarities /= alpha; tmpMolarities /= alpha;
Flash::template solve<MaterialLaw>(surfaceFluidState, paramCache, matParams, tmpMolarities); Flash::template solve<MaterialLaw>(surfaceFluidState, matParams, paramCache, tmpMolarities);
return alpha; return alpha;
} }
@ -316,7 +316,7 @@ inline void testAll()
typedef Opm::LinearMaterial<MaterialTraits> MaterialLaw; typedef Opm::LinearMaterial<MaterialTraits> MaterialLaw;
typedef typename MaterialLaw::Params MaterialLawParams; typedef typename MaterialLaw::Params MaterialLawParams;
typedef typename FluidSystem::ParameterCache ParameterCache; typedef typename FluidSystem::template ParameterCache<Scalar> ParameterCache;
//////////// ////////////
// Initialize the fluid system and create the capillary pressure // Initialize the fluid system and create the capillary pressure
@ -400,8 +400,8 @@ inline void testAll()
FluidState flashFluidState, surfaceFluidState; FluidState flashFluidState, surfaceFluidState;
flashFluidState.assign(fluidState); flashFluidState.assign(fluidState);
//Flash::guessInitial(flashFluidState, paramCache, totalMolarities); //Flash::guessInitial(flashFluidState, totalMolarities);
Flash::template solve<MaterialLaw>(flashFluidState, paramCache, matParams, totalMolarities); Flash::template solve<MaterialLaw>(flashFluidState, matParams, paramCache, totalMolarities);
Scalar surfaceAlpha = 1; Scalar surfaceAlpha = 1;
surfaceAlpha = bringOilToSurface<Scalar, FluidSystem>(surfaceFluidState, surfaceAlpha, flashFluidState, /*guessInitial=*/true); surfaceAlpha = bringOilToSurface<Scalar, FluidSystem>(surfaceFluidState, surfaceAlpha, flashFluidState, /*guessInitial=*/true);
@ -424,7 +424,7 @@ inline void testAll()
curTotalMolarities /= alpha; curTotalMolarities /= alpha;
// "flash" the modified reservoir oil // "flash" the modified reservoir oil
Flash::template solve<MaterialLaw>(flashFluidState, paramCache, matParams, curTotalMolarities); Flash::template solve<MaterialLaw>(flashFluidState, matParams, paramCache, curTotalMolarities);
surfaceAlpha = bringOilToSurface<Scalar, FluidSystem>(surfaceFluidState, surfaceAlpha = bringOilToSurface<Scalar, FluidSystem>(surfaceFluidState,
surfaceAlpha, surfaceAlpha,