rhoCentralFoam是如何计算温度的?
-
在rhoCentralFoam中,能量方程解了之后求的是e--internal energy, 那么温度是在哪里计算的呢?
我在rhoCentralFoam中的createField.H
里面看到:const volScalarField& T = thermo.T();
请问为何这里将T声明为const
呢?在之后加T.boundaryFieldRef()=###
, 编译会报错,就是说T
被声明为了const
。想问const
的声明是否是必须的呢?谢谢大家!
-
做了一些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; } -
感谢东岳师兄指导!当时找到THE就不知道该怎么找下去了,还想请问一下如何可以准确的找到方程的定义啊?比如在找THE的时候,会出现在很多.H文件里,怎么能知道具体的某个solver是用的哪个呢?我一直都是在doxygen里面看最相关的,但是有时候不熟悉的话就得重复找好多次。。。很糟心。。。后来用了Qt,在写自己solver的时候是挺方便,但是看其他openfoam solver还得自己重新整理所有头文件进去,也很麻烦。。还请各位前辈给些意见~谢谢啦!
3/5