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

[cleanup] Use convenience function for saturation

Implement a saturation() function in the volvars and use it
instead of volvars.fluidstate().saturation(phaseIdx).
parent 496eb859
......@@ -129,8 +129,8 @@ public:
{
// make sure to only calculate diffusion coefficents
// for phases which exist in both finite volumes
if (elemVolVars[i].fluidState().saturation(phaseIdx) <= 1e-4 ||
elemVolVars[j].fluidState().saturation(phaseIdx) <= 1e-4)
if (elemVolVars[i].saturation(phaseIdx) <= 1e-4 ||
elemVolVars[j].saturation(phaseIdx) <= 1e-4)
{
continue;
}
......@@ -141,11 +141,11 @@ public:
// and j
//
Scalar red_i =
elemVolVars[i].fluidState().saturation(phaseIdx)/elemVolVars[i].porosity() *
pow(elemVolVars[i].porosity() * elemVolVars[i].fluidState().saturation(phaseIdx), 7.0/3);
elemVolVars[i].saturation(phaseIdx)/elemVolVars[i].porosity() *
pow(elemVolVars[i].porosity() * elemVolVars[i].saturation(phaseIdx), 7.0/3);
Scalar red_j =
elemVolVars[j].fluidState().saturation(phaseIdx)/elemVolVars[j].porosity() *
pow(elemVolVars[j].porosity() * elemVolVars[j].fluidState().saturation(phaseIdx), 7.0/3);
elemVolVars[j].saturation(phaseIdx)/elemVolVars[j].porosity() *
pow(elemVolVars[j].porosity() * elemVolVars[j].saturation(phaseIdx), 7.0/3);
if (phaseIdx == wPhaseIdx) {
// Liquid phase diffusion coefficients in the porous medium
......
......@@ -192,13 +192,13 @@ protected:
if (GET_PROP_VALUE(TypeTag, ImplicitIsBox))
{
lambdaI =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].saturation(wPhaseIdx),
elemVolVars[i].thermalConductivity(wPhaseIdx),
elemVolVars[i].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(element, fvGeometry, i),
problem.spatialParams().porosity(element, fvGeometry, i));
lambdaJ =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].saturation(wPhaseIdx),
elemVolVars[j].thermalConductivity(wPhaseIdx),
elemVolVars[j].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(element, fvGeometry, j),
......@@ -211,7 +211,7 @@ protected:
fvGeometryI.subContVol[0].global = elementI.geometry().center();
lambdaI =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].saturation(wPhaseIdx),
elemVolVars[i].thermalConductivity(wPhaseIdx),
elemVolVars[i].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(elementI, fvGeometryI, 0),
......@@ -222,7 +222,7 @@ protected:
fvGeometryJ.subContVol[0].global = elementJ.geometry().center();
lambdaJ =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].saturation(wPhaseIdx),
elemVolVars[j].thermalConductivity(wPhaseIdx),
elemVolVars[j].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(elementJ, fvGeometryJ, 0),
......
......@@ -246,13 +246,13 @@ protected:
if (GET_PROP_VALUE(TypeTag, ImplicitIsBox))
{
lambdaI =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].saturation(wPhaseIdx),
elemVolVars[i].thermalConductivity(wPhaseIdx),
elemVolVars[i].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(element, fvGeometry, i),
problem.spatialParams().porosity(element, fvGeometry, i));
lambdaJ =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].saturation(wPhaseIdx),
elemVolVars[j].thermalConductivity(wPhaseIdx),
elemVolVars[j].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(element, fvGeometry, j),
......@@ -265,7 +265,7 @@ protected:
fvGeometryI.subContVol[0].global = elementI.geometry().center();
lambdaI =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[i].saturation(wPhaseIdx),
elemVolVars[i].thermalConductivity(wPhaseIdx),
elemVolVars[i].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(elementI, fvGeometryI, 0),
......@@ -276,7 +276,7 @@ protected:
fvGeometryJ.subContVol[0].global = elementJ.geometry().center();
lambdaJ =
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].fluidState().saturation(wPhaseIdx),
ThermalConductivityModel::effectiveThermalConductivity(elemVolVars[j].saturation(wPhaseIdx),
elemVolVars[j].thermalConductivity(wPhaseIdx),
elemVolVars[j].thermalConductivity(nPhaseIdx),
problem.spatialParams().solidThermalConductivity(elementJ, fvGeometryJ, 0),
......
......@@ -377,7 +377,7 @@ public:
const unsigned int vIdxGlobal = this->problem_.vertexMapper().subIndex(element, localVertexIdx, dim);
const VolumeVariables &volVars = elemVolVars[localVertexIdx];
qBoil_[vIdxGlobal] = LocalResidual::QBoilFunc(volVars, volVars.fluidState().saturation(wPhaseIdx));
qBoil_[vIdxGlobal] = LocalResidual::QBoilFunc(volVars, volVars.saturation(wPhaseIdx));
qsf_[vIdxGlobal] = LocalResidual::qsf(volVars);
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx) {
......
......@@ -76,7 +76,7 @@ public:
storage = 0;
for (int compIdx = 0; compIdx < numComponents; ++ compIdx) {
storage[compIdx] +=
volVars.fluidState().saturation(phaseIdx)*
volVars.saturation(phaseIdx)*
volVars.fluidState().molarity(phaseIdx, compIdx);
#ifndef NDEBUG
if (!std::isfinite(storage[compIdx]))
......@@ -184,7 +184,7 @@ if (!std::isfinite(volumeFlux))
+
( 1. - massUpwindWeight)*dn.fluidState().molarity(phaseIdx, compIdx) );
if (!std::isfinite(flux[compIdx]))
DUNE_THROW(NumericalProblem, "Calculated non-finite normal flux in phase " << phaseIdx << " comp " << compIdx << "T: "<< up.fluidState().temperature(phaseIdx) << "S "<<up.fluidState().saturation(phaseIdx) ) ;
DUNE_THROW(NumericalProblem, "Calculated non-finite normal flux in phase " << phaseIdx << " comp " << compIdx << "T: "<< up.fluidState().temperature(phaseIdx) << "S "<<up.saturation(phaseIdx) ) ;
}
}
}
......@@ -211,8 +211,8 @@ if (!std::isfinite(volumeFlux))
const VolumeVariables &volVarsI = fluxVars.volVars(fluxVars.face().i);
const VolumeVariables &volVarsJ = fluxVars.volVars(fluxVars.face().j);
if (volVarsI.fluidState().saturation(phaseIdx) < 1e-4 ||
volVarsJ.fluidState().saturation(phaseIdx) < 1e-4)
if (volVarsI.saturation(phaseIdx) < 1e-4 ||
volVarsJ.saturation(phaseIdx) < 1e-4)
{
return; // phase is not present in one of the finite volumes
}
......
......@@ -265,6 +265,15 @@ public:
const FluidState &fluidState() const
{ return fluidState_; }
/*!
* \brief Returns the saturation of a given phase within
* the control volume in \f$[-]\f$.
*
* \param phaseIdx The phase index
*/
Scalar saturation(int phaseIdx) const
{ return fluidState_.saturation(phaseIdx); }
/*!
* \brief Returns the effective mobility of a given phase within
* the control volume.
......
......@@ -151,7 +151,7 @@ public:
if (boundaryTypesOutput_) boundaryTypes_[dofIdxGlobal] = tmp;
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (saturationOutput_) saturation_[phaseIdx][dofIdxGlobal] = volVars.fluidState().saturation(phaseIdx);
if (saturationOutput_) saturation_[phaseIdx][dofIdxGlobal] = volVars.saturation(phaseIdx);
if (pressureOutput_) pressure_[phaseIdx][dofIdxGlobal] = volVars.fluidState().pressure(phaseIdx);
if (densityOutput_) density_[phaseIdx][dofIdxGlobal] = volVars.fluidState().density(phaseIdx);
if (mobilityOutput_) mobility_[phaseIdx][dofIdxGlobal] = volVars.mobility(phaseIdx);
......
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