OpenFOAM 简单 blockMesh 浮点异常
OpenFOAM simple blockMesh floating point exception
我正在逐步学习 OpenFOAM,目前正在尝试使用 blockMesh
工具创建一个非常简单的网格,但不断出现浮点异常。我的 blockMeshDict
几乎与 section 4.3.1 of the OF user manual:
中的网格教程完全一致
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 安装(我特别使用 Arch AUR 的 org 版本),因为从 this tutorial 中给出的存档中复制了一个不同的网格字典来代替我的完美运行。
我对此失去了理智,我多次检查了顶点和面部描述,没有发现任何问题,但错误仍然存在。我是否遗漏了什么错误?
你的 blockMeshDict 文件的问题是你没有遵守这些规则:
局部坐标系由顶点在块定义中出现的顺序定义,根据:
轴原点是块定义中的第一个条目,顶点 0
x方向描述为从顶点0移动到顶点1;
y方向描述为从顶点1移动到顶点2;
顶点 0、1、2、3 定义平面 z = 0。
从顶点 0 沿 z 方向移动找到顶点 4。
顶点5,6和7同样通过从顶点1,2和3沿z方向移动找到。
指定面时必须遵循右手法则.
这是一个可以正常工作的 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
文档。小心,因为它们不一定兼容。
在大多数情况下,您可以使用 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
这是记住顶点顺序的最快作弊sheet。
请注意,blockMesh 还有一个 -write-vtk
选项,速度非常快。它以 .vtu
格式写出基本块,您可以在任何版本的 paraview 中显示(不需要额外的插件)。我通常在 paraview 中使用 hover on point 函数来查询顶点编号。
一旦你像这样定义了你的块,你可能会很高兴知道你也可以根据块 ID 和局部面 ID 来定义边界面。因此你的边界可能是这样的:
boundary
(
inlet
{
type patch;
faces
(
(0 0) // x-min
);
}
outlet
{
type patch;
faces
(
(0 1) // x-max
);
}
...
);
我正在逐步学习 OpenFOAM,目前正在尝试使用 blockMesh
工具创建一个非常简单的网格,但不断出现浮点异常。我的 blockMeshDict
几乎与 section 4.3.1 of the OF user manual:
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 安装(我特别使用 Arch AUR 的 org 版本),因为从 this tutorial 中给出的存档中复制了一个不同的网格字典来代替我的完美运行。
我对此失去了理智,我多次检查了顶点和面部描述,没有发现任何问题,但错误仍然存在。我是否遗漏了什么错误?
你的 blockMeshDict 文件的问题是你没有遵守这些规则:
局部坐标系由顶点在块定义中出现的顺序定义,根据:
轴原点是块定义中的第一个条目,顶点 0
x方向描述为从顶点0移动到顶点1;
y方向描述为从顶点1移动到顶点2;
顶点 0、1、2、3 定义平面 z = 0。
从顶点 0 沿 z 方向移动找到顶点 4。
顶点5,6和7同样通过从顶点1,2和3沿z方向移动找到。
指定面时必须遵循右手法则.
这是一个可以正常工作的 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
文档。小心,因为它们不一定兼容。
在大多数情况下,您可以使用 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
这是记住顶点顺序的最快作弊sheet。
请注意,blockMesh 还有一个 -write-vtk
选项,速度非常快。它以 .vtu
格式写出基本块,您可以在任何版本的 paraview 中显示(不需要额外的插件)。我通常在 paraview 中使用 hover on point 函数来查询顶点编号。
一旦你像这样定义了你的块,你可能会很高兴知道你也可以根据块 ID 和局部面 ID 来定义边界面。因此你的边界可能是这样的:
boundary
(
inlet
{
type patch;
faces
(
(0 0) // x-min
);
}
outlet
{
type patch;
faces
(
(0 1) // x-max
);
}
...
);