尝试将compressibleInterFoam中求解温度方程改为求解能量方程
-
compressibleInterFoam中求解的是温度方程,现在想改为求解能量方程,添加的EEqn.H文件如下
{ volScalarField& he = mixture.he(); fvScalarMatrix EEqn ( fvm::ddt(rho, he) + mvConvection->fvmDiv(rhoPhi, he) + fvc::ddt(rho, K) + fvc::div(rhoPhi, K) + ( he.name() == "e" ? fvc::div ( fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)" ) : -dpdt ) == fvm::laplacian(turbulence.alphaEff(), he) ); EEqn.relax(); fvOptions.constrain(EEqn); EEqn.solve(); fvOptions.correct(he); mixture.correctThermo(); mixture.correct(); Info<< "T min/max " << min(T).value() << ", " << max(T).value() << endl; }
编译通过了,但是在第一步求解到能量方程时报错如下:
--> FOAM FATAL ERROR: cannot be called for a calculatedFvPatchField on patch gasinlet of field h.water in file "/home/tens/htest/0/h.water" You are probably trying to solve for a field with a default boundary condition. From function Foam::tmp<Foam::Field<Type> > Foam::calculatedFvPatchField<Type>::gradientInternalCoeffs() const [with Type = double] in file /home/tens/OpenFOAM/OpenFOAM-7/src/finiteVolume/lnInclude/calculatedFvPatchField.C at line 188. FOAM aborting
有人知道问题出在哪里了吗
-
@李东岳 谢谢东岳老师回复,我看其他求能量方程的算例中初始条件也都是给的温度边界,所以我并没有给h的初始边界条件而是给的初始温度。我看twoPhaseMixtureThermo.C中的he如下
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::he ( const volScalarField& p, const volScalarField& T ) const { return alpha1()*thermo1_->he(p, T) + alpha2()*thermo2_->he(p, T); }
应该是根据p与T计算得到的,我将这两个初始条件中calculated的部分全改了,还是报一样的错误
-
在twoPhaseMixtureThermo.H中关于he的定义,原本有NotImplemented,被我注释掉了,难道是说这个热物理模型中关于he部分并不完善吗
virtual volScalarField& he() { //NotImplemented; return thermo1_->he(); } //- Enthalpy/Internal energy [J/kg] virtual const volScalarField& he() const { //NotImplemented; return thermo1_->he(); }