@东岳 非常感谢东岳老师!按照您的指导,我设置了新的边界条件immersedboundaryEnthalpyFvPatchField,其他部分的设置目前都正常,但是想要使用浸没温度边界上的函数来更新焓值时会报错,我的程序部分如下所示:
const label patchi = patch().index(); wordList type = thermo.T().boundaryField().types(); if(isA<immersedBoundaryFvPatchScalarField>(type[patchi])) { immersedBoundaryFvPatchScalarField& TIb = thermo.T().boundaryField()[patchi]; scalarField & Tref = TIb.refValue(); }之后程序就会报错,
error: invalid initialization of reference of type ‘Foam::immersedBoundaryFvPatchScalarField& {aka Foam::immersedBoundaryFvPatchField<double>&}’ from expression of type ‘const Foam::fvPatchField<double>’ thermo.T().boundaryField()[patchi];应该是无法将基类转换为派生类,想和老师请教一下遇到这个问题要怎么解决呢,麻烦老师了!!!:xiexie: