Question

In: Mechanical Engineering

in math lab how to simulated heat conduction and how to show it in a video...

in math lab how to simulated heat conduction and how to show it in a video sinulation
bottom code is a simulation of just the hear conduction without the video

clear,pack,clc

% material properties
k=200
cp=921
rho=2500
alpha=k/(cp*rho);

% introduce discretization constants
% time
delta_t=0.1;
%space
delta_L=0.01; % this is in meters

% how many points
N=100;

% constants a1, and a2

a1=1-2*(alpha*delta_t)/(delta_L^2);
a2=(alpha*delta_t)/(delta_L^2);


% introduce initial and boundary conditions

% initial condition
T0=zeros(N,1);
T0(1:floor(N/3))=30;

% boundary condition

% this is the left point next to the bar
T0_m1=500;

% this is the right point next to the bar
T0_Np1=10;
b=zeros(N,1);
b(1)=a2*T0_m1;
b(N)=a2*T0_Np1;



% define the A matrix
A=zeros(N,N);

for i=1:N
if i==1
A(1,1)=a1; A(1,2)=a2;
end
if i==N
A(N,N)=a1; A(N,N-1)=a2;
end
if (i>=2)&&(i<=N-1)
A(i,i)=a1;
A(i,i-1)=a2;
A(i,i+1)=a2;
end

end


% number of simulation steps
sim_steps=10000;

RESULT=zeros(N,sim_steps);

for j=1:sim_steps

if j==1
RESULT(:,1)=T0; % initial temperature
else

RESULT(:,j)=A*RESULT(:,j-1)+b;
end


end

imagesc(RESULT)

% RESULT is number of points X time

% middle point plotting

plot(RESULT(50,:))

hold on

plot(RESULT(80,:),'r')

Solutions

Expert Solution

I have modified parts of the code to store animation in the form of video file.

clear;
pack;clc;

% material properties
k=200;
cp=921;
rho=2500;
alpha=k/(cp*rho);

% introduce discretization constants
% time
delta_t=0.1;
%space
delta_L=0.01; % this is in meters

% how many points
N=100;

% constants a1, and a2

a1=1-2*(alpha*delta_t)/(delta_L^2);
a2=(alpha*delta_t)/(delta_L^2);


% introduce initial and boundary conditions

% initial condition
T0=zeros(N,1);
T0(1:floor(N/3))=30;

% boundary condition

% this is the left point next to the bar
T0_m1=500;

% this is the right point next to the bar
T0_Np1=10;
b=zeros(N,1);
b(1)=a2*T0_m1;
b(N)=a2*T0_Np1;

% define the A matrix
A=zeros(N,N);

for i=1:N
if i==1
A(1,1)=a1; A(1,2)=a2;
end
if i==N
A(N,N)=a1; A(N,N-1)=a2;
end
if (i>=2)&&(i<=N-1)
A(i,i)=a1;
A(i,i-1)=a2;
A(i,i+1)=a2;
end

end


% number of simulation steps
sim_steps=10000;

RESULT=zeros(N,sim_steps);

figure()
reruns=1; % number of times movie is to play
fps=2; % frames per second

writerObj = VideoWriter('heat_conduction.avi');
open(writerObj);

for j=1:sim_steps

if j==1
RESULT(:,1)=T0; % initial temperature
else

RESULT(:,j)=A*RESULT(:,j-1)+b;
end

imagesc(RESULT(:,j))
drawnow;
Frames(:,i)=getframe;
writeVideo(writerObj,Frames(:,i))
end
close(writerObj);

%imagesc(RESULT)

% RESULT is number of points X time

% middle point plotting

% plot(RESULT(50,:))
%
% hold on
%
% plot(RESULT(80,:),'r')


Related Solutions

1) What is a simple way conduction deafness can be simulated? Explain how this simulates conduction...
1) What is a simple way conduction deafness can be simulated? Explain how this simulates conduction deafness. Is there a simple way to simulate nerve deafness? Why or why not? 2) Compare nerve deafness to conduction deafness. 3) In your own words, describe how the procedure for the Rinne's Test differs from the procedure for the Weber's test. What type of a result would you see from each of these tests if an individual had normal hearing?
Suppose that 300.0 J of heat is transferred by conduction from a heat reservoir at a...
Suppose that 300.0 J of heat is transferred by conduction from a heat reservoir at a temperature of 415.0 K to another reservoir. Calculate the entropy change if the temperature of the second reservoir is 100.0 K
Show how the ratios of the simulated spherical S to the experimental S is equivalent to...
Show how the ratios of the simulated spherical S to the experimental S is equivalent to f/f0, and calculate this value. What does this suggest about the structure of the nuclesomal array in the saltfree buffer?
In this lab you will learn how to use methods from the Math class in order...
In this lab you will learn how to use methods from the Math class in order to calculate the area or the volume of several different shapes. If you are confused about the Methods you can access from the Math class and would like to see some examples click here. Hint: Most of these methods can be done in one line. Step 1 - circleArea In this method you will calculate the area of a circle. Before you can calculate...
Thermochemistry Lab 1. Briefly explain, in terms of heat exchange, how you determined the heat capacity...
Thermochemistry Lab 1. Briefly explain, in terms of heat exchange, how you determined the heat capacity of the calorimeter. 2.Briefly explain, in terms of heat exchange, how you determined the heat of neutralization qreaction. 3. How does the q reaction differ from ΔH neutralization? Which value is an intensive property? Explain. 4. Do your values of ΔH for each reaction follow the expected trend? 5. Does it take more or less energy to break the weak acid bond or the...
This is a CLC assignment. As a group, observe the simulated "Home Visit With Sallie Mae Fisher" video
This is a CLC assignment. As a group, observe the simulated "Home Visit With Sallie Mae Fisher" video (http://lc.gcumedia.com/zwebassets/courseMaterialPages/nrs410v_vp01Alt.php). Refer to "Sallie Mae Fisher's Health History and Discharge Orders" for specifics related to the case study used to inform the assignment. Using "Home Visit With Sallie Mae Fisher" and "Sallie Mae Fisher's Health History and Discharge Orders," complete the following components of this assignment: After viewing the home visit, write an essay of 500-750-words in which you do the following:...
Write the heat conduction equation (without flow in and out) in cartesian coordinates for the following...
Write the heat conduction equation (without flow in and out) in cartesian coordinates for the following case: 1. Steady-state, 1-D, without heat generation (2 points) 2.Transient, 1-D, without heat generation (2 points) 3.Transient, 3-D, with heat generation (3 points) 3. Write the three types of boundary conditions. (3 points)
Develop and explain each step the general equation of heat transfer by conduction in a constructive...
Develop and explain each step the general equation of heat transfer by conduction in a constructive way starting from an element general differential in the cartesian coordinate system and then reduce to get: 1) Laplace's equation (in R3) Δ? = 0 2) The Poisson equation (with constant thermal conductivity ?) Δ? + ? '''= 0 Δ is the Laplacian operator and ? ''' is a source term. Note: start the analysis from a differential element with volume ??????. Make a...
Conduction is a transfer of heat energy that requires direct contact requires actual motion of substance...
Conduction is a transfer of heat energy that requires direct contact requires actual motion of substance it does not require matter all of the above
Conduction is a transfer of heat energy that requires direct contact requires actual motion of substance...
Conduction is a transfer of heat energy that requires direct contact requires actual motion of substance it does not require matter all of the above
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT