heThermo: Simplified initialisation and fixed Clang optimisation issue

The initialisation of energy in heThermo has been rewritten to use the
"he" method.

This has had the effect of resolving a floating point error in the
initialisation by disabling Clang's vectorisation of the loop in which
cell values of energy are calculated from the temperature field.
This commit is contained in:
Will Bainbridge
2019-11-27 12:50:55 +00:00
parent 5eaf74c3a4
commit 9675107f7e
2 changed files with 4 additions and 37 deletions

View File

@ -29,34 +29,6 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class BasicThermo, class MixtureType>
void Foam::heThermo<BasicThermo, MixtureType>::init()
{
scalarField& heCells = he_.primitiveFieldRef();
const scalarField& pCells = this->p();
const scalarField& TCells = this->T_;
forAll(heCells, celli)
{
heCells[celli] =
this->cellMixture(celli).HE(pCells[celli], TCells[celli]);
}
volScalarField::Boundary& heBf = he_.boundaryFieldRef();
forAll(heBf, patchi)
{
heBf[patchi] == he
(
this->T_.boundaryField()[patchi],
patchi
);
}
this->heBoundaryCorrection(he_);
}
template<class BasicThermo, class MixtureType>
template<class Method, class ... Args>
Foam::tmp<Foam::volScalarField>
@ -206,13 +178,12 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
he(this->p(), this->T_),
this->heBoundaryTypes(),
this->heBoundaryBaseTypes()
)
{
init();
heBoundaryCorrection(he_);
}
@ -240,13 +211,12 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass,
he(this->p(), this->T_),
this->heBoundaryTypes(),
this->heBoundaryBaseTypes()
)
{
init();
heBoundaryCorrection(he_);
}

View File

@ -54,9 +54,6 @@ class heThermo
{
// Private Member Functions
//- Initialize heThermo
void init();
//- Return a volScalarField of the given property
template<class Method, class ... Args>
tmp<volScalarField> volScalarFieldProperty