MATLAB Answers


structured quadrilateral mesh in PDE Toolbox

Asked by Natalia
on 5 Jun 2014
Latest activity Commented on by Alejandro Arrizabalaga on 29 Nov 2017
Hello, I would like to ask if in the PDE Toolbox it is possible to generate a structured quadrilateral mesh instead of the triangular one? If so how can it be implemented in the code? My geometry is simply a rectangular of dimensions 3cm x 0.1mm and the mesh I would like to create is 0.5mm x 0.005mm. Here is a part of my code:
% Geometry description:
pderect([0 0.03 0.0001 0],'R1');
% Mesh generation:
Thank you very much in advance, N


Although an old question, as it seems to resurface again and again, for future reference the FEA Toolbox does support structured meshes with quadrilateral and hexahedral finite elements. They can either be generated with the built-in quadmesh function, generated manually through a set of grid primitives, or imported from an external mesh generator.
Yes, but the FEA Toolbox requires an additional license.

Sign in to comment.

1 Answer

Answer by Bill Greene on 5 Jun 2014
 Accepted Answer

There is no support for quadrilateral elements in PDE Toolbox-- either in the meshers or the computational modules. However, if you have a rectangular geometry, you can generate a regular triangular mesh using the poimesh function. This option isn't available in the pdetool GUI so you would need to define your problem using the command line interface.


Thank you Bill! Could you tell me how should I define the mesh? I tried to substitute pdetool('initmesh') with pdetool('poimesh') but this gives me en error message.
I guess the best option would be to define the mesh in an external .m script and read it with the main code.
In one of the examples for pdetool I saw that to create the regular mesh one can write [p,e,t]=poimesh(g,10); pdemesh(p,e,t);
How can I implement it into my code?
Thank you again.
I don't know of any way to use the poimesh function with the pdetool GUI.
The only way I know to use poimesh is by defining your entire analysis as a MATLAB script using the command line functions that are part of PDE Toolbox. All of the examples on this page:
take that approach.
In this example the geometry is a square but you can easily make that a rectangle. That example creates the mesh with this function call:
[p, e, t] = initmesh(g, 'Hmax', hmax);
but you could replace that with
[p, e, t] = poimesh(g, 20);
PS: You didn't say why you needed a regular grid but if, for example, it is so you can get the results defined on a rectangular grid, you can perform the analysis with the unstructured mesh and then call the tri2grid function to interpolate those results to a grid.
Thank you again for all the help Bill. The reason for defining a regular grid was to obtain the results already on such grid without using the unstructured grid and doing the transformation later.
In any case for one rectangle I defined it as:
width = 0.3; height = 0.0001;
gdmTrans = [3 4 0 width width 0 0 0 height height];
g = decsg(gdmTrans', 'S1', ('S1')');
figure; pdemesh(p,e,t);
I have another question though, if I want to have a structure composed of two rectangles, one on top of another with the coordinates [0 width width 0 height height 2*height 2*height], what would be the best way to define the grid for such system as a whole?
Many thanks, Natalia

Sign in to comment.