mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fixedTemperatureConstraint,effectivenessHeatExchangerSource: Set the field name to that of the energy
field from which the temperature is obtained Removes the need for the 'alwaysApply' hack.
This commit is contained in:
@ -94,19 +94,20 @@ Foam::fv::fixedTemperatureConstraint::fixedTemperatureConstraint
|
||||
}
|
||||
|
||||
|
||||
fieldNames_.setSize(1, "energy");
|
||||
// Set the field name to that of the energy field from which the temperature
|
||||
// is obtained
|
||||
|
||||
const basicThermo& thermo =
|
||||
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
fieldNames_.setSize(1, thermo.he().name());
|
||||
|
||||
applied_.setSize(1, false);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fv::fixedTemperatureConstraint::alwaysApply() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::fixedTemperatureConstraint::constrain
|
||||
(
|
||||
fvMatrix<scalar>& eqn,
|
||||
@ -116,34 +117,30 @@ void Foam::fv::fixedTemperatureConstraint::constrain
|
||||
const basicThermo& thermo =
|
||||
mesh_.lookupObject<basicThermo>("thermophysicalProperties");
|
||||
|
||||
if (eqn.psi().name() == thermo.he().name())
|
||||
switch (mode_)
|
||||
{
|
||||
switch (mode_)
|
||||
case tmUniform:
|
||||
{
|
||||
case tmUniform:
|
||||
{
|
||||
const scalar t = mesh_.time().value();
|
||||
scalarField Tuni(cells_.size(), Tuniform_->value(t));
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tuni, cells_));
|
||||
const scalar t = mesh_.time().value();
|
||||
scalarField Tuni(cells_.size(), Tuniform_->value(t));
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tuni, cells_));
|
||||
|
||||
break;
|
||||
}
|
||||
case tmLookup:
|
||||
{
|
||||
const volScalarField& T =
|
||||
mesh().lookupObject<volScalarField>(TName_);
|
||||
|
||||
scalarField Tlkp(T, cells_);
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tlkp, cells_));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// error handling done by NamedEnum
|
||||
}
|
||||
break;
|
||||
}
|
||||
case tmLookup:
|
||||
{
|
||||
const volScalarField& T =
|
||||
mesh().lookupObject<volScalarField>(TName_);
|
||||
|
||||
scalarField Tlkp(T, cells_);
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tlkp, cells_));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// error handling done by NamedEnum
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user