diff --git a/dumux/material/constraintsolvers/computefromreferencephase.hh b/dumux/material/constraintsolvers/computefromreferencephase.hh index f12d4aab941fff8648f6b74326e0a92db46ad236..cd7ce8034645a08f94d603fa8d246215704d4848 100644 --- a/dumux/material/constraintsolvers/computefromreferencephase.hh +++ b/dumux/material/constraintsolvers/computefromreferencephase.hh @@ -149,7 +149,8 @@ public: refPhaseIdx)); // compute the fugacities of all components in the reference phase - for (int compIdx = 0; compIdx < numComponents; ++compIdx) { + for (int compIdx = 0; compIdx < numComponents; ++compIdx) + { fluidState.setFugacityCoefficient(refPhaseIdx, compIdx, FluidSystem::fugacityCoefficient(fluidState, @@ -160,7 +161,8 @@ public: } // compute all quantities for the non-reference phases - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { + for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) + { if (phaseIdx == refPhaseIdx) continue; // reference phase is already calculated diff --git a/dumux/material/constraintsolvers/computefromreferencephase2pnc.hh b/dumux/material/constraintsolvers/computefromreferencephase2pnc.hh index 52def91eef9e67298fffb3ad84b9c78f267ad81a..7ba997335e486f63e7cbc2c44c0a82f3ef44a937 100644 --- a/dumux/material/constraintsolvers/computefromreferencephase2pnc.hh +++ b/dumux/material/constraintsolvers/computefromreferencephase2pnc.hh @@ -29,13 +29,9 @@ #ifndef DUMUX_COMPUTE_FROM_REFERENCE_PHASE_2PNC_HH #define DUMUX_COMPUTE_FROM_REFERENCE_PHASE_2PNC_HH -#include <dumux/material/constraintsolvers/compositionfromfugacities.hh> +#include <dune/common/deprecated.hh> -#include <dune/common/fvector.hh> -#include <dune/common/fmatrix.hh> - -#include <dumux/common/exceptions.hh> -#include <dumux/common/valgrind.hh> +#include "computefromreferencephase.hh" namespace Dumux { @@ -66,112 +62,10 @@ namespace Dumux { * - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases */ template <class Scalar, class FluidSystem> +DUNE_DEPRECATED_MSG("ComputeFromReferencePhase2pNC is deprecated. Use ComputeFromReferencePhase2p instead.") class ComputeFromReferencePhase2pNC -{ - enum { numPhases = FluidSystem::numPhases }; - enum { numComponents = FluidSystem::numComponents }; - typedef Dumux::CompositionFromFugacities<Scalar, FluidSystem> CompositionFromFugacities; - typedef Dune::FieldVector<Scalar, numComponents> ComponentVector; - -public: - /*! - * \brief Computes all quantities of a generic fluid state if a - * reference phase has been specified. - * - * This makes it is possible to specify just one phase and let the - * remaining ones be calculated by the constraint solver. This - * constraint solver assumes thermodynamic equilibrium. It assumes the - * following quantities to be set: - * - * - composition (mole+mass fractions) of the *reference* phase - * - temperature of the *all* phases - * - saturations of *all* phases - * - pressures of *all* phases - * - * after calling the solve() method the following quantities are - * calculated in addition: - * - * - temperature of *all* phases - * - density, molar density, molar volume of *all* phases - * - composition in mole and mass fractions and molaries of *all* phases - * - mean molar masses of *all* phases - * - fugacity coefficients of *all* components in *all* phases - * - if the setViscosity parameter is true, also dynamic viscosities of *all* phases - * - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases - * - * \param fluidState Thermodynamic state of the fluids - * \param paramCache Container for cache parameters - * \param refPhaseIdx The phase index of the reference phase - * \param setViscosity Specify whether the dynamic viscosity of - * each phase should also be set. - * \param setEnthalpy Specify whether the specific - * enthalpy/internal energy of each phase - * should also be set. - */ - template <class FluidState, class ParameterCache> - static void solve(FluidState &fluidState, - ParameterCache ¶mCache, - int refPhaseIdx, - bool setViscosity, - bool setEnthalpy) - { - ComponentVector fugVec; - - // compute the density and enthalpy of the - // reference phase - paramCache.updatePhase(fluidState, refPhaseIdx); - fluidState.setDensity(refPhaseIdx, - FluidSystem::density(fluidState, - paramCache, - refPhaseIdx)); - - if (setEnthalpy) - fluidState.setEnthalpy(refPhaseIdx, - FluidSystem::enthalpy(fluidState, - paramCache, - refPhaseIdx)); - - if (setViscosity) - fluidState.setViscosity(refPhaseIdx, - FluidSystem::viscosity(fluidState, - paramCache, - refPhaseIdx)); - - // compute the fugacities of all components in the reference phase - for (int compIdx = 0; compIdx < numComponents; ++compIdx) - { - fluidState.setFugacityCoefficient(refPhaseIdx, - compIdx, - FluidSystem::fugacityCoefficient(fluidState, - paramCache, - refPhaseIdx, - compIdx)); - fugVec[compIdx] = fluidState.fugacity(refPhaseIdx, compIdx); - } - - // compute all quantities for the non-reference phases - for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) - { - if (phaseIdx == refPhaseIdx) - continue; // reference phase is already calculated - - CompositionFromFugacities::guessInitial(fluidState, paramCache, phaseIdx, fugVec); - CompositionFromFugacities::solve(fluidState, paramCache, phaseIdx, fugVec); - - if (setViscosity) - fluidState.setViscosity(phaseIdx, - FluidSystem::viscosity(fluidState, - paramCache, - phaseIdx)); - - if (setEnthalpy) - fluidState.setEnthalpy(phaseIdx, - FluidSystem::enthalpy(fluidState, - paramCache, - phaseIdx)); - } - } -}; + : public ComputeFromReferencePhase<Scalar, FluidSystem> +{ }; } // end namespace Dumux diff --git a/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh b/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh index 6f14d8c510065c122d179f5adda715f9db6602e2..b67ec289dc9d18edc43309f16030a66ceb352feb 100644 --- a/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/2pnc/implicit/volumevariables.hh @@ -34,7 +34,7 @@ #include "properties.hh" #include "indices.hh" -#include <dumux/material/constraintsolvers/computefromreferencephase2pnc.hh> +#include <dumux/material/constraintsolvers/computefromreferencephase.hh> #include <dumux/material/constraintsolvers/miscible2pnccomposition.hh> namespace Dumux @@ -101,7 +101,7 @@ class TwoPNCVolumeVariables : public ImplicitVolumeVariables<TypeTag> using Element = typename GridView::template Codim<0>::Entity; using CoordScalar = typename Grid::ctype; using Miscible2pNCComposition = Dumux::Miscible2pNCComposition<Scalar, FluidSystem>; - using ComputeFromReferencePhase2pNC = Dumux::ComputeFromReferencePhase2pNC<Scalar, FluidSystem>; + using ComputeFromReferencePhase = Dumux::ComputeFromReferencePhase<Scalar, FluidSystem>; enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) }; enum { dofCodim = isBox ? dim : 0 }; @@ -294,19 +294,18 @@ public: // calculate the composition of the remaining phases (as // well as the densities of all phases). this is the job - // of the "ComputeFromReferencePhase2pNC" constraint solver - ComputeFromReferencePhase2pNC::solve(fluidState, - paramCache, - nPhaseIdx, - /*setViscosity=*/true, - /*setEnthalpy=*/false); + // of the "ComputeFromReferencePhase" constraint solver + ComputeFromReferencePhase::solve(fluidState, + paramCache, + nPhaseIdx, + /*setViscosity=*/true, + /*setEnthalpy=*/false); } - else if (phasePresence == wPhaseOnly) - { - // only the liquid phase is present, i.e. liquid phase - // composition is stored explicitly. - // extract _mass_ fractions in the gas phase + else if (phasePresence == wPhaseOnly){ + // only the liquid phase is present, i.e. liquid phase + // composition is stored explicitly. + // extract _mass_ fractions in the gas phase Dune::FieldVector<Scalar, numComponents> moleFrac; for (int compIdx=numMajorComponents; compIdx<numComponents; ++compIdx) @@ -328,12 +327,12 @@ public: // calculate the composition of the remaining phases (as // well as the densities of all phases). this is the job - // of the "ComputeFromReferencePhase2pNC" constraint solver - ComputeFromReferencePhase2pNC::solve(fluidState, - paramCache, - wPhaseIdx, - /*setViscosity=*/true, - /*setEnthalpy=*/false); + // of the "ComputeFromReferencePhase" constraint solver + ComputeFromReferencePhase::solve(fluidState, + paramCache, + wPhaseIdx, + /*setViscosity=*/true, + /*setEnthalpy=*/false); } paramCache.updateAll(fluidState); for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)