Question: clc clear all close all dt = 0 . 0 1 ; % timestep dx = 0 . 0 1 ; % mesh size n

clc
clear all
close all
dt =0.01; %timestep
dx =0.01; % mesh size
n =50; %number of node points
%The size and the mesh of plate
Lx =(n-1)*dx; % total length in X
Ly = Lx; % total length in y
xs =0:dx:Lx; %vector of positions in x
ys = xs; %vector of positions in y
[X , Y]= meshgrid(xs , ys); %mesh
Ta =300; %k, Temperture of the environment
dTmax =200; %max temp above the temp of environment
alpha =1e-4; % thermal diffusivity of copper (m^2/s)
% intial condition
T = ones(n)*Ta; %uniform temperture
T(30:45,30:45)= Ta + dTmax; %the hop part temp
c =3;
% c0 stands for Periodic boundaries
% c1 stands for Fixed temperature at the boundary
% c2 stands for Insulated BC
% c3 stands for Heat generation with fixed temp BC
q =300000; %the power of the laser focusing on the center of the plate
cp =1000; %heat capacity
rho =1000; %density
for i=1:30000%runnig thr simulation for 30,000 cycles=300 s
Tx1= circshift(T,[0,-1]); % T shifted to the left (aka the right neghbor)
Tx_1= circshift(T,[0,1]); % T shifted to the right (aka the left neghbor)
Ty1= circshift(T,[-1,0]); % T shifted upwards (aka the below neghbor)
Ty_1= circshift(T,[1,0]); % T shifted downwards (aka the above neghbor)
%the main heat equations
Told = T;
T = T + alpha*(Tx1+Tx_1+ Ty1+Ty_1-4*T)/dx^2*dt; % this is all there to it!
if c==1%Fixed temperature at the boundary
T(1,:)= Ta;
T(n,:)= Ta;
T(:,1)= Ta;
T(:,n)= Ta;
elseif c==2%insulated BC
%insulated edges
T(:,1)= Told(:,1)+ alpha*(Tx1(:,1)+ Ty1(:,1)+Ty_1(:,1)-
3*Told(:,1))/dx^2*dt;
%left edge,heat flows from right, top, bottom
T(:,n)= Told(:,n)+ alpha*(Tx_1(:,n)+ Ty1(:,n)+Ty_1(:,n)-3*Told(:,n))/
dx^2*dt;
%right edge,heat flows from left, top, bottom
T(1,:)= Told(1,:)+ alpha*(Tx1(1,:)+ Ty1(1,:)+Tx_1(1,:)-
3*Told(1,:))/dx^2*dt;
%bottom,heat flows from right, top, left
T(n,:)= Told(n,:)+ alpha*(Tx1(n,:)+ Tx_1(n,:)+Ty_1(n,:)-3*Told(n,:))/
dx^2*dt;
%top edge,heat flows from right, left, bottom
%insulated coreners
T(1,1)= Told(1,1)+ alpha*(Tx1(1,1)+ Ty1(1,1)-2*Told(1,1))/dx^2*dt;
%bottom left corner, heat flows from top and right
T(n,n)= Told(n,n)+ alpha*(Tx_1(n,n)+ Ty_1(n,n)-2*Told(n,n))/dx^2*dt;
%top right corner, heat flows from bottom and left
T(1,n)= Told(1,n)+ alpha*(Tx_1(1,n)+ Ty1(1,n)-2*Told(1,n))/dx^2*dt;
%bottom right corner, heat flows from top and left
T(n,1)= Told(n,1)+ alpha*(Tx1(n,1)+ Ty_1(n,1)-2*Told(n,1))/dx^2*dt;
%top corner, heat flows from bottom and right
elseif c==3
T(1,:)= Ta;
T(n,:)= Ta;
T(:,1)= Ta;
T(:,n)= Ta;
T(n/2, n/2)= T(n/2, n/2)+ q/(dx*dx*cp*rho)*dt;
end
if mod(i,100)==0%plotting every 100th interation
pcolor(X, Y, T)
%caxis([300,500])%this fixes the colorbar so that the colors slways
between 300-500k
shading interp
colorbar()
%%alternative way to plot
% surf(X, Y ,T);
% axis([0,Lx,0,Ly,Ta,Ta+dTmax]);
% shading interp
title (['t=', num2str(dt*i),' s'])
drawnow()
end
end
!!Can you edit this given matlab code to meet the requirements! !
The goal of this simulation is to figure out the intrinsic size of a point heat source and to practice mesh and
geometric convergence. Geometric convergence is defined as: "the smallest cell that you can use such that the
boundary conditions do not affect the thermal profile."
Start with the posted 2D MATLAB simulation from the tutorial and apply a 5000 W point source to the center
of the plate with 300 K boundaries on all faces. From the results from this working 2D simulation. Calculate
the width of the hot spot in the thermal profile. The definition of width you will use is also up to you, some
common choices are RMS width, standard deviation, and FWHM (don't forget to mention which one you
chose).
The steps I recommend are:
Pick how long to run your simulation and a converged time step (up to you, but include in deliverable).
Pick a starting size of the plate (also your choice).
Start with the thermal diffusivity for copper ({: 1.11e-4m^2//s) and converge the mesh, then the geometry.
As you change mesh, make sure you have defined your heat source in a way that scales with the mesh size
correctly!
Using the same mesh, use change the thermal diffusivity to that for acrylic (1e-7m^2//s ) and converge the
geometry.
For your deliverable, please include:
Proof of converged mesh for copper.
Proof of converged geometry for copper.
Proof of converged mesh for acrylic
Proof of converged geometry for acrylic.
Also include some short text comments on how you reasonably chose your timestep and total duration, as
well as why your plots make sense. (hint: you can compare how mesh and geometry convergences differ
between the two materials).
clc clear all close all dt = 0 . 0 1 ; % timestep

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mechanical Engineering Questions!