CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Mesh Generation & Pre-Processing (https://www.cfd-online.com/Forums/mesh-generation/)
-   -   Locally refining mesh over cylinder in Gmsh (https://www.cfd-online.com/Forums/mesh-generation/231384-locally-refining-mesh-over-cylinder-gmsh.html)

dgmadival November 3, 2020 23:34

Locally refining mesh over cylinder in Gmsh
 
I want to mesh a cylinder in Gmsh with a finer mesh at a particular circular location along its height. I have succeeded partially with the code below:

--------------------------------------------------------------------------------
SetFactory("OpenCASCADE");

//Create a circle
Circle(1) = {0, 0, 6, 1, 0, 2*Pi};
Curve Loop(1) = {1};
Plane Surface(1) = {1};

//Extrude into a cylinder 4 units along Z-direction and 6 units along -Z direction
Extrude {0, 0, 4} {
Surface{1};
}

Extrude {0, 0, -6} {
Surface{1};
}

//Convert Circle 1 into transfinite line so that a fine mesh can be obtained in its vicinity
Transfinite Line{1}=100;

--------------------------------------------------------------------------------------

The mesh is coming out fine (when I do a 2D or 3D mesh) except at the location where the generator of the extruded cylinder intersects the circle (here the mesh is coarse). Any ideas on how to overcome the problem and obtain a uniformly fine mesh at Circle(1)?

Flowkersma November 5, 2020 13:55

At the moment, you are only defining the cell size along the line. You should also define the cell size elsewhere. For instance, define the cell sizes at the points:
Characteristic Length {1} = 0.1;
Characteristic Length {2, 3} = 1;

dgmadival November 6, 2020 01:02

Your solution worked :) Thanks a lot.

But what do points 1,2,3 correspond to? Are they the three points at which cylinder's generator-line intersects the three circles?

Flowkersma November 6, 2020 01:40

You are welcome. If you visually look at the geometry, it contains only 3 points. The points are the start/end points of each circle.


All times are GMT -4. The time now is 04:57.