openfoam8 wave算例学习记录
前言
一直以来都是使用waves2Foam+OpenFOAM 3.0.1
实现造波消波的功能,但是waves2Foam
支持的openfoam v 版本只到4.1。由于最近项目中需要使用六自由度运动,在算例写完之后发现其并行计算会发散,这一些询问后得知除非更改源代码,不然无法并行。遂将目光看向了最新版本,并尝试开始学习波浪算例。
在openfoam.org的官网中其从5.0版本开始自带造波与消波。内容如下:
Wave Modelling: implemented boundary conditions for applying waves at an inlet that meets standards of code quality, maintainability and licensing [commit e7e46]
Wave Initialisation: new setWaves utility for initialising waves [commit e7e46]
Wave Damping: new verticalDamping fvOption damps the vertical motions of an interface in the region approaching an outlet to avoid reflections [commit 813a6]
Data Processing: a interfaceHeight function object reports height of a phase interface from a set of locations [commit ab2b25]
Hull: new interfaceCompression boundary condition improves cases where a fluid interface hits a surface at shallow angle [commit 8514f]
观察Allrun
算例路径:$FOAM_TUTIRIALS/multiphase/interFoam/laminar/wave
- 打开随机算例,第一步就是观察Allrun脚本的内容,并尝试理解每条命令的作用。
Allrun脚本如下#!/bin/sh cd ${0%/*} || exit 1 . $WM_PROJECT_DIR/bin/tools/RunFunctions runApplication blockMesh # blockMesh划分网格 runApplication extrudeMesh # 这条命令暂时不清楚作用 # 以下为网格加密,加密了两次 for i in 1 2 do runApplication -s $i topoSet -dict system/topoSetDict$i runApplication -s $i refineMesh -dict system/refineMeshDictX -overwrite done # 还是网格加密,加密了四次,但为什么不写一起呢,因为加密的方向不同。上面可以看到加密字典是refineMeshDictX 可以得知其在x方向加密,而下面四次是Y方向 for i in 3 4 5 6 do runApplication -s $i topoSet -dict system/topoSetDict$i runApplication -s $i refineMesh -dict system/refineMeshDictY -overwrite done # 不太清楚这条命令,猜测类似与plus版里的setFeilds runApplication setWaves # 以下三条 域分割-计算-合并 runApplication decomposePar runParallel $(getApplication) runApplication reconstructPar
- 直接运行Allrun脚本并在后处理中查看
- clean掉算例
这步是为了对整个算例有所了解,理解该算例。
下一步为理解算例是如何编写的。