From 9675107f7ed26871b622ae4ebeef4fa8be5ce911 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Wed, 27 Nov 2019 12:50:55 +0000 Subject: [PATCH] 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. --- .../basic/heThermo/heThermo.C | 38 ++----------------- .../basic/heThermo/heThermo.H | 3 -- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index 97a733f8ee..5881b3713e 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -29,34 +29,6 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::heThermo::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 template Foam::tmp @@ -206,13 +178,12 @@ Foam::heThermo::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::heThermo IOobject::NO_READ, IOobject::NO_WRITE ), - mesh, - dimEnergy/dimMass, + he(this->p(), this->T_), this->heBoundaryTypes(), this->heBoundaryBaseTypes() ) { - init(); + heBoundaryCorrection(he_); } diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index 0dec4360ad..42bc66be1c 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -54,9 +54,6 @@ class heThermo { // Private Member Functions - //- Initialize heThermo - void init(); - //- Return a volScalarField of the given property template tmp volScalarFieldProperty