文章目录
一、多孔介质(porous media)
在流体力学中,流体流经多孔介质是指流体流经多孔介质时的行为方式,如海绵或木材,或使用沙子或其他多孔材料过滤水。
我们将展示如何设置多孔层,并使用OpenFOAM模拟流体通过该介质。
二、使用步骤
1.达西定律
达西定律最初是由达西通过实验确定的,但后来通过均匀化方法从Navier-Stokes方程推导出来。热传导领域类似于傅里叶定律,电网络领域类似于欧姆定律,扩散理论类似于菲克定律。
达西定律的一个应用是用于分析通过含水层的水流;达西定律和质量守恒方程简化了水文地质基本关系之一的地下水流动方程。
2.Darcy-Forchheimer
Darcy Forchheimer模型用于模拟多孔介质,允许我们在流体域内简单地添加一个孔隙带,而无需任何费用。
在动量方程中,Sm作为源项
D和F在fvOption中修改
3.OpenFOAM fvOptions
为了使用这个模型,你必须把fvOptions文件放到 0/constant 常量文件夹中,其中包括以下内容:
达西公式
0/constant/fvOptions
porosity1
{
type explicitPorositySource;//模拟多孔介质区域(显示)
active yes;
explicitPorositySourceCoeffs
{
selectionMode cellZone;//在toposet中配置
cellZone fixedWalls;//在toposet中配置
type DarcyForchheimer;
f 4050;
d 0; //本案例不考虑粘性损失
DarcyForchheimerCoeffs
{
d ($d $d $d);
f ($f $f $f);
coordinateSystem
{
type cartesian;
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
e2 (0 1 0);
}
}
}
}
}
多孔介质模型的位置
0/system/topoSetDict
actions
(
{
name porousWalls;
type cellSet;//faceSet;
action new;
source boxToCell;
sourceInfo
{
box (0 0 -1) (0.2 1 1);
}
}
//faceZone:leftAndRightWall
{
name fixedWalls;
type cellZoneSet;//faceZoneSet;
action new;
source setToCellZone;
sourceInfo
{
//faceSet porousWalls;
set porousWalls;
}
}
);
4.paraview动画每帧显示时间(Annotate Time)
paraview动画每帧显示时间(Annotate Time)
- 点击Filters->Alphabetical->ProgrammableFilter,在Properties->Script中设置以下两段代码中任意一段,按照自己的需求选择并修改
pdo = self.GetOutput()
sexaTime = vtk.vtkFloatArray()
sexaTime.SetName("SexaTime")
t = inputs[0].GetInformation().Get(vtk.vtkDataObject.DATA_TIME_STEP())
#convertedTime = t+18.5 #compute your time here in python
convertedTime = t//12+18+(t*5)%60/100
sexaTime.InsertNextValue(convertedTime)
pdo.GetFieldData().AddArray(sexaTime)
#set as string
pdo = self.GetOutput()
sexaTime = vtk.vtkStringArray()
sexaTime.SetName("SexaTime")
t = inputs[0].GetInformation().Get(vtk.vtkDataObject.DATA_TIME_STEP())
#timeAsAString = f(t) #compute your time here in python in a string format
s1=t//12+18
s2=(t*5)%60
timeAsAString = str(t//12+18)+':'+str((t*5)%60)
sexaTime.InsertNextValue(timeAsAString)
pdo.GetFieldData().AddArray(sexaTime)
- 在Pipeline Browser中选中ProgrammableFilter然后点击Filters->Annotation->AnnotateGlobalData,然后在Properties中设置AnnotateGlobalData的显示格式
结果如下所示:
5.参考内容
Paraview设置动画显示时间(Annotate Time)格式:https://www.jianshu.com/p/404f183e7a77
DarcyForchheimer-openfoamwiki:
https://openfoamwiki.net/index.php/DarcyForchheimer
fvOptions----运行时可选的物理操作:https://blog.csdn.net/hanbingchegu/article/details/107417054
DarcyForchheimer-openfoamwiki:
https://openfoamwiki.net/index.php/DarcyForchheimer
(详细)Flow through a porous media: using OpenFOAM:https://www.hyperlyceum.com/product/flow-through-a-porous-media-using-openfoam/
总结
OpenFOAM : fvOptions, topoSetDict; Paraview : Annotate Time
CFD小白的进阶之路。