Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

refer to the below code on MATLAB and solve the questions from question #4! Please refer to the attached. mlx file The heat conduction equation

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
refer to the below code on MATLAB and solve the questions from question #4!
Please refer to the attached. mlx file The heat conduction equation is given by tT=x22T 1. Discretize the time derivative using first-order-accurate-forward-difference-scheme. 2. Discretize the second derivative with respect to x using the second-order-accurate-centraldifference-scheme. 3. Write down the difference equation and rearrange the terms to set up the solution for temperature using the explicit approach. 4. Modify the attached code to show the temperature profile as a function of location when t=0s, t=400s,t=10msec and t=50msec. 5. Copy the temperature plot from the code at t=0s,t=400s,t=10msec and t=50msec. 6. What is the value of temperature at 200 micro second at 0.06667m from the left wall? 7. What are the default values of thermal diffusivity, x and t ? 8. What is the initial condition in the given code? Illustrate with a figure. 9. Copy and paste the part of the program where the explicit approach is coded? 10. Why are there two for-loops? Explain the function of each for-loop. 11. Re-run the code by setting the time step to 100s ? What is the solution at 50msec ? 12. What is the value of temperature at 200 microseconds at x=0.06667m from the left wall when the new time step is used? FDM Solution of 1-D unsteady heat equation using explicit approach In this exercise, you will solve for the transient temperature distribution in a medium bounded by two walls. The walls are separated by L(0.2m) and they extend to infinity. Read the comments and run the code in the cell below. Here, we define the number of grid points ( n ), the value of thermal conductivity (alph), the physical length of the solution domain i.e. the fluid extent (L), and the walf temperatures (fout or T2 and tin or T) clear Nhais clears the menory nu10; snumber of nodes in L between the two walls alpher. 264zwithermal diffusivity Lue.2; slength of the nedium tout-160iktenperature in cetcius at Twa tinisiveneperature in celcius at. TWI The command linspace (0,L,n) breaks the line between 0 and L to n points. For example, lets say you would like to divide ine between x=0 and x=10 using 5 grid points. You can do this by writing linspace (0,10,5). Write a line of code to create 5 arid psintin between x=0 and x=20. \& Type your solution. (1 line) \& Begin code x= linspace (0,20,5) x=15 send code Now, create n grid points between 0 and L. Denote the grid points by x so the grid point locations are stored as elements of the array x. Note that the semi-colon (i) at the end of the line supresses the output. x=18100.0222220.6444440.0666670.0888890.111110.13333 Now, you should compute the value of x based on the length of the solution domain and the number of grid points. Note that the the number of grid spaces (x) is n1. For example, if there are 5 grid point points then there are 4 grid spaces so tialAx=L(n1). The folowing line crestes a variable delx, which is the x. helx=L f(n1) sspacing between nodes Now, we should define the time step and the grid points in the temporal (i.e.time) axis. Assume that the time step is 2 micro seconds so that you will compute the temperature values at the spatial grid points evory micro second. Let's also run the calculations for a total of 1 seconds. The total number of time steps will be equal to the fotai number of grid points in the temporal direction minus.1. The initial condition can be defined as follows. The command ones (1,n2) creates an array of 15 with 1 row and n2 columnse Tha intial values of the temperatures at all the grid points are stored in the array 'temp'. Note that the units of temperatures are converted to Kelvin by adding 273.15. temp(1)=tin+273.15; istemperature at the left edge temp (n)= tout +273.15; stemperature at the right edge temp (2:n1)=temp(1); sinitial temperature at all the interior points Exercise 4: Create an array of is with 5 rows and 2 columns: Type your sotution. (1 tine) * Begin code A= ones (5,2) A=ones(5,2)A=521111111111 send code Now, create an array to store the values of the temperatures at each time step. In this array, the rows will contain the semperature values at points in x. Each column corresponds to a time step. tempt = zeros (n,j); edef ine, the vector which will contain temperature. at increasing time steps tempt (:,1)=tempi idefines the init ial condition tempt (1,i)=temp(1); kdefines boundary condition teapt (n,t)=temp(n); rdefines boundary condition vAgMABLE CODE SIMULINK ENIVBONMENT ExplicitAppecoch Lab5 vid-1099 Write the time marching iterative procedure. The inner loop computes the temperature values at x for a given time step. The outer loop marches the solution forward Piot the results figure (1) plot (x, tempt (:,1),10,x, tempt (:,10),0,x, tempt (:,100),10,x,tenpt(:,1000),0,0) Index in position. 2 exceeds array bounds. Index must not exceed 125. Exercise 5 : fun the code below. Do not modify it. 4ilgetenv(COANPUTERANE)fornatshortgc=clock

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions