OpenFOAM12如何添加标量场并在0/文件夹读取
-
各位老师好,我目前正在进行代码移植的工作,主要是将基于OpenFOAM-6自定义的interfoam移植到OpenFOAM-12中,实现相同的功能。目前在改写incompressibleVoF这个module。
我对下面提到的momentumPredictor()函数中的速度方程,希望引入额外的添加项,并且能够在0/文件夹中读取初始值。但是我在VoFSolver中新建标量场,运行时提示cannot fine the file "0.007891/drag"。
我认为原因是,OpenFOAM12中的foamRun先执行了runtime++,然后调用了solver.momentumPredictor(),然后初始化了我新加的标量,导致找不到文件。
所以,我非常好奇OpenFOAM-12中是如何初始化它的变量,从0/文件夹中读取数据的。在OpenFOAM-6的intefoam中,一般是通过createFields定义场和变量,并在interfoam的pimple循环前执行
#include createFields.H
请各位老师不吝赐教!
-
是的,在新版除了createFields.H没了,fvCFD.H都没了。变量都在class里面初始化,比如VoFSolver。H:
class VoFSolver : public fluidSolver { protected: // Phase properties //- The compressible two-phase mixture autoPtr<VoFMixture> mixturePtr_; VoFMixture& mixture_; //- Name of the alpha convection scheme const word divAlphaName; //- Phase-fraction flux Courant number scalar alphaCoNum; // Kinematic properties //- Velocity field volVectorField U_; //- Volumetric flux field surfaceScalarField phi_;