[Gmsh] Problem making a bulged cylinder using Gmsh

Geordie McBain gdmcbain at freeshell.org
Tue Jan 17 23:00:28 CET 2012


2012/1/18 Rahul <rahulsn at iitk.ac.in>:
> Hello Geordie,
>  Thank you for quick reply and your comments. I am actually new to to Gmsh
> and don't know much of it's functions yet. I have drawn some simple
> geometries using Gmsh and meshed them successfully. But i want to draw a
> spline driven by an equation(such as y=sin(x)) and i was wondering
> whether is it possible to draw this equation driven curve in Gmsh.

It is.  Here's a quick example; see if this gets you going.

%<---sine.geo---
x1 = 0;
x2 = Pi;
n = 9;
y0 = 1;

Point (1) = {0, y0, 0};
For i In {1:n}
  x = x1 + (x2 - x1) * i/n;
  Point (i+1) = {x, y0 + Sin (x), 0};
EndFor

// above was typed, below was generated via GUI

Spline(1) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
Extrude {{1, 0, 0}, {0, 0, 0}, Pi/2} {
  Line{1};
}
Extrude {{1, 0, 0}, {0, 0, 0}, Pi/2} {
  Line{2};
}
Extrude {{1, 0, 0}, {0, 0, 0}, Pi/2} {
  Line{6};
}
Extrude {{1, 0, 0}, {0, 0, 0}, Pi/2} {
  Line{10};
}
Line Loop(18) = {4, 8, 12, 16};
Plane Surface(19) = {18};
Line Loop(20) = {3, 7, 11, 15};
Plane Surface(21) = {20};
Physical Surface(22) = {19};
Physical Surface(23) = {21};
Physical Surface(24) = {5, 17, 9, 13};
--->%
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sine.geo
Type: application/octet-stream
Size: 664 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20120118/4bb15474/attachment.geo>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sine.png
Type: image/png
Size: 45782 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20120118/4bb15474/attachment.png>