CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Improvement to the update of T_ et al in hMixtureThermoC and hhuMixtureThermoC (http://www.cfd-online.com/Forums/openfoam-bugs/62404-improvement-update-t_-et-al-hmixturethermoc-hhumixturethermoc.html)

richpaj October 9, 2008 04:19

Description: An improvement
 
Description:
An improvement to the update of T_, psi_, mu_, and alpha_ (also Tu_)
in hMixtureThermo.C and hhuMixtureThermo.C.

"oldTime" information for the internalField values
of T_, psi_, mu_, and alpha_ (also Tu_) is apparently lost
in hMixtureThermo.C and hhuMixtureThermo.C.

For example, in the Euler scheme, fvc::ddt(T) = 0 for internalField
values (boundary values, however, differentiate correctly).

(I don't think using "T.storeOldTimes()" will help here, though I stand to be corrected).



Remedy:

in hMixtureThermo.C
from line 73

forAll(T_, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);

T_[celli] = mixture_.TH(h_[celli], T_[celli]);
psi_[celli] = mixture_.psi(p_[celli], T_[celli]);

mu_[celli] = mixture_.mu(T_[celli]);
alpha_[celli] = mixture_.alpha(T_[celli]);
}

Replace with

forAll(T_, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);

T_.internalField()[celli] = mixture_.TH(h_[celli], T_[celli]);
psi_.internalField()[celli] = mixture_.psi(p_[celli], T_[celli]);

mu_.internalField()[celli] = mixture_.mu(T_[celli]);
alpha_.internalField()[celli] = mixture_.alpha(T_[celli]);
}




hhuMixtureThermo.C
from line 86


forAll(T_, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);

T_.internalField()[celli] = mixture_.TH(h_[celli], T_[celli]);
psi_.internalField()[celli] = mixture_.psi(p_[celli], T_[celli]);

mu_.internalField()[celli] = mixture_.mu(T_[celli]);
alpha_.internalField()[celli] = mixture_.alpha(T_[celli]);

Tu_.internalField()[celli] = this->cellReactants(celli).TH(hu_[celli], Tu_[celli]);
}

Replace with:


forAll(T_, celli)
{
const typename MixtureType::thermoType& mixture_ =
this->cellMixture(celli);

T_.internalField()[celli] = mixture_.TH(h_[celli], T_[celli]);
psi_internalField()[celli] = mixture_.psi(p_[celli], T_[celli]);

mu_internalField()[celli] = mixture_.mu(T_[celli]);
alpha_internalField()[celli] = mixture_.alpha(T_[celli]);

Tu_internalField()[celli] = this->cellReactants(celli).TH(hu_[celli], Tu_[celli]);
}

henry October 9, 2008 05:29

Thanks very much for your bug
 
Thanks very much for your bug report and proposed fix. Your solution will certainly work but has a run-time overhead and would stop the loops vectorizing. Using "T.storeOldTimes()" etc. before the loop would work and more efficiently (note that T.internalField() simply calls T.storeOldTimes() before returning the field). I will implement this change and upload it to our 1.5.x git repository.

H

richpaj October 9, 2008 22:14

That's useful to know about st
 
That's useful to know about storeOldTimes(), many thanks, RGK


All times are GMT -4. The time now is 07:29.