Commit 5f203b30 authored by Katharina Heck's avatar Katharina Heck Committed by Kilian Weishaupt
Browse files

[porousmediumflow] add average molar mass in all compositional

volumevariables as maxwell-stefan needs that
parent 74bcb339
......@@ -194,6 +194,14 @@ public:
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx = 0) const
{ return fluidState_.averageMolarMass(0); }
/*!
* \brief Returns density \f$\mathrm{[kg/m^3]}\f$ the of the fluid phase.
*
......
......@@ -309,6 +309,13 @@ public:
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the effective saturation of a given phase within
......
......@@ -248,6 +248,14 @@ public:
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the saturation of a given phase within
* the control volume in \f$[-]\f$.
......
......@@ -352,6 +352,14 @@ public:
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the saturation of a given phase within
* the control volume in \f$[-]\f$.
......
......@@ -589,6 +589,15 @@ public:
*/
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the effective saturation of a given phase within
* the control volume.
......
......@@ -789,6 +789,14 @@ public:
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the effective saturation of a given phase within
* the control volume.
......
......@@ -323,6 +323,13 @@ public:
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the saturation of a given phase within
......
......@@ -112,8 +112,17 @@ public:
if (phasePresence == Indices::gasPhaseOnly)
{
moleFraction_[FluidSystem::liquidPhaseIdx] = 1.0;
massFraction_[FluidSystem::liquidPhaseIdx] = 1.0;
moleFraction_[FluidSystem::gasPhaseIdx] = priVars[Indices::switchIdx];
const auto averageMolarMassGasPhase = (moleFraction_[FluidSystem::gasPhaseIdx]*FluidSystem::molarMass(FluidSystem::liquidPhaseIdx)) +
((1-moleFraction_[FluidSystem::gasPhaseIdx])*FluidSystem::molarMass(FluidSystem::gasPhaseIdx));
//X_w = x_w* M_w/ M_avg
massFraction_[FluidSystem::gasPhaseIdx] = priVars[Indices::switchIdx]*FluidSystem::molarMass(FluidSystem::liquidPhaseIdx)/averageMolarMassGasPhase;
fluidState_.setSaturation(FluidSystem::liquidPhaseIdx, 0.0);
fluidState_.setSaturation(FluidSystem::gasPhaseIdx, 1.0);
......@@ -158,6 +167,12 @@ public:
moleFraction_[FluidSystem::gasPhaseIdx] = FluidSystem::H2O::vaporPressure(temperature()) / problem.nonWettingReferencePressure();
const auto averageMolarMassGasPhase = (moleFraction_[FluidSystem::gasPhaseIdx]*FluidSystem::molarMass(FluidSystem::liquidPhaseIdx)) +
((1-moleFraction_[FluidSystem::gasPhaseIdx])*FluidSystem::molarMass(FluidSystem::gasPhaseIdx));
//X_w = x_w* M_w/ M_avg
massFraction_[FluidSystem::gasPhaseIdx] = moleFraction_[FluidSystem::gasPhaseIdx]*FluidSystem::molarMass(FluidSystem::liquidPhaseIdx)/averageMolarMassGasPhase;
// binary diffusion coefficients
typename FluidSystem::ParameterCache paramCache;
paramCache.updateAll(fluidState_);
......@@ -174,6 +189,8 @@ public:
molarDensity_[FluidSystem::gasPhaseIdx] = IdealGas<Scalar>::molarDensity(temperature(), problem.nonWettingReferencePressure());
moleFraction_[FluidSystem::liquidPhaseIdx] = 1.0;
moleFraction_[FluidSystem::gasPhaseIdx] = 0.0;
massFraction_[FluidSystem::liquidPhaseIdx] = 1.0;
massFraction_[FluidSystem::gasPhaseIdx] = 0.0;
// binary diffusion coefficients
typename FluidSystem::ParameterCache paramCache;
......@@ -416,6 +433,21 @@ public:
return moleFraction_[phaseIdx];
}
/*!
* \brief Returns the mole fraction of a given component in a
* given phase within the control volume in \f$[-]\f$.
*
* \param phaseIdx The phase index
* \param compIdx The component index
*/
Scalar massFraction(const int phaseIdx, const int compIdx) const
{
assert(enableWaterDiffusionInAir());
if (compIdx != FluidSystem::comp0Idx)
DUNE_THROW(Dune::InvalidStateException, "There is only one component for Richards!");
return massFraction_[phaseIdx];
}
/*!
* \brief Returns the mass density of a given phase within the
* control volume in \f$[mol/m^3]\f$.
......@@ -447,6 +479,7 @@ protected:
PermeabilityType permeability_; //!< the instrinsic permeability
Scalar minPc_; //!< the minimum capillary pressure (entry pressure)
Scalar moleFraction_[ParentType::numFluidPhases()]; //!< The water mole fractions in water and air
Scalar massFraction_[ParentType::numFluidPhases()]; //!< The water mass fractions in water and air
Scalar molarDensity_[ParentType::numFluidPhases()]; //!< The molar density of water and air
Scalar diffCoeff_; //!< The binary diffusion coefficient of water in air
};
......
......@@ -199,6 +199,14 @@ public:
const SolidState &solidState() const
{ return solidState_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(const int phaseIdx = 0) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the temperature.
*/
......
......@@ -106,6 +106,14 @@ public:
Scalar density(int phaseIdx = 0) const
{ return fluidDensity_; }
/*!
* \brief Returns the average molar mass \f$\mathrm{[kg/mol]}\f$$ the of the fluid phase.
*
* \param phaseIdx The phase index
*/
Scalar averageMolarMass(int phaseIdx = 0) const
{ return fluidMolarMass_; }
/*!
* \brief Returns the phase state for the control volume.
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment