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:
Henry
2015-06-01 15:46:17 +01:00
parent 25944abbc8
commit 7608bb5bc6
5 changed files with 41 additions and 57 deletions

View File

@ -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
}
}
}