# Locally refining mesh over cylinder in Gmsh

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 3, 2020, 23:34 Locally refining mesh over cylinder in Gmsh #1 New Member   Deepak Join Date: Nov 2020 Posts: 2 Rep Power: 0 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)?

 November 5, 2020, 13:55 #2 Senior Member   Mikko Join Date: Jul 2014 Location: The Hague, The Netherlands Posts: 243 Rep Power: 12 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;

 November 6, 2020, 01:02 #3 New Member   Deepak Join Date: Nov 2020 Posts: 2 Rep Power: 0 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?

 November 6, 2020, 01:40 #4 Senior Member   Mikko Join Date: Jul 2014 Location: The Hague, The Netherlands Posts: 243 Rep Power: 12 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.

 Tags gmsh 4.5.4, mesh 2d, refine mesh