Find Specific Faces on a 3D PDE DiscreteGeometry/ThermalModel
Mostra commenti meno recenti
Hi,
I am struggling to create a universal code that is able to solve a Thermal Model of heat travelling through a cube from one face to the other with different cavity types.
I was hoping to find a way to extract the number of the faces on the outer surface of the cube on opposing sides in either the x or y direction. I wish to do this so that I can easily change the model without having to manually find the values of opposing faces. Something like this;
thermalBC(model,'Face',pos_face,'Temperature',pos_t);
thermalBC(model,'Face',zero_face,'Temperature',zero_t);
where the pos_face and zero_face variables are extracted from the model.
Cheers!
Risposta accettata
Più risposte (1)
darova
il 27 Giu 2020
Here is an example
[x,y] = pol2cart(pi/4:pi/2:2*pi,1); % rectangle
gd = [2;length(x);x(:);y(:)]; % geometry description
dl = decsg(gd); % decomposition
[p,e,t] = initmesh(dl,'hmax',0.05); % triangulation
ind = logical(t(1,:)*0)'; % indices inside a region
for i = 1:length(ind)
vv = p(:,t(1:3,i)); % triangle vertices
rr = hypot(vv(1,:),vv(2,:)) < 0.3; % all vertices inside circle
if all(rr)
ind(i) = true; % write triangle
end
end
pdemesh(p,e,t) % display all mesh
ff.faces = t(1:3,ind)';
ff.vertices = p';
ff.facecolor = 'g';
patch(ff) % display region inside
viscircles([0 0],0.3) % display region

1 Commento
Luke Benham
il 29 Giu 2020
Categorie
Scopri di più su Geometry and Mesh in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!