Euler-Lagrange的一些解析,sprayFoam
-
@chengan-wang 上面已写具体做法
-
@星星星星晴 您好,我参考了GOFUN2017_ParticleSimulations_slides.pdf ,建立一个文件夹,并把文件拷过来。
mkdir lagrangian cp -r $FOAM_SRC/lagrangian/intermediate/ lagrangian/
采用输出文件方法2,修改particleCollector,然后编译也成功了,
但是输出文件中没有看到output.txt文件,
我还需要在算例中设置什么命令才能调用particleCollector?
谢谢 -
@chengan-wang 这个是cloudfunction,在sprayproperties里面添加cloudfunction。
-
@星星星星晴 谢谢指点!
我这两天大概改了一下cloudfunction,似乎能运行了,但是从重新编译的求解器log文件上看,应该有一些问题,我好像重复调用了一些库函数:Duplicate entry facePostProcessing in runtime selection table CloudFunctionObject #0 /home/chengan/OpenFOAM/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so(_ZN4Foam5error14safePrintStackERSo+0x3e) [0x7f28ae2ae0ae] #1 /home/chengan/OpenFOAM/chengan-2.4.0/platforms/linux64GccDPOpt/lib/libstatisticslagrangianIntermediate.so(_ZN4Foam19CloudFunctionObjectINS_14KinematicCloudINS_5CloudINS_15KinematicParcelINS_8particleEEEEEEEE31adddictionaryConstructorToTableINS_18FacePostProcessingIS7_EEEC1ERKNS_4wordE+0xfb) [0x7f28b4ff288b] #2 /home/chengan/OpenFOAM/chengan-2.4.0/platforms/linux64GccDPOpt/lib/libstatisticslagrangianIntermediate.so(+0x2410f5) [0x7f28b4fbe0f5] #3 /lib64/ld-linux-x86-64.so.2(+0x108d3) [0x7f28b55618d3] #4 /lib64/ld-linux-x86-64.so.2(+0x10ca) [0x7f28b55520ca] Duplicate entry particleCollector in runtime selection table CloudFunctionObject #0 /home/chengan/OpenFOAM/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so(_ZN4Foam5error14safePrintStackERSo+0x3e) [0x7f28ae2ae0ae] #1 /home/chengan/OpenFOAM/chengan-2.4.0/platforms/linux64GccDPOpt/lib/libstatisticslagrangianIntermediate.so(_ZN4Foam19CloudFunctionObjectINS_14KinematicCloudINS_5CloudINS_15KinematicParcelINS_8particleEEEEEEEE31adddictionaryConstructorToTableINS_17ParticleCollectorIS7_EEEC2ERKNS_4wordE+0xfb) [0x7f28b4ff29cb] #2 /home/chengan/OpenFOAM/chengan-2.4.0/platforms/linux64GccDPOpt/lib/libstatisticslagrangianIntermediate.so(+0x24115c) [0x7f28b4fbe15c] #3 /lib64/ld-linux-x86-64.so.2(+0x108d3) [0x7f28b55618d3] #4 /lib64/ld-linux-x86-64.so.2(+0x10ca) [0x7f28b55520ca] Duplicate entry particleErosion in runtime selection table CloudFunctionObject #0 /home/chengan/OpenFOAM/OpenFOAM-2.4.0/platforms/linux64GccDPOpt/lib/libOpenFOAM.so(_ZN4Foam5error14safePrintStackERSo+0x3e) [0x7f28ae2ae0ae] #1 /home/chengan/OpenFOAM/chengan-2.4.0/platforms/linux64GccDPOpt/lib/libstatisticslagrangianIntermediate.so(_ZN4Foam19CloudFunctionObjectINS_14KinematicCloudINS_5CloudINS_15KinematicParcelINS_8particleEEEEEEEE31adddictionaryConstructorToTableINS_15ParticleErosionIS7_EEEC1ERKNS_4wordE+0xfb) [0x7f28b4ff2b0b]
我又看了一下求解器Make文件夹的options文件:
EXE_INC = \ -Ilagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/spray/lnInclude \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ -L$(FOAM_USER_LIBBIN) \ -lstatisticslagrangianIntermediate \ -lfiniteVolume \ -lmeshTools \ -lsampling \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ -llagrangian \ -llagrangianTurbulence \ -llagrangianSpray \ -lspecie \ -lfluidThermophysicalModels \ -lliquidProperties \ -lliquidMixtureProperties \ -lsolidProperties \ -lsolidMixtureProperties \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ -lchemistryModel \ -lradiationModels \ -lODE \ -lregionModels \ -lsurfaceFilmModels \ -lfvOptions \ -lcombustionModels
没看出来我编译的intermediate文件夹跟哪个冲突。(我在求解器文件夹中建立lagrangian文件夹,然后把原始的intermediate文件夹拷进去,修改particleCollector,然后编译,编译过程中没有报错)。
麻烦您啦! -
@chengan-wang 看来你这个是祖传代码,我也看不出来你这个问题到底在哪。。虽然of的基础变化不大,但是你还用的是2.4。。
你这个编译方法看起来是可以使用的,但是你只编译了intermediate这个文件夹是么,你确定其他关联到intermediate的库的都关联这个了么?
建议你自己一点一点查吧
-
@chengan-wang 就是普通的 教程上的方法。。。一板一眼
-
@星星星星晴 您好,我这次直接在OpenFOAM-2.4.0下面的ParticleCollector.C文件修改,wclean, wmake libso,编译成功,避免了冲突问题。
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> void Foam::ParticleCollector<CloudType>::postMove ( parcelType& p, const label cellI, const scalar dt, const point& position0, bool& keepParticle ) { if ((parcelType_ != -1) && (parcelType_ != p.typeId())) { return; } // slightly extend end position to avoid falling within tracking tolerances const point position1 = position0 + 1.0001*(p.position() - position0); hitFaceIDs_.clear(); switch (mode_) { case mtPolygon: { collectParcelPolygon(position0, position1); break; } case mtConcentricCircle: { collectParcelConcentricCircles(position0, position1); break; } default: { } } forAll(hitFaceIDs_, i) { label faceI = hitFaceIDs_[i]; scalar m = p.nParticle()*p.mass(); if (negateParcelsOppositeNormal_) { vector Uhat = p.U(); Uhat /= mag(Uhat) + ROOTVSMALL; if ((Uhat & normal_[faceI]) < 0) { m *= -1.0; } } // add mass contribution mass_[faceI] += m; if (nSector_ == 1) { mass_[faceI + 1] += m; mass_[faceI + 2] += m; mass_[faceI + 3] += m; } if (removeCollected_) { keepParticle = false; } } //******add by myself****** forAll(hitFaceIDs_, i) { std::ofstream outfile; outfile.setf(ios_base::fixed, ios_base::floatfield); outfile.precision(8); outfile.open("output.txt", ios_base::app); outfile << this->owner().db().time().timeName() << tab << p.origId() << tab << p.typeId() << tab << p.age() << tab << p.position().component(0) << tab << p.position().component(1) << tab << p.position().component(2) << tab << p.U().component(0) << tab << p.U().component(1) << tab << p.U().component(2) << tab << p.d() << tab << p.nParticle() << tab << p.mass()*1e18 << tab << nl; } //******add by myself****** }
之后,我在sprayCloudProperties文件中定义(用的是ParticleCollector.H自带例子)
cloudFunctions { particleCollector2 { type particleCollector; mode polygon; polygons ( ( (-0.01 0.05 -0.01) (-0.01 0.05 0.01) (0.01 0.05 0.01) (0.01 0.05 -0.01) ) ); normal (0 0 1); negateParcelsOppositeNormal no; removeCollected no; surfaceFormat vtk; resetOnWrite no; log yes; } }
运行至第一个时间步长就报错了
[2] --> FOAM FATAL IO ERROR: [13] [13] [13] --> FOAM FATAL IO ERROR: [13] wrong token type - expected Scalar, found on line 0 the punctuation token '-' [13] [13] file: /home/chengan/OpenFOAM/chengan-2.4.0/run/sprayFoam/watermist/processor13/0/uniform/lagrangian/sprayCloud/sprayCloudOutputProperties.cloudFunctionObject.particleCollector2.massFlowRate at line 0. [13] [13] From function operator>>(Istream&, Scalar&) [13] in file lnInclude/Scalar.C at line 93. [13] FOAM parallel run exiting [13] [2] wrong token type - expected Scalar, found on line 0 the punctuation token '-' [2] [2] file: /home/chengan/OpenFOAM/chengan-2.4.0/run/sprayFoam/watermist/processor2/0/uniform/lagrangian/sprayCloud/sprayCloudOutputProperties.cloudFunctionObject.particleCollector2.massFlowRate at line 0. [2] [2] From function operator>>(Istream&, Scalar&) [2] in file lnInclude/Scalar.C at line 93. [2] FOAM parallel run exiting [2] particleCollector output: -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 2 in communicator MPI_COMM_WORLD with errorcode 1. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. -------------------------------------------------------------------------- [chengan-MS-7C80:26316] 1 more process has sent help message help-mpi-api.txt / mpi-abort [chengan-MS-7C80:26316] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
如果不用particleCollector,直接使用cloudFunctions{}算例可以运行。
我没有搞明白到底什么地方出了问题
-
这部分你可以删掉,particlecollector总是有些问题,我也遇到过,后来不必要的东西全删掉了
forAll(hitFaceIDs_, i) { label faceI = hitFaceIDs_[i]; scalar m = p.nParticle()*p.mass(); if (negateParcelsOppositeNormal_) { vector Uhat = p.U(); Uhat /= mag(Uhat) + ROOTVSMALL; if ((Uhat & normal_[faceI]) < 0) { m *= -1.0; } } // add mass contribution mass_[faceI] += m; if (nSector_ == 1) { mass_[faceI + 1] += m; mass_[faceI + 2] += m; mass_[faceI + 3] += m; } if (removeCollected_) { keepParticle = false; } }
-
@vbcwl
在kinematicparcel.C中流体对粒子判断受力是通过Fcp.Sp()和Fncp.Su()这两项,显性隐性的区别,calcVelocity方程计算新速度。
calcDispersion方程是dispersionmodel里计算新流场速度,OF自带是基于k-e的粒子对流体:UTrans这一项传递的
粒子之间:kinematicCloud中的 stochasticCollision().update(td, solution_.trackTime());这一项
粒子与壁面:hitFace, hitpatch这个方程等,具体调用哪个 这部分我不是很熟悉
OpenFOAM-8/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/ 具体模型是在这个部分具体你用了某个模型的话一定要看好code,有的模型kicematicparcel是没有的
-
@星星星星晴 您好,谢谢回复
[2] file: /home/chengan/OpenFOAM/chengan-2.4.0/run/sprayFoam/watermist/processor2/0/uniform/lagrangian/sprayCloud/sprayCloudOutputProperties.cloudFunctionObject.particleCollector2.massFlowRate at line 0. [2] [2] From function operator>>(Istream&, Scalar&) [2] in file lnInclude/Scalar.C at line 93. [2] FOAM parallel run exiting [2] particleCollector output: -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 2 in communicator MPI_COMM_WORLD with errorcode 1.
这个问题我大概知道怎么回事了,当resetOnWrite no;如果我采用单核计算,这个错误问题就没有出现;resetOnWrite yes;才能用多核并行,但我不知道有没有啥影响。
第二个问题,我直接在OpenFOAM-2.4.0下面的ParticleCollector.C文件修改,然后在intermediate文件夹下编译,wclean; wmake libso。其它没有动。但是运行结束后在postProcessing文件夹里面没有找到output.txt文件,感觉是没有调用新编译的库文件函数?您的编译方法参考教程能方便发一下么?
第三个问题,我用polygon做了一个切片,
particleCollector2 { type particleCollector; mode polygon; polygons ( ( (-0.01 0.06 -0.01) (-0.01 0.06 0.01) (0.01 0.06 0.01) (0.01 0.06 -0.01) ) ); normal (0 0 1); negateParcelsOppositeNormal no; removeCollected no; surfaceFormat vtk; resetOnWrite yes; log yes; }
很明显,粒子已经通过我设计的多边形,但是质量流量等于0,这又是什么原因呢?
-
-
我没有试过resetOnWrite 这部分,所以我也不知道你这么弄有没有问题。我仅仅是使用output的文件作后处理,套用了particlecollector这个cloudfunction而已,对于其他的东西我并不在意,而且之前总出错,与其用一个无法确定是否正确的东西,不如原始一点自己处理。
-
编译教程你可以在google上找很多,最主要的是你编译了一个东西以后,要对其重命名,然后相关引用到该lib的都要引用你新编译的模型,仔细看了一下,你在solver部分是有问题的,但是你编译了spray这个文件了么?编译的新spray有没有用到新的intermediate?solver没有引用新的spray。
3.如果你像我说的删除掉那部分code的话,自然没有质量的计算啊,所以后处理就是自己写个python script或者你用matlab或者什么后处理文件,因为你文件里面包含了所有hitpatch的数据。
-
-
- 额,这我就不是很了解了,我也不是code大神,仅仅是使用推荐的方法进行编译,这肯定不会错,正常情况下,建议无论更改了 什么,最好是重新编译一下相关的东西,以免发生错误。有些东西没办法解释。。。就是这么做,也不会思考为什么。
你修改原始包也没问题,但是不用重新命名。
但是如果有些东西你自己编译错了,很可能会引发连锁反应,这也是为什么人家推荐用的是$USER_LIB_SRC
$LIB_SRC
不是在人家原始的包里面做修改的原因,这样用以区别你自己的东西和原始的东西。
另外并不是所有人都有root的权限的。
我个人觉得还是人家推荐的方式比较好。- 这我就不是很清楚了。