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

[blockMesh] Sphere mesh with blockMesh - weird cells

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 2 Post By TheMadHungarian
  • 1 Post By guin
  • 2 Post By mAlletto

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 22, 2018, 10:00
Default Sphere mesh with blockMesh - weird cells
  #1
New Member
 
Andy S.
Join Date: Jun 2018
Posts: 17
Rep Power: 8
TheMadHungarian is on a distinguished road
Hi all, a longtime "lurker" here. I have learnt a lot from this community but there is one case now I need some special hints.


I'm using blockMeshDict to create a spherical mesh with a spherical void in the middle (a spherical shell in essence). The meshing goes great but when checking the inside of the mesh with Paraview and "Slice" or "Clip", I see several ill-formed cells. How do I fix those? I figured the mesher would be smart enough to create a bunch of slightly spherical "bricks" some some cells are wedge-shaped...I guess. I'm still getting good results from sonicFoam but these artifacts bother me.


The simulation I'm running is a transonic blast expansion, FYI. We're trying to determine the shock wave travel characteristics.


blockMesh runs without errors, checkMesh also "OK" everything, and I also ran renumberMesh...all good. Still getting those weird artifacts. What's the deal?????



So, I need inputs, comments, hints, etc.


Thanks!!!!!


Pictures attached are of the actual mesh in question.


Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

verbose yes;

geometry {
    sphere1 {
        type searchableSphere;
        centre (0 0 0);
        radius 3.5;
    }
    sphere2 {
        type searchableSphere;
        centre (0 0 0);
        radius 50;
    }
}

scale 1;

n1 20;

v    28.8675;//0.5773502;
mv  -28.8675; //-0.5773502;
vh   2.0207; //0.2886751;
mvh -2.0207; //-0.2886751;

a    35.3553; //0.7071067;
ma  -35.3553; //-0.7071067;
ah   2.47487; //0.3464101;
mah -2.47487; //-0.3464101;

vertices (
    ($mvh $mvh $mvh)
    ( $vh $mvh $mvh)
    ( $vh  $vh $mvh)
    ($mvh  $vh $mvh)
    ($mvh $mvh  $vh)
    ( $vh $mvh  $vh)
    ( $vh  $vh  $vh)
    ($mvh  $vh  $vh) //7

    ($mv $mv $mv) //8
    ( $v $mv $mv)
    ( $v  $v $mv)
    ($mv  $v $mv)
    ($mv $mv  $v)
    ( $v $mv  $v)
    ( $v  $v  $v)
    ($mv  $v  $v) //15
);

blocks (
    hex ( 9  8 12 13  1  0  4  5) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex (10  9 13 14  2  1  5  6) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex (11 10 14 15  3  2  6  7) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex ( 8 11 15 12  0  3  7  4) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex ( 8  9 10 11  0  1  2  3) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex (13 12 15 14  5  4  7  6) ($n1 $n1 $n1) simpleGrading (1 1 1)
);

edges (
    arc  8  9 (0 $ma $ma)
    arc 10 11 (0 $a $ma)
    arc 14 15 (0 $a $a)
    arc 12 13 (0 $ma $a)

    arc  8 11 ($ma 0 $ma)
    arc  9 10 ($a 0 $ma)
    arc 13 14 ($a 0 $a)
    arc 12 15 ($ma 0 $a)

    arc  8 12 ($ma $ma 0)
    arc  9 13 ($a $ma 0)
    arc 10 14 ($a $a 0)
    arc 11 15 ($ma $a 0)


    arc  0  1 (0 $mah $mah)
    arc  2  3 (0 $ah $mah)
    arc  6  7 (0 $ah $ah)
    arc  4  5 (0 $mah $ah)

    arc  0  3 ($mah 0 $mah)
    arc  1  2 ($ah 0 $mah)
    arc  5  6 ($ah 0 $ah)
    arc  4  7 ($mah 0 $ah)

    arc  0  4 ($mah $mah 0)
    arc  1  5 ($ah $mah 0)
    arc  2  6 ($ah $ah 0)
    arc  3  7 ($mah $ah 0)
);

faces (
    project ( 0 4 7 3) sphere1
    project (2 6 5 1) sphere1
    project ( 1 5 4  0) sphere1
    project (3 7 6 2) sphere1
    project ( 0 3 2 1) sphere1
    project (4 5 6 7) sphere1

    project (8 12 15 11) sphere2
    project (10 14 13 9) sphere2
    project (9 13 12 8) sphere2
    project (11 15 14 10) sphere2
    project (8 11 10 9) sphere2
    project (12 13 14 15) sphere2
);

boundary (
    atmosphere {
        type patch;
        faces
        (
            ( 8 12 15 11)
            (10 14 13  9)
            ( 9 13 12  8)
            (11 15 14 10)
            ( 8 11 10  9)
            (12 13 14 15)
        );
    }
    blast {
        type patch;
        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)
        );
    }
);
checkMesh results show no issues:



Code:
Mesh stats
    points:           393682
    faces:            1161600
    internal faces:   1142400
    cells:            384000
    faces per cell:   6
    boundary patches: 2
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     384000
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch               Faces    Points   Surface topology
    atmosphere          9600     9602     ok (closed singly connected)
    blast               9600     9602     ok (closed singly connected)

Checking geometry...
    Overall domain bounding box (-50 -50 -50) (50 50 50)
    Mesh has 3 geometric (non-empty/wedge) directions (1 1 1)
    Mesh has 3 solution (non-empty) directions (1 1 1)
    Boundary openness (2.65525e-016 2.44712e-016 2.10464e-016) OK.
    Max cell openness = 3.83177e-016 OK.
    Max aspect ratio = 5.79932 OK.
    Minimum face area = 0.0104915. Maximum face area = 4.08288.  Face area magnitudes OK.
    Min volume = 0.018498. Max volume = 4.59341.  Total volume = 522007.  Cell volumes OK.
    Mesh non-orthogonality Max: 50.2352 average: 8.22207
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 0.470245 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

End
Attached Images
File Type: jpg Clip.jpg (147.9 KB, 112 views)
File Type: png Sphere.png (153.2 KB, 96 views)
saralen and mAlletto like this.
TheMadHungarian is offline   Reply With Quote

Old   October 23, 2018, 02:54
Default
  #2
Senior Member
 
Zander Meiring
Join Date: Jul 2018
Posts: 125
Rep Power: 8
yambanshee is on a distinguished road
This is likely nothing more than an artifact of how paraview cuts the mesh when you section it, and is not an accurate representation of what your mesh actually looks like. All my meshes look like this when viewing a slice. I just think that paraview doesn't do a good job of accurately showing the mesh when sliced
yambanshee is offline   Reply With Quote

Old   October 23, 2018, 08:27
Default
  #3
Member
 
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16
guin is on a distinguished road
Your mesh is fine. In order to see the mesh elements correctly do not forget to enable "Crinkle clip" (bottom left-hand side in attached snapshot)
Attached Images
File Type: jpg Screenshot_20181023_131913.jpg (170.2 KB, 68 views)

Last edited by guin; October 23, 2018 at 08:39. Reason: It took me a while, but I finally found out the way to include pictures as attachment
guin is offline   Reply With Quote

Old   October 23, 2018, 11:41
Default
  #4
New Member
 
Andy S.
Join Date: Jun 2018
Posts: 17
Rep Power: 8
TheMadHungarian is on a distinguished road
OK, thanks for the input...I checked the number of cells, it checks out.
I have the crinkle-cut vs. non-crinkle cuts attached....still does not look right, it must be a Paraview issue.


The odd thing is, when I slice or clip the mesh, I clip it right in the middle - right between the cells - so there should be no weird artifacts.


Andy
Attached Images
File Type: png crinkle.png (64.4 KB, 60 views)
File Type: png non-crinkle.png (64.0 KB, 52 views)
TheMadHungarian is offline   Reply With Quote

Old   October 23, 2018, 11:51
Default
  #5
Member
 
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16
guin is on a distinguished road
It's a numerical issue form ParaView. The clip sets by default its origin at (0,0,0). Just shift it slightly -e.g. to (1e-6, 1e-6, 1e-6) - in order to help ParaView at identifying which cells are at which side of the clip.
TheMadHungarian likes this.
guin is offline   Reply With Quote

Old   October 23, 2018, 11:58
Default
  #6
New Member
 
Andy S.
Join Date: Jun 2018
Posts: 17
Rep Power: 8
TheMadHungarian is on a distinguished road
That reminds me: is there any utilities which convert OpenFOAM mesh to some other format, say Gmsh?
I want to visually check the mesh using anotjer format...
TheMadHungarian is offline   Reply With Quote

Old   October 23, 2018, 12:02
Default
  #7
New Member
 
Andy S.
Join Date: Jun 2018
Posts: 17
Rep Power: 8
TheMadHungarian is on a distinguished road
Quote:
Originally Posted by guin View Post
It's a numerical issue form ParaView. The clip sets by default its origin at (0,0,0). Just shift it slightly -e.g. to (1e-6, 1e-6, 1e-6) - in order to help ParaView at identifying which cells are at which side of the clip.

Thank you guin! it worked !!!!!


Although it is weird that when Paraview "slices" a cell it shows a completely different view that one would expect when slicing a "brick" - it would still be a brick but smaller.
Oh well. Lesson learnt.


Thanks again.
TheMadHungarian is offline   Reply With Quote

Old   October 23, 2018, 12:05
Default
  #8
Member
 
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16
guin is on a distinguished road
what about https://cpp.openfoam.org/dev/foamToStarMesh_8C.html ?

there are a couple of "foamTo<whatever>" utilities, just search for them in the online documentation.
guin is offline   Reply With Quote

Old   October 23, 2018, 12:06
Default
  #9
Member
 
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16
guin is on a distinguished road
... among them also https://cpp.openfoam.org/dev/foamMeshToFluent_8C.html
guin is offline   Reply With Quote

Old   March 18, 2023, 07:20
Default
  #10
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
I've slightly updated the above blockMesh in order that someone can specify freely the inner and the outer radius. Maybe it is useful for somebody



Code:

FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

verbose yes;

innerRadius 35;
outerRadius 50;

geometry {
    sphere1 {
        type searchableSphere;
        centre (0 0 0);
        radius $innerRadius;
    }
    sphere2 {
        type searchableSphere;
        centre (0 0 0);
        radius $outerRadius;
    }
}

scale 1;

n1 20;

v #eval{ $outerRadius*0.5773502 };
mv #eval{ -$outerRadius*0.5773502 };
vh #eval{ $innerRadius*0.5773502 };
mvh #eval{ -$innerRadius*0.5773502 };
a #eval{ $outerRadius*0.7071067 };
ma #eval{ -$outerRadius*0.7071067 };
ah #eval{ $innerRadius*0.7071067 };
mah #eval{ -$innerRadius*0.7071067 };

/*
v    28.8675;//0.5773502;
mv  -28.8675; //-0.5773502;
vh   2.0207; //0.2886751;
mvh -2.0207; //-0.2886751;

a    35.3553; //0.7071067;
ma  -35.3553; //-0.7071067;
ah   2.47487; //0.3464101;
mah -2.47487; //-0.3464101;
*/

vertices (
    ($mvh $mvh $mvh)
    ( $vh $mvh $mvh)
    ( $vh  $vh $mvh)
    ($mvh  $vh $mvh)
    ($mvh $mvh  $vh)
    ( $vh $mvh  $vh)
    ( $vh  $vh  $vh)
    ($mvh  $vh  $vh) //7

    ($mv $mv $mv) //8
    ( $v $mv $mv)
    ( $v  $v $mv)
    ($mv  $v $mv)
    ($mv $mv  $v)
    ( $v $mv  $v)
    ( $v  $v  $v)
    ($mv  $v  $v) //15
);

blocks (
    hex ( 9  8 12 13  1  0  4  5) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex (10  9 13 14  2  1  5  6) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex (11 10 14 15  3  2  6  7) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex ( 8 11 15 12  0  3  7  4) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex ( 8  9 10 11  0  1  2  3) ($n1 $n1 $n1) simpleGrading (1 1 1)
    hex (13 12 15 14  5  4  7  6) ($n1 $n1 $n1) simpleGrading (1 1 1)
);

edges (
    arc  8  9 (0 $ma $ma)
    arc 10 11 (0 $a $ma)
    arc 14 15 (0 $a $a)
    arc 12 13 (0 $ma $a)

    arc  8 11 ($ma 0 $ma)
    arc  9 10 ($a 0 $ma)
    arc 13 14 ($a 0 $a)
    arc 12 15 ($ma 0 $a)

    arc  8 12 ($ma $ma 0)
    arc  9 13 ($a $ma 0)
    arc 10 14 ($a $a 0)
    arc 11 15 ($ma $a 0)


    arc  0  1 (0 $mah $mah)
    arc  2  3 (0 $ah $mah)
    arc  6  7 (0 $ah $ah)
    arc  4  5 (0 $mah $ah)

    arc  0  3 ($mah 0 $mah)
    arc  1  2 ($ah 0 $mah)
    arc  5  6 ($ah 0 $ah)
    arc  4  7 ($mah 0 $ah)

    arc  0  4 ($mah $mah 0)
    arc  1  5 ($ah $mah 0)
    arc  2  6 ($ah $ah 0)
    arc  3  7 ($mah $ah 0)
);

faces (
    project ( 0 4 7 3) sphere1
    project (2 6 5 1) sphere1
    project ( 1 5 4  0) sphere1
    project (3 7 6 2) sphere1
    project ( 0 3 2 1) sphere1
    project (4 5 6 7) sphere1

    project (8 12 15 11) sphere2
    project (10 14 13 9) sphere2
    project (9 13 12 8) sphere2
    project (11 15 14 10) sphere2
    project (8 11 10 9) sphere2
    project (12 13 14 15) sphere2
);

boundary (
    atmosphere {
        type patch;
        faces
        (
            ( 8 12 15 11)
            (10 14 13  9)
            ( 9 13 12  8)
            (11 15 14 10)
            ( 8 11 10  9)
            (12 13 14 15)
        );
    }
    blast {
        type patch;
        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)
        );
    }
);

// ************************************************************************* //
mAlletto is offline   Reply With Quote

Reply


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
[snappyHexMesh] Error snappyhexmesh - Multiple outside loops avinashjagdale OpenFOAM Meshing & Mesh Conversion 53 March 8, 2019 10:42
[snappyHexMesh] SHM Layer Addition Phase dickcruz OpenFOAM Meshing & Mesh Conversion 4 November 1, 2018 08:05
[blockMesh] Create internal faces as patch in blockMesh m.delta68 OpenFOAM Meshing & Mesh Conversion 14 July 12, 2018 15:43
Possible to select Cells next to a SPHERE surface? keepfit OpenFOAM 2 November 30, 2016 16:47
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 20:43


All times are GMT -4. The time now is 23:41.