refine mesh in PDEModel

12 views (last 30 days)
d
d on 25 Aug 2015
Answered: Ian Jentz on 2 Oct 2020
Hello, I'm trying to solve a laplace equation using PDEModel. I created the mesh object like this:
model=createpde;
msh=generateMesh(model,'Hmax',l/20);
But it looks like it is not good enough (there are no nodes in the bulk). Is there a way to refine the mesh in the PDEModel?
I also tried to refine it like this:
[p,e,t] = meshToPet(msh);
[p,e,t] = refinemesh(dl,p,e,t);
But I dont know how to convert the [p,e,t]-mesh into FEMesh and insert it to the PDEModel object. Is there an opposite function to the meshToPet maybe?
I attached to pictures of the mesh using "generateMesh" command and mesh using "refinemesh" command and

Accepted Answer

Alan Weiss
Alan Weiss on 27 Aug 2015
You cannot refine a mesh using a PDEModel. You have to import the geometry (I assume that you did that before trying to create a mesh) and then call generateMesh using an appropriate value of Hmax. If you need more nodes, just call generateMesh again using a smaller value of Hmax.
Alan Weiss
MATLAB mathematical toolbox documentation
  9 Comments
shixiang zhao
shixiang zhao on 10 Feb 2017
Hello, I am thinking about this problem these days, I am dealing with plane stress problems and studying stresses of the edges of a hole in an plate. I understand that it's better to use 'assempde' to get the solves, because I want more nodes in edges of the hole (I need to refine mesh). But this way, I can only get solutions 'u' which means x-displacements in plane stress problems, while by using PDEmodel I can get 'result.NodalSolution' and 'result.XGradients','result.YGradients' which contains displacements and deformations. And the more important thing is in 'result.NodalSolution' I get a matrix (n-by-2,where n is quantity of all nodes) which means the x- and y-displacements. But 'u = assempde' give me only a vector which means x-displacement. Shortly speaking, I want to refine mesh to get more nodes in the edges of hole and at the same time I need to get a n-by-2 matrix at the output of my program. But I can't figure out how to get them both. Hoping that you can give me some advice and I will really appreciate that.
Mohamed NJH
Mohamed NJH on 1 Dec 2019
Hello Shixiang,
I am facing the same problem as you. Were you able to refine mesh using PDEModel or evaluating the gradient of the solution using [p e t ] mesh? Thank you in advance

Sign in to comment.

More Answers (1)

Ian Jentz
Ian Jentz on 2 Oct 2020
There is now a port of refinemesh() available for PDEModel. Like refinemesh(), it works for 2D linear triangular geometries only.
The new PDEModel compatible function is refinePDEMmesh().
This is how you would run your problem:
model=createpde;
msh=generateMesh(model,'Hmax',l/20);
model = refinePDEMmesh(model);

Community Treasure Hunt

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

Start Hunting!