有时候,为了提高运算精度,需要加密网格。这时,如果在细化网格后重新开始进行计算,会增加计算机资源的消耗。这时,可以将现有的计算结果映射到细化后的文件中,在现有结果的基础上进行运算,节省了计算时间以及计算机资源。
1. mapFields指令
mapFields 指令可以把一个给定几何的场信息,映射到另一个几何的对应场。它通过读取被映射场(target)算例 controlDict 文件startFrom/startTime中指定的时间步文件夹,对原始场(source)进行映射。
值得注意的是:
- 当场量相同,即被映射场和原始场的几何,边界类型和条件一样时,称之为连续场。在执行
mapFields指令时,在被映射场目录下,使用-consistent附加命令选项。
mapFields <source directory> -consistent
- 当场量不同,即为非连续场时,需要在被映射场的
system文件夹下添加mapFieldsDict文件,以指定其映射关系。执行mapFields指令时,在被映射场目录下输入以下代码:
mapFields <source directory>
2. mapFieldsDict 文件
($FOAM_TUTOURIALS/incompressible/icoFoam/cavity/cavityClipped/system/mapFieldsDict)
该文件组成结构如下:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object mapFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
patchMap (lid movingWall);
cuttingPatches ();
// ************************************************************************* //
这个文件包含两个关键词,一个是 patchMap,另一个是 cuttingPatches。
patchMap用于指定需要被映射的 patch ,用户需要指定对应patch的名字;cuttingPatches是原始场与映射场不吻合的部分,相交的部分被映射,不相交的部分保留原始数据。
3. 并行映射
这一部分涉及到两个关键词:
parallelSource:原始场采用并行运算;parallelTarget:被映射场采用并行运算。
综上,场映射命令的程序代码形式如下:
mapFields <source root> <source case> <target root> <target case> [-consistent] [-parallelSource] [-parallelTarget]
参考:
- http://openfoamwiki.net/index.php/MapFields
- https://download.csdn.net/download/hanbingchegu/12638981