diff --git a/dumux/implicit/2pnc/2pncfluxvariables.hh b/dumux/implicit/2pnc/2pncfluxvariables.hh index 4a31de496322a6ddb0a7caa3a4f2e6a499e73d80..541db7b224455360e8bb5ece7c2a57738095ee44 100644 --- a/dumux/implicit/2pnc/2pncfluxvariables.hh +++ b/dumux/implicit/2pnc/2pncfluxvariables.hh @@ -147,11 +147,11 @@ protected: if(compIdx != phaseIdx) //No grad is needed for this case { tmp = feGrad; - tmp *= elemVolVars[idx].fluidState().massFraction(phaseIdx, compIdx); + tmp *= elemVolVars[idx].massFraction(phaseIdx, compIdx); massFractionGrad_[phaseIdx][compIdx] += tmp; tmp = feGrad; - tmp *= elemVolVars[idx].fluidState().moleFraction(phaseIdx, compIdx); + tmp *= elemVolVars[idx].moleFraction(phaseIdx, compIdx); moleFractionGrad_[phaseIdx][compIdx] += tmp; } } diff --git a/dumux/implicit/2pnc/2pncmodel.hh b/dumux/implicit/2pnc/2pncmodel.hh index b9242d17e623172620173afc3d64412b45f6dc60..1b91cadddbb7a2f33d79af0ae2d10be2a7ede384 100644 --- a/dumux/implicit/2pnc/2pncmodel.hh +++ b/dumux/implicit/2pnc/2pncmodel.hh @@ -371,8 +371,8 @@ public: (*pg)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(nPhaseIdx); (*pl)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(wPhaseIdx); (*pc)[dofIdxGlobal] = elemVolVars[scvIdx].capillaryPressure(); - (*rhoL)[dofIdxGlobal] = elemVolVars[scvIdx].fluidState().density(wPhaseIdx); - (*rhoG)[dofIdxGlobal] = elemVolVars[scvIdx].fluidState().density(nPhaseIdx); + (*rhoL)[dofIdxGlobal] = elemVolVars[scvIdx].density(wPhaseIdx); + (*rhoG)[dofIdxGlobal] = elemVolVars[scvIdx].density(nPhaseIdx); (*mobL)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(wPhaseIdx); (*mobG)[dofIdxGlobal] = elemVolVars[scvIdx].mobility(nPhaseIdx); (*boxVolume)[dofIdxGlobal] += fvGeometry.subContVol[scvIdx].volume; @@ -383,12 +383,12 @@ public: { for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - (*moleFraction[phaseIdx][compIdx])[dofIdxGlobal]= volVars.fluidState().moleFraction(phaseIdx,compIdx); + (*moleFraction[phaseIdx][compIdx])[dofIdxGlobal]= volVars.moleFraction(phaseIdx,compIdx); Valgrind::CheckDefined((*moleFraction[phaseIdx][compIdx])[dofIdxGlobal]); } } for (int compIdx = 0; compIdx < numComponents; ++compIdx) - (*molarity[compIdx])[dofIdxGlobal] = (volVars.fluidState().molarity(wPhaseIdx, compIdx)); + (*molarity[compIdx])[dofIdxGlobal] = (volVars.molarity(wPhaseIdx, compIdx)); Tensor K = perm_(this->problem_().spatialParams().intrinsicPermeability(element, fvGeometry, scvIdx)); @@ -641,11 +641,11 @@ protected: //switch not depending on formulation //switch "Sl" to "xgH20" globalSol[dofIdxGlobal][switchIdx] - = volVars.fluidState().moleFraction(nPhaseIdx, wCompIdx /*H2O*/); + = volVars.moleFraction(nPhaseIdx, wCompIdx /*H2O*/); //switch all secondary components to mole fraction in gas phase for (int compIdx=numMajorComponents; compIdx<numComponents; ++compIdx) - globalSol[dofIdxGlobal][compIdx] = volVars.fluidState().moleFraction(nPhaseIdx,compIdx); + globalSol[dofIdxGlobal][compIdx] = volVars.moleFraction(nPhaseIdx,compIdx); } //if saturation of gas phase is smaller than 0 switch else if (volVars.saturation(nPhaseIdx) <= Smin) @@ -659,7 +659,7 @@ protected: //switch "Sl" to "xlN2" globalSol[dofIdxGlobal][switchIdx] - = volVars.fluidState().moleFraction(wPhaseIdx, nCompIdx /*N2*/); + = volVars.moleFraction(wPhaseIdx, nCompIdx /*N2*/); } } else if (phasePresence == nPhaseOnly) @@ -669,7 +669,7 @@ protected: //Calculate sum of mole fractions in the hypothetical liquid phase for (int compIdx = 0; compIdx < numComponents; compIdx++) { - sumxl += volVars.fluidState().moleFraction(wPhaseIdx, compIdx); + sumxl += volVars.moleFraction(wPhaseIdx, compIdx); } if (sumxl > xlmax) wouldSwitch = true; @@ -691,7 +691,7 @@ protected: //switch all secondary components back to liquid mole fraction for (int compIdx=numMajorComponents; compIdx<numComponents; ++compIdx) - globalSol[dofIdxGlobal][compIdx] = volVars.fluidState().moleFraction(wPhaseIdx,compIdx); + globalSol[dofIdxGlobal][compIdx] = volVars.moleFraction(wPhaseIdx,compIdx); } } else if (phasePresence == wPhaseOnly) @@ -701,7 +701,7 @@ protected: //Calculate sum of mole fractions in the hypothetical liquid phase for (int compIdx = 0; compIdx < numComponents; compIdx++) { - sumxg += volVars.fluidState().moleFraction(nPhaseIdx, compIdx); + sumxg += volVars.moleFraction(nPhaseIdx, compIdx); } if (sumxg > xgmax) wouldSwitch = true; diff --git a/dumux/implicit/2pnc/2pncvolumevariables.hh b/dumux/implicit/2pnc/2pncvolumevariables.hh index 7bf1c928eb8e315d31d68da11a50e7e6f3477e34..2b8e3980a6ad7c731e1be4f8721e03b9e5e327f1 100644 --- a/dumux/implicit/2pnc/2pncvolumevariables.hh +++ b/dumux/implicit/2pnc/2pncvolumevariables.hh @@ -445,6 +445,37 @@ public: Scalar diffCoeff(int phaseIdx, int compIdx) const { return diffCoeff_[phaseIdx][compIdx]; } + /*! + * \brief Returns the molarity of a component in the phase + * + * \param phaseIdx the index of the fluid phase + * \param compIdx the index of the component + */ + Scalar molarity(int phaseIdx, int compIdx) const // [moles/m^3] + { return this->fluidState_.molarity(phaseIdx, compIdx);} + + /*! + * \brief Returns the mass fraction of a component in the phase + * + * \param phaseIdx the index of the fluid phase + * \param compIdx the index of the component + */ + Scalar massFraction(int phaseIdx, int compIdx) const + { + return this->fluidState_.massFraction(phaseIdx, compIdx); + } + + /*! + * \brief Returns the mole fraction of a component in the phase + * + * \param phaseIdx the index of the fluid phase + * \param compIdx the index of the component + */ + Scalar moleFraction(int phaseIdx, int compIdx) const + { + return this->fluidState_.moleFraction(phaseIdx, compIdx); + } + protected: static Scalar temperature_(const PrimaryVariables &priVars, diff --git a/dumux/implicit/2pncmin/2pncminmodel.hh b/dumux/implicit/2pncmin/2pncminmodel.hh index 573fab9d760c99d1c32407aa5709e12a053a07c1..808e387e4a9956af15aebed4c711ae0bdb271663 100644 --- a/dumux/implicit/2pncmin/2pncminmodel.hh +++ b/dumux/implicit/2pncmin/2pncminmodel.hh @@ -265,8 +265,8 @@ public: (*pg)[globalIdx] = volVars.pressure(nPhaseIdx); (*pl)[globalIdx] = volVars.pressure(wPhaseIdx); (*pc)[globalIdx] = volVars.capillaryPressure(); - (*rhoL)[globalIdx] = volVars.fluidState().density(wPhaseIdx); - (*rhoG)[globalIdx] = volVars.fluidState().density(nPhaseIdx); + (*rhoL)[globalIdx] = volVars.density(wPhaseIdx); + (*rhoG)[globalIdx] = volVars.density(nPhaseIdx); (*mobL)[globalIdx] = volVars.mobility(wPhaseIdx); (*mobG)[globalIdx] = volVars.mobility(nPhaseIdx); (*boxVolume)[globalIdx] += fvGeometry.subContVol[i].volume; @@ -283,13 +283,13 @@ public: for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) for (int compIdx = 0; compIdx < numComponents; ++compIdx) { - (*massFraction[phaseIdx][compIdx])[globalIdx]= volVars.fluidState().massFraction(phaseIdx,compIdx); + (*massFraction[phaseIdx][compIdx])[globalIdx]= volVars.massFraction(phaseIdx,compIdx); Valgrind::CheckDefined((*massFraction[phaseIdx][compIdx])[globalIdx]); } for (int compIdx = 0; compIdx < numComponents; ++compIdx) - (*molarity[compIdx])[globalIdx] = (volVars.fluidState().molarity(wPhaseIdx, compIdx)); + (*molarity[compIdx])[globalIdx] = (volVars.molarity(wPhaseIdx, compIdx)); Tensor K = this->perm_(this->problem_().spatialParams().intrinsicPermeability(element, fvGeometry, i)); @@ -458,7 +458,7 @@ protected: //switch not depending on formulation //switch "Sl" to "xgH20" globalSol[globalIdx][switchIdx] - = volVars.fluidState().moleFraction(nPhaseIdx, wCompIdx /*H2O*/); + = volVars.moleFraction(nPhaseIdx, wCompIdx /*H2O*/); //Here unlike 2pnc model we do not switch all components to to mole fraction in gas phase } //if saturation of gas phase is smaller than 0 switch @@ -473,7 +473,7 @@ protected: //switch "Sl" to "xlN2" globalSol[globalIdx][switchIdx] - = volVars.fluidState().moleFraction(wPhaseIdx, nCompIdx /*N2*/); + = volVars.moleFraction(wPhaseIdx, nCompIdx /*N2*/); } } else if (phasePresence == nPhaseOnly) @@ -484,7 +484,7 @@ protected: //are only present in the liquid phase and cannot condense as the liquid (water). for (int compIdx = 0; compIdx < numComponents; compIdx++) { - sumxl += volVars.fluidState().moleFraction(wPhaseIdx, compIdx); + sumxl += volVars.moleFraction(wPhaseIdx, compIdx); } Scalar xlmax = 1.0; if (sumxl > xlmax) @@ -515,7 +515,7 @@ protected: //Calculate sum of mole fractions in the hypothetical gas phase for (int compIdx = 0; compIdx < numComponents; compIdx++) { - sumxg += volVars.fluidState().moleFraction(nPhaseIdx, compIdx); + sumxg += volVars.moleFraction(nPhaseIdx, compIdx); } if (sumxg > xgmax) wouldSwitch = true; diff --git a/dumux/implicit/2pncmin/2pncminvolumevariables.hh b/dumux/implicit/2pncmin/2pncminvolumevariables.hh index 9ac07987746a6a7c7462a2d086718c826496a5cc..12e9e6e063d17b79a25e3ee8988faf89334bd533 100644 --- a/dumux/implicit/2pncmin/2pncminvolumevariables.hh +++ b/dumux/implicit/2pncmin/2pncminvolumevariables.hh @@ -416,16 +416,16 @@ public: Scalar permeabilityFactor() const { return permeabilityFactor_; } - /*! - * \brief Returns the mole fraction of a component in the phase - * - * \param phaseIdx the index of the fluid phase - * \param compIdx the index of the component - */ - Scalar moleFraction(int phaseIdx, int compIdx) const - { - return this->fluidState_.moleFraction(phaseIdx, compIdx); - } +// /*! +// * \brief Returns the mole fraction of a component in the phase +// * +// * \param phaseIdx the index of the fluid phase +// * \param compIdx the index of the component +// */ +// Scalar moleFraction(int phaseIdx, int compIdx) const +// { +// return this->fluidState_.moleFraction(phaseIdx, compIdx); +// } /*! * \brief Returns the mole fraction of the salinity in the liquid phase @@ -478,9 +478,15 @@ public: * * \param phaseIdx the index of the fluid phase * \param compIdx the index of the component + * molality=\frac{n_{component}}{m_{solvent}} + * =\frac{n_{component}}{n_{solvent}*M_{solvent}} + * compIdx of the main component (solvent) in the + * phase is equal to the phaseIdx */ Scalar molality(int phaseIdx, int compIdx) const // [moles/Kg] - { return this->fluidState_.moleFraction(phaseIdx, compIdx)/FluidSystem::molarMass(compIdx);} + { return this->fluidState_.moleFraction(phaseIdx, compIdx) + /(fluidState_.moleFraction(phaseIdx, phaseIdx) + * FluidSystem::molarMass(phaseIdx));} protected: friend class TwoPNCVolumeVariables<TypeTag>; @@ -528,6 +534,7 @@ protected: Scalar sumPrecipitates_; Scalar salinity_; Scalar moleFractionSalinity_; + FluidState fluidState_; private: Implementation &asImp_()