Customize 2D mesh creation using the PDE modeler toolbox
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a 2D rectangular geometry and I would like to create a mesh using generateMesh() in such a way that the triangles have a fixed both dimensions fixed, one of the two being the width of the rectangole. The idea is to replicate a very coarse rectangular mesh using triangles, so that every rectangole would be ideally split in two triangles (with a 90 degrees angle). Everything would be much easier if it was possible to use a rectangular mesh, but apparently the pde modeler toolbox doesn't allow for it.
To give context, I am trying to solve a heat conduction problem between two different materials in a cilyndrical geometry. However, to speed up calculations, I am using a weakly coupled scheme for which a transient analysis is performed on one material and a steady state analysis is performed on the other and the two models exchange boundary conditions at the common boundary every timestep. In one region the mesh is refined, but in the other I want it to be coarse, however the two must be consistent on the boundary edge in order to exchage correctly the boundary conditions.
Does anyone know how to generate the coarse mesh as I need it to be using generateMesh()?
0 comentarios
Respuestas (1)
Avni Agrawal
el 21 de Dic. de 2023
Hi pierluigi,
I understand that you want to density of states. In PDE Toolbox, `generateMesh` automatically creates a triangular mesh for a given geometry. While you don't have direct control over the exact shape of the triangles, you can influence the mesh generation process using several options provided by the function.
For your specific need to create a coarse mesh where each rectangle is ideally split into two triangles, you can use the `Hmax` property of the `generateMesh` function to specify the maximum element size. By setting `Hmax` to be approximately equal to the width of the rectangles, you can encourage the mesh generator to use fewer, larger triangles.
Here is the code how to generate a coarse mesh with the desired properties:
% Create a PDE model
model = createpde();
% Define the geometry of the rectangle
% For example, a rectangle that goes from (0,0) to (L,W)
L = 10; % Length of the rectangle
W = 2; % Width of the rectangle (also the desired triangle width)
g = [3,4,0,L,L,0,0,0,W,W]'; % [3,4,x1,x2,x3,x4,y1,y2,y3,y4]'
% Add the geometry to the PDE model
geometryFromEdges(model, decsg(g));
% Generate the mesh with Hmax set to the width of the rectangle
mesh = generateMesh(model, 'Hmax', W);
% Plot the mesh
pdeplot(model);
axis equal;
If you need to ensure that the mesh aligns perfectly with the boundaries between different materials, you might need to create a composite geometry that includes both materials and ensure that the mesh respects the interface between them. You can do this by creating the geometry for each material separately and then combining them using set operations (union, intersection, etc.) provided by the `decsg` function.
Please refer to the following documentation page for more information on the ‘generateMesh’ function: https://www.mathworks.com/help/pde/ug/generate-mesh.html
I hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Geometry and Mesh en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!