Commit d1eb1ccd authored by Thomas Fetzer's avatar Thomas Fetzer
Browse files

[stokes and fluidsystem]

- implemented heat capacity from already existing component heat
  capacities in h2oairfluidsystem.hh
- implemented return functions for moleFraction, temperature, and heat
  capacity in fluxVars



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13872 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent ce8e972a
......@@ -88,13 +88,19 @@ public:
*/
const Scalar molarDensity() const
{ return molarDensity_; }
/*!
/*!
* \brief Return the mass fraction of a transported component at the integration point.
*/
const Scalar massFraction(int compIdx) const
{ return massFraction_[compIdx]; }
/*!
* \brief Return the mole fraction of a transported component at the integration point.
*/
const Scalar moleFraction(int compIdx) const
{ return moleFraction_[compIdx]; }
/*!
* \brief Return the molar diffusion coefficient of a transported component at the integration point.
*/
......@@ -122,6 +128,7 @@ protected:
// loop over all components
for (int compIdx=0; compIdx<numComponents; compIdx++){
massFraction_[compIdx] = Scalar(0.0);
moleFraction_[compIdx] = Scalar(0.0);
diffusionCoeff_[compIdx] = Scalar(0.0);
moleFractionGrad_[compIdx] = Scalar(0.0);
......@@ -139,6 +146,8 @@ protected:
this->face().shapeValue[scvIdx];
massFraction_[compIdx] += elemVolVars[scvIdx].massFraction(compIdx) *
this->face().shapeValue[scvIdx];
moleFraction_[compIdx] += elemVolVars[scvIdx].moleFraction(compIdx) *
this->face().shapeValue[scvIdx];
diffusionCoeff_[compIdx] += elemVolVars[scvIdx].diffusionCoeff(compIdx) *
this->face().shapeValue[scvIdx];
......@@ -152,7 +161,8 @@ protected:
}
Valgrind::CheckDefined(molarDensity_);
Valgrind::CheckDefined(massFraction_[compIdx]);
Valgrind::CheckDefined(massFraction_[compIdx]);
Valgrind::CheckDefined(moleFraction_[compIdx]);
Valgrind::CheckDefined(diffusionCoeff_[compIdx]);
Valgrind::CheckDefined(moleFractionGrad_[compIdx]);
}
......@@ -160,7 +170,8 @@ protected:
}
Scalar molarDensity_;
Scalar massFraction_[numComponents];
Scalar massFraction_[numComponents];
Scalar moleFraction_[numComponents];
Scalar diffusionCoeff_[numComponents];
DimVector moleFractionGrad_[numComponents];
};
......
......@@ -181,8 +181,8 @@ public:
{ return this->fluidState_.massFraction(phaseIdx, compIdx); }
/*!
* \brief Returns the mass fraction of a given component in the
* given fluid phase within the control volume.
* \brief Returns the mole fraction of a given component in the
* given fluid phase within the control volume.
*
* \param compIdx The component index
*/
......
......@@ -77,12 +77,25 @@ public:
calculateValues_(problem, element, elemVolVars);
}
/*!
* \brief Returns the temperature \f$\mathrm{[K]}\f$ at the integration point.
*/
const Scalar temperature() const
{ return temperature_; }
/*!
* \brief Returns the thermal conductivity \f$\mathrm{[W/(m*K)]}\f$ at the integration point.
*/
const Scalar thermalConductivity() const
{ return thermalConductivity_; }
/*!
* \brief Returns the specific isobaric heat capacity \f$\mathrm{[J/(kg*K)]}\f$
* at the integration point.
*/
Scalar heatCapacity() const
{ return heatCapacity_; }
/*!
* \brief Return the enthalpy of a component \f$\mathrm{[J/kg]}\f$ at the integration point.
*/
......@@ -90,7 +103,7 @@ public:
{ return componentEnthalpy_[componentIdx]; }
/*!
* \brief Returns the temperature gradient at the integration point.
* \brief Returns the temperature gradient \f$\mathrm{[K/m]}\f$ at the integration point.
*/
const DimVector &temperatureGrad() const
{ return temperatureGrad_; }
......@@ -107,7 +120,9 @@ protected:
const Element &element,
const ElementVolumeVariables &elemVolVars)
{
temperature_ = Scalar(0);
thermalConductivity_ = Scalar(0);
heatCapacity_ = Scalar(0);
temperatureGrad_ = Scalar(0);
// calculate gradients and secondary variables at IPs
......@@ -116,16 +131,24 @@ protected:
idx < this->fvGeometry_.numScv;
idx++) // loop over vertices of the element
{
temperature_ += elemVolVars[idx].temperature() *
this->face().shapeValue[idx];
thermalConductivity_ += elemVolVars[idx].thermalConductivity() *
this->face().shapeValue[idx];
heatCapacity_ += elemVolVars[idx].heatCapacity() *
this->face().shapeValue[idx];
// the gradient of the temperature at the IP
for (int dimIdx=0; dimIdx<dim; ++dimIdx)
temperatureGrad_ +=
this->face().grad[idx][dimIdx]*
elemVolVars[idx].temperature();
}
Valgrind::CheckDefined(temperature_);
Valgrind::CheckDefined(thermalConductivity_);
Valgrind::CheckDefined(heatCapacity_);
Valgrind::CheckDefined(temperatureGrad_);
for (unsigned int i = 0; i < numComponents; ++i)
......@@ -140,7 +163,9 @@ protected:
}
}
Scalar temperature_;
Scalar thermalConductivity_;
Scalar heatCapacity_;
Scalar componentEnthalpy_[numComponents];
DimVector temperatureGrad_;
};
......
......@@ -93,21 +93,24 @@ public:
{ return this->fluidState_.enthalpy(phaseIdx); }
/*!
* \brief Returns the component enthalpy in the sub-control volume.
* \brief Return the specific isobaric heat capacity \f$\mathrm{[J/(kg*K)]}\f$
* in the sub-control volume.
*/
Scalar heatCapacity() const
{ return FluidSystem::heatCapacity(this->fluidState_, phaseIdx); }
/*!
* \brief Returns the component enthalpy \f$\mathrm{[J/(kg*K)]}\f$ in the sub-control volume.
*/
Scalar componentEnthalpy(unsigned int componentIdx) const
{
return FluidSystem::componentEnthalpy(this->fluidState_, phaseIdx, componentIdx);
}
{ return FluidSystem::componentEnthalpy(this->fluidState_, phaseIdx, componentIdx); }
/*!
* \brief Returns the thermal conductivity \f$\mathrm{[W/(m*K)]}\f$
* of the fluid phase in the sub-control volume.
*/
Scalar thermalConductivity() const
{
return FluidSystem::thermalConductivity(this->fluidState_, phaseIdx);
}
{ return FluidSystem::thermalConductivity(this->fluidState_, phaseIdx); }
protected:
......
......@@ -204,7 +204,7 @@ public:
}
/*!
* \brief Specific isobaric heat capacity \f$[J/(kg K)]\f$ of pure
* \brief Specific isobaric heat capacity \f$\mathrm{[J/(kg*K)}\f$ of pure
* air.
*
* This methods uses the formula for "zero-pressure" heat capacity that
......
......@@ -250,7 +250,7 @@ public:
}
/*!
* \brief Specific isobaric heat capacity of water steam \f$\mathrm{[J/kg]}\f$.
* \brief Specific isobaric heat capacity of water steam \f$\mathrm{[J/(kg*K)}\f$.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
......@@ -483,7 +483,7 @@ public:
}
/*!
* \brief Specific isochoric heat capacity of steam and water vapor \f$\mathrm{[J/kg]}\f$.
* \brief Specific isochoric heat capacity of steam and water vapor \f$\mathrm{[J/(kg*K)}\f$.
*
* \param temperature temperature of component in \f$\mathrm{[K]}\f$
* \param pressure pressure of component in \f$\mathrm{[Pa]}\f$
......
......@@ -725,7 +725,7 @@ public:
/*!
* \brief Specific isobaric heat capacity of a fluid phase.
* \f$\mathrm{[J/kg]}\f$.
* \f$\mathrm{[J/(kg*K)}\f$.
*
* \param params mutable parameters
* \param phaseIdx for which phase to give back the heat capacity
......@@ -735,7 +735,21 @@ public:
static Scalar heatCapacity(const FluidState &fluidState,
int phaseIdx)
{
DUNE_THROW(Dune::NotImplemented, "FluidSystems::H2OAir::heatCapacity()");
const Scalar temperature = fluidState.temperature(phaseIdx);
const Scalar pressure = fluidState.pressure(phaseIdx);
if (phaseIdx == wPhaseIdx)
{
// influence of air is neglected
return H2O::liquidHeatCapacity(temperature, pressure);
}
else if (phaseIdx == nPhaseIdx)
{
//! \todo PRELIMINARY, right way to deal with solutes?
return Air::gasHeatCapacity(temperature, pressure) * fluidState.moleFraction(nPhaseIdx, AirIdx)
+ H2O::gasHeatCapacity(temperature, pressure) * fluidState.moleFraction(nPhaseIdx, H2OIdx);
}
else
DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << 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