我正在一步一步地学习OpenFOAM,目前正在尝试用blockMesh工具创建一个非常简单的网格,但始终获得浮点异常。我的blockMeshDict与用户手册第4.3.1节中的啮合教程几乎完全一致。
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1.0;
vertices
(
(0 0 0) //0
(0 0 1) //1
(0 1 1) //2
(0 1 0) //3
(1 0 0) //4
(1 0 1) //5
(1 1 1) //6
(1 1 0) //7
);
edges
(
);
blocks
(
hex (0 1 2 3 7 6 5 4)
(2 1 1) // 2 blocks in the x direction
simpleGrading (1 1 1) // default expansion ratios
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 3)
);
}
outlet
{
type patch;
faces
(
(4 5 6 7)
);
}
walls
{
type wall;
faces
(
(0 4 7 3)
(0 4 5 1)
(1 5 6 2)
(2 6 7 3)
);
}
);这只是一个单位长度的“空气管”立方体,沿x轴有两个部分,另一边和墙壁上有一个入口和出口:

此配置立即因以下错误而中断:
$ blockMesh
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 9
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
Build : 9-c8374a4890ad
Exec : blockMesh
Date : Nov 02 2021
Time : 11:50:35
Host : "artixlinux"
PID : 10555
I/O : uncollated
Case : /home/andrii/foamtest
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Reading "blockMeshDict"
Creating block mesh from
"system/blockMeshDict"
Creating block edges
No non-planar block faces defined
Creating topology blocks
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/usr/lib/libc.so.6"
#3 Foam::face::centre(Foam::Field<Foam::Vector<double> > const&) const at ??:?
#4 Foam::blockDescriptor::check(Foam::Istream const&) at ??:?
#5 Foam::blockDescriptor::blockDescriptor(Foam::dictionary const&, int, Foam::Field<Foam::Vector<double> > const&, Foam::PtrList<Foam::blockEdge> const&, Foam::PtrList<Foam::blockFace> const&, Foam::Istream&) at ??:?
#6 Foam::block::block(Foam::dictionary const&, int, Foam::Field<Foam::Vector<double> > const&, Foam::PtrList<Foam::blockEdge> const&, Foam::PtrList<Foam::blockFace> const&, Foam::Istream&) at ??:?
#7 Foam::block::New(Foam::dictionary const&, int, Foam::Field<Foam::Vector<double> > const&, Foam::PtrList<Foam::blockEdge> const&, Foam::PtrList<Foam::blockFace> const&, Foam::Istream&) at ??:?
#8 void Foam::PtrList<Foam::block>::read<Foam::block::iNew>(Foam::Istream&, Foam::block::iNew const&) at ??:?
#9 Foam::blockMesh::createTopology(Foam::IOdictionary const&, Foam::word const&) at ??:?
#10 Foam::blockMesh::blockMesh(Foam::IOdictionary const&, Foam::word const&) at ??:?
#11 ? in "/opt/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/bin/blockMesh"
#12 __libc_start_main in "/usr/lib/libc.so.6"
#13 ? in "/opt/OpenFOAM/OpenFOAM-9/platforms/linux64GccDPInt32Opt/bin/blockMesh"
zsh: floating point exception blockMesh我相当肯定,这不仅仅是一个坏掉的OpenFOAM安装(我特别使用的是archive的组织版本),因为复制的一个不同的网格数据集取代了本教程中给出的归档文件,工作得非常完美。
我对此失去了理智,我多次检查顶点和面部描述,没有发现任何问题,但错误仍然存在。我错过了什么错误吗?
发布于 2021-11-02 17:50:41
blockMeshDict文件的问题在于您没有遵循以下规则:
局部坐标系由在块定义中表示顶点的顺序来定义,该顺序如下:
下面是一个正确工作的blockMesh版本:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1.0;
vertices
(
(0 0 0) //0
(0 0 1) //1
(0 1 1) //2
(0 1 0) //3
(1 0 0) //4
(1 0 1) //5
(1 1 1) //6
(1 1 0) //7
);
edges
(
);
blocks
(
hex (0 4 7 3 1 5 6 2) //>>>> Follow the rules above <<<<
(2 1 1) // 2 blocks in the x direction
simpleGrading (1 1 1) // default expansion ratios
);
boundary
(
inlet
{
type patch;
faces
(
(0 1 2 3)
);
}
outlet
{
type patch;
faces
(
(4 7 6 5)
);
}
walls
{
type wall;
faces
(
(0 3 7 4)
(0 4 5 1)
(1 5 6 2)
(2 6 7 3)
);
}
);使用:
blockMesh
paraFoam -block你会得到:

侧注:在使用OpenFOAM基金会版本(openfoam.org)时,您指的是openfoam.com文档。要小心,因为它们不一定是兼容的。
发布于 2021-11-04 18:45:21
在大多数情况下,您可以直接从blockMesh -help命令行获得最快的帮助。您将获得这类ASCII艺术:
...
Block mesh generator.
The ordering of vertex and face labels within a block as shown below.
For the local vertex numbering in the sequence 0 to 7:
Faces 0, 1 (x-direction) are left, right.
Faces 2, 3 (y-direction) are front, back.
Faces 4, 5 (z-direction) are bottom, top.
7 ---- 6
f5 |\ |\ f3
| | 4 ---- 5 \
| 3 |--- 2 | \
| \| \| f2
f4 0 ---- 1
Y Z
\ | f0 ------ f1
\|
O--- X
Using: OpenFOAM-v2106 (2106) - visit www.openfoam.com
Build: f815a12bba-20210902
Arch: LSB;label=32;scalar=64这是记忆顶点排序的最快的备忘单。
请注意,blockMesh还有一个非常快速的-write-vtk选项。它以.vtu格式写出基本块,您可以在任何版本的截视图中显示它(不需要额外的插件)。我通常使用截视范围内的点悬停函数来询问顶点数。
一旦您像这样定义了您的块,您可能很高兴知道您也可以用块id和本地faces id来定义边界面。因此,您的边界可能如下所示:
boundary
(
inlet
{
type patch;
faces
(
(0 0) // x-min
);
}
outlet
{
type patch;
faces
(
(0 1) // x-max
);
}
...
);https://stackoverflow.com/questions/69809436
复制相似问题