运行算例出现segmentation fault
-
各位老师晚上好~
我自定义求解器编译成功,在运行算例的时候,读取我自定义phaseCoupling.H文件,会出现segmentation fault。其中这个文件是参照之前文章提供的求解器,我只进行了小部分修改。通过逐行输出,可以发现问题主要出现在Heat_Capacity[volID] += alpha_[cellI]*mesh_.V()[cellI]*Cp_[cellI];
这一句。
可以麻烦有经验的老师帮我看一下可能的错误嘛~
phaseCoupling.HforAll(mesh_.cells(), cellI) { if (vofID_[cellI] > 0.1) { Info << " debug6 " << endl; // Get volume ID label volID = floor(vofID_[cellI] + 0.5); Info << " debug7 " << endl; noCells[volID] += 1; Info << " debug8 " << endl; cellVolume[volID] += mesh_.V()[cellI]; Info << " debug9 " << endl; volume[volID] += alpha_[cellI]*mesh_.V()[cellI]; Info << " debug10 " << endl; velocity[volID] += alpha_[cellI]*mesh_.V()[cellI]*U_[cellI]; Info << " debug11 " << endl; position[volID] += alpha_[cellI]*mesh_.V()[cellI]*mesh_.C()[cellI]; Info << " debug12 " << endl; Temperature[volID] += alpha_[cellI]*mesh_.V()[cellI]*T_[cellI]; Info << " debug13 " << endl; Heat_Capacity[volID] += alpha_[cellI]*mesh_.V()[cellI]*Cp_[cellI]; Info << " debug14 " << endl; Density[volID] += alpha_[cellI]*mesh_.V()[cellI]*density_[cellI]; } }
报错信息:
debug1 debug2 debug3 debug4 debug5 debug6 debug7 debug8 debug9 debug10 debug11 debug12 debug13 #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::sigSegv::sigHandler(int) at ??:? #2 ? in /lib/x86_64-linux-gnu/libpthread.so.0 #3 Foam::phaseCoupling::update() at ??:? #4 ? in ~/OpenFOAM/dyfluid-v2012/platforms/linux64GccDPInt32Opt/bin/mycompressible #5 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 #6 ? in ~/OpenFOAM/dyfluid-v2012/platforms/linux64GccDPInt32Opt/bin/mycompressible Segmentation fault (core dumped)
-