[Gmsh] Block structured hex-only-3D-mesh for sequence of conical frustums

Florian Hoffmann florian.hoffmann at inutech.de
Thu Apr 21 10:48:10 CEST 2016


Dear Felix,

thank you very much for your quick response.
Please find attached a simplified example highlighting my problem.
It is a simple cylinder with an internal block structure. The 3D 
geometry is obtained by extruding several surfaces (=blocks for hexaeder 
meshing). Extrusion is done in line 161 of the *.geo file.
With the variable 'withDilate' in line 186 one can switch on/off the 
dilate command I was trying to obtain the frustum-like outline with.
I also attached two screenshot showing my problem when meshing: On the 
left hand side there is the cylinder (Extrude only) and on the right 
hand side one can see the conical frustum (Extrude+Dilate) but one can 
also see the problem with the mesh.
If you could point me to the bits that I would have to change/add in 
order to make this work, that would be really really making my day.

Thank you very much.

Best regards,

Florian




Am 21.04.2016 um 06:18 schrieb Felix Salazar:
>
> Hello,
>
> I did something similar not too long ago. My geometry had a basic 
> structure, and for different cases, the angles and lengths of the 
> sections varied. Just make sure that Extrude ReturnLateralEntities 
> option is on, and check the contents of the extruded array.  Start 
> with the B->C extrusion only, and make sure that you're using the 
> Layers option in the extrusion, to get your structured mesh. Depending 
> on your options, you might need to explicitly recombine your elements 
> to get hexas. Could we see your .GEO file? Just from the B-B surface 
> to the extrusion? You can remove the details of the A-A section, to 
> protect IP
>
> On Apr 20, 2016 5:47 PM, "Florian Hoffmann" 
> <florian.hoffmann at inutech.de <mailto:florian.hoffmann at inutech.de>> wrote:
>
>     Dear all,
>
>
>     I would like to generate a block structured hexaeder-only-3D-mesh
>     for a geometry consisting of several conical frustums. Something
>     like this:
>
>
>       __________
>       \                 /
>        |               |
>         \             /
>          |           |
>     C_|           | _ C
>          \          /            ^  extrude B->C
>     B _ \____/  _ B    _|_
>     A _  |___|   _ A
>
>
>     Section A-A has a non-circular cross-section, and section B-B and
>     all others above have circular cross-section. I successfully
>     created A-A and the circular cross-section B-B. Both consist of
>     several surfaces/blocks (see attached picture). In my *.geo script
>     I try to work with variables. There I collect the IDs of all
>     surfaces forming the cross-section B-B (= the bottom of the first
>     conical frustum) in an array (=cross_section_BB_surfaces[]).
>     Nevertheless, when I try to Extrude+Dilate these surfaces in order
>     to build the first conical frustum (=B-B -> C-C), during meshing I
>     get several errors about „Could not find extruded vertex …“ .
>     Extrusion-only of B-B to C-C (without Dilate) works fine, but this
>     would just give me a cylinder outline and it is not what I want.
>     Since I need a block structured mesh and also because A-A has a
>     non-circular cross-section (see bottom plane of geometry in
>     attached picture) I would really like to make use of the extrude
>     command for creation of C-C and the other frustum above.
>
>     (1) Is there a way to make this work (without having to create all
>     frustums including their blocked structure by hand) ?
>
>     (2) If not, can anybody think of a solution for how to script this
>     in an efficient and handable way ?
>
>
>     Thanks a lot.
>
>     Cheers Flo
>
>
>
>
>
>
>
>
>
>     Mit freundlichen Grüßen
>     --**
>     Dr.-Ing. Florian Hoffmann**
>     inuTech GmbH Phone    : +49-(0)911-323843-22
>     <tel:%2B49-%280%29911-323843-22>
>     Fuerther Strasse 212         Fax        : +49-(0)911-323843-43
>     <tel:%2B49-%280%29911-323843-43>
>     90429 Nuernberg               E-Mai l  
>     :florian.hoffmann at inutech.de <mailto:sebastian.peetz at inutech.de>
>     Germany                            Internet  : http://www.inutech.de
>
>     inuTech GmbH
>     Sitz / Registered Office: Nuernberg
>     Handelsregister / Companies' Register: AG Nürnberg HRB Nr. 19026
>     Geschäftsführer / Managing Director: Frank Vogel
>
>     *****************************************************************
>     DIFFPACK - THE NEW GENERATION OF SIMULATION-SOFTWARE!
>
>     Go to http://www.diffpack.com to read the details
>     *****************************************************************
>
>
>     _______________________________________________
>     gmsh mailing list
>     gmsh at onelab.info <mailto:gmsh at onelab.info>
>     http://onelab.info/mailman/listinfo/gmsh
>

-- 
Mit freundlichen Grüßen
--
Dr.-Ing. Florian Hoffmann
inuTech GmbH		Phone	 : +49-(0)911-323843-22
Fuerther Strasse 212	Fax	 : +49-(0)911-323843-43
90429 Nuernberg		E-Mai l	 : florian.hoffmann at inutech.de
Germany		        Internet : http://www.inutech.de

inuTech GmbH
Sitz / Registered Office: Nuernberg
Handelsregister / Companies' Register: AG Nürnberg HRB Nr. 19026
Geschäftsführer / Managing Director: Frank Vogel

*****************************************************************
DIFFPACK - THE NEW GENERATION OF SIMULATION-SOFTWARE!

Go to http://www.diffpack.com to read the details
*****************************************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20160421/0fde25b0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 231880 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20160421/0fde25b0/attachment-0002.png>
-------------- next part --------------
/*********************************************************************
 *
 * This is a cylindrical mesh script for gmsh
 * the aim is to use it as mesh template for cylindrical reactor mesh generation
 *
 *********************************************************************/

u__1   = 0.001; //convert to meters
cl1    = u__1*10;   //mesh size at point ...

R2     = 125; // reactor radius
height = 200; // extrude in z direction
pz0    = 0;   // reactor elevation

r = 50;  // Note: 0 < r < R2 ("inner radius")


/* ** Structured mesh configuration  ** */
arcs_points          = 10 ;   //radial resolution
outer_radial_points  = 5 ;
no_z_cells           = 10;  //layers


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

// basic points (generators)
p_1 = newp;    Point(p_1) = {0,       0,      0,        cl1};  // center of reactor


// central geometry
p_2 = newp;    Point(p_2) = {u__1*r,  0,      u__1*pz0, cl1};  // arc points
p_3 = newp;    Point(p_3) = {0,       u__1*r, u__1*pz0, cl1};
p_4 = newp;    Point(p_4) = {-u__1*r, 0,      u__1*pz0, cl1};
p_5 = newp;    Point(p_5) = {0,      -u__1*r, u__1*pz0, cl1};

g = 1.5; // kinda gravity to influence arcs amplitude
p__2 = newp;    Point(p__2) = {u__1*r/g,   u__1*r/g,        u__1*pz0, cl1};  // outer points  influencing arcs amplitude
p__3 = newp;    Point(p__3) = {-u__1*r/g,   u__1*r/g,        u__1*pz0, cl1};  // arc points
p__4 = newp;    Point(p__4) = {-u__1*r/g,   -u__1*r/g,        u__1*pz0, cl1};  // arc points
p__5 = newp;    Point(p__5) = {u__1*r/g,   -u__1*r/g,        u__1*pz0, cl1};  // arc points

 // central arcs using BSpline 
lc_1=newl;    BSpline(lc_1) = {p_2,p__2,p_3};  
lc_2=newl;    BSpline(lc_2) = {p_3,p__3,p_4}; 
lc_3=newl;    BSpline(lc_3) = {p_4,p__4,p_5}; 
lc_4=newl;    BSpline(lc_4) = {p_5,p__5,p_2}; 

 
// central arcs using Circles
//lc_1=newl;    Circle(lc_1) = {p_2,p_1,p_3}; 
//lc_2=newl;    Circle(lc_2) = {p_3,p_1,p_4};
//lc_3=newl;    Circle(lc_3) = {p_4,p_1,p_5};
//lc_4=newl;    Circle(lc_4) = {p_5,p_1,p_2};


//Central surface
ll_1 = newll; 
Line Loop(ll_1)  = {p_1,p_2,p_3,p_4};

s1=news;
Ruled Surface(s1) = {ll_1};



/*****************************************************************************/
// Outer geometry
// circumference generators
p_22 = newp;    Point(p_22) = {u__1*R2,   0,        u__1*pz0, cl1};  // arc points
p_23 = newp;    Point(p_23) = {0,         u__1*R2,  u__1*pz0, cl1};
p_24 = newp;    Point(p_24) = {-u__1*R2,  0,        u__1*pz0, cl1};
p_25 = newp;    Point(p_25) = {0,         -u__1*R2, u__1*pz0, cl1};


//arcs (a circle is made of 4 arcs)
lc_21=newl;    Circle(lc_21) = {p_22,p_1,p_23}; 
lc_22=newl;    Circle(lc_22) = {p_23,p_1,p_24};
lc_23=newl;    Circle(lc_23) = {p_24,p_1,p_25};
lc_24=newl;    Circle(lc_24) = {p_25,p_1,p_22};

// lines to make the quadrants
lr_1=newl;    Line(lr_1) = {p_2, p_22};
lr_2=newl;    Line(lr_2) = {p_3, p_23};
lr_3=newl;    Line(lr_3) = {p_4, p_24};
lr_4=newl;    Line(lr_4) = {p_5, p_25};


// 1st quadrant
ll_q1 = newll;
Line Loop(ll_q1) = {lr_1, lc_21, -lr_2, -lc_1};
sq_1=news;
Plane Surface(sq_1) = {ll_q1};



// 2nd  quadrant
ll_q2 = newll;
//Line Loop(ll_q2) = {lr_1, lc_21, -lr_2, -lc_1};
Line Loop(ll_q2) = {lr_2, lc_22, -lr_3, -lc_2};
sq_2=news;
Plane Surface(sq_2) = {ll_q2};
//



// 3th quadrant
ll_q3 = newll;
Line Loop(ll_q3) = {lr_3, lc_23, -lr_4, -lc_3};
sq_3=news;
Plane Surface(sq_3) = {ll_q3};
//



// 4th quadrant
ll_q4 = newll;
Line Loop(ll_q4) = {lr_4, lc_24, -lr_1, -lc_4};
sq_4=news;
Plane Surface(sq_4) = {ll_q4};
//




//        Refining         //
//////////////////////////////////////////////////////////////
// outer radial refining
Transfinite Line {lr_1,lr_2,lr_3,lr_4}  = outer_radial_points;
Transfinite Line {lc_24,-lc_4} = arcs_points;
Transfinite Line {lc_23,-lc_3} = arcs_points;
Transfinite Line {lc_22,-lc_2} = arcs_points;
Transfinite Line {lc_21,-lc_1} = arcs_points;
Transfinite Line{lc_1,lc_2,lc_3,lc_4} =  arcs_points;
////////////////////////////////////////////////////////////



/****************************************************************
****************************************************************/
// joining al the surfaces


/* Make a list of a ring (annulus) of surfaces */
allParts[] = {s1,sq_1,sq_2,sq_3,sq_4};
 

/* Make surfaces to be meshed by transfinite algorithm */
Transfinite Surface {allParts[]};
 
/* The "Recombine Surface" command is issued in order to
 * create quadrilateral elements. */
Recombine Surface {allParts[]};



/****************************************************************
****************************************************************/
// Extruding circle to do a cylinder
/* Extrude geometry and quadrilateral mesh in Z direction */
//
extrude_zdir[]=
Extrude{0,0,u__1*(height+pz0)} {
  Surface{allParts[]};
  Layers{no_z_cells};
  Recombine;};
  
  
num_volumes = 0;
num_surfs   = 0;
num_surfs_wall = 0;

    // 6 entries created by extrusion of a surface:
  //    [0] = created opposite surface
  //    [1] = created volume
  // [1..5] = created side surfaces
For i In {0:4}
    volumes[num_volumes]        = extrude_zdir[i*6+1]; num_volumes++;
    surfs[num_surfs]            = extrude_zdir[i*6];   num_surfs++;
    walls_surfs[num_surfs_wall] = extrude_zdir[i*6+2]; num_surfs_wall++;
    walls_surfs[num_surfs_wall] = extrude_zdir[i*6+3]; num_surfs_wall++;
    walls_surfs[num_surfs_wall] = extrude_zdir[i*6+4]; num_surfs_wall++;
    walls_surfs[num_surfs_wall] = extrude_zdir[i*6+5]; num_surfs_wall++;
EndFor


withDilate = 1;

If(withDilate==1)
  Dilate {{0, 0, u__1*(pz0)}, 1.2} { Surface{ surfs[] }; }
EndIf


// END of script
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ExtrudeDilateProblemWithMesh.png
Type: image/png
Size: 404152 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20160421/0fde25b0/attachment-0003.png>


More information about the gmsh mailing list