Create ring mesh with specified size

4 views (last 30 days)
Lawson Bailey
Lawson Bailey on 11 Aug 2022
Answered: William Rose on 11 Aug 2022
I need to create a ring mesh to model something. The problem I have is that the book I am following the instructions from says "If Δr and rΔθ are the radial and angular mesh increments,". I am slightly confused how rΔθ is the angular mesh increment and not just Δθ? Later in the text it says " and choosing a mesh such that Δr = rΔθ ,". I need help in understanding what values to make the mesh rather than how to set the mesh in matlab. My code only creates a section of the mesh which is repeated for the full ring. Due to the rΔθ I am unsure if I am getting the ring mesh correct? I have a feeling that something is wrong in the way I am setting the mesh becuase later on the model drastically changes depending on how many increments are used which should not happen so I feel the way I am using " and choosing a mesh such that Δr = rΔθ ," is wrong. I'll add my code regardless,
or = 50; %outside radius
pcr = 30;
ir = 10; %inside radius
orifices = 8;
theta = pi/(2*orifices);
increments = 7;
dt = theta/increments;
dr = dt*or;
theta1 = (0:(dt):theta);
r1 = (ir:dr:or);
r1 = transpose(r1);
z = zeros(height(r1),width(theta1));
[x,y,z] = pol2cart(theta1,r1,z);
surf(x,y,z)
So pretty much how do I set the mesh such that Δr = rΔθ? I know that it is in MATLAB but should I be using the following instead?
theta1 = (0:(dt*or):theta);

Answers (1)

William Rose
William Rose on 11 Aug 2022
Here is a ring-shaped mesh. Just for the heck of it, I have assigned a z-height as follows:
where hw=(ro-ri)/2=half-width of the mesh in the radial direction, and is the midpoint in the radial direction. So the 3D surface should be the top half of a torus.
ir=10; or=50; orifices=8; increments=7;
dt=2*pi/(orifices*increments);
dr=10/3;
theta=0:dt:2*pi;
r=ir:dr:or;
[R,Theta]=meshgrid(r,theta);
hw=(or-ir)/2;
rmid=(or+ir)/2;
Z=sqrt(hw.^2-(R-rmid).^2);
[X,Y,Z]=pol2cart(Theta,R,Z);
surf(X,Y,Z)
axis equal
In the code above, I chose dr=10/3 because it produces dr=r*dt in the middle of the grid (approximately). The grid is rectangular one way at the inside edge and rectangular the other way ot the outside edge. Try the above and tweak as needed.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!