How to create custom Mesh for PDE model

4 visualizaciones (últimos 30 días)
Jose Ortiz
Jose Ortiz el 27 de Dic. de 2015
Comentada: amir13631363 el 29 de Nov. de 2017
Hi:
I want to create a custom mesh for a 2D PDE model different from the one that 'generateMesh' creates automatically. Following examples, I have defined the geometry, edges information, nodes, triangle elements, etc. I am only using only a single rectangular structure. But when I try to assign my mesh info to my model directly, like:
MyCustomMesh= pde.FEMesh(MyNodesMatrix,MyTriangleElements,#max,#min,'linear', --> ??? <---);
that last parameter is required, but there is no info at all about it in the documentation. Whenever you look for the pde.FEMesh properties, all that you get listed is:
- Properties for class pde.FEMesh:
* Nodes
* Elements
* MaxElementSize
* MinElementSize
* GeometricOrder
because inside the FEMesh.m function you have:
classdef (Sealed) FEMesh < handle
properties(SetAccess=private)
Nodes;
Elements;
MaxElementSize;
MinElementSize;
GeometricOrder;
end
properties(Hidden=true)
MeshAssociation;
end
methods
function [p, e, t] = meshToPet(obj)
p = obj.Nodes;
if obj.MeshAssociation.PetFormat
e = obj.MeshAssociation.EdgeAssociativity;
else
e = obj.MeshAssociation;
end
t = obj.Elements;
if size(p,1) == 2
t(end+1,:) = obj.MeshAssociation.RegionAssociativity;
else
t(end+1,:) = ones(1,size(t,2));
end
end
end
methods(Hidden=true)
function obj=FEMesh(nodes, elems, maxelemsz, minelemsz, order,assoc)
obj.Nodes = nodes;
obj.Elements = elems;
obj.MaxElementSize = maxelemsz;
obj.MinElementSize = minelemsz;
obj.GeometricOrder = order;
obj.MeshAssociation = assoc;
end
end
end
'MeshAssociation' is hidden, and the function caption doesn't give any description like it does for all other properties. Yet the last parameter is required. I would like to see my mesh plotted to verify it, but I cannot get to the point of running
MyCustomMesh= pde.FEMesh(MyNodesMatrix,MyTriangleElements,#max,#min,'linear', --> What goes here? <---);
model.Mesh=MyCustomMesh;
pdeplot(model);
because I get
Error in pde.FEMesh/meshToPet (line 69)
if obj.MeshAssociation.PetFormat
What are the alternatives for 'PetFormat', or how is it supposed to be defined as the required last parameter? Or is there a different way to assign a custom mesh to a PDE structure (+2015a). I don't want to use legacy [p,e,t] format if possible, unless it is the only alternative.
Thanks.

Respuestas (1)

Alan Weiss
Alan Weiss el 28 de Dic. de 2015
I think that you can create your own mesh as long as you stick with the following two rules:
Then, as long as you have a consistent [p,e,t] representation of your mesh, I believe that solvers will be able to use your custom mesh.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  1 comentario
amir13631363
amir13631363 el 29 de Nov. de 2017
Hi Alan: I have a 3D mesh data and I want to calculate [p,e,t]. I should impose my boundary condition for a part of the face (not the whole of it). Could you please guide me how could I define the boundary (e) for the 3D problems. Bests, Amirreza

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by