rhoCentralFoam是如何计算温度的?
-
做了一些search后有如下进展:
解完能量方程后,有这样一行:thermo.correct();
然后thermal correct基本就是calculate();
在hePsiThermo.C中发现:TCells[celli] = mixture_.THE ( hCells[celli], pCells[celli], TCells[celli] );
就又去找了THE的解释:
inline Foam::scalar Foam::species::thermo<Thermo, Type>::THE ( const scalar he, const scalar p, const scalar T0 ) const { return Type<thermo<Thermo, Type>>::THE(*this, he, p, T0); }
但是到这里还是不清楚到底是如何计算T的啊?
-
const volScalarField& T = thermo.T();请问为何这里将T声明为const呢?
防止求解器直接求解
T
,你建立一个场也可以,这有一部分是好编程习惯养成的问题。所以你操作T
的boundaryField
不成功计算方法总结一下,希望对后来者有用
最原始来自于抽象基类
basicThermo.H
:rhoCentralFoam.C
->thermo.correct();
->hePsiThermo.C
->correct();
->calculate();
->TCells[celli] = mixture_.THE ( hCells[celli], pCells[celli], TCells[celli] );
->
const typename MixtureType::thermoType& mixture_ = this->cellMixture(celli);
->
basicThermo.H
,
->//- Temperature from enthalpy/internal energy for cell-set virtual tmp<scalarField> THE ( const scalarField& h, const scalarField& p, const scalarField& T0, // starting temperature const labelList& cells ) const = 0;
-> 运行时选择 ->
sensibleInternalEnerge.H
//- Temperature from sensible internal energy // given an initial temperature T0 scalar THE ( const Thermo& thermo, const scalar e, const scalar p, const scalar T0 ) const { return thermo.TEs(e, p, T0); }
->
thermoI.H
template<class Thermo, template<class> class Type> inline Foam::scalar Foam::species::thermo<Thermo, Type>::TEs ( const scalar es, const scalar p, const scalar T0 ) const { return T ( es, p, T0, &thermo<Thermo, Type>::Es, &thermo<Thermo, Type>::Cv, &thermo<Thermo, Type>::limit ); }
->
template<class Thermo, template<class> class Type> inline Foam::scalar Foam::species::thermo<Thermo, Type>::T ( scalar f, scalar p, scalar T0, scalar (thermo<Thermo, Type>::*F)(const scalar, const scalar) const, scalar (thermo<Thermo, Type>::*dFdT)(const scalar, const scalar) const, scalar (thermo<Thermo, Type>::*limit)(const scalar) const ) const { ... return Tnew; }