フィルターのクリア

How to create a 3d mesh with a unique property for every element?

6 ビュー (過去 30 日間)
Derrick Hasterok
Derrick Hasterok 2023 年 4 月 19 日
編集済み: chicken vector 2023 年 4 月 19 日
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.

回答 (1 件)

chicken vector
chicken vector 2023 年 4 月 19 日
編集済み: chicken vector 2023 年 4 月 19 日
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.

カテゴリ

Help Center および File ExchangeDelaunay Triangulation についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by