Commit fae83da5 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[cleanup] Use convenience functions for enthalpy, internal energy, fugacity and avgMolarmass

Implement  functions in the volvars and use them
instead of volvars.fluidstate().x().
parent 567e78be
......@@ -248,7 +248,7 @@ if (!std::isfinite(storage[energyEqIdx]))
// use the phase enthalpy of the upstream vertex to calculate
// the enthalpy transport
const VolumeVariables &up = elemVolVars[upIdx];
flux[energyEqIdx] += up.fluidState().enthalpy(phaseIdx) * massFlux;
flux[energyEqIdx] += up.enthalpy(phaseIdx) * massFlux;
#ifndef NDEBUG
if (!std::isfinite(flux[energyEqIdx]) )
DUNE_THROW(NumericalProblem, "Calculated non-finite energy flux");
......
......@@ -209,8 +209,8 @@ public:
* To be more precise this should be the components enthalpy.
* In the same vein: Counter current diffusion is not accounted for here.
*/
const Scalar transportedThingUp = up.fluidState().enthalpy(phaseIdx) ;
const Scalar transportedThingDn = dn.fluidState().enthalpy(phaseIdx) ;
const Scalar transportedThingUp = up.enthalpy(phaseIdx) ;
const Scalar transportedThingDn = dn.enthalpy(phaseIdx) ;
const Scalar massUpwindWeight_ = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Implicit, MassUpwindWeight);
......@@ -574,8 +574,8 @@ public:
/* todo
* CAUTION: this is not exactly correct: does diffusion carry the upstream phase enthalpy? To be more precise this should be the components enthalpy. In the same vein: Counter current diffusion is not accounted for here.
*/
const Scalar transportedThingUp = up.fluidState().enthalpy(phaseIdx) ;
const Scalar transportedThingDn = dn.fluidState().enthalpy(phaseIdx) ;
const Scalar transportedThingUp = up.enthalpy(phaseIdx) ;
const Scalar transportedThingDn = dn.enthalpy(phaseIdx) ;
const Scalar massUpwindWeight_ = GET_PARAM_FROM_GROUP(TypeTag, Scalar, Implicit, MassUpwindWeight);
flux[energyEq0Idx] += massFlux *
......
......@@ -193,9 +193,9 @@ public:
if (temperatureOutput_) temperature_[gobalIdx] = volVars.fluidState().temperature(/*phaseIdx=*/0);
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
if (enthalpyOutput_)
enthalpy_[phaseIdx][gobalIdx] = volVars.fluidState().enthalpy(phaseIdx);
enthalpy_[phaseIdx][gobalIdx] = volVars.enthalpy(phaseIdx);
if (internalEnergyOutput_)
internalEnergy_[phaseIdx][gobalIdx] = volVars.fluidState().internalEnergy(phaseIdx);
internalEnergy_[phaseIdx][gobalIdx] = volVars.internalEnergy(phaseIdx);
}
}
}
......
......@@ -136,8 +136,8 @@ public:
const VolumeVariables &volVars = elemVolVars[localVertexIdx];
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
enthalpy_[phaseIdx][vIdxGlobal] = volVars.fluidState().enthalpy(phaseIdx);
internalEnergy_[phaseIdx][vIdxGlobal] = volVars.fluidState().internalEnergy(phaseIdx);
enthalpy_[phaseIdx][vIdxGlobal] = volVars.enthalpy(phaseIdx);
internalEnergy_[phaseIdx][vIdxGlobal] = volVars.internalEnergy(phaseIdx);
reynoldsNumber_[phaseIdx][vIdxGlobal] = volVars.reynoldsNumber(phaseIdx);
prandtlNumber_[phaseIdx][vIdxGlobal] = volVars.prandtlNumber(phaseIdx);
nusseltNumber_[phaseIdx][vIdxGlobal] = volVars.nusseltNumber(phaseIdx);
......@@ -381,8 +381,8 @@ public:
qsf_[vIdxGlobal] = LocalResidual::qsf(volVars);
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
enthalpy_[phaseIdx][vIdxGlobal] = volVars.fluidState().enthalpy(phaseIdx);
internalEnergy_[phaseIdx][vIdxGlobal] = volVars.fluidState().internalEnergy(phaseIdx);
enthalpy_[phaseIdx][vIdxGlobal] = volVars.enthalpy(phaseIdx);
internalEnergy_[phaseIdx][vIdxGlobal] = volVars.internalEnergy(phaseIdx);
reynoldsNumber_[phaseIdx][vIdxGlobal] = volVars.reynoldsNumber(phaseIdx);
prandtlNumber_[phaseIdx][vIdxGlobal] = volVars.prandtlNumber(phaseIdx);
nusseltNumber_[phaseIdx][vIdxGlobal] = volVars.nusseltNumber(phaseIdx);
......
......@@ -99,7 +99,7 @@ public:
if (fugacityOutput_) {
for (int compIdx = 0; compIdx < numComponents; ++compIdx) {
fugacity_[compIdx][dofIdxGlobal] = volVars.fluidState().fugacity(compIdx);
fugacity_[compIdx][dofIdxGlobal] = volVars.fugacity(compIdx);
}
}
}
......
......@@ -321,6 +321,30 @@ public:
Scalar density(const int phaseIdx) const
{ return fluidState_.density(phaseIdx); }
/*!
* \brief Return enthalpy \f$\mathrm{[kg/m^3]}\f$ the of the fluid phase.
*/
Scalar enthalpy(const int phaseIdx) const
{ return fluidState_.enthalpy(phaseIdx); }
/*!
* \brief Return internal energy \f$\mathrm{[kg/m^3]}\f$ the of the fluid phase.
*/
Scalar internalEnergy(const int phaseIdx) const
{ return fluidState_.internalEnergy(phaseIdx); }
/*!
* \brief Return fugacity \f$\mathrm{[kg/m^3]}\f$ the of the component.
*/
Scalar fugacity(const int compIdx) const
{ return fluidState_.fugacity(compIdx); }
/*!
* \brief Return average molar mass \f$\mathrm{[kg/m^3]}\f$ the of the phase.
*/
Scalar averageMolarMass(const int phaseIdx) const
{ return fluidState_.averageMolarMass(phaseIdx); }
/*!
* \brief Returns the effective mobility of a given phase within
* the control volume.
......
......@@ -155,7 +155,7 @@ public:
if (pressureOutput_) pressure_[phaseIdx][dofIdxGlobal] = volVars.pressure(phaseIdx);
if (densityOutput_) density_[phaseIdx][dofIdxGlobal] = volVars.density(phaseIdx);
if (mobilityOutput_) mobility_[phaseIdx][dofIdxGlobal] = volVars.mobility(phaseIdx);
if (averageMolarMassOutput_) averageMolarMass_[phaseIdx][dofIdxGlobal] = volVars.fluidState().averageMolarMass(phaseIdx);
if (averageMolarMassOutput_) averageMolarMass_[phaseIdx][dofIdxGlobal] = volVars.averageMolarMass(phaseIdx);
for (int compIdx = 0; compIdx < numComponents; ++compIdx) {
if (moleFracOutput_) moleFrac_[phaseIdx][compIdx][dofIdxGlobal] = volVars.moleFraction(phaseIdx, compIdx);
if (massFracOutput_) massFrac_[phaseIdx][compIdx][dofIdxGlobal] = volVars.massFraction(phaseIdx, compIdx);
......
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