foam-extend中block coulpled方法添加laplacian项
-
各位大佬,现想利用fe中的block couple方法耦合求解,需要耦合的项是laplacian项,但是现在fe5.0中没有该方法,于是我自己添加。一顿操作后,编译遇到如下问题,始终没能定位问题出在哪,求大佬指导一二。
In file included from /home/dong/foam/foam-extend-5.0/src/foam/lnInclude/PtrList.H:315,
from /home/dong/foam/foam-extend-5.0/src/foam/lnInclude/List.C:30,
from /home/dong/foam/foam-extend-5.0/src/foam/lnInclude/List.H:291,
from /home/dong/foam/foam-extend-5.0/src/foam/lnInclude/labelList.H:36,
from /home/dong/foam/foam-extend-5.0/src/foam/lnInclude/Pstream.H:43,
from /home/dong/foam/foam-extend-5.0/src/foam/lnInclude/OPstream.H:35,
from /home/dong/foam/foam-extend-5.0/src/foam/lnInclude/parRun.H:35,
from /home/dong/foam/foam-extend-5.0/src/finiteVolume/lnInclude/fvCFD.H:4,
from pbFourEqnsTwoPhaseFoam.C:43:
/home/dong/foam/foam-extend-5.0/src/foam/lnInclude/PtrList.C: In instantiation of ‘Foam::PtrList<T>::PtrList(const Foam::PtrList<T>&) [with T = Foam::CoeffField<double>]’:
/home/dong/foam/foam-extend-5.0/src/foam/lnInclude/FieldField.C28: required from ‘Foam::FieldField<Field, Type>::FieldField(const Foam::FieldField<Field, Type>&) [with Field = Foam::CoeffField; Type = double]’
/home/dong/foam/foam-extend-5.0/src/foam/lnInclude/BlockLduMatrix.C:84:28: required from ‘Foam::BlockLduMatrix<Type>::BlockLduMatrix(const Foam::BlockLduMatrix<Type>&) [with Type = double]’
/home/dong/foam/foam-extend-5.0/src/finiteVolume/lnInclude/BlockLduSystem.C:99:24: required from ‘Foam::BlockLduSystem<blockType, sourceType>::BlockLduSystem(const Foam::BlockLduSystem<blockType, sourceType>&) [with blockType = double; sourceType = double]’
pTEqn.H:73:70: required from here
/home/dong/foam/foam-extend-5.0/src/foam/lnInclude/PtrList.C:54:18: error: invalid conversion from ‘Foam::Field<double>’ to ‘Foam::CoeffField<double>’ [-fpermissive]
54 | ptrs_[i] = (a[i]).clone().ptr(); -
@yhdthu 大佬,以下是问gpt的回复,不知道对不对:
这个编译错误提示显示在PtrList.C文件的第54行,表明在这一行代码中存在从Foam::Field<double>到Foam::CoeffField<double>的无效转换。 该转换无效的原因可能是因为ptrs_[i]的类型是Foam::CoeffField<double>*,但尝试将Foam::Field<double>类型的对象赋给它是不允许的。 要解决这个问题,您可以尝试以下几种方法: 1. 确保在您的代码中正确使用了正确的类型。检查PtrList.C中的指针类型和涉及到的其他类型是否匹配。 2. 查看代码中是否存在其他地方对ptrs_成员进行了赋值操作,确认这些赋值是否类型匹配。 3. 考虑修改代码以确保在赋值时进行正确的类型转换或者使用适当的类来替换。 您可以检查PtrList.C文件中的相关代码,特别是第54行的内容,以了解更多上下文并尝试解决这个问题。如果需要更多帮助,请提供更多的代码或上下文信息。