当前位置:首页 >> 电力/水利 >>

创建自己的空化求解器myIterPhaseChangeFoam


创建自己的空化求解器 myIterPhaseChangeFoam 翻译:空化流动 OpenFOAM 开源计算千人群:139297966 注:翻译源文件来自 Martin Andersen 的 Project work——A interphaseChangeFoam tutorial Before modifying the interPhaseChangeFoam it need

s to be copied to a new location and be rename to myInterPhaseChangeFoam. 在 修 改 求 解 器 interPhaseChangeFoam 之 前 , 需 要 先 将 其 复 制 到 一 个 新 的 位 置 , 并 命 名 为 myInterPhaseChangeFoam mkdir -p $WM_PROJECT_USER_DIR/applications/solvers/multiphase //建立新求解器的路径 cd $WM_PROJECT_USER_DIR/applications/solvers/multiphase cp -r $FOAM_SOLVERS/multiphase/interPhaseChangeFoam . //注意:有个点,表示当前路径 mv mv interPhaseChangeFoam interPhaseChangeFoam.C myInterPhaseChangeFoam //文件夹重命名 //求解器重命名 cd myInterPhaseChangeFoam myInterPhaseChangeFoam.C

The solver interPhaseChangeFoam includes a file from interFoam by a relative path. To keep things simple, this file will be copied into the myInterPhaseChangeFoam folder: 求解器 interPhaseChangeFoam 通过相对路径包含了一个 interFoam 的文件,简单起见,直接把这 个 文 件 复 制 到 myInterPhaseChangeFoam 文 件 夹 。 方 法 : 查 看 求 解 器 代 码 文 件 myInterPhaseChangeFoam.C 找到通过相对路径包含的的文件 correctPhi.H,复制到求解器所在目 录,并将.C 文件的相对路径改为当前路径 cp $FOAM_SOLVERS/multiphase/interFoam/correctPhi.H . Find the line: 在 myInterPhaseChangeFoam.C 中找到下面这一行代码: #include "../interFoam/correctPhi.H" in myInterPhaseChangeFoam.C and change it to 将其替换成下面的一行代码: #include "correctPhi.H" That was all the copying. Now it is just to clean up and adjust the files to the new name. 以上就是所有要复制的内容,然后清理并将 files 里的内容改成新的名字。 Remove the files coming from the compilation of interPhaseChangeFoam. 清除编译 interPhaseChangeFoam 产生的文件(.deb) wclean Edit the build files to fit the myInterPhaseChangeFoam solver. The file Make/files should look like this: 编辑编译文件以适应 myInterPhaseChangeFoam 求解器,将 Make/files 改成如下: myInterPhaseChangeFoam.C //表示当前路径的点

phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture. C phaseChangeTwoPhaseMixtures/Kunz/Kunz.C phaseChangeTwoPhaseMixtures/Merkle/Merkle.C phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C EXE = $(FOAM_USER_APPBIN)/myInterPhaseChangeFoam

The red text shows the new code that needs to be added to the original file. The solver is now ready to be compiled: 红色的文字显示的是需要添加到源文件中的新代码。下面就可以编译求解器了: wmake If everything was done correctly, the new solver binary should appear in the FOAM USER APPBIN directory. Check this with: 如果所有工作均完成, 新的求解器就会出现在 FOAM USER APPBIN 文件夹下面, 通过下面的命 令查看: ls $FOAM_USER_APPBIN

算例测试 cp -r $FOAM_TUTORIALS/multiphase/interPhaseChangeFoam/cavitatingBullet $FOAM_RUN/cavitatingBulletNew cd $FOAM_RUN/cavitatingBulletNew Edit the file system/controlDict so that application is changed from interPhaseChangeFoam to myInterphaseChangeFoam. Also change the endTime to 0.001. 编辑 system/controlDict, 将 application 从 interPhaseChangeFoam 改成 myInterphaseChangeFoam , endTime 改成 0.001 ./Allrun


相关文章:
更多相关标签: