c++ - OpenFOAM 块状网格
问题描述
我正在尝试模拟制冷系统的储水箱。我是 OpenFOAM 的新手。
但是,我试图在互联网上找到相关信息,结果发现这非常困难,因为关于 OpenFOAM 的信息很少,尤其是关于我的具体项目的信息。
水箱将有一个入口和一个出口。
写入的blockMesh文件为:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.1;
vertices
(
(0 0 0) //0
(3.984 0 0) //1
(3.984 1.992 0) //2
(0 1.992 0) //3
(0 0 2.984) //4
(3.984 0 2.984) //5
(3.984 1.992 2.984) //6
(0 1.992 2.984) //7
(0.147 0.197 2.984) //8
(0.353 0.197 2.984) //9
(0.147 0.313 2.984) //10
(0.353 0.313 2.984) //11
(0.147 1.679 2.984) //12
(0.353 1.679 2.984) //13
(0.353 1.885 2.984) //14
(0.147 1.885 2.984) //15
);
blocks
(
hex (0 1 2 3 4 5 6 7) (4 2 3) simpleGrading (1 1 1)
hex (8 9 10 11) (1 1 0) simpleGrading (1 1 1)
hex (12 13 14 15) (1 1 0) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(8 9 10 11)
);
}
outlet
{
type patch;
faces
(
(12 13 14 15)
);
}
fixedWalls
{
type wall;
faces
(
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
(3 7 6 2)
(0 3 2 1)
(4 5 6 7)
);
}
);
//mergePatchPairs
(
);
入口和出口应该是单独的块还是与水箱的其余部分组合成一个六角块?
没有必要做所有的工作。我会很感激一些有用的提示,我需要注意什么。(我知道顶点的顺序很重要,这是正确的吗?)
这是我在终端中运行“blockMesh”命令时收到的错误代码:
\*---------------------------------------------------------------------------*/
Build : 8-1c9b5879390b
Exec : blockMesh
Date : May 27 2021
Time : 11:03:25
Host : "DESKTOP-DCDG4KB"
PID : 600
I/O : uncollated
Case : /home/flaayor/OpenFOAM/flaayor-8/run/cavity
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
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::sigSegv::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::Vector<double> Foam::face::centre<Foam::UIndirectList<Foam::Vector<double> > >(Foam::UIndirectList<Foam::Vector<double> > const&) at ??:?
#4 Foam::face::centre(Foam::Field<Foam::Vector<double> > const&) const at ??:?
#5 Foam::blockDescriptor::check(Foam::Istream const&) at ??:?
#6 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 ??:?
#7 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 ??:?
#8 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 ??:?
#9 void Foam::PtrList<Foam::block>::read<Foam::block::iNew>(Foam::Istream&, Foam::block::iNew const&) at ??:?
#10 Foam::blockMesh::createTopology(Foam::IOdictionary const&, Foam::word const&) at ??:?
#11 Foam::blockMesh::blockMesh(Foam::IOdictionary const&, Foam::word const&) at ??:?
#12 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/blockMesh"
#13 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#14 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/blockMesh"
Segmentation fault (core dumped)
解决方案
您的代码中有很多错误。可以使用各种方法创建您的问题,例如blockMesh、codedFixedValue、snappyHexMesh和...。通过 blockMesh 命令,它需要定义 15 个单独的块,如下图所示;它在 Z 轴视图中。
但是如果你使用 codedFixedValue 来帮助指定入口和出口只需要一个块,它会变得非常容易。在blockMesh中,blocks必须是六边形的,并且在blocks section中由8个点定义;有些在您的代码中有 4 个点。在定义块和边界时不遵守顶点的顺序可能会混淆 OpenFOAM 并导致未来解决问题,因此必须遵守。
正如在blockMesh的问题中所问的那样,我已经创建了一个这样的示例,但只有 4 个块。blockMesh代码如下,代码中写了一些解释:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.1;
vertices
(
(0.0 0.0 0.0) //0
(1.0 0.0 0.0) //1
(2.0 0.0 0.0) //2
(0.0 1.0 0.0) //3
(1.0 1.0 0.0) //4
(2.0 1.0 0.0) //5
(0.0 2.0 0.0) //6
(1.0 2.0 0.0) //7
(2.0 2.0 0.0) //8
(0.0 0.0 4.0) //9
(1.0 0.0 4.0) //10
(2.0 0.0 4.0) //11
(0.0 1.0 4.0) //12
(1.0 1.0 4.0) //13
(2.0 1.0 4.0) //14
(0.0 2.0 4.0) //15
(1.0 2.0 4.0) //16
(2.0 2.0 4.0) //17
);
blocks // Always hex; write as [(minX,minY,minZ) (maxX,minY,minZ) (maxX,maxY,minZ) (minX,maxY,minZ) (minX,minY,maxZ) (maxX,minY,maxZ) (maxX,maxY,maxZ) (minX,maxY,maxZ)]
(
hex (0 1 4 3 9 10 13 12) (2 4 8) simpleGrading (1 1 1)
hex (1 2 5 4 10 11 14 13) (2 4 8) simpleGrading (1 1 1)
hex (3 4 7 6 12 13 16 15) (2 4 8) simpleGrading (1 1 1)
hex (4 5 8 7 13 14 17 16) (2 4 8) simpleGrading (1 1 1)
);
edges
(
);
boundary // For each block's corresponding faces, order as how, using right-hand rule, the thumb of the right hand outwards the block
(
inlet
{
type patch;
faces
(
(12 13 16 15)
);
}
outlet
{
type patch;
faces
(
(10 11 14 13)
);
}
fixedWalls
{
type wall;
faces
(
(0 9 12 3)
(3 12 15 6)
(6 15 16 7)
(7 16 17 8)
(8 17 14 5)
(5 14 11 2)
(2 11 10 1)
(1 10 9 0)
(0 3 4 1)
(2 1 4 5)
(3 6 7 4)
(5 4 7 8)
(13 14 17 16)
(9 10 13 12)
);
}
);
mergePatchPairs
(
);
这将是:
您可以将此示例用于您的问题,但有足够的块。
在您的问题中以及使用 blockMesh 时,必须在单独的块上指定入口和出口;使用 codedFixedValue 方法时只能在一个块上指定。
希望它会有所帮助。
推荐阅读
- vue.js - How to make vuetify navigation drawer to close group with selected item and open group based on url
- ruby-on-rails - Rails Minitest 有很多并且属于模型测试 ActiveRecord::UnknownPrimaryKey 错误
- angular - Apache Web 主机服务器上 Angular Universal 应用程序的 .htaccess 中应该包含什么?
- python - 如何使用 grid_rowconfigure 和 grid_columnconfigure 制作多列表框
- google-cloud-platform - GCP:将流量从全局 HTTP 负载均衡器引导到 istio 内部负载均衡器
- javascript - 无法读取未定义/敲除的属性 x
- for-loop - 使用 text2vec 的困惑问题
- blockly - 块恢复块
- angular - Ionic 4 路由器以编程方式销毁页面
- asp.net-core - 在 SwaggerDoc 中添加多个联系人 URL