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/)
-   -   [Other] How to mesh inside a sphere? (https://www.cfd-online.com/Forums/openfoam-meshing/142296-how-mesh-inside-sphere.html)

ssss September 27, 2014 07:05

How to mesh inside a sphere?
 
Hi,

Anyone knows how to create a spherical mesh of the inside of a sphere?

Thank you

cutter October 20, 2014 08:36

Hi,

have a look at snappyHexMesh (www.openfoam.org/docs/user/snappyHexMesh.php).

There are also some nice explanations at https://sites.google.com/site/snappywiki/. Both the 'cube case' and the 'cylinder case' can be adapted for a sphere.

Cutter

cutter October 20, 2014 08:54

1 Attachment(s)
I just played with cfMesh (one of its tools called 'cartesianMesh'). It also did a really good job (see attached image!). Depending on your requirements on the final mesh, there's also a tool called 'tetMesh' for the creation of tetrahedral meshes.

See http://www.c-fields.com/solutions/products/meshing for more infos!

Have fun!

Cutter

alexeym October 20, 2014 13:47

1 Attachment(s)
Hi,

Quote:

Originally Posted by ssss (Post 512128)
Anyone knows how to create a spherical mesh of the inside of a sphere?

well, you can surely try to use snapptHexMesh or cfMesh, as cutter suggested. But I think it'll be much easier to use Gmsh (http://gmsh.info).

Here's an example of GEO file to generate fully hexagonal mesh of the sphere:

Code:

l = 1;
r1 = 2;
r2 = 0.5;
n = 20;

Point(1) = {0,0,0,l};
Point(102) = {r2,r2,-r2,l};
Point(103) = {-r2,r2,-r2,l};
Point(104) = {-r2,-r2,-r2,l};
Point(105) = {r2,-r2,-r2,l};
Circle(29) = {103,1,102};
Circle(30) = {102,1,105};
Circle(31) = {105,1,104};
Circle(32) = {104,1,103};
Line Loop(33) = {29,30,31,32};
Ruled Surface(34) = {33};
Rotate { {1,0,0},{0,0,0}, Pi/2 } { Duplicata{ Surface{34}; } }
Rotate { {1,0,0},{0,0,0}, Pi } { Duplicata{ Surface{34}; } }
Rotate { {1,0,0},{0,0,0}, 3*Pi/2 } { Duplicata{ Surface{34}; } }
Rotate { {0,1,0},{0,0,0}, Pi/2 } { Duplicata { Surface{34}; } }
Rotate { {0,1,0},{0,0,0}, -Pi/2 } { Duplicata { Surface{34}; } }

Surface Loop(101) = {35, 40, 45, 34, 51, 50};
Volume(102) = {101};

Transfinite Line {42, 44, 30, 32, 36, 41, 29, 31, 39, 49, 37, 47} = n;
Transfinite Surface "*";
Recombine Surface "*";
Transfinite Volume "*";
Recombine Volume "*";

Physical Surface(100) = {34,35,40,45,50,51};
Physical Volume(103) = {102};


cutter October 20, 2014 15:53

Hi Alexey,

thanks for you additions. I haven't used Gmsh for a couple of years now. The last time I used it, the UI was quite unconventionally and somewhat intimidating. After quick and steep learning curve regarding the UI and experimenting with its scripting language I got pretty good meshes though. I liked it, but it didn't work within our toolchain (well, all the other OF tools need custom scripts and proprietary UIs too...). I will definitely have a look at it again!

Creating the sphere geometry (STL) with Salome and meshing the whole thing with cfMesh based on an existing tutorial case took me just a few minutes (less than ten!). Creating the mesh using the Gmsh script from Alexey shouldn't take any longer.

@SSSS: After all you have to find a workflow that works for your special use case (depending on mesh requirements, input files etc.). Now you've got already three of them, there are probably a dozen more ;-)

Cutter

ssss October 27, 2014 09:36

Thank you all of you guys for your help, I finally managed to mesh a sphere, and an sphere section using snappyHexMesh and blockMesh to cut the geometry. The idea was borrowed from iglooTutorial in buoyanBoussinesqSimpleFoam folder

I will have a look at other posibilities mentioned here, thank you all you're awesome.


All times are GMT -4. The time now is 14:21.