编译失败求助
-
想实现更改每个单元的粘度的功能,于是在laminarTransport的类singlePhaseTransportModel.H中加入了
virtual void crtMyNu(const labelUList& myList,scalar myNu);
目的是为了在simpleFoam里面可以调用laminarTransport.crtMyNu(),输入单元编号的List,和想改成的数值myNu;
然后在Newtonian.H 里加入void crtMyNu(const labelUList& myList,scalar myNu) { forAll(myList,i) { label cellI=myList[i]; this->nu_[cellI]=myNu; } }
实现对nu_的具体修改。
编译libincompressibleTransportModels时没有错误
但是在simpleFOAM.C中加入laminarTransport.crtMyNu(solidCells,scalar(10000));
后,编译simpleFOAM时报错
-lm -o /home/samuel/OpenFOAM/samuel-v1806/platforms/linux64GccDPInt64Opt/bin/GCSimpleFoam Make/linux64GccDPInt64Opt/GCSimpleFoam.o: In function `main': GCSimpleFoam.C:(.text.startup+0x3748): undefined reference to `Foam::singlePhaseTransportModel::crtMyNu(Foam::UList<long> const&, double)' collect2: error: ld returned 1 exit status /home/samuel/OpenFOAM/OpenFOAM-v1806/wmake/makefiles/general:136: recipe for target '/home/samuel/OpenFOAM/samuel-v1806/platforms/linux64GccDPInt64Opt/bin/GCSimpleFoam' failed make: *** [/home/samuel/OpenFOAM/samuel-v1806/platforms/linux64GccDPInt64Opt/bin/GCSimpleFoam] Error 1
编译错误的原因是什么呢?搞不懂。。
-
@wwzhao 在Newtonian.H里加吗,singlePhaseTransportModel类编译不通过了。
In file included from viscosityModels/Newtonian/Newtonian.C:26:0: viscosityModels/Newtonian/Newtonian.H:110:14: error: ‘singlePhaseTransportModel’ has not been declared void singlePhaseTransportModel::crtMyNu(const labelUList& myList,scalar myNu) ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/samuel/OpenFOAM/OpenFOAM-v1806/wmake/rules/General/transform:34: recipe for target '/home/samuel/OpenFOAM/OpenFOAM-v1806/build/linux64GccDPInt64Opt/src/transportModels/incompressible/viscosityModels/Newtonian/Newtonian.o' failed make: *** [/home/samuel/OpenFOAM/OpenFOAM-v1806/build/linux64GccDPInt64Opt/src/transportModels/incompressible/viscosityModels/Newtonian/Newtonian.o] Error 1