OpenFoam 并行计算设置需要的步骤。
一, 准备 decomposeParDict 文件
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method simple;
simpleCoeffs
{
n (2 2 1);
delta 0.001;
}
hierarchicalCoeffs
{
n (1 1 1);
delta 0.001;
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* //
二,运行命令行指令
decomposePar
mpirun -np 4 simpleFoam -parallel > log
reconstructPar
三,注意事项
初始值设定时,如果使用了入口大气边界条件,应该设定 value 值。
比如 U 值设定为:
/*--------------------------------*- 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 volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
e
{
type zeroGradient;
}
n
{
type atmBoundaryLayerInletVelocity;
flowDir (0 -1 0);
zDir (0 0 1);
Uref 9.52;
Zref 6.0;
z0 uniform 0.01;
zGround uniform 0.0;
value uniform (0 0 0); //setup value
initABL true; //setup initial bool to true
}
s
{
type zeroGradient;
}
w
{
type zeroGradient;
}
top
{
type symmetry;
}
bottom
{
type noSlip;
}
inner_bottom
{
type noSlip;
}
bldg
{
type noSlip;
}
}
// ************************************************************************* //
比如 k 和 epsilon 值设定为:
/*--------------------------------*- 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 volScalarField;
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
epsilonInlet 0.03; // Cmu^0.75 * k^1.5 / L ; L =10
dimensions [0 2 -3 0 0 0 0];
internalField uniform $epsilonInlet;
boundaryField
{
e
{
type zeroGradient;
}
n
{
type atmBoundaryLayerInletEpsilon;
flowDir (0 -1 0);
zDir (0 0 1);
Uref 9.52;
Zref 6.0;
z0 uniform 0.01;
zGround uniform 0.0;
value uniform 0;
initABL true;
}
s
{
type zeroGradient;
}
w
{
type zeroGradient;
}
top
{
type symmetry;
}
bottom
{
type epsilonWallFunction;
value uniform $epsilonInlet;
//z0 uniform 0.01;
}
inner_bottom
{
type epsilonWallFunction;
value uniform $epsilonInlet;
//z0 uniform 0.01;
}
bldg
{
type epsilonWallFunction;
value uniform $epsilonInlet;
//z0 uniform 0.005;
}
}
// ************************************************************************* //
合并计算域数据:
reconstructPar -latestTime