MATLAB: Refine mesh in PDEModel

femeshgeneratemeshlaplacemeshmeshtopetpdemodelrefinemesh

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

Best Answer

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