首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OpenFOAM blockMesh

OpenFOAM blockMesh
EN

Stack Overflow用户
提问于 2021-05-27 17:15:49
回答 2查看 131关注 0票数 0

我正在尝试模拟一个用于制冷系统的储水箱。我是OpenFOAM的新手。

但是,我试图在互联网上找到相关的信息,这被证明是相当困难的,因为关于OpenFOAM的信息很少,特别是关于我的具体项目。

水箱将有一个入口和一个出口。

写入的blockMesh文件为:

代码语言:javascript
复制
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“命令时收到的错误代码:

代码语言:javascript
复制
\*---------------------------------------------------------------------------*/
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)

提前向你致以最美好的祝福和感谢

EN

回答 2

Stack Overflow用户

发布于 2021-06-13 02:56:11

出于某些原因,你已经定义了四个点的十六进制块-你肯定需要每个十六进制8个点。例如,如果你有两个十六进制块连接在一起,你将需要定义12个点,其中4个点将在两个块之间是公共的。

票数 0
EN

Stack Overflow用户

发布于 2021-09-23 20:15:29

你的代码中有很多错误。您的问题可以通过各种方法来创建,例如blockMeshcodedFixedValuesnappyHexMesh,和...。通过blockMesh命令,它将需要15个单独的块来定义,如下图所示;它在Z轴视图中。

但是,如果您使用codedFixedValue,这可能会非常容易,因为它有助于通过一个块指定入口和出口。在blockMesh中,块必须是六边形的,并由块部分中的8个点定义;有些块在代码中有4个点。在定义块和边界时,不遵守顶点的顺序可能会混淆OpenFOAM,并导致未来解决问题,因此必须遵循。

正如在blockMesh的问题中所问的那样,我已经创建了一个类似于您的问题的示例,但只有4个块。blockMesh代码如下,代码中写了一些解释:

代码语言:javascript
复制
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方法时,只能在一个块上指定。

希望能对您有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67719178

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档