Professional Documents
Culture Documents
Laboratorio 1 Matlab
Laboratorio 1 Matlab
Ingeniería Industrial
The first step in solving a heat transfer problem is to create a thermal analysis model. This is a container that
holds the geometry, thermal material properties, internal heat sources, temperature on the boundaries, heat
fluxes through the boundaries, mesh, and initial conditions.
thermalmodel = createpde('thermal','transient');
Import Geometry
Add the block geometry to the thermal model by using the geometryFromEdges function. The geometry
description file for this problem is called crackg.m.
geometryFromEdges(thermalmodel,@crackg);
pdegplot(thermalmodel,'EdgeLabels','on')
ylim([-2,2])
axis square
1
Specify the thermal conductivity, mass density, and specific heat of the material.
thermalProperties(thermalmodel,'ThermalConductivity',10,...
'MassDensity',10,...
'SpecificHeat',100);
Specify the temperature on the left edge as 100, and constant heat flow to the exterior through the right edge
as -10. The toolbox uses the default insulating boundary condition for all other boundaries.
thermalBC(thermalmodel,'Edge',6,'Temperature',100);
thermalBC(thermalmodel,'Edge',1,'HeatFlux',-10);
thermalIC(thermalmodel,0);
Generate Mesh
generateMesh(thermalmodel);
figure
pdemesh(thermalmodel)
title('Mesh with Quadratic Triangular Elements')
2
Specify Solution Times
tlist = 0:0.5:10;
Calculate Solution
thermalresults = solve(thermalmodel,tlist)
thermalresults =
TransientThermalResults with properties:
[qx,qy] = evaluateHeatFlux(thermalresults);
3
Plot Temperature Distribution and Heat Flux
Plot the solution at the final time step, t = 5.0 seconds, with isothermal lines using a contour plot, and plot the
heat flux vector field using arrows.
pdeplot(thermalmodel,'XYData',thermalresults.Temperature(:,end), ...
'Contour','on',...
'FlowData',[qx(:,end),qy(:,end)], ...
'ColorMap','hot')