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] Meshing a circle in a square (https://www.cfd-online.com/Forums/openfoam-meshing/178536-meshing-circle-square.html)

ChasingNeutrons October 10, 2016 19:18

Meshing a circle in a square
 
Hi,

I'm attempting to make a mesh of a circle split into two radial block regions and four angular block regions. This circle is nested inside a square of eight angular block regions. This is actually for a neutronic solver - it's meant to represent a fuel pin in a nuclear reactor.

I'm having trouble getting it to mesh - I'm sure there are at least a few errors but currently struggling to identify the cause of:
HTML Code:

Invalid arc definition - are the points co-linear?  Denom =0
If anyone can spot where the error is and generally critique it would be much appreciated!

Code:

vertices
(
 //Rectangular points
  (0  0  0)          //0
  (0.5 0 0)    //1
  (0.5 0.35 0)    //2
  (0.252513 0.252513 0) //3   
 
  //Second moderator zone    //bottom right mod zone
  (1 0 0)    //4
  (0.747487 0.252513 0)    //5
 
  //Third moderator zone    //clockwise from first
  (0.15 0.5 0)    //6
  (0 0.5 0)    //7
 
  //Fourth zone
  (1 0.5 0)    //8
  (0.85 0.5 0)    //9
 
  //Fifth zone
  (0.252513 0.747487 0)    //10
  (0 1 0)        //11
 
  //Sixth zone
  (1 1 0)        //12
  (0.747487 0.747487 0)    //13
 
  //Seventh zone //eighth defined already
  (0.5 0.85 0)        //14
  (0.5 1 0)        //15
 
  //Clad bottom
  (0.287868 0.28787868 0)    //16
  (0.712132 0.28787868 0)    //17
 
  //Clad left
  (0.287868 0.712132034 0)    //18
  //Clad right
  (0.712132 0.712132 0)        //19
 
  //Centre
  (0.5 0.5 0)            //20
 
  //Top layer
  //Rectangular points
  (0  0  0.1)          //21
  (0.5 0 0.1)        //22
  (0.5 0.35 0.1)    //23
  (0.252513 0.252513 0.1) //24   
 
  //Second moderator zone    //bottom right mod zone
  (1 0 0.1)            //25
  (0.747487 0.252513 0.1)    //26
 
  //Third moderator zone    //clockwise from first
  (0.15 0.5 0.1)    //27
  (0 0.5 0.1)        //28
 
  //Fourth zone
  (1 0.5 0.1)        //29
  (0.85 0.5 0.1)    //30
 
  //Fifth zone
  (0.252513 0.747487 0.1)    //31
  (0 1 0.1)            //32
 
  //Sixth zone
  (1 1 0.1)            //33
  (9.747487 0.747487 0.1)    //34
 
  //Seventh zone //eighth defined already
  (0.5 0.85 0.1)        //35
  (0.5 1 0.1)            //36
 
  //Clad bottom
  (0.287868 0.28787868 0.1)    //37
  (0.712132 0.28787868 0.1)    //38
 
  //Clad left
  (0.287868 0.712132034 0.1)    //39
  //Clad right
  (0.712132 0.712132 0.1)    //40
 
  //Centre
  (0.5 0.5 0.1)            //41
 
);

edges
(
    arc 2 3 (0.5 0.5 0)
    arc 5 2 (0.5 0.5 0)
    arc 3 6 (0.5 0.5 0)
    arc 9 6 (0.5 0.5 0)
    arc 10 5 (0.5 0.5 0)
    arc 13 9 (0.5 0.5 0)
    arc 14 10 (0.5 0.5 0)
    arc 13 14 (0.5 0.5 0)
    arc 16 17 (0.5 0.5 0)
    arc 16 18 (0.5 0.5 0)
    arc 18 19 (0.5 0.5 0)
    arc 17 19 (0.5 0.5 0)
   
    arc 23 24 (0.5 0.5 0.1)
    arc 26 23 (0.5 0.5 0.1)
    arc 24 27 (0.5 0.5 0.1)
    arc 30 27 (0.5 0.5 0.1)
    arc 31 24 (0.5 0.5 0.1)
    arc 34 30 (0.5 0.5 0.1)
    arc 35 31 (0.5 0.5 0.1)
    arc 34 35 (0.5 0.5 0.1)
    arc 37 38 (0.5 0.5 0.1)
    arc 37 39 (0.5 0.5 0.1)
    arc 39 40 (0.5 0.5 0.1)
    arc 38 40 (0.5 0.5 0.1)
   
    arc 3 5 (0.5 0.5 0)
    arc 3 9 (0.5 0.5 0)
    arc 5 13 (0.5 0.5 0)
    arc 9 13 (0.5 0.5 0)
   
    arc 24 26 (0.5 0.5 0.1)
    arc 24 30 (0.5 0.5 0.1)
    arc 26 35 (0.5 0.5 0.1)
    arc 30 35 (0.5 0.5 0.1)
);

blocks
(


    hex (0 1 2 3 21 22 23 24) moderator (1 1 1) simpleGrading (1 1 1)
    hex (1 4 5 2 22 25 26 23) moderator (1 1 1) simpleGrading (1 1 1)
    hex (0 3 6 7 21 24 27 28) moderator (1 1 1) simpleGrading (1 1 1)
    hex (4 8 9 5 25 29 30 26) moderator (1 1 1) simpleGrading (1 1 1)
    hex (6 10 11 7 27 31 32 28 ) moderator (1 1 1) simpleGrading (1 1 1)
    hex (8 12 13 9 29 30 33 34) moderator (1 1 1) simpleGrading (1 1 1)
    hex (10 14 15 11 31 35 36 32) moderator (1 1 1) simpleGrading (1 1 1)
    hex (14 13 12 15 35 34 33 36) moderator (1 1 1) simpleGrading (1 1 1)
    hex (3 5 17 16 24 26 38 37) clad (1 1 1) simpleGrading (1 1 1)
    hex (3 16 18 10 24 37 39 31) clad (1 1 1) simpleGrading (1 1 1)
    hex (18 19 13 10 39 40 34 31) clad (1 1 1) simpleGrading (1 1 1)
    hex (5 13 19 16 26 34 40 37) clad (1 1 1) simpleGrading (1 1 1)
    hex (16 17 20 16 37 38 41 37) fuel (1 1 1) simpleGrading (1 1 1)
    hex (16 20 18 16 37 41 39 37) fuel (1 1 1) simpleGrading (1 1 1)
    hex (17 19 20 17 38 40 41 38) fuel (1 1 1) simpleGrading (1 1 1)
    hex (20 19 18 20 41 40 39 41) fuel (1 1 1) simpleGrading (1 1 1)
);

boundary
(   
    LeftWall
    {
        type wall;
        faces
        (
        (0 21 28 7)
        (7 28 32 11)
        );
    }

    RightWall
    {
    type wall;
    faces
    (
        (8 29 25 4)
        (4 25 33 12)
    );
      }
     
      TopWall
      {
    type wall;
    faces
    (
        (11 32 36 15)
        (15 36 33 12)
    );
      }
     
      BottomWall
      {
    type wall;
    faces
    (
        (1 22 21 0)
        (4 25 22 1)
    );
    }
);


mergePatchPairs
(
);


Antimony October 10, 2016 19:49

Hi,

Do you have a simple schematic or a diagram of your geometry? That would greatly help in trying to understand your vertices, arcs and block definitions.

Cheers,
Antimony

ChasingNeutrons October 11, 2016 06:16

1 Attachment(s)
Hi Antimony,

Thanks very much for the response. Here's a picture of what I'm looking for with each region intended to be a different block consisting of one mesh cell - ignore the red line cutting across! I fear blockMesh may not be an efficient way to make these but it's a start.

Cheers!

Antimony October 11, 2016 10:04

Hi,

Your problem comes from your vertices 9 and 6 both of which have a y-value of 0.5 & the interpolation point, which also has a y-value of 0.5 as a result of which the three points are co-linear.

Hope this helps.

Cheers,
Antimony

ChasingNeutrons October 11, 2016 11:27

1 Attachment(s)
Problem solved! Thanks Antimony - there were plenty more but all a bit less opaque.
On a follow up note, after meshing the geometry it's not quite what I expected, likely due to using only one mesh cell per block. Instead of something a bit more curvaceous, the attached image appears which isn't quite what I'm hoping for.

Do you know how I might instead wind up with curved mesh cells as in the image above?

Thanks again.

EDIT: I think the problem is due to requiring some intermediate points along the curved lines - tried to cheat that by skipping the midpoints. Still investigating though!

ChasingNeutrons October 11, 2016 12:49

Alas, no luck, I just can't get the edges to curve in spite of using the arc command. Any help would be much appreciated!
Code:

vertices
(
    //Radius is 0.3
    //Clad thickness is 0.05
 //Rectangular points
  (0  0  0)          //0
  (0.5 0 0)    //1
  (0.5 0.15 0)    //2
  (0.252513 0.252513 0) //3   
 
  //Second moderator zone    //bottom right mod zone
  (1 0 0)    //4
  (0.747487 0.252513 0)    //5
 
  //Third moderator zone    //clockwise from first
  (0.15 0.5 0)    //6
  (0 0.5 0)    //7
 
  //Fourth zone
  (1 0.5 0)    //8
  (0.85 0.5 0)    //9
 
  //Fifth zone
  (0.252513 0.747487 0)    //10
  (0 1 0)        //11
 
  //Sixth zone
  (1 1 0)        //12
  (0.747487 0.747487 0)    //13
 
  //Seventh zone //eighth defined already
  (0.5 0.85 0)        //14
  (0.5 1 0)        //15
 
  //Clad bottom
  (0.287868 0.28787868 0)    //16
  (0.712132 0.28787868 0)    //17
 
  //Clad left
  (0.287868 0.712132034 0)    //18
  //Clad right
  (0.712132 0.712132 0)        //19
 
  //Centre
  (0.5 0.5 0)            //20
 
  //Top layer
  //Rectangular points
  (0  0  0.1)          //21
  (0.5 0 0.1)        //22
  (0.5 0.15 0.1)    //23
  (0.252513 0.252513 0.1) //24   
 
  //Second moderator zone    //bottom right mod zone
  (1 0 0.1)            //25
  (0.747487 0.252513 0.1)    //26
 
  //Third moderator zone    //clockwise from first
  (0.15 0.5 0.1)    //27
  (0 0.5 0.1)        //28
 
  //Fourth zone
  (1 0.5 0.1)        //29
  (0.85 0.5 0.1)    //30
 
  //Fifth zone
  (0.252513 0.747487 0.1)    //31
  (0 1 0.1)            //32
 
  //Sixth zone
  (1 1 0.1)            //33
  (0.747487 0.747487 0.1)    //34
 
  //Seventh zone //eighth defined already
  (0.5 0.85 0.1)        //35
  (0.5 1 0.1)            //36
 
  //Clad bottom
  (0.287868 0.28787868 0.1)    //37
  (0.712132 0.28787868 0.1)    //38
 
  //Clad left
  (0.287868 0.712132034 0.1)    //39
  //Clad right
  (0.712132 0.712132 0.1)    //40
 
  //Centre
  (0.5 0.5 0.1)            //41


  //Additional points to curve
  (0.5 0.2 0)
  (0.2 0.5 0)
  (0.8 0.5 0)
  (0.5 0.8 0)

  (0.5 0.2 0.1)
  (0.2 0.5 0.1)
  (0.8 0.5 0.1)
  (0.5 0.8 0.1)
 
);

edges
(
    arc 2 3 (0.5 0.5 0)
    arc 5 2 (0.5 0.5 0)
    arc 3 6 (0.5 0.5 0)
    arc 10 6 (0.5 0.5 0)
    arc 9 5 (0.5 0.5 0)
    arc 13 9 (0.5 0.5 0)
    arc 14 10 (0.5 0.5 0)
    arc 13 14 (0.5 0.5 0)
    arc 16 17 (0.5 0.5 0)
    arc 16 18 (0.5 0.5 0)
    arc 18 19 (0.5 0.5 0)
    arc 17 19 (0.5 0.5 0)

    arc 42 16 (0.5 0.5 0)
    arc 42 17 (0.5 0.5 0)
    arc 43 16 (0.5 0.5 0)
    arc 43 18 (0.5 0.5 0)
    arc 45 18 (0.5 0.5 0)
    arc 45 19 (0.5 0.5 0)
    arc 44 19 (0.5 0.5 0)
    arc 44 17 (0.5 0.5 0)   

    arc 46 37 (0.5 0.5 0)
    arc 46 38 (0.5 0.5 0)
    arc 47 37 (0.5 0.5 0)
    arc 47 39 (0.5 0.5 0)
    arc 49 39 (0.5 0.5 0)
    arc 49 40 (0.5 0.5 0)
    arc 48 40 (0.5 0.5 0)
    arc 48 38 (0.5 0.5 0)   
   
    arc 23 24 (0.5 0.5 0.1)
    arc 26 23 (0.5 0.5 0.1)
    arc 24 27 (0.5 0.5 0.1)
    arc 31 27 (0.5 0.5 0.1)
    arc 30 24 (0.5 0.5 0.1)
    arc 34 30 (0.5 0.5 0.1)
    arc 35 31 (0.5 0.5 0.1)
    arc 34 35 (0.5 0.5 0.1)
    arc 37 38 (0.5 0.5 0.1)
    arc 37 39 (0.5 0.5 0.1)
    arc 39 40 (0.5 0.5 0.1)
    arc 38 40 (0.5 0.5 0.1)
   
    /*
    arc 3 5 (0.5 0.5 0)
    arc 3 10 (0.5 0.5 0)
    arc 5 13 (0.5 0.5 0)
    arc 10 13 (0.5 0.5 0)
   
    arc 24 26 (0.5 0.5 0.1)
    arc 24 31 (0.5 0.5 0.1)
    arc 26 34 (0.5 0.5 0.1)
    arc 31 34 (0.5 0.5 0.1)
    */
);

blocks
(


    hex (0 1 2 3 21 22 23 24) moderator (1 1 1) simpleGrading (1 1 1)
    hex (1 4 5 2 22 25 26 23) moderator (1 1 1) simpleGrading (1 1 1)
    hex (0 3 6 7 21 24 27 28) moderator (1 1 1) simpleGrading (1 1 1)
    hex (4 8 9 5 25 29 30 26) moderator (1 1 1) simpleGrading (1 1 1)
    hex (6 10 11 7 27 31 32 28 ) moderator (1 1 1) simpleGrading (1 1 1)
    hex (8 12 13 9 29 33 34 30) moderator (1 1 1) simpleGrading (1 1 1)
    hex (10 14 15 11 31 35 36 32) moderator (1 1 1) simpleGrading (1 1 1)
    hex (14 13 12 15 35 34 33 36) moderator (1 1 1) simpleGrading (1 1 1)
    hex (3 2 42 16 24 23 46 37) clad (1 1 1) simpleGrading (1 1 1)
    hex (2 5 17 42 23 26 38 46) clad (1 1 1) simpleGrading (1 1 1)
    hex (3 16 43 6 24 37 47 27) clad (1 1 1) simpleGrading (1 1 1)
    hex (6 43 18 10 27 47 39 31) clad (1 1 1) simpleGrading (1 1 1)
    hex (18 45 14 10 39 49 35 31) clad (1 1 1) simpleGrading (1 1 1)
    hex (45 19 13 14 49 40 34 35) clad (1 1 1) simpleGrading (1 1 1)
    hex (19 44 9 13 40 48 30 34) clad (1 1 1) simpleGrading (1 1 1)
    hex (5 9 44 17 26 30 48 38) clad (1 1 1) simpleGrading (1 1 1)
    hex (16 42 20 16 37 46 41 37) fuel (1 1 1) simpleGrading (1 1 1)
    hex (17 20 42 17 38 41 46 38) fuel (1 1 1) simpleGrading (1 1 1)
    hex (16 20 43 16 37 41 47 37) fuel (1 1 1) simpleGrading (1 1 1)
    hex (20 19 45 20 41 40 49 41) fuel (1 1 1) simpleGrading (1 1 1)
    hex (17 44 20 17 38 48 41 38) fuel (1 1 1) simpleGrading (1 1 1)
    hex (44 19 20 44 48 40 41 48) fuel (1 1 1) simpleGrading (1 1 1)
    hex (20 45 18 20 41 49 39 41) fuel (1 1 1) simpleGrading (1 1 1)
    hex (20 18 43 20 41 39 47 41) fuel (1 1 1) simpleGrading (1 1 1)
);

boundary
(   
    LeftWall
    {
        type wall;
        faces
        (
        (0 21 28 7)
        (7 28 32 11)
        );
    }

    RightWall
    {
    type wall;
    faces
    (
        (8 29 25 4)
        (12 33 29 8)
    );
      }
     
      TopWall
      {
    type wall;
    faces
    (
        (11 32 36 15)
        (15 36 33 12)
    );
      }
     
      BottomWall
      {
    type wall;
    faces
    (
        (1 22 21 0)
        (4 25 22 1)
    );
    }
);


mergePatchPairs
(
);


Antimony October 11, 2016 20:42

Hi,

Increase the number of divisions/cells along the edges that need to be an arc. If you think about it, one cell is never really going to create a proper arc. So instead of a single cell, try ten cells (as a start). The edge will look more like an arc.

So instead of: hex (0 1 2 3 21 22 23 24) (1 1 1)
Try: hex (0 1 2 3 21 22 23 24) (10 10 1)

Cheers,
Antimony


All times are GMT -4. The time now is 03:02.