7.1 溃坝
官网
目录:$FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak
7.1.1 介绍
本案例使用interFoam两相算法,基于流体体积分数(VOF)法,每个网格中的相体积分数(alpha)通过求解一个组分运输方程确定。物理属性基于这个相分数通过加权平均计算。
7.1.2 网格生成
blockMesh
7.1.3 边界条件
最顶端atmosphere边界设置为patch
// 0/U
boundaryField
{
...
atmosphere
{
type pressureInletOutletVelocity; // 对所有分量应用zeroGradient条件,当流动为入流时,对边界切向的分量应用fixedValue;
value uniform (0 0 0);
}
defaultFaces
{
type empty;
}
}
// 0/p_rgh
boundaryField
{
...
atmosphere
{
type totalPressure; // 一种fixedValue条件,利用指定的总压p0和当地速度U计算获得;
p0 uniform 0;
}
defaultFaces
{
type empty;
}
}
// 0/alpha.water.orig
boundaryField
{
...
atmosphere
{
type inletOutlet; // 出流时为zeroGradient,入流时则为fixedValue条件;
inletValue uniform 0;
value uniform 0;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //
所有壁面边界处,压力场采用fixedFluxPressure边界条件,它自动调整压力梯度使边界通量符合速度边界条件。
boundaryField
{
leftWall
{
type fixedFluxPressure; //
value uniform 0;
}
rightWall
{
type fixedFluxPressure;
value uniform 0;
}
lowerWall
{
type fixedFluxPressure;
value uniform 0;
}
}
defaultFaces代表此2维问题的前后面,像往常一样,是empty类型
defaultFaces
{
type empty;
}
7.1.4 设置初场
相当于fluent中的patch,patch出一个水域。
boxToCell通过定义一个最小和最大的向量来创建一个盒子区域,在此区域内为水相,water被设置为1.
在执行setFields
之前,先备份0目录下的alpha.water.org(备份文件)为alpha.water。因为setFields工具从文件读取场并重新定义这些场,然后把它们重新写入文件,原始文件会被覆盖,所以需要备份。
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
volScalarFieldValue alpha.water 0 // 场内默认为空气
);
regions
(
boxToCell
{
box (0 0 -1) (0.1461 0.292 1); // 对应坐标如下
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
// ************************************************************************* //
使用
paraFoam -builtin
后处理查看
7.1.5 流体特性
constant/transportProperties
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phases (water air); // 两相
water
{
transportModel Newtonian; // 牛顿流体
nu 1e-06; // 运动粘度
rho 1000; // 密度
}
air
{
transportModel Newtonian;
nu 1.48e-05;
rho 1;
}
sigma 0.07; // 表面张力
// ************************************************************************* //
Newtonian为牛顿流体,CrossPowerLawCoeffs为非牛顿流体。
重力场
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*----------------------