CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [blockMesh] Mesh defining with parameters (https://www.cfd-online.com/Forums/openfoam-meshing/233740-mesh-defining-parameters.html)

Wowbagger February 9, 2021 14:06

Mesh defining with parameters
 
Hi everyone,

I want to simulate a kind of tubular heat exchanger and prepared the mesh via blockmesh.
Because of its symmetry I made the model as a wedge.

Maybe this is irrelevant depending my question but I get the same warning for a change in the geometry setup.
For some bigger angles I get the known (?) error below.

Quote:

--> FOAM Warning : From function virtual void Foam::wedgePolyPatch::calcGeometry(Foam::PstreamBu ffers&) in file meshes/polyMesh/polyPatches/constraint/wedge/wedgePolyPatch.C at line 70 Wedge patch 'symmetrie_back' is not planar.At local face at (2.925 119.75 0.102082) the normal (-0.0348784 -1.37971e-17 0.999392) differs from the average normal (-0.0348783 -3.67866e-20 0.999392) by 7.88202e-15Either correct the patch or split it into planar parts
So far so good. This should not really a problem as I read but to avoid this I use to go to really tiny angles.
All constructive data are set as parameters in the first part of the blockMeshDict file.
There comes the strange thing, I recognised that it is not a problem to do some calculation with the parametric setup but for the grading it is not possible.

I did the grading as shown below according to this file: http://www.wolfdynamics.com/wiki/mes..._blockmesh.pdf

Code:

    hex (5 7 8 9 23 25 26 27) ($ZR3 $ZL2 1) simpleGrading          // Block 3 Fluid
    (
            (
            //x-Achse
            ($BB $DD $EE)
            ($AA $CC 1)
            ($BB $DD $FF)
            )           
        (
        //y-Achse
        1;
        )
        (
        //z-Achse
        1
        )
    )

But this is only possible if the FF variable is not calculated.
At this time my blockMeshDict file looks like this and it works fine.
But I would prefer to calculate the FF dependent on EE as shown in the commented lines:


Code:

    // Grading der Zellen, Ringspalt
    AA 0.2;                  // Anteil Kernbereich
    BB #calc "(1-$AA)/2";    // Bereich Grenzschicht
    CC 0.1;                  // Anteil Zellen Kernbereich
    DD #calc "(1-$CC)/2";    // Anteil Zellen Grenzschicht
    EE 4;                    // Grading Da
    FF 0.25;
//    FF #calc "(5-$EE)";    // Grading Di
//    FF #calc "pow ($EE, -1)";        // Grading Di - Berechnen geht nicht
//    FF #calc "1/($EE)";              // Grading Di - Berechnen geht nicht

If I start the meshing with one of the comment lines I get the same Warning as mentioned above (--> FOAM Warning ..... Either correct the patch or split it into planar parts) and paraFoam will close after a short time telling me "Segmentation fault (core dumped)".

So far I realised in the last few attemts that the meshing works with values for EE<2. I have no problem setting one more parameter for FF but I would like to know why this calculation is not working in that intented use. Does anyone have a clue?

Best regards
Michael

HPE February 9, 2021 15:43

I have no idea regarding the main question (my apologies), but please use `eval` instead of `calc` to gain considerable level of speed by avoiding compilations.

GerhardHolzinger February 10, 2021 02:29

I came across something similar, when creating wedge geometries along with inline calculation using blockMesh.

I could solve my problems by increasing the setting for writePrecision to 10 or higher. Note, that some mesh-generation or -processing tools will always write in ASCII, hence changing to writing in binary format will not always solve such issues.

Wowbagger February 10, 2021 15:15

Quote:

Originally Posted by HPE (Post 795773)
I have no idea regarding the main question (my apologies), but please use `eval` instead of `calc` to gain considerable level of speed by avoiding compilations.

Thanks HPE

I tried a few variations but later I found out that this is not working with my Foundation version OF8. Nevertheless, this and some other features I'll try in a further upcoming case...

Quote:

Originally Posted by GerhardHolzinger (Post 795805)
I came across something similar, when creating wedge geometries along with inline calculation using blockMesh.

I could solve my problems by increasing the setting for writePrecision to 10 or higher. Note, that some mesh-generation or -processing tools will always write in ASCII, hence changing to writing in binary format will not always solve such issues.

Thanks GerhardHolzinger,

I tried but without success in my case.
I'll keep it in mind but go on with setting the FF parameter. Enough other jobs at my first case so far...





Best regards
Michael

HPE February 10, 2021 15:20

Hi,


Would you consider to attach the blockMeshDict of yours, so that we can try to test it locally?

Wowbagger February 10, 2021 15:33

Quote:

Originally Posted by HPE (Post 795903)
Hi,
Would you consider to attach the blockMeshDict of yours, so that we can try to test it locally?

Sure, you are welcome! :)
Here it is:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  7
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //



    R1 3;      // ri Innenrohr x
    R2 4;      // ra Innenrohr x
    R3 5;      // ri Außenrohr x
    R4 6;      // ra Außenrohr x
    L1 110;      // Länge Innenrohr y
    L2 5;      // Innenrohr bis Boden y
    L3 5;      // Bodenstärke y

    W #calc "degToRad(0.00002)"; // Winkel für z

    // Zellen in Länge
    ZL1 500; // Zellen in L1
    ZL2 30; // Zellen in L2
    ZL3 10; // Zellen in L3

    // Zellen Radial
    ZR1 20; // Innen
    ZR2 15; // Cu
    ZR3 30; // Ringspalt
    ZR4 10; // Cu

    // Grading der Zellen, Ringspalt
    AA 0.2;                  // Anteil Kernbereich
    BB #calc "(1-$AA)/2";    // Bereich Grenzschicht
    CC 0.1;                  // Anteil Zellen Kernbereich
    DD #calc "(1-$CC)/2";    // Anteil Zellen Grenzschicht
    EE 4;                    // Grading Da
    FF 0.25;
//    FF #calc "(5-$EE)"";    // Grading Di
//    FF #calc "pow ($EE, -1)";        // Grading Di - Berechnen geht nicht
//    FF #calc "1/($EE)";              // Grading Di - Berechnen geht nicht

    // Grading der Zellen, Kupfer -> Ringspalt
    GG 10;                 


// Alle benötigten Punkte:

    x0 0;
    y0 0;
    z0 0;

    x1 $R1;
    y1 0;
    z1 #calc "-1*sin($W)*$R1";

    x2 $R1;
    y2 $L1;
    z2 $z1;

    x3 0;
    y3 $L1;
    z3 0;

    x4 $R2;
    y4 0;
    z4 #calc "-1*sin($W)*$R2";

    x5 $R2;
    y5 $L1;
    z5 $z4;

    x6 $R3;
    y6 0;
    z6 #calc "-1*sin($W)*$R3";

    x7 $R3;
    y7 $L1;
    z7 $z6;

    x8 $R3;
    y8 #calc "$L1+$L2";
    z8 $z6;

    x9 $R2;
    y9 #calc "$L1+$L2";
    z9 $z4;

    x10 $R1;
    y10 #calc "$L1+$L2";
    z10 $z1;

    x11 0;
    y11 #calc "$L1+$L2";
    z11 0;

    x12 $R4;
    y12 0;
    z12 #calc "-1*sin($W)*$R4";

    x13 $R4;
    y13 $L1;
    z13 $z12;

    x14 $R4;
    y14 #calc "$L1+$L2";
    z14 $z12;

    x15 $R4;
    y15 #calc "$L1+$L2+$L3";
    z15 $z12;

    x16 $R3;
    y16 #calc "$L1+$L2+$L3";
    z16 $z6;

    x17 $R2;
    y17 #calc "$L1+$L2+$L3";
    z17 $z4;

    x18 $R1;
    y18 #calc "$L1+$L2+$L3";
    z18 $z1;

    x19 0;
    y19 #calc "$L1+$L2+$L3";
    z19 0;

    z20 #calc "-1*$z1";
    z21 #calc "-1*$z2";
    z22 #calc "-1*$z4";
    z23 #calc "-1*$z5";
    z24 #calc "-1*$z6";
    z25 #calc "-1*$z7";
    z26 #calc "-1*$z8";
    z27 #calc "-1*$z9";
    z28 #calc "-1*$z10";
    z29 #calc "-1*$z12";
    z30 #calc "-1*$z13";
    z31 #calc "-1*$z14";
    z32 #calc "-1*$z15";
    z33 #calc "-1*$z16";
    z34 #calc "-1*$z17";
    z35 #calc "-1*$z18";

// Alle Zylinder

geometry
{
    Zyl_Boden
    {
        type searchableCylinder;
        point1 (0 $y11 0);
        point2 (0 $y18 0);
        radius $R4;
    }

    Zyl_R4
    {
        type searchableCylinder;
        point1 (0 $y0 0);
        point2 (0 $y11 0);
        radius $R4;
    }

    Zyl_R3
    {
        type searchableCylinder;
        point1 (0 $y0 0);
        point2 (0 $y11 0);
        radius $R3;
    }

    Zyl_R2
    {
        type searchableCylinder;
        point1 (0 $y0 0);
        point2 (0 $y3 0);
        radius $R2;
    }

    Zyl_R1
    {
        type searchableCylinder;
        point1 (0 $y0 0);
        point2 (0 $y3 0);
        radius $R1;
    }


}


vertices
(
    ($x0 $y0 $z0) // 0                       
    ($x1 $y1 $z1) // 1
    ($x2 $y2 $z2) // 2
    ($x3 $y3 $z3) // 3           
    ($x4 $y4 $z4) // 4                       
    ($x5 $y5 $z5) // 5           
    ($x6 $y6 $z6) // 6           
    ($x7 $y7 $z7) // 7
    ($x8 $y8 $z8) // 8
    ($x9 $y9 $z9) // 9
    ($x10 $y10 $z10) // 10
    ($x11 $y11 $z11) // 11
    ($x12 $y12 $z12) // 12
    ($x13 $y13 $z13) // 13
    ($x14 $y14 $z14) // 14
    ($x15 $y15 $z15) // 15
    ($x16 $y16 $z16) // 16
    ($x17 $y17 $z17) // 17
    ($x18 $y18 $z18) // 18
    ($x19 $y19 $z19) // 19

    ($x1 $y1 $z20) // 20
    ($x2 $y2 $z21) // 21 
       
    ($x4 $y4 $z22) // 22                       
    ($x5 $y5 $z23) // 23           
    ($x6 $y6 $z24) // 24           
    ($x7 $y7 $z25) // 25
    ($x8 $y8 $z26) // 26
    ($x9 $y9 $z27) // 27
    ($x10 $y10 $z28) // 28

    ($x12 $y12 $z29) // 29
    ($x13 $y13 $z30) // 30
    ($x14 $y14 $z31) // 31
    ($x15 $y15 $z32) // 32
    ($x16 $y16 $z33) // 33
    ($x17 $y17 $z34) // 34
    ($x18 $y18 $z35) // 36



);

blocks
(
    hex (0 1 2 3 0 20 21 3) ($ZR1 $ZL1 1) simpleGrading (1 1 1)    // Block 0 Fluid Innenrohr
    hex (3 2 10 11 3 21 28 11) ($ZR1 $ZL2 1) simpleGrading (1 1 1)  // Block 1 Fluid Innenrohr
    hex (2 5 9 10 21 23 27 28) ($ZR2 $ZL2 1) simpleGrading (1 1 1)    // Block 2 Fluid Innenrohr
    hex (5 7 8 9 23 25 26 27) ($ZR3 $ZL2 1) simpleGrading          // Block 3 Fluid
    (
            (
            //x-Achse
            ($BB $DD $EE)
            ($AA $CC 1)
            ($BB $DD $FF)
            )
           
        (
        //y-Achse
        1;
       
        )
        (
        //z-Achse
        1
        )
    )

    hex (4 6 7 5 22 24 25 23) ($ZR3 $ZL1 1) simpleGrading              // Block 4 Fluid Wärmeaufnahme
        (
            (
            //x-Achse
            ($BB $DD $EE)
            ($AA $CC 1)
            ($BB $DD $FF)
            )
               
            (
            //y-Achse
            1;
           
            )
            (
            //z-Achse
            1
            )
        )

    hex (1 4 5 2 20 22 23 21) ($ZR2 $ZL1 1) simpleGrading (1 1 1)    // Block 5 Kupfer Innenrohr

    hex (6 12 13 7 24 29 30 25) ($ZR4 $ZL1 1) simpleGrading ($GG 1 1)    // Block 6 Kupfer Innenrohr
    hex (7 13 14 8 25 30 31 26) ($ZR4 $ZL2 1) simpleGrading ($GG 1 1)    // Block 7 Kupfer Innenrohr
    hex (8 14 15 16 26 31 32 33 ) ($ZR4 $ZL3 1) simpleGrading ($GG $GG 1)    // Block 8 Kupfer Boden
    hex (9 8 16 17 27 26 33 34) ($ZR3 $ZL3 1) simpleGrading              // Block 9 Kupfer Boden
    (
            (
            //x-Achse
            ($BB $DD $EE)
            ($AA $CC 1)
            ($BB $DD $FF)
            )           
        (
        //y-Achse
        $GG
        )

        (
        //z-Achse
        1
        )
    )


    hex (10 9 17 18 28 27 34 35) ($ZR2 $ZL3 1) simpleGrading (1 $GG 1)    // Block 10 Kupfer Boden
    hex (11 10 18 19 11 28 35 19) ($ZR1 $ZL3 1) simpleGrading (1 $GG 1)    // Block 11 Kupfer Boden
);


edges
(
);



boundary
(



// Achsensymmetrie

symmetrie_front
{
    type wedge;
    faces
    (
        (0 1 2 3)
        (3 2 10 11)
        (2 5 9 10)
        (5 7 8 9)
        (4 6 7 5)
        (1 4 5 2)
        (6 12 13 7)
        (7 13 14 8)
        (8 14 15 16)
        (9 8 16 17)
        (10 9 17 18)
        (11 10 18 19)
    );
}

symmetrie_back
{
    type wedge;
    faces
    (
        (0 20 21 3)
        (3 21 28 11)
        (21 23 27 28)
        (23 25 26 27)
        (22 24 25 23)
        (20 22 23 21)
        (24 29 30 25)
        (25 30 31 26)
        (26 31 32 33)
        (27 26 33 34)
        (28 27 34 35)
        (11 28 35 19)
    );



inlet
{
    type patch;
    faces
    ( 
    (0 1 20 0)
    );
}

outlet
{
    type patch;
    faces
    ( 
    (4 6 24 22)
    );
}

HotSide
{
    type patch;
    faces
    (
    (14 15 31 32)
    (13 14 31 30)
    (12 13 30 29)
    );
}


);


// ************************************************************************* //

As you see I changed back to the #calc command because of OF8.

Thanks in advance, I have to leave for today but will be back latest at the weekend.



Best regards
Michael

Wowbagger February 13, 2021 13:40

Hi everyone,

I tried to use the OF2012 version just to see if there is a difference to OF8.
Strange things happened...

I used the blockMeshDict file as listed above and OF2012 gave me this error:

Quote:

--> FOAM FATAL IO ERROR: (openfoam-2012)
Block hex (0 1 2 3 0 20 21 3) (20 500 1) simpleGrading (1(1) 1(1) 1(1)) has inward-pointing faces
4(0 3 2 1) 4(0 20 21 3)

file: /home/michel/OpenFOAM/michel-v2012/run/WL_v01-10/system/blockMeshDict.blocks at line 251.

From void Foam::blockDescriptor::check(const Foam::Istream&)
in file blockDescriptor/blockDescriptor.C at line 86.

FOAM exiting
Intentionally I increased the degree of the wedge to "degToRad(0.002)" and the meshing worked.
Also checkMesh gave that reportings:
Quote:

***Zero or negative face area detected. Minimum area: 0
***Max skewness = 1e+149, 540 highly skew faces detected which may impair the quality of the results
Switching to the calculation: FF #calc "1/($EE)";
Gave me the very first warning as seen in the beginning of this thread: "Either correct the patch or split it into planar parts"

checkMesh told me:

Quote:

***High aspect ratio cells found, Max aspect ratio: 8.56384e+146, number of cells 7020
***Zero or negative face area detected. Minimum area: 0
***Zero or negative cell volume detected. Minimum negative volume: -5.88415e-20, Number of negative volume cells: 7020
***Number of non-orthogonality errors: 13486.
***Max skewness = 6.11703e+149, 14606 highly skew faces detected which may impair the quality of the results
Furthermore I changed "#calc" to "#eval".
Meshing seems ok and only two mesh check failed with two reports as above:


Quote:

***Zero or negative face area detected. Minimum area: 0
***Max skewness = 1e+149, 540 highly skew faces detected which may impair the quality of the results
So far so good. The 540 cells should be the cells at the wedge symmetry line.
I see that there are differences between OF8 and OF2012.
This might be too many different steps listed but maybe this helps somebody...

I tried this meshing with my laptop and will try the calculation on my other machine by next week.
Am I right that the zero face and max skewness shouldn be a problem with the wedge type?

Best regards
Michael

sadsid March 5, 2021 16:45

1 Attachment(s)
Is it possible to introduce stretching through a formula in blockMesh. For example, introduce stretching through the attached expression.

Any hint how to do so?

Wowbagger March 7, 2021 13:31

Quote:

Originally Posted by sadsid (Post 798020)
Is it possible to introduce stretching through a formula in blockMesh. For example, introduce stretching through the attached expression.

Any hint how to do so?




At the moment I still have a similar problem with angles and the "asin" function.
Maybe someone else has a hint?



Best regards

sadsid March 7, 2021 14:12

I managed to introduce stretching, but not with blockMesh. But still facing a minor issue!

Wowbagger March 9, 2021 11:54

1 Attachment(s)
Meanwhile I changed my workstyle to get the mesh for the calculation.


At the beginning I thought it is a good idea to do all the parametric calculation in the blockMesDict.
Meanwhile I changed the calculation to Excel.
I got my parametric values and depending on them I calculate the vertices. In the attached pic is an example. Beginning in line 13 I copy to paste in blockMesDict. For me this is easier to handle. Also debugging is easier.

Maybe this helps some other users.


Best reagrds,
Michael


Attachment 83227


All times are GMT -4. The time now is 06:09.