Creating and solving a general 2D axisymmetric linear single scalar PDE with Dirichlet & Neumann BCs
16 views (last 30 days)
Show older comments
See attached.
Seeking Psi(r,z,t) & first derivative of Psi_z.
How would one set up this general PDE in MATLAB - I see options for structural, thermal & modal, but not clear how to set it up for a general PDE such as this.
Answers (5)
Suleyman Sahin
on 27 May 2022
How can I convert a method of characteristics calculation of a 2D Model to 2D axisymmetric model ?
1 Comment
Torsten
on 27 May 2022
Since the equations to solve are different, you'll have to write the code anew.
Filipe Soares
on 1 Mar 2024
Hello Joseph. Did you find a way to solve this?
I have exactly the same problem: trying to solve the Helmholtz equation in 2D-axisymmetric domain...
0 Comments
Carlo Silano
on 29 Apr 2024
Edited: Torsten
on 30 Apr 2024
Hello,
You made errors in creating the geometry. I haven't checked the rest of the code, I'm only responding to the geometry creation and the issue you reported.
At the link: https://it.mathworks.com/help/pde/ug/decsg.html (read 'Input Arguments'), you can find information on how to build the geometry. I'm attaching a sample code where I plot your geometry (I used a circular domain to represent the external environment, but it can also give you an idea of how to correctly write 'ns' and 'sf' when representing multiple geometric figures). I recommend reading the documentation and trying to modify various aspects of my code to understand.
Many of the things I've written are not necessary when defining the geometry (such as parameterization, etc.), but I believe they can be useful when building complex geometries and you want to reuse the code.
I hope I have been helpful. Have a good day.
% Link MATLAB page: https://it.mathworks.com/help/pde/ug/decsg.html
% Read Input Arguments
close all
clear
clc
% ---------------------------PARAMETRIZATION-------------------------------
height = 10; % meter
ra = 0.90; z1 = 0;
rb = 0.95; z2 = height;
% (1) Name; (2) R [m] centroid/center of gravity;
% (3) Z[m] centroid; (4)deltaR [m]; (5) deltaZ [m];
A={
'R1' 0 0 (rb-ra) (z2-z1)
};
R=vertcat(A{:,2});
Z=vertcat(A{:,3});
deltaR=vertcat(A{:,4});
deltaZ=vertcat(A{:,5});
% Create a circular domain containing your geometry. It will represent the
% surrounding environment
% (1) circle's name (2) Xcenter, (3) Ycenter
% (4) radius
C={
'C1' 0.0 0.0 25
};
% Create vectors containing only certain columns of C (circle coordinates)
Xc=vertcat(C{:,2});
Yc=vertcat(C{:,3});
Rc=vertcat(C{:,4});
% -----------------------GEOMETRY DEFINITION-------------------------------
% For a circle, the first row contains 1. The second and third rows contain
% the x- and y-coordinates of the center. The fourth row contains the radius
% of the circle. The radius must be a positive value
% For a rectangle, the first row contains 3, and the second row contains 4.
% The next four rows contain the x-coordinates of the starting points of the
% edges, and the four rows after that contain the y-coordinates of the starting
% points of the edges.
% Geometry description
gd = [1,Xc(1),Yc(1),Rc(1),0,0,0,0,0,0;...
3,4,R(1)-deltaR(1)/2,R(1)+deltaR(1)/2,R(1)+deltaR(1)/2,R(1)-deltaR(1)/2,...
Z(1)-deltaZ(1)/2,Z(1)-deltaZ(1)/2,Z(1)+deltaZ(1)/2,Z(1)+deltaZ(1)/2;]';
% name-space matrix
ns = char('C1','R1')';
% SET FORMULA
sf = 'C1+R1';
% Create a geometry and remove boundary conditions on the faces
geom = decsg(gd,sf,ns);
% Set number of equations
neqs = 1;
% Create a "model container"
model = createpde(neqs);
% geometryFromEdges for 2-D
geometryFromEdges(model,geom);
% -------------------------------PLOT--------------------------------------
% Edge plot
figure
pdegplot(geom,EdgeLabels="on")
xlim([-2 2])
ylim([-6 6])
title('Edge')
% Vertex plot
figure
pdegplot(geom,VertexLabels="on")
xlim([-2 2])
ylim([-6 6])
title('Vertex')
% Domain plot
figure
pdegplot(geom,FaceLabels="on")
xlim([-2 2])
ylim([-6 6])
title('Domain')
0 Comments
See Also
Categories
Find more on Boundary Conditions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

