diff --git a/opm/material/checkFluidSystem.hpp b/opm/material/checkFluidSystem.hpp index d4c5e42e6..f89f8ae4f 100644 --- a/opm/material/checkFluidSystem.hpp +++ b/opm/material/checkFluidSystem.hpp @@ -297,18 +297,19 @@ void checkFluidSystem() " as the one passed to the checkFluidSystem() function"); // check whether the parameter cache adheres to the API - typedef typename FluidSystem::ParameterCache PC; - PC paramCache; + typedef typename FluidSystem::template ParameterCache ParameterCache; + + ParameterCache paramCache; try { paramCache.updateAll(fs); } catch (...) {}; - try { paramCache.updateAll(fs, /*except=*/PC::None); } catch (...) {}; - try { paramCache.updateAll(fs, /*except=*/PC::Temperature | PC::Pressure | PC::Composition); } catch (...) {}; + try { paramCache.updateAll(fs, /*except=*/ParameterCache::None); } catch (...) {}; + try { paramCache.updateAll(fs, /*except=*/ParameterCache::Temperature | ParameterCache::Pressure | ParameterCache::Composition); } catch (...) {}; try { paramCache.updateAllPressures(fs); } catch (...) {}; for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { fs.restrictToPhase(static_cast(phaseIdx)); try { paramCache.updatePhase(fs, phaseIdx); } catch (...) {}; - try { paramCache.updatePhase(fs, phaseIdx, /*except=*/PC::None); } catch (...) {}; - try { paramCache.updatePhase(fs, phaseIdx, /*except=*/PC::Temperature | PC::Pressure | PC::Composition); } catch (...) {}; + try { paramCache.updatePhase(fs, phaseIdx, /*except=*/ParameterCache::None); } catch (...) {}; + try { paramCache.updatePhase(fs, phaseIdx, /*except=*/ParameterCache::Temperature | ParameterCache::Pressure | ParameterCache::Composition); } catch (...) {}; try { paramCache.updateTemperature(fs, phaseIdx); } catch (...) {}; try { paramCache.updatePressure(fs, phaseIdx); } catch (...) {}; try { paramCache.updateComposition(fs, phaseIdx); } catch (...) {}; diff --git a/opm/material/constraintsolvers/CompositionFromFugacities.hpp b/opm/material/constraintsolvers/CompositionFromFugacities.hpp index 956fe36f4..118541f61 100644 --- a/opm/material/constraintsolvers/CompositionFromFugacities.hpp +++ b/opm/material/constraintsolvers/CompositionFromFugacities.hpp @@ -55,8 +55,6 @@ class CompositionFromFugacities { enum { numComponents = FluidSystem::numComponents }; - typedef typename FluidSystem::ParameterCache ParameterCache; - public: typedef Dune::FieldVector ComponentVector; @@ -65,7 +63,6 @@ public: */ template static void guessInitial(FluidState &fluidState, - ParameterCache &/*paramCache*/, unsigned phaseIdx, const ComponentVector &/*fugVec*/) { @@ -89,7 +86,7 @@ public: */ template static void solve(FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, unsigned phaseIdx, const ComponentVector &targetFug) { @@ -195,7 +192,7 @@ protected: // independent of the phase's composition. template static void solveIdealMix_(FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, unsigned phaseIdx, const ComponentVector &fugacities) { @@ -223,7 +220,7 @@ protected: static Scalar linearize_(Dune::FieldMatrix &J, Dune::FieldVector &defect, FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, unsigned phaseIdx, const ComponentVector &targetFug) { @@ -295,7 +292,7 @@ protected: template static Scalar update_(FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, Dune::FieldVector &x, Dune::FieldVector &/*b*/, unsigned phaseIdx, diff --git a/opm/material/constraintsolvers/ComputeFromReferencePhase.hpp b/opm/material/constraintsolvers/ComputeFromReferencePhase.hpp index e10bb7c0d..49fa8a52a 100644 --- a/opm/material/constraintsolvers/ComputeFromReferencePhase.hpp +++ b/opm/material/constraintsolvers/ComputeFromReferencePhase.hpp @@ -105,9 +105,9 @@ public: * enthalpy/internal energy of each phase * should also be set. */ - template + template static void solve(FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache ¶mCache, unsigned refPhaseIdx, bool setViscosity, bool setEnthalpy) diff --git a/opm/material/constraintsolvers/ImmiscibleFlash.hpp b/opm/material/constraintsolvers/ImmiscibleFlash.hpp index b73b15faf..b09d05cd2 100644 --- a/opm/material/constraintsolvers/ImmiscibleFlash.hpp +++ b/opm/material/constraintsolvers/ImmiscibleFlash.hpp @@ -74,7 +74,6 @@ class ImmiscibleFlash "Immiscibility assumes that the number of phases" " is equal to the number of components"); - typedef typename FluidSystem::ParameterCache ParameterCache; static const int numEq = numPhases; @@ -87,16 +86,10 @@ public: /*! * \brief Guess initial values for all quantities. */ - template + template static void guessInitial(FluidState &fluidState, - ParameterCache &/*paramCache*/, - const ComponentVector &globalMolarities) + const Dune::FieldVector& /*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) { // pressure. use atmospheric pressure as initial guess fluidState.setPressure(phaseIdx, 2e5); @@ -114,12 +107,14 @@ public: */ template static void solve(FluidState &fluidState, - ParameterCache ¶mCache, const typename MaterialLaw::Params &matParams, - const ComponentVector &globalMolarities) + typename FluidSystem::template ParameterCache& paramCache, + const Dune::FieldVector& globalMolarities) { Dune::FMatrixPrecision::set_singular_limit(1e-25); + paramCache.updateAll(fluidState); + ///////////////////////// // Check if all fluid phases are incompressible ///////////////////////// @@ -132,7 +127,6 @@ public: }; if (allIncompressible) { - paramCache.updateAll(fluidState); for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { Scalar rho = FluidSystem::density(fluidState, paramCache, phaseIdx); fluidState.setDensity(phaseIdx, rho); @@ -159,12 +153,12 @@ public: Valgrind::SetUndefined(deltaX); Valgrind::SetUndefined(b); - completeFluidState_(fluidState, paramCache, matParams); + completeFluidState_(fluidState, matParams, paramCache); const int nMax = 50; // <- maximum number of newton iterations for (int nIdx = 0; nIdx < nMax; ++nIdx) { // calculate Jacobian matrix and right hand side - linearize_(J, b, fluidState, paramCache, matParams, globalMolarities); + linearize_(J, b, fluidState, matParams, paramCache, globalMolarities); Valgrind::CheckDefined(J); Valgrind::CheckDefined(b); @@ -205,7 +199,7 @@ public: */ // update the fluid quantities. - Scalar relError = update_(fluidState, paramCache, matParams, deltaX); + Scalar relError = update_(fluidState, matParams, paramCache, deltaX); if (relError < 1e-9) return; @@ -260,12 +254,13 @@ protected: static void linearize_(Matrix &J, Vector &b, FluidState &fluidState, - ParameterCache ¶mCache, const typename MaterialLaw::Params &matParams, + typename FluidSystem::template ParameterCache& paramCache, const ComponentVector &globalMolarities) { + // copy the undisturbed fluid state and parameter cache FluidState origFluidState(fluidState); - ParameterCache origParamCache(paramCache); + auto origParamCache(paramCache); Vector tmp; @@ -287,7 +282,7 @@ protected: // deviate the mole fraction of the i-th component Scalar xI = getQuantity_(fluidState, pvIdx); const Scalar eps = 1e-10/quantityWeight_(fluidState, pvIdx); - setQuantity_(fluidState, paramCache, matParams, pvIdx, xI + eps); + setQuantity_(fluidState, matParams, paramCache, pvIdx, xI + eps); assert(std::abs(getQuantity_(fluidState, pvIdx) - (xI + eps)) <= std::max(1.0, std::abs(xI))*std::numeric_limits::epsilon()*100); @@ -324,11 +319,11 @@ protected: } } - template - static Scalar update_(FluidState &fluidState, - ParameterCache ¶mCache, - const typename MaterialLaw::Params &matParams, - const Vector &deltaX) + template + static Scalar update_(FlashFluidState& fluidState, + const typename MaterialLaw::Params& matParams, + typename FluidSystem::template ParameterCache& paramCache, + const EvalVector& deltaX) { Scalar relError = 0; for (unsigned pvIdx = 0; pvIdx < numEq; ++ pvIdx) { @@ -352,16 +347,18 @@ protected: setQuantityRaw_(fluidState, pvIdx, tmp - delta); } - completeFluidState_(fluidState, paramCache, matParams); + completeFluidState_(fluidState, matParams, paramCache); return relError; } template static void completeFluidState_(FluidState &fluidState, - ParameterCache ¶mCache, - const typename MaterialLaw::Params &matParams) + const typename MaterialLaw::Params &matParams, + typename FluidSystem::template ParameterCache& paramCache) { + typedef typename FluidSystem::template ParameterCache ParamCache; + // calculate the saturation of the last phase as a function of // the other saturations Scalar sumSat = 0.0; @@ -393,7 +390,7 @@ protected: + (pC[phaseIdx] - pC[0])); // update the parameter cache - paramCache.updateAll(fluidState, /*except=*/ParameterCache::Temperature|ParameterCache::Composition); + paramCache.updateAll(fluidState, /*except=*/ParamCache::Temperature|ParamCache::Composition); // update all densities for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { @@ -430,8 +427,8 @@ protected: // set a quantity in the fluid state template static void setQuantity_(FluidState &fs, - ParameterCache ¶mCache, const typename MaterialLaw::Params &matParams, + typename FluidSystem::template ParameterCache& paramCache, unsigned pvIdx, Scalar value) { @@ -445,6 +442,8 @@ protected: // pressure does not depend on absolute pressure. for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) fs.setPressure(phaseIdx, fs.pressure(phaseIdx) + delta); + + // update the parameter cache paramCache.updateAllPressures(fs); // update all densities @@ -473,6 +472,8 @@ protected: fs.setPressure(phaseIdx, fs.pressure(0) + (pC[phaseIdx] - pC[0])); + + // update the parameter cache paramCache.updateAllPressures(fs); // update all densities diff --git a/opm/material/constraintsolvers/NcpFlash.hpp b/opm/material/constraintsolvers/NcpFlash.hpp index 9c1b36d91..b8b6f81d9 100644 --- a/opm/material/constraintsolvers/NcpFlash.hpp +++ b/opm/material/constraintsolvers/NcpFlash.hpp @@ -88,8 +88,6 @@ class NcpFlash enum { numPhases = FluidSystem::numPhases }; enum { numComponents = FluidSystem::numComponents }; - typedef typename FluidSystem::ParameterCache ParameterCache; - static const int numEq = numPhases*(numComponents + 1); public: @@ -98,7 +96,6 @@ public: */ template static void guessInitial(FluidState &fluidState, - ParameterCache ¶mCache, const Dune::FieldVector& globalMolarities) { // the sum of all molarities @@ -121,6 +118,7 @@ public: } // set the fugacity coefficients of all components in all phases + typename FluidSystem::template ParameterCache paramCache; paramCache.updateAll(fluidState); for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { for (unsigned compIdx = 0; compIdx < numComponents; ++ compIdx) { @@ -139,8 +137,8 @@ public: */ template static void solve(FluidState &fluidState, - ParameterCache ¶mCache, const typename MaterialLaw::Params &matParams, + typename FluidSystem::template ParameterCache& paramCache, const Dune::FieldVector& globalMolarities, Scalar tolerance = -1.0) { @@ -265,15 +263,12 @@ public: const ComponentVector &globalMolarities, Scalar tolerance = 0.0) { - ParameterCache paramCache; - paramCache.updateAll(fluidState); - typedef NullMaterialTraits MaterialTraits; typedef NullMaterial MaterialLaw; typedef typename MaterialLaw::Params MaterialLawParams; MaterialLawParams matParams; - solve(fluidState, paramCache, matParams, globalMolarities, tolerance); + solve(fluidState, matParams, globalMolarities, tolerance); } @@ -331,14 +326,14 @@ protected: static void linearize_(Matrix &J, Vector &b, FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, const typename MaterialLaw::Params &matParams, const ComponentVector &globalMolarities) { typedef typename FluidState::Scalar Evaluation; FluidState origFluidState(fluidState); - ParameterCache origParamCache(paramCache); + auto origParamCache(paramCache); Vector tmp; @@ -444,7 +439,7 @@ protected: template static Scalar update_(FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, const typename MaterialLaw::Params &matParams, const Vector &deltaX) { @@ -522,10 +517,11 @@ protected: template static void completeFluidState_(FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, const typename MaterialLaw::Params &matParams) { typedef typename FluidState::Scalar Evaluation; + typedef typename FluidSystem::template ParameterCache ParameterCache; // calculate the saturation of the last phase as a function of // the other saturations @@ -596,7 +592,7 @@ protected: // set a quantity in the fluid state template static void setQuantity_(FluidState &fluidState, - ParameterCache ¶mCache, + typename FluidSystem::template ParameterCache& paramCache, const typename MaterialLaw::Params &matParams, unsigned pvIdx, const typename FluidState::Scalar& value) diff --git a/opm/material/fluidsystems/BaseFluidSystem.hpp b/opm/material/fluidsystems/BaseFluidSystem.hpp index 400da9e5d..38bc48f5e 100644 --- a/opm/material/fluidsystems/BaseFluidSystem.hpp +++ b/opm/material/fluidsystems/BaseFluidSystem.hpp @@ -51,12 +51,14 @@ public: /*! * \brief The type of the fluid system's parameter cache * - * The parameter cache can be used to avoid re-calculating - * expensive parameters for multiple quantities. Be aware that - * what the parameter cache actually does is specific for each - * fluid system and that it is opaque outside the fluid system. + * The parameter cache can be used to avoid re-calculating expensive parameters for + * multiple quantities. Be aware that what the parameter cache actually does is + * specific for each fluid system and that it is opaque outside the fluid system. */ - typedef NullParameterCache ParameterCache; + template + struct ParameterCache { + ParameterCache() = delete; // derived fluid systems must specify this class! + }; //! Number of chemical species in the fluid system static const int numComponents = -1000; @@ -167,9 +169,9 @@ public: * \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::phaseIdxParam */ - template - static LhsEval density(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + template + static LhsEval density(const FluidState& /*fluidState*/, + const ParamCache& /*paramCache*/, unsigned /*phaseIdx*/) { OPM_THROW(std::runtime_error, @@ -190,9 +192,9 @@ public: * \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::compIdxParam */ - template - static LhsEval fugacityCoefficient(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + template + static LhsEval fugacityCoefficient(const FluidState& /*fluidState*/, + ParamCache& /*paramCache*/, unsigned /*phaseIdx*/, unsigned /*compIdx*/) { @@ -205,9 +207,9 @@ public: * \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::phaseIdxParam */ - template - static LhsEval viscosity(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + template + static LhsEval viscosity(const FluidState& /*fluidState*/, + ParamCache& /*paramCache*/, unsigned /*phaseIdx*/) { OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className() << "' does not provide a viscosity() method!"); @@ -230,9 +232,9 @@ public: * \copydoc Doxygen::phaseIdxParam * \copydoc Doxygen::compIdxParam */ - template - static LhsEval diffusionCoefficient(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + template + static LhsEval diffusionCoefficient(const FluidState& /*fluidState*/, + ParamCache& /*paramCache*/, unsigned /*phaseIdx*/, unsigned /*compIdx*/) { @@ -246,9 +248,9 @@ public: * \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::phaseIdxParam */ - template - static LhsEval enthalpy(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + template + static LhsEval enthalpy(const FluidState& /*fluidState*/, + ParamCache& /*paramCache*/, unsigned /*phaseIdx*/) { OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className() << "' does not provide an enthalpy() method!"); @@ -260,9 +262,9 @@ public: * \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::phaseIdxParam */ - template - static LhsEval thermalConductivity(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + template + static LhsEval thermalConductivity(const FluidState& /*fluidState*/, + ParamCache& /*paramCache*/, unsigned /*phaseIdx*/) { OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className() << "' does not provide a thermalConductivity() method!"); @@ -274,9 +276,9 @@ public: * \copydoc Doxygen::fluidSystemBaseParams * \copydoc Doxygen::phaseIdxParam */ - template - static LhsEval heatCapacity(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + template + static LhsEval heatCapacity(const FluidState& /*fluidState*/, + ParamCache& /*paramCache*/, unsigned /*phaseIdx*/) { OPM_THROW(std::runtime_error, "Not implemented: The fluid system '" << Opm::className() << "' does not provide a heatCapacity() method!"); diff --git a/opm/material/fluidsystems/BlackOilFluidSystem.hpp b/opm/material/fluidsystems/BlackOilFluidSystem.hpp index 2c92638a5..e4a08a688 100644 --- a/opm/material/fluidsystems/BlackOilFluidSystem.hpp +++ b/opm/material/fluidsystems/BlackOilFluidSystem.hpp @@ -113,7 +113,8 @@ public: typedef Opm::WaterPvtMultiplexer WaterPvt; //! \copydoc BaseFluidSystem::ParameterCache - class ParameterCache : public Opm::NullParameterCache + template + struct ParameterCache : public Opm::NullParameterCache { public: ParameterCache(int /*regionIdx*/=0) @@ -396,24 +397,24 @@ public: * thermodynamic quantities (generic version, only isothermal) ****************************************/ //! \copydoc BaseFluidSystem::density - template + template static LhsEval density(const FluidState &fluidState, - ParameterCache ¶mCache, + const ParameterCache ¶mCache, unsigned phaseIdx) { return density(fluidState, phaseIdx, paramCache.regionIndex()); } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &fluidState, - const ParameterCache ¶mCache, + const ParameterCache ¶mCache, unsigned phaseIdx, unsigned compIdx) { return fugacityCoefficient(fluidState, phaseIdx, compIdx, paramCache.regionIndex()); } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache ¶mCache, + const ParameterCache ¶mCache, unsigned phaseIdx) { return viscosity(fluidState, phaseIdx, paramCache.regionIndex()); } diff --git a/opm/material/fluidsystems/BrineCO2FluidSystem.hpp b/opm/material/fluidsystems/BrineCO2FluidSystem.hpp index 46abe0eb8..b7c70cf86 100644 --- a/opm/material/fluidsystems/BrineCO2FluidSystem.hpp +++ b/opm/material/fluidsystems/BrineCO2FluidSystem.hpp @@ -69,12 +69,13 @@ class BrineCO2 typedef H2O_Tabulated H2O; public: + template + struct ParameterCache : public Opm::NullParameterCache + {}; + //! The binary coefficients for brine and CO2 used by this fluid system typedef Opm::BinaryCoeff::Brine_CO2 BinaryCoeffBrineCO2; - //! \copydoc BaseFluidSystem::ParameterCache - typedef Opm::NullParameterCache ParameterCache; - /**************************************** * Fluid phase related static parameters ****************************************/ @@ -228,9 +229,9 @@ public: /*! * \copydoc BaseFluidSystem::density */ - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; @@ -282,9 +283,9 @@ public: /*! * \copydoc BaseFluidSystem::viscosity */ - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; @@ -311,9 +312,9 @@ public: /*! * \copydoc BaseFluidSystem::fugacityCoefficient */ - template + template static LhsEval fugacityCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -368,9 +369,9 @@ public: /*! * \copydoc BaseFluidSystem::diffusionCoefficient */ - template + template static LhsEval diffusionCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned /*compIdx*/) { @@ -388,9 +389,9 @@ public: /*! * \copydoc BaseFluidSystem::enthalpy */ - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; @@ -425,9 +426,9 @@ public: /*! * \copydoc BaseFluidSystem::thermalConductivity */ - template + template static LhsEval thermalConductivity(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox LhsToolbox; @@ -452,9 +453,9 @@ public: * \param phaseIdx The index of the fluid phase to consider * \tparam FluidState the fluid state class */ - template + template static LhsEval heatCapacity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; diff --git a/opm/material/fluidsystems/H2OAirFluidSystem.hpp b/opm/material/fluidsystems/H2OAirFluidSystem.hpp index 8c551c2bd..9d9c80094 100644 --- a/opm/material/fluidsystems/H2OAirFluidSystem.hpp +++ b/opm/material/fluidsystems/H2OAirFluidSystem.hpp @@ -67,8 +67,9 @@ class H2OAir typedef Opm::IdealGas IdealGas; public: - //! \copydoc BaseFluidSystem::ParameterCache - typedef NullParameterCache ParameterCache; + template + struct ParameterCache : public Opm::NullParameterCache + {}; //! The type of the water component used for this fluid system typedef H2Otype H2O; @@ -253,9 +254,9 @@ public: } //! \copydoc BaseFluidSystem::density - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -319,9 +320,9 @@ public: } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox LhsToolbox; @@ -388,9 +389,9 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -414,9 +415,9 @@ public: } //! \copydoc BaseFluidSystem::diffusionCoefficient - template + template static LhsEval binaryDiffusionCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned /*compIdx*/) { @@ -433,9 +434,9 @@ public: } //! \copydoc BaseFluidSystem::enthalpy - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -467,9 +468,9 @@ public: } //! \copydoc BaseFluidSystem::thermalConductivity - template + template static LhsEval thermalConductivity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; diff --git a/opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp b/opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp index 54ce20aff..0a0bfd592 100644 --- a/opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp +++ b/opm/material/fluidsystems/H2OAirMesityleneFluidSystem.hpp @@ -63,8 +63,9 @@ class H2OAirMesitylene typedef Opm::TabulatedComponent TabulatedH2O; public: - //! \copydoc BaseFluidSystem::ParameterCache - typedef NullParameterCache ParameterCache; + template + struct ParameterCache : public Opm::NullParameterCache + {}; //! The type of the mesithylene/napl component typedef Opm::Mesitylene NAPL; @@ -197,9 +198,9 @@ public: } //! \copydoc BaseFluidSystem::density - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -244,9 +245,9 @@ public: } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -308,9 +309,9 @@ public: } //! \copydoc BaseFluidSystem::diffusionCoefficient - template + template static LhsEval diffusionCoefficient(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned /*phaseIdx*/, unsigned /*compIdx*/) { @@ -369,9 +370,9 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -418,9 +419,9 @@ public: //! \copydoc BaseFluidSystem::enthalpy - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -447,9 +448,9 @@ public: } //! \copydoc BaseFluidSystem::thermalConductivity - template + template static LhsEval thermalConductivity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; diff --git a/opm/material/fluidsystems/H2OAirXyleneFluidSystem.hpp b/opm/material/fluidsystems/H2OAirXyleneFluidSystem.hpp index d69463083..4ca841427 100644 --- a/opm/material/fluidsystems/H2OAirXyleneFluidSystem.hpp +++ b/opm/material/fluidsystems/H2OAirXyleneFluidSystem.hpp @@ -56,8 +56,9 @@ class H2OAirXylene typedef BaseFluidSystem Base; public: - //! \copydoc BaseFluidSystem::ParameterCache - typedef NullParameterCache ParameterCache; + template + struct ParameterCache : public Opm::NullParameterCache + {}; //! The type of the water component typedef Opm::H2O H2O; @@ -164,9 +165,9 @@ public: } //! \copydoc BaseFluidSystem::density - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -207,9 +208,9 @@ public: } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -271,9 +272,9 @@ public: } //! \copydoc BaseFluidSystem::diffusionCoefficient - template + template static LhsEval diffusionCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -325,9 +326,9 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -370,9 +371,9 @@ public: } //! \copydoc BaseFluidSystem::enthalpy - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; diff --git a/opm/material/fluidsystems/H2ON2FluidSystem.hpp b/opm/material/fluidsystems/H2ON2FluidSystem.hpp index eb33a2d3e..4c1383d9c 100644 --- a/opm/material/fluidsystems/H2ON2FluidSystem.hpp +++ b/opm/material/fluidsystems/H2ON2FluidSystem.hpp @@ -67,7 +67,8 @@ class H2ON2 public: //! \copydoc BaseFluidSystem::ParameterCache - typedef NullParameterCache ParameterCache; + template + using ParameterCache = NullParameterCache; /**************************************** * Fluid phase related static parameters @@ -264,9 +265,9 @@ public: * of a multiphase multicomponent model for PEMFC - Technical report: IRTG-NUPUS", * University of Stuttgart, 2008 */ - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -321,9 +322,9 @@ public: } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -382,9 +383,9 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -411,9 +412,9 @@ public: } //! \copydoc BaseFluidSystem::diffusionCoefficient - template + template static LhsEval diffusionCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned /*compIdx*/) @@ -433,9 +434,9 @@ public: } //! \copydoc BaseFluidSystem::enthalpy - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -467,9 +468,9 @@ public: } //! \copydoc BaseFluidSystem::thermalConductivity - template + template static LhsEval thermalConductivity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); @@ -502,9 +503,9 @@ public: } //! \copydoc BaseFluidSystem::heatCapacity - template + template static LhsEval heatCapacity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; diff --git a/opm/material/fluidsystems/H2ON2LiquidPhaseFluidSystem.hpp b/opm/material/fluidsystems/H2ON2LiquidPhaseFluidSystem.hpp index c76b2e980..d14a6957a 100644 --- a/opm/material/fluidsystems/H2ON2LiquidPhaseFluidSystem.hpp +++ b/opm/material/fluidsystems/H2ON2LiquidPhaseFluidSystem.hpp @@ -67,7 +67,9 @@ class H2ON2LiquidPhase public: //! \copydoc BaseFluidSystem::ParameterCache - typedef NullParameterCache ParameterCache; + template + struct ParameterCache : public Opm::NullParameterCache + {}; /**************************************** * Fluid phase related static parameters @@ -248,9 +250,9 @@ public: } //! \copydoc BaseFluidSystem::density - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -285,9 +287,9 @@ public: } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -302,9 +304,9 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -322,9 +324,9 @@ public: } //! \copydoc BaseFluidSystem::diffusionCoefficient - template + template static LhsEval diffusionCoefficient(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned /*compIdx*/) @@ -340,9 +342,9 @@ public: } //! \copydoc BaseFluidSystem::enthalpy - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -359,9 +361,9 @@ public: } //! \copydoc BaseFluidSystem::thermalConductivity - template + template static LhsEval thermalConductivity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, const unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -378,9 +380,9 @@ public: } //! \copydoc BaseFluidSystem::heatCapacity - template + template static LhsEval heatCapacity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; diff --git a/opm/material/fluidsystems/NullParameterCache.hpp b/opm/material/fluidsystems/NullParameterCache.hpp index 09c786fa2..2573b7cb4 100644 --- a/opm/material/fluidsystems/NullParameterCache.hpp +++ b/opm/material/fluidsystems/NullParameterCache.hpp @@ -35,7 +35,8 @@ namespace Opm { * \ingroup Fluidsystems * \brief A parameter cache which does nothing */ -class NullParameterCache : public ParameterCacheBase +template +class NullParameterCache : public ParameterCacheBase > { public: NullParameterCache() diff --git a/opm/material/fluidsystems/SinglePhaseFluidSystem.hpp b/opm/material/fluidsystems/SinglePhaseFluidSystem.hpp index 4333ab663..f403aa200 100644 --- a/opm/material/fluidsystems/SinglePhaseFluidSystem.hpp +++ b/opm/material/fluidsystems/SinglePhaseFluidSystem.hpp @@ -63,7 +63,9 @@ class SinglePhase public: //! \copydoc BaseFluidSystem::ParameterCache - typedef NullParameterCache ParameterCache; + template + struct ParameterCache : public Opm::NullParameterCache + {}; /**************************************** * Fluid phase related static parameters @@ -183,9 +185,9 @@ public: { } //! \copydoc BaseFluidSystem::density - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -198,9 +200,9 @@ public: } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -213,9 +215,9 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -232,9 +234,9 @@ public: } //! \copydoc BaseFluidSystem::enthalpy - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -247,9 +249,9 @@ public: } //! \copydoc BaseFluidSystem::thermalConductivity - template + template static LhsEval thermalConductivity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; @@ -262,9 +264,9 @@ public: } //! \copydoc BaseFluidSystem::heatCapacity - template + template static LhsEval heatCapacity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef Opm::MathToolbox FsToolbox; diff --git a/opm/material/fluidsystems/Spe5FluidSystem.hpp b/opm/material/fluidsystems/Spe5FluidSystem.hpp index 0053ae6ea..311c780ff 100644 --- a/opm/material/fluidsystems/Spe5FluidSystem.hpp +++ b/opm/material/fluidsystems/Spe5FluidSystem.hpp @@ -64,7 +64,9 @@ class Spe5 public: //! \copydoc BaseFluidSystem::ParameterCache - typedef Opm::Spe5ParameterCache ParameterCache; + template + struct ParameterCache : public Opm::Spe5ParameterCache + {}; /**************************************** * Fluid phase parameters @@ -356,27 +358,23 @@ public: } //! \copydoc BaseFluidSystem::density - template - static Scalar density(const FluidState &fluidState, - const ParameterCache ¶mCache, - unsigned phaseIdx) + template + static LhsEval density(const FluidState &fluidState, + const ParameterCache ¶mCache, + unsigned phaseIdx) { assert(0 <= phaseIdx && phaseIdx < numPhases); - static_assert(std::is_same::value, - "The SPE-5 fluid system is currently only implemented for the scalar case."); return fluidState.averageMolarMass(phaseIdx)/paramCache.molarVolume(phaseIdx); } //! \copydoc BaseFluidSystem::viscosity - template - static Scalar viscosity(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, - unsigned phaseIdx) + template + static LhsEval viscosity(const FluidState &/*fluidState*/, + const ParameterCache &/*paramCache*/, + unsigned phaseIdx) { assert(0 <= phaseIdx && phaseIdx <= numPhases); - static_assert(std::is_same::value, - "The SPE-5 fluid system is currently only implemented for the scalar case."); if (phaseIdx == gasPhaseIdx) { // given by SPE-5 in table on page 64. we use a constant @@ -395,16 +393,14 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template - static Scalar fugacityCoefficient(const FluidState &fluidState, - const ParameterCache ¶mCache, - unsigned phaseIdx, - unsigned compIdx) + template + static LhsEval fugacityCoefficient(const FluidState &fluidState, + const ParameterCache ¶mCache, + unsigned phaseIdx, + unsigned compIdx) { assert(0 <= phaseIdx && phaseIdx <= numPhases); assert(0 <= compIdx && compIdx <= numComponents); - static_assert(std::is_same::value, - "The SPE-5 fluid system is currently only implemented for the scalar case."); if (phaseIdx == oilPhaseIdx || phaseIdx == gasPhaseIdx) return PengRobinsonMixture::computeFugacityCoefficient(fluidState, @@ -420,7 +416,8 @@ public: } protected: - static Scalar henryCoeffWater_(unsigned compIdx, Scalar temperature) + template + static LhsEval henryCoeffWater_(unsigned compIdx, const LhsEval& temperature) { // use henry's law for the solutes and the vapor pressure for // the solvent. diff --git a/opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp b/opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp index 43b205697..4ed84b7d9 100644 --- a/opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp +++ b/opm/material/fluidsystems/TwoPhaseImmiscibleFluidSystem.hpp @@ -63,9 +63,11 @@ class TwoPhaseImmiscible typedef TwoPhaseImmiscible ThisType; typedef BaseFluidSystem Base; + public: - //! \copydoc BaseFluidSystem::ParameterCache - typedef NullParameterCache ParameterCache; + template + struct ParameterCache : public Opm::NullParameterCache + {}; /**************************************** * Fluid phase related static parameters @@ -219,9 +221,9 @@ public: } //! \copydoc BaseFluidSystem::density - template + template static LhsEval density(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; @@ -236,9 +238,9 @@ public: } //! \copydoc BaseFluidSystem::viscosity - template + template static LhsEval viscosity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; @@ -253,9 +255,9 @@ public: } //! \copydoc BaseFluidSystem::fugacityCoefficient - template + template static LhsEval fugacityCoefficient(const FluidState &/*fluidState*/, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx, unsigned compIdx) { @@ -274,9 +276,9 @@ public: } //! \copydoc BaseFluidSystem::enthalpy - template + template static LhsEval enthalpy(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; @@ -291,9 +293,9 @@ public: } //! \copydoc BaseFluidSystem::thermalConductivity - template + template static LhsEval thermalConductivity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; @@ -308,9 +310,9 @@ public: } //! \copydoc BaseFluidSystem::heatCapacity - template + template static LhsEval heatCapacity(const FluidState &fluidState, - const ParameterCache &/*paramCache*/, + const ParameterCache &/*paramCache*/, unsigned phaseIdx) { typedef MathToolbox FsToolbox; diff --git a/tests/test_immiscibleflash.cpp b/tests/test_immiscibleflash.cpp index 921b57f69..efaf6e3f7 100644 --- a/tests/test_immiscibleflash.cpp +++ b/tests/test_immiscibleflash.cpp @@ -108,9 +108,9 @@ void checkImmiscibleFlash(const FluidState &fsRef, fsFlash.setTemperature(fsRef.temperature(/*phaseIdx=*/0)); // run the flash calculation - typename FluidSystem::ParameterCache paramCache; - ImmiscibleFlash::guessInitial(fsFlash, paramCache, globalMolarities); - ImmiscibleFlash::template solve(fsFlash, paramCache, matParams, globalMolarities); + ImmiscibleFlash::guessInitial(fsFlash, globalMolarities); + typename FluidSystem::template ParameterCache paramCache; + ImmiscibleFlash::template solve(fsFlash, matParams, paramCache, globalMolarities); // compare the "flashed" fluid state with the reference one checkSame(fsRef, fsFlash); @@ -138,7 +138,7 @@ void completeReferenceFluidState(FluidState &fs, + (pC[otherPhaseIdx] - pC[refPhaseIdx])); // set all phase densities - typename FluidSystem::ParameterCache paramCache; + typename FluidSystem::template ParameterCache paramCache; paramCache.updateAll(fs); for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) { Scalar rho = FluidSystem::density(fs, paramCache, phaseIdx); diff --git a/tests/test_ncpflash.cpp b/tests/test_ncpflash.cpp index cb4b47d34..7eb0c51ff 100644 --- a/tests/test_ncpflash.cpp +++ b/tests/test_ncpflash.cpp @@ -90,6 +90,7 @@ void checkNcpFlash(const FluidState &fsRef, enum { numPhases = FluidSystem::numPhases }; enum { numComponents = FluidSystem::numComponents }; typedef Dune::FieldVector ComponentVector; + typedef typename FluidSystem::template ParameterCache ParameterCache; // calculate the total amount of stuff in the reference fluid // phase @@ -108,9 +109,10 @@ void checkNcpFlash(const FluidState &fsRef, fsFlash.setTemperature(fsRef.temperature(/*phaseIdx=*/0)); // run the flash calculation - typename FluidSystem::ParameterCache paramCache; - NcpFlash::guessInitial(fsFlash, paramCache, globalMolarities); - NcpFlash::template solve(fsFlash, paramCache, matParams, globalMolarities); + ParameterCache paramCache; + paramCache.updateAll(fsFlash); + NcpFlash::guessInitial(fsFlash, globalMolarities); + NcpFlash::template solve(fsFlash, matParams, paramCache, globalMolarities); // compare the "flashed" fluid state with the reference one checkSame(fsRef, fsFlash); @@ -141,7 +143,7 @@ void completeReferenceFluidState(FluidState &fs, // make the fluid state consistent with local thermodynamic // equilibrium - typename FluidSystem::ParameterCache paramCache; + typename FluidSystem::template ParameterCache paramCache; ComputeFromReferencePhase::solve(fs, paramCache, refPhaseIdx, @@ -251,7 +253,7 @@ inline void testAll() fsRef.setPressure(liquidPhaseIdx, 1e6); fsRef.setPressure(gasPhaseIdx, 1e6); - typename FluidSystem::ParameterCache paramCache; + typename FluidSystem::template ParameterCache paramCache; typedef Opm::MiscibleMultiPhaseComposition MiscibleMultiPhaseComposition; MiscibleMultiPhaseComposition::solve(fsRef, paramCache, /*setViscosity=*/false, diff --git a/tests/test_pengrobinson.cpp b/tests/test_pengrobinson.cpp index 6775d4513..1f2801c01 100644 --- a/tests/test_pengrobinson.cpp +++ b/tests/test_pengrobinson.cpp @@ -59,7 +59,7 @@ void createSurfaceGasFluidSystem(FluidState &gasFluidState) gasFluidState.setMoleFraction(gasPhaseIdx, FluidSystem::C20Idx, 0.00); // gas density - typename FluidSystem::ParameterCache paramCache; + typename FluidSystem::template ParameterCache paramCache; paramCache.updatePhase(gasFluidState, gasPhaseIdx); gasFluidState.setDensity(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)); } - typename FluidSystem::ParameterCache paramCache; + typename FluidSystem::template ParameterCache paramCache; paramCache.updateAll(surfaceFluidState); // 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 tmpMolarities = molarities; tmpMolarities /= alpha; - Flash::template solve(surfaceFluidState, paramCache, matParams, tmpMolarities); + Flash::template solve(surfaceFluidState, matParams, paramCache, tmpMolarities); Scalar f = surfaceFluidState.pressure(gasPhaseIdx) - refPressure; // 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; tmpMolarities = molarities; tmpMolarities /= alpha + eps; - Flash::template solve(surfaceFluidState, paramCache, matParams, tmpMolarities); + Flash::template solve(surfaceFluidState, matParams, paramCache, tmpMolarities); Scalar fStar = surfaceFluidState.pressure(gasPhaseIdx) - refPressure; Scalar fPrime = (fStar - f)/eps; @@ -247,7 +247,7 @@ Scalar bringOilToSurface(FluidState &surfaceFluidState, Scalar alpha, const Flui // calculate the final result tmpMolarities = molarities; tmpMolarities /= alpha; - Flash::template solve(surfaceFluidState, paramCache, matParams, tmpMolarities); + Flash::template solve(surfaceFluidState, matParams, paramCache, tmpMolarities); return alpha; } @@ -316,7 +316,7 @@ inline void testAll() typedef Opm::LinearMaterial MaterialLaw; typedef typename MaterialLaw::Params MaterialLawParams; - typedef typename FluidSystem::ParameterCache ParameterCache; + typedef typename FluidSystem::template ParameterCache ParameterCache; //////////// // Initialize the fluid system and create the capillary pressure @@ -400,8 +400,8 @@ inline void testAll() FluidState flashFluidState, surfaceFluidState; flashFluidState.assign(fluidState); - //Flash::guessInitial(flashFluidState, paramCache, totalMolarities); - Flash::template solve(flashFluidState, paramCache, matParams, totalMolarities); + //Flash::guessInitial(flashFluidState, totalMolarities); + Flash::template solve(flashFluidState, matParams, paramCache, totalMolarities); Scalar surfaceAlpha = 1; surfaceAlpha = bringOilToSurface(surfaceFluidState, surfaceAlpha, flashFluidState, /*guessInitial=*/true); @@ -424,7 +424,7 @@ inline void testAll() curTotalMolarities /= alpha; // "flash" the modified reservoir oil - Flash::template solve(flashFluidState, paramCache, matParams, curTotalMolarities); + Flash::template solve(flashFluidState, matParams, paramCache, curTotalMolarities); surfaceAlpha = bringOilToSurface(surfaceFluidState, surfaceAlpha,