How to create a 3d mesh with a unique property for every element?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm struggling to create a finite element mesh to suit my needs for a thermal model. I'm starting from a data file that has 3d rectangular elements of variable size and physical properties. The physical properties (conductivity and heat production) cannot simply be separated into descrete zones as each element is different.
I've been able to create a mesh using delaunay.m and geometryFromMesh.m, but I cannot figure out how to efficiently assign a unique set of properties to each element (i.e. each element becomes its own cell). The code does not seem to be set up to work this way. Any ideas are welcome.
0 Kommentare
Antworten (1)
chicken vector
am 19 Apr. 2023
Bearbeitet: chicken vector
am 19 Apr. 2023
You can store all the information you want into a structure:
nElements = 25;
x = rand(nElements, 1);
y = rand(nElements, 1);
z = rand(nElements, 1);
condunctivity = 50 + 5 * sin(linspace(0, 2*pi, nElements));
DT = delaunay(x, y, z);
mesh = struct;
for element = 1 : nElements
mesh(j).Indeces = [DT(j,:); DT(j,:); DT(j,:)]
mesh(j).Points = [x(DT(j,:)); y(DT(j,:)); z(DT(j,:))]
mesh(j).Conductivity = condunctivity(j)
end
Alternatively you can define a class with a similar approach.
This is usefull to perform operations on the elements.
classdef meshElement
properties
indeces
x
y
z
conductivity
end
methods
function el = meshElement(DT,row,x,y,z,elementConductivity)
el.indeces = DT(row,:);
el.x = el.x(indeces);
el.y = el.y(indeces);
el.z = el.z(indeces);
el.conductivity = elementConductivity;
end
end
end
Unfortunately the instance of the class returned by delaunayTriangulation is not dynamic, othereise you could just have added the property conductivity to it.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Triangulation Representation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!