- Don't use a PDEModel to represent your problem
- Represent your boundary conditions using a boundary file or a boundary matrix exported from the PDE app.
How to create custom Mesh for PDE model
조회 수: 4 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Alan Weiss
2015년 12월 28일
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
amir13631363
2017년 11월 29일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Geometry and Mesh에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!