geometryFromMesh loses some features

13 views (last 30 days)
Chengyuan Qian
Chengyuan Qian on 1 Apr 2020
Hi all,
I was trying to make some meshes which has different sizes in x, y and z dimensions when solving a partial differential equation using pde toolbox. The way I thought about is to create such a inhomogeneous mesh first and use 'geometryFromMesh' function to generate a geometry for a pde model. Therefore, I tested the function first and it turns out that even when I gave 'geometryFromMesh' the matlab generated mesh from a certain geometry to regenerated the geometry itself again, it lost some features which prevented me from setting correct boundary conditions. I tried making the mesh finer but nothing changes in the output of 'geometryFromMesh'. My code is as the following,
model = createpde();
importGeometry(model,<my stl file>);
m = generateMesh(model,'Hmax',0.05,'Hmin',0.001);
model1 = createpde();
g1 = model.Geometry
g2 = geometryFromMesh(model1,m.Nodes,m.Elements)
pdemesh(model)
pdegplot(model)
pdegplot(model1)
The results are shown below,
g1 =
DiscreteGeometry with properties:
NumCells: 1
NumFaces: 130
NumEdges: 368
NumVertices: 240
g2 =
DiscreteGeometry with properties:
NumCells: 1
NumFaces: 106
NumEdges: 312
NumVertices: 208
In the last figure, it is obvious that the second geometry 'g2' loses an edge and two faces are treated as one when I set the boundary condition. In the first figure, one may find out that the wall it vert thin and there Is only 1 layer of mesh. But at least this is not all the reasons because I have other similar features and they are regenerated correctly. Also my PC really cannot generate a mesh with maximum element size smaller than the wall thickness.
I was wondering if there is a way to avoid losing those feature when using 'geometryFromMesh' or there are some brilliant way to achieve my original task which is to using an mesh which has different sizes in different direction in pde solving. I will much appreciate it if you can give me some help on solving this problem!
Best,
Chengyuan

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!