CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[blockMesh] Blockmesh Spline usage strange simpleGrading behavior

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By snak
  • 1 Post By exnihilo

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2023, 06:40
Post Blockmesh Spline usage strange simpleGrading behavior
  #1
New Member
 
Andrea
Join Date: Oct 2022
Posts: 3
Rep Power: 4
exnihilo is on a distinguished road
I am trying to make a "smart" mesh for a laminar flame, but I cant get why blockMesh is subdividing the blocks like that (look at the image I linked). I have tried both wiht simplegrading and edgegrading. The problem is on the blocks on the west side, near to the blocks boundaries the mesh goes from fine to course, but this is not specified. The only thing that works is not using any Spline/polyLine. If you have any suggestion/solution I would be happy to hear it.
Thanks in advance.


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

convertToMeters 0.001;

vertices
(
   (0     0                    -15)   // 0

   (8  -0.13962634015954636  -30)   // 1
   (8   0.13962634015954636  -30)   // 2

   (0     0                     15)     // 3

   (8  -0.13962634015954636   0)     // 4
   (8   0.13962634015954636   0)     // 5

   (45  -0.7853981633974483     0)     // 6
   (45   0.7853981633974483     0)     // 7

   (0     0                     90)   // 8

   (8  -0.13962634015954636   75)   // 9
   (8   0.13962634015954636   75)   // 10

   (45  -0.7853981633974483     75)   // 11
   (45   0.7853981633974483     75)   // 12
   (8.5  0.14835298641951802 0) // 13
   (8.5 -0.14835298641951802 75) // 14
   (8.5  0.14835298641951802 75) // 15
   (8.5 -0.14835298641951802 0) // 16
   (0 0 17) // 17
   (8  -0.13962634015954636 2) // 18
   (8  0.13962634015954636 2) // 19
   (8.5 -0.14835298641951802 2) // 20
   (8.5 0.14835298641951802 2) // 21
   (45 -0.7853981633974483 2) // 22
   (45 0.7853981633974483 2) // 23
);

blocks
(
   hex ( 0 1 2 0 3 4 5 3 )   (40 1 40)   edgeGrading (1 1 1 1 1 1 1 1 1 1 1 1) //(0.7 1 0.15) //sw
   hex ( 3 4 5 3 17 18 19 17 )   (40 1 33)   edgeGrading (1 1 1 1 1 1 1 1 1 1 1 1) //(0.7 1 0.7) // cw
   hex ( 17 18 19 17 8 9 10 8 ) (40 1 133) edgeGrading  (1 1 1 1 1 1 1 1 1 1 1 1)//(0.7 1 22) // nw
   hex ( 5 4 16 13 19 18 20 21 )   (1 30 33)   simpleGrading  (1 1 1)//(1 1 0.7) // cc
   hex ( 19 18 20 21 10 9 14 15 ) (1 30 133) simpleGrading  (1 1 1)//(1 1 22) // cn
   hex ( 13 16 6 7 21 20 22 23 ) (1 40 33) simpleGrading  (1 1 1)//(1 3 0.7) // ce
   hex ( 21 20 22 23 15 14 11 12 ) (1 40 133) simpleGrading  (1 1 1)//(1 3 22) // ne

);

boundary
(
    inletFuel
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    wallOutside
    {
        type wall;
        faces
        (
            (7 6 23 22)
            (23 22 12 11)
        );
    }

    wallTube
    {
        type wall;
        faces
        (
            (2 1 5 4)
            (5 4 16 13)
        );
    }


    inletN
    {
        type patch;
        faces
        (
            (13 16 6 7)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (8 9 10 8)
            (10 9 14 15)
            ( 15 14 11 12 )
        );
    }

    axis
    {
        type empty;
        faces
        (
            (0 3 3 0)
            (3 17 17 3)
            (17 8 8 17)
        );
    }

    frontAndBack_pos
    {
        type wedge;
        faces
        (
            (0 2 3 5)
            (3 5 17 19)
            (17 19 8 10)
            (5 13 19 21)
            (19 21 10 15)
            (13 7 21 23)
            (21 23 15 12)
        );
    }

    frontAndBack_neg
    {
        type wedge;
        faces
        (
            (0 1 3 4)
            (3 4 17 18)
            (17 18 8 9)
            (4 16 18 20)
            (18 20 9 14)
            (16 6 20 22)
            (20 22 14 11)
        );
    }
);

edges
(
    BSpline 17 19 ((0.2 0.003490658503988659 17) (1 0.017453292519943295 16.7) (7 0.12217304763960307 2.3) (7.8 0.1361356816555577 2))
    BSpline 17 18 ((0.2 -0.003490658503988659 17) (1 -0.017453292519943295 16.7) (7 -0.12217304763960307 2.3) (7.8 -0.1361356816555577 2))
    BSpline 3 4 ((0.2 -0.003490658503988659 15) (1 -0.017453292519943295 14.7) (7 -0.12217304763960307 0.3) (7.8 -0.1361356816555577 0))
    BSpline 3 5 ((0.2 0.003490658503988659 15) (1 0.017453292519943295 14.7) (7 0.12217304763960307 0.3) (7.8 0.1361356816555577 0))
    BSpline 0 1 ((0.2 -0.003490658503988659 -15) (1 -0.017453292519943295 -15.3) (7 -0.12217304763960307 -29.7) (7.8 -0.1361356816555577 -30))
    BSpline 0 2 ((0.2 0.003490658503988659 -15) (1 0.017453292519943295 -15.3) (7 0.12217304763960307 -29.7) (7.8 0.1361356816555577 -30))
    BSpline 8 9 ((0.2 -0.003490658503988659 90) (1 -0.017453292519943295 89.7) (7 -0.12217304763960307 75.3) (7.8 -0.1361356816555577 75))
    BSpline 8 10 ((0.2 0.003490658503988659 90) (1 0.017453292519943295 89.7) (7 0.12217304763960307 75.3) (7.8 0.1361356816555577 75))
);
// ************************************************************************* //
Attached Images
File Type: jpg badMesh.jpg (51.5 KB, 42 views)

Last edited by exnihilo; June 9, 2023 at 06:48. Reason: further explainations
exnihilo is offline   Reply With Quote

Old   June 10, 2023, 05:32
Default
  #2
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi exnihilo,

Thank you for sharing interesting problem.

It looks like that positions given in spline edges prevents grading.

I cannot suggest a direct solution unfortunately.

To avoid the problem, we may use geometry and projection in blockMesh dict. With this method grading instruction works. I modified your dict as follows. Curves is obtained from spheres created in geometry sub-dict. Your can use arbitrary shape (stl files and others) instead of sphere.

https://develop.openfoam.com/Develop.../blockMeshDict

https://www.openfoam.com/documentati...-geometry.html


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


// OpenFOAM v2212

 
scale 0.001;

// Geometric parameters
outerRadius 8;

geometry
{
    sphere0
    {
        type    sphere;
        origin  (0 0 -30);
        radius  $outerRadius;
    }
    sphere1
    {
        type    sphere;
        origin  (0 0 0);
        radius  $outerRadius;
    }
    sphere2
    {
        type    sphere;
        origin  (0 0 2);
        radius  $outerRadius;
    }
    sphere3
    {
        type    sphere;
        origin  (0 0 75);
        radius  $outerRadius;
    }
}

vertices
(
   (0     0                  -22) // -15)   // 0
   (8  -0.13962634015954636  -30)   // 1
   (8   0.13962634015954636  -30)   // 2
   //project (0 0 -15) (sphere)  // 0
   //project (8  -0.13962634015954636 -30) (sphere)  // 1
   //project (8   0.13962634015954636  -30) (sphere)  // 2

   (0     0                   8) //  15)     // 3
   (8  -0.13962634015954636   0)     // 4
   (8   0.13962634015954636   0)     // 5

   (45  -0.7853981633974483     0)     // 6
   (45   0.7853981633974483     0)     // 7

   (0     0                   83) //  90)   // 8

   (8  -0.13962634015954636   75)   // 9
   (8   0.13962634015954636   75)   // 10

   (45  -0.7853981633974483     75)   // 11
   (45   0.7853981633974483     75)   // 12
   (8.5  0.14835298641951802 0) // 13
   (8.5 -0.14835298641951802 75) // 14
   (8.5  0.14835298641951802 75) // 15
   (8.5 -0.14835298641951802 0) // 16

   (0 0 10) //17) // 17
   (8  -0.13962634015954636 2) // 18
   (8  0.13962634015954636 2) // 19

   (8.5 -0.14835298641951802 2) // 20
   (8.5 0.14835298641951802 2) // 21
   (45 -0.7853981633974483 2) // 22
   (45 0.7853981633974483 2) // 23
);

blocks
(
   hex ( 0 1 2 0         3 4 5 3 ) (40 1  40) simpleGrading (0.25 1 1) // block 0  //(0.7 1 0.15) //sw
   hex ( 3 4 5 3     17 18 19 17 ) (40 1  33) simpleGrading (0.25 1 1) //block 1 //(0.7 1 0.7) // cw
   hex ( 17 18 19 17    8 9 10 8 ) (40 1 133) simpleGrading  (0.25 1 1) // block 2 //(0.7 1 22) // nw
   hex ( 5 4 16 13   19 18 20 21 ) (1 30  33) simpleGrading  (1 1 1)//(1 1 0.7) // cc
   hex ( 19 18 20 21  10 9 14 15 ) (1 30 133) simpleGrading  (1 1 1)//(1 1 22) // cn
   hex ( 13 16 6 7   21 20 22 23 ) (1 40  33) simpleGrading  (1 1 1)//(1 3 0.7) // ce
   hex ( 21 20 22 23 15 14 11 12 ) (1 40 133) simpleGrading  (1 1 1)//(1 3 22) // ne
);

boundary
(
    inletFuel
    {
        type patch;
        faces
        (
            (0 1 2 0)
        );
    }

    wallOutside
    {
        type wall;
        faces
        (
            (7 6 23 22)
            (23 22 12 11)
        );
    }

    wallTube
    {
        type wall;
        faces
        (
            (2 1 5 4)
            (5 4 16 13)
        );
    }

    inletN
    {
        type patch;
        faces
        (
            (13 16 6 7)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (8 9 10 8)
            (10 9 14 15)
            ( 15 14 11 12 )
        );
    }

    axis
    {
        type empty;
        faces
        (
            (0 3 3 0)
            (3 17 17 3)
            (17 8 8 17)
        );
    }

    frontAndBack_pos
    {
        type wedge;
        faces
        (
            (0 2 3 5)
            (3 5 17 19)
            (17 19 8 10)
            (5 13 19 21)
            (19 21 10 15)
            (13 7 21 23)
            (21 23 15 12)
        );
    }

    frontAndBack_neg
    {
        type wedge;
        faces
        (
            (0 1 3 4)
            (3 4 17 18)
            (17 18 8 9)
            (4 16 18 20)
            (18 20 9 14)
            (16 6 20 22)
            (20 22 14 11)
        );
    }
);

edges
(
    //BSpline 17 19 ((0.2 0.003490658503988659 17) (1 0.017453292519943295 16.7) (7 0.12217304763960307 2.3) (7.8 0.1361356816555577 2))
    //BSpline 17 18 ((0.2 -0.003490658503988659 17) (1 -0.017453292519943295 16.7) (7 -0.12217304763960307 2.3) (7.8 -0.1361356816555577 2))

    project 17 19 (sphere2) // block 1-0 block 2-
    project 17 18 (sphere2) // block 1-1 block 2-


    //BSpline 3 4 ((0.2 -0.003490658503988659 15) (1 -0.017453292519943295 14.7) (7 -0.12217304763960307 0.3) (7.8 -0.1361356816555577 0))
    //BSpline 3 5 ((0.2 0.003490658503988659 15) (1 0.017453292519943295 14.7) (7 0.12217304763960307 0.3) (7.8 0.1361356816555577 0))

    project 3 4 (sphere1) // block 0-3
    project 3 5 (sphere1) // block 0-2


/*
    // BSpline
    simpleSpline 0 1 
    (
        (0.2 -0.003490658503988659 -15)
        (1   -0.017453292519943295 -15.3)
        (7   -0.12217304763960307  -29.7)
        (7.8 -0.1361356816555577   -30)
    )

    //BSpline
    simpleSpline 0 2 ((0.2 0.003490658503988659 -15) (1 0.017453292519943295 -15.3) (7 0.12217304763960307 -29.7) (7.8 0.1361356816555577 -30))
*/

    project 0 1 (sphere0) // block 0-0
    project 0 2 (sphere0) // block 0-1


    //BSpline 8 9 ((0.2 -0.003490658503988659 90) (1 -0.017453292519943295 89.7) (7 -0.12217304763960307 75.3) (7.8 -0.1361356816555577 75))
    //BSpline 8 10 ((0.2 0.003490658503988659 90) (1 0.017453292519943295 89.7) (7 0.12217304763960307 75.3) (7.8 0.1361356816555577 75))

    project 8 9 (sphere3) // block 2-0
    project 8 10 (sphere3) // block 2-1
);

    // https://develop.openfoam.com/Development/openfoam/-/blob/master/tutorials/mesh/blockMesh/sphere7ProjectedEdges/system/blockMeshDict
faces
(
    project (0 4) sphere0 // block 1: z-min
    project (0 5) sphere1 // block 1: z-max
    project (1 4) sphere1 // block 2: z-min
    project (1 5) sphere2 // block 2: z-max
    project (2 4) sphere2 // block ?: z-min
    project (2 5) sphere3 // block ?: z-max
);

// ************************************************************************* //
Attached Images
File Type: jpg mesh.jpg (125.6 KB, 31 views)
exnihilo likes this.
snak is offline   Reply With Quote

Old   June 10, 2023, 05:42
Wink
  #3
New Member
 
Andrea
Join Date: Oct 2022
Posts: 3
Rep Power: 4
exnihilo is on a distinguished road
Thank you very much! I thought spline was a good instrument since I could have made the flame on a super coarse mesh with a 1/2 step reaction mechanism and then I could have easily fitted the flame front on the spline. This would result in a super fine mesh where needed, but I think I can do something similar with a sphere, just fitting the sphere or with a generated .stl file. Thank you very much again for the suggestions, I will probably add this to the issues on openfoam site.
snak likes this.
exnihilo is offline   Reply With Quote

Reply

Tags
blockmesh, edgegrading, simplegrading


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot converge a pimpleFoam simulation iper88 OpenFOAM Running, Solving & CFD 1 November 26, 2015 09:04
[blockMesh] External flow around cube with blockMesh Woody8 OpenFOAM Meshing & Mesh Conversion 0 March 31, 2015 15:54
error messages about blockmeshing and solving cramsdead OpenFOAM Pre-Processing 2 November 11, 2014 11:53
[OpenFOAM] ParaView shows bad cells, checkMesh doesn't seem to notice. CoolHand ParaView 2 August 21, 2014 16:58
[blockMesh] Blockmesh error - 2D scramjet ishaninair OpenFOAM Meshing & Mesh Conversion 7 March 18, 2011 01:14


All times are GMT -4. The time now is 11:24.