pdeModeler vs initmesh vs generateMesh

11 views (last 30 days)
Renato Fiorenza
Renato Fiorenza on 15 Jun 2021
Edited: Renato Fiorenza on 15 Jun 2021
My geometry is given by two (small) rectangles enclosed in a big rectangle.
When I draw the geometry in pdeModeler and initialize the mesh, I get a nice mesh, that is finer near the small rectangles and coarser near the outer edges.
When programming in a function,
[p,e,t] = initmesh(dl);
pdemesh(p,e,t);
gives a very similar result (but not perfectly identical: for example, look at the bottom right corner of the right rectangle).
However, I read on the MATLAB docs that this function is deprecated, so I programmed my PDE with the new workflow, and I used
geometryFromEdges(model, dl);
generateMesh(model, 'Hgrad', 1.3);
pdeplot(model);
In this case I get a very different mesh, where all the elements are more or less all similar to each other, which will be less computationally efficient.
What is the difference in the algorithm between the three methods? Why do they give different results? Where can I find out more about this?
--------
I am considering using the legacy initmesh method, but how can I give its output to PDEModel? I tried using geometryFromMesh but it gives me this error:
Elements matrix contain invalid number of nodes (rows) - the input element topology not supported.
--------
If initmesh is not compatible with PDEModel, I suppose I have to use the legacy assempde to solve my PDE. However, I can't seem to find any information in the documentation about how to build the boundary condition matrix b, and how to specify different coefficients in different regions.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!