How can I Identify Boundary Labels when writing a PDE code (not with the pdetool)?

3 views (last 30 days)
I want to solve the Laplace equation using MATLAB, without using the PDE app. I first created a geometry which includes several rectangles, depending on user choise. Now I need to identify the labels of each boundary to determine the boundary conditions (applyBoundaryCondition). Is there another way besides manually plotting the geometry (pdegplot(model,'EdgeLabels','on')), to know the labels of each boundary? Some automatic code that will determine which boundary is which?
Thanks in advance
  1 Comment
d
d on 8 Mar 2017
Following this question, is there a possibility to define different boundary conditions for the same edge?
For example:
I created a 2D rectangle with corner-coordinates as follows:
(0,0),(0,a),(a,b),(a,0).
Now, on one edge [between (0,0)->(0,a)] I need different boundary conditions in different places. (0,0)->(0,a/3): Neumann boundary condition (Insulated du/dx=0) (0,0)->(a/3,2a/3): Dirichlet boundary condition (u=0) (0,0)->(2a/3,a): Neumann boundary condition (Insulated du/dx=0)
Is there a way to write this boundary all together? or I must divide my geometry to three rectangles and define them separately?

Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 8 Mar 2017
Check out how to create geometry using a geometry function. You have complete control over the geometry labels.
And to have different boundary conditions on the same edge, yes, you must divide the edge by placing edges that divide it into sections. You could fake this by having a condition that depends on the location, but that would not be as exact, as things could go one way or another near the dividing point depending on the mesh.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  3 Comments
Alan Weiss
Alan Weiss on 8 Mar 2017
Yes, you need to place new edges in the geometry function, which divide the real edges where you like. You can ignore the new edges in your coefficient functions, but be aware that the mesh will respect the new edges as real.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!