diff --git a/dumux/material/fluidsystems/h2on2kinetic.hh b/dumux/material/fluidsystems/h2on2kinetic.hh index c971bbc6edbd9163ebb3cfa6955fe1ec6c5a8693..c9a07bbdb4e3d74f57e9ec1b2240a609a57234bd 100644 --- a/dumux/material/fluidsystems/h2on2kinetic.hh +++ b/dumux/material/fluidsystems/h2on2kinetic.hh @@ -102,185 +102,6 @@ public: }// end switch phaseIdx } - - /*! - * \brief Returns the equilibrium mole fraction of a component in the other phase. - * - * I.e. this is a (2-phase) solution of the problem: I know the composition of a - * phase and want to know the composition of the other phase. - * - * \param fluidState A container with the current (physical) state of the fluid - * \param paramCache A container for iterative calculation of fluid composition - * \param referencePhaseIdx The index of the phase for which composition is known. - * \param calcCompIdx The component for which the composition in the other phase is to be - * calculated. - */ - - template <class FluidState> - DUNE_DEPRECATED_MSG("FluidSystems should not compute equilibrium mole fractionos. Please use a constraintsolver e.g. the MiscibleMultiPhaseComposition instead") - static void calculateEquilibriumMoleFractionOtherPhase(FluidState & fluidState, - const ParameterCache & paramCache, - const unsigned int referencePhaseIdx, - const unsigned int calcCompIdx) - { - const unsigned int nPhaseIdx = ParentType::gasPhaseIdx; - const unsigned int wPhaseIdx = ParentType::liquidPhaseIdx; - const unsigned int nCompIdx = ParentType::N2Idx; - const unsigned int wCompIdx = ParentType::H2OIdx; - - assert(0 <= referencePhaseIdx && referencePhaseIdx < ParentType::numPhases); - assert(0 <= calcCompIdx && calcCompIdx < ParentType::numComponents); - - const unsigned int numPhases = ParentType::numPhases; - const unsigned int numComponents= ParentType::numComponents; - static_assert(( (numComponents==numPhases) && (numPhases==2) ), - "This function requires that the number of fluid phases is equal " - "to the number of components"); - - const Scalar temperature = fluidState.temperature(/*phaseIdx=*/0); - - // the index of the other phase - // for the 2-phase case, this is easy: nPhase in, wPhase set ; wPhase in, nPhase set - const unsigned int otherPhaseIdx = referencePhaseIdx==wPhaseIdx ? nPhaseIdx : wPhaseIdx ; - - // idea: - the mole fraction of a component in a phase is known. - // - by means of functional relations, the mole fraction of the - // same component in the other phase can be calculated. - - // therefore in: phaseIdx, compIdx, out: mole fraction of compIdx in otherPhaseIdx - - const Scalar pn = fluidState.pressure(nPhaseIdx); - - // the switch is based on what is known: - // the mole fraction of one component in one phase - switch (referencePhaseIdx) - { - case wPhaseIdx : - switch (calcCompIdx) - { - case wCompIdx : - { - // wPhase, wComp comes in: we hand back the concentration in the other phase: nPhase, wComp - const Scalar pv = ParentType::H2O::vaporPressure(temperature) ; - const Scalar xww = fluidState.moleFraction(referencePhaseIdx, calcCompIdx) ; // known from reference phase - const Scalar xnw = pv / pn * xww ; // mole fraction in the other phase - Valgrind::CheckDefined(xnw); - fluidState.setMoleFraction(otherPhaseIdx, calcCompIdx, xnw) ; - return; - } - - case nCompIdx : - { - // wPhase, nComp comes in: we hand back the concentration in the other phase: nPhase, nComp - const Scalar H = BinaryCoeff::H2O_N2::henry(temperature) ; // Pa - const Scalar xwn = fluidState.moleFraction(referencePhaseIdx, calcCompIdx) ; // known from reference phase - const Scalar xnn = H / pn * xwn; // mole fraction in the other phase - Valgrind::CheckDefined(xnn); - fluidState.setMoleFraction(otherPhaseIdx, calcCompIdx, xnn) ; - return; - } - - default: DUNE_THROW(Dune::NotImplemented, "wrong index"); - break; - } - break; - - case nPhaseIdx : - switch (calcCompIdx) - { - case wCompIdx : - { - // nPhase, wComp comes in: we hand back the concentration in the other phase: wPhase, wComp - const Scalar pv = ParentType::H2O::vaporPressure(temperature) ; - const Scalar xnw = fluidState.moleFraction(referencePhaseIdx, calcCompIdx) ;// known from reference phase - const Scalar xww = pn / pv * xnw ; // mole fraction in the other phase - Valgrind::CheckDefined(xww); - fluidState.setMoleFraction(otherPhaseIdx, calcCompIdx, xww) ; - return; - } - - case nCompIdx : - { - // nPhase, nComp comes in: we hand back the concentration in the other phase: wPhase, nComp - const Scalar H = BinaryCoeff::H2O_N2::henry(temperature) ; // Pa - const Scalar xnn = fluidState.moleFraction(referencePhaseIdx, calcCompIdx) ;// known from reference phase - const Scalar xwn = pn / H * xnn ; // mole fraction in the other phase - Valgrind::CheckDefined(xwn); - fluidState.setMoleFraction(otherPhaseIdx, calcCompIdx, xwn) ; - return ; - } - - default: - DUNE_THROW(Dune::NotImplemented, "wrong index"); - } - - DUNE_THROW(Dune::NotImplemented, "wrong index"); - } - } - - /*! - * \brief Calculates the equilibrium composition for a given temperature and pressure. - * - * In general a system of equations needs to be solved for this. In the case of - * a 2 component system, this can done by hand. - * - * If this system was to be described with more components, and /or if a matrix is - * to be assembled like e.g. MiscibleMultiPhaseComposition ConstraintSolver, - * a function describing the chemical potentials of the components in the respective - * phases was needed. - * - * In the case of Henry, Raoult this would be - * - * ----- n-Comp w-Comp - * - * nPhase pn \f$\mathrm{x_n^n}\f$ pn \f$\mathrm{x_n^w}\f$ - * - * wPhase pv \f$\mathrm{w_w^w}\f$ H \f$\mathrm{x_w^n}\f$ - * - * - * Plus additional relations for additional components. - * - * Basically the same structure of the matrix can be used, but the thing that is the - * same in both phases is the chemical potential, not the fugacity coefficient. - * - * \param fluidState A container with the current (physical) state of the fluid - * \param paramCache A container for iterative calculation of fluid composition - */ - template <class FluidState> - DUNE_DEPRECATED_MSG("FluidSystems should not compute equilibrium mole fractionos. Please use a constraintsolver e.g. the MiscibleMultiPhaseComposition instead") - static void calculateEquilibriumMoleFractions(FluidState & fluidState, - const ParameterCache & paramCache) - { - const unsigned int nPhaseIdx = ParentType::gasPhaseIdx; - const unsigned int wPhaseIdx = ParentType::liquidPhaseIdx; - const unsigned int nCompIdx = ParentType::N2Idx; - const unsigned int wCompIdx = ParentType::H2OIdx; - const unsigned int numPhases = ParentType::numPhases; - const unsigned int numComponents= ParentType::numComponents; - - static_assert(((numComponents == numPhases) && (numPhases== 2)), - "This function requires that the number fluid phases is equal " - "to the number of components"); - - const Scalar temperature = fluidState.temperature(/*phaseIdx=*/0); - const Scalar pn = fluidState.pressure(nPhaseIdx); - const Scalar satVapPressure = ParentType::H2O::vaporPressure(temperature); - const Scalar henry = BinaryCoeff::H2O_N2::henry(temperature); - - Scalar x[numPhases][numComponents] ; - x[nPhaseIdx][wCompIdx] = ( satVapPressure*(henry - pn) ) / ( pn*(henry-satVapPressure) ) ; - x[nPhaseIdx][nCompIdx] = 1. - x[nPhaseIdx][wCompIdx]; - x[wPhaseIdx][nCompIdx] = x[nPhaseIdx][nCompIdx] * pn / henry; - x[wPhaseIdx][wCompIdx] = x[nPhaseIdx][wCompIdx] * pn / satVapPressure; - - for (unsigned int phaseIdx = 0; phaseIdx < numPhases; phaseIdx++) - for (unsigned int compIdx = 0; compIdx < numComponents; compIdx++) - { - Valgrind::CheckDefined(x[phaseIdx][compIdx]); - fluidState.setMoleFraction(phaseIdx, compIdx, x[phaseIdx][compIdx]) ; - } - } - /*! * \brief Return the Henry constant for a component in a phase. \f$\mathrm{[Pa]}\f$ * \param temperature The given temperature