Question: In this problem we study the temperature distribution in a two-dimensional object, like a very thin metal plate. We can model such an object as


In this problem we study the temperature distribution in a two-dimensional object, like a very thin metal plate. We can model such an object as a grid of wires, as shown below. In the example, we assume that the temperature at the exterior grid points is constant and known. Your job is to determine the temperature at the interior points in the thermal equilibrium. When the temperature distribution in the grid is stable, the temperature at each interior point is the average of the temperatures at the four adjacent points. For example, The vector S is stored as a 1-d numpy array in S. Use this to compute T and store the vector in T as a numpy array of the same shape as S. The setup code gives the following variables: Your code snippet should define the following variables: Note: The use of np. linalg. solve ( ) is not permitted in this question, as you may not have access to it on the exam. How else can you solve a system of equations? You are now given the vector S=S0S8. Compute T=T0T4 The vector S is stored as a 1-d numpy array in S. Use this to compute T and store the vector in T as a numpy array of the same shape as 5. The setup code gives the following variables: Your code snippet should define the following variables: Note: The use of np. linalg. solve ( ) is not permitted in this question, as you may not have access to it on the exam. How else can you solve a system of equations? user_code.py inport numpy os np F Define the problem paraneters n=10# number of interior grid points in each disension dx=1.0/(n+1) in grid spacing 5=np.zeros((n+2,n+2)) inttialize the boundary conditions 5[0,:]100 in top boundary S[n1,:]0 an botton boundary S[;,0]50= left boundary S[;,n+1]=75= right boundary * Inttialize the temperature vector T=np,zecos((n+2,n+2)) If Define the corvergence threshold and moximum number of iterations eps - 1e-5 max_iter =10000 7 Perform the Jocobi iterations for k in range(nax_iter): T oold =Tc copy O in make a copy of the old temperature vector for i in range( (1,n+1) : for j in range (1,n+1) : if np,max(np, abs (TTold)) e eps: * check for convergence break F Extract the interior temperature vector Tinterlor =T[1:1,1:1]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
