FEM2D: Thermal convection problems using Triangular Elements
Consider the 2D equation model, a second order PDE equation with general coefficients a11, a12, a21, a22, a00, f :
Engine cooling fin: State the problem
Consider the mesh file meshAleta2DTriang.m which represents half of the geometry of the cooling fin shown at the figure with the Bondary Conditions stated there.
Take the material conductivity coefficient kc=0.5 and no internal heat source (f=0).
Question: Find the temperature at the point P=[0.9,2.1].
Define Geometry: node coordinates and elements
eval('meshAleta2DTriang');
plotElements(nodes,elem,numbering);
Select Boundary points
indLeft=find(nodes(:,1) < 0.01);
indRight=find(nodes(:,1) > 4.99);
indTop=find(abs(2*nodes(:,1)/5 +2 - nodes(:,2))< 0.01);
plot(nodes(indLeft,1),nodes(indLeft,2),'yd');
plot(nodes(indRight,1),nodes(indRight,2),'mo');
plot(nodes(indTop,1),nodes(indTop,2),'yd');
Define Coefficients vector of the model equation
In this case we use the Poisson coefficients defined in the problem above
coeff=[a11,a12,a21,a22,a00,f];
Compute the global stiff matrix
Use the linearTriangElement function to compute the system by element
K=zeros(numNod); %global Stiff Matrix
F=zeros(numNod,1); %global internal forces vector
Q=zeros(numNod,1); %global secondary variables vector
[Ke,Fe]=linearTriangElement(coeff,nodes,elem,e);
rows=[elem(e,1); elem(e,2); elem(e,3)];
K(rows,colums)=K(rows,colums)+Ke; %assembly
% make a copy of the original matrices
Boundary Conditions (BC)
Impose Boundary Conditions for this example.
fixedNodes=[indRight']; %Fixed Nodes (global num.)
freeNodes = setdiff(1:numNod,fixedNodes); %Complementary of fixed nodes
% ------------ Convection BC
convecNodes=[indLeft', indTop']; %must be a row vector
convecNodes=unique(convecNodes); %to avoid duplicate nodes
beta=0.05; %Convection Coefficient
Tinf=-17; %Bulk temperature
[K,Q]=applyConvTriang(convecNodes,beta,Tinf,K,Q,nodes,elem);
% ------------ Essential BC
u=zeros(numNod,1); %initialize u vector
u(indRight)=90; %all of them are zero
F=F-K(:,fixedNodes)*u(fixedNodes);%here u can be different from zero only for fixed nodes
% modify the linear system.
Km=K(freeNodes,freeNodes);
Im=F(freeNodes)+Q(freeNodes);
Compute the solution
solve the System
format short e; %just to a better view of the numbers
PostProcess: Compute secondary variables and plot results
titol='Temperature Distribution';
plotContourSolution(nodes,elem,u,titol,colorScale);
[alphas, isInside]=baryCoord(vertices, p);
% interpolate temperature
temp=alphas*u(elem(ntri,:))
(c)Numerical Factory 2026