Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this task we consider a heated plate and seek to find the temperature distribution in the plate given certain boundary conditions. This is an

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
In this task we consider a heated plate and seek to find the temperature distribution in the plate given certain boundary conditions. This is an example of Laplace's equation in 2D. Our domain of interest for this problem will be a square. The specific equation we will solve is: a2T a2T ax27 + dy z = 0. The domain we will consider is shown in the figure below, where, XE[0,1], yE[0,1] . Here, we see that there will be prescribed temperatures on the top, right, bottom, and left boundaries. Note the corner points are associated with a specific condition (here either the top or bottom temperature).T = Ttop 7 (1,3) (2,3) (3, 3) T = Tleft - - - 3 5. (1,2) (2, 2) (3, 2) T = Tright 2 (1, 1) (2 1) (3, 1) T = Tbottom In the grid (domain) shown in the figure, the overall grid consists of 5x5=25 nodes or each side has been divided into 4x4 segments. 16 of these nodes are on the boundary so we do not need to solve for them. Your task is to write a function (BVP_2D.py) that solves for the temperature in this general domain using 2nd order central finite differences. That is, replace the 2"d derivatives with a2 T Titi,j-2Tij+Ti-1,j a x2 Ax2 a2 T Titi,j-2Ti,j+Ti-1,j ay Ay2 for a general nseg x nseg segments. The differential equation is, Titi,j - 2Tij + Ti-1,j + Ti+1,j - 2Ti,j + Ti-1,j = 0 Since, we know only how to solve the differential equation in only one direction we will perform an 'operator split'. We will first assume a Temperature distribution. We will solve in the x direction first (X sweep) and then in the y direction (Y sweep) iteratively. During X sweep, we utilize the Itj+, and Tij-1 from the previous iteration and vice versa for the Y sweep. We shall continue doing this until the error in the differential equation is below a tolerance limit. A sample code with the X sweep is given below. The residue is calculated by integrating the differential equation throughout the domain which derives to be, n-1n-1 R = Titij-2Tu+Ti-1j+Ti+1j-2Taj+Ti-1,jAfter solving the BVP the function needs to return the Temperature at (x = 0.25 and y =0.25) Format for the function, Valid call: To = BVPsolver_20(nseg, Tleft, Tright, Tbott, Ttop, ResTol) Inputs: nseg (int ) number of segments Tleft (float) Temperature at left boundary Tright (float) Temperature at right boundary Tbott (float) Temperature at bottom boundary Ttop (float) Temperature at top boundary ResTol (float) Tolerance level below which the residue should be. Outputs: Ta (float ) Temperature at x = 0.25 and y = 0.25 Assumptions: . Number of segments are equal in the x and y directions Write a script (need not submit this script) that calls the function and passes the conditions (Tleft = 75, Tright=50, Tbott=0, Ttop=1000, ResTol=1e-2). Compute the solution for Tq for nseg = [4, 8, 16, 32, 64] and identify when the approximate error is below 0.1%.(This solution you identify is called as the grid- independent solution) Include your graphs for T for the grid independent solution in the PDF file. Mention for what number of segments the grid independent solution was found. import numpy as np import matplotlib. pyplot as plt nseg = 4 xx = np. linspace(0, 1, nseg+1) yy = np. linspace(0, 1, nseg+1) X, Y = np. meshgrid(xx, yy) T = np. zeros((nseg+1, nseg+1)) # Boundary Conditions Tleft, Tright, Tbott, Ttop - 75., 50., 0., 1060. T[e, : ] = Tleft T[-1, :] = Tright T[ : , 0] = Tbott T[:, -1] = Ttop # Plot of the initial condition pit. figure( ) pit. contourf (X, Y, T. transpose()) pit. colorbar pit. title('Initial Temperature Solution" ) print (T)

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_2

Step: 3

blur-text-image_3

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

Coherent States And Applications In Mathematical Physics

Authors: Didier Robert, Monique Combescure

2nd Edition

3030708446, 9783030708443

More Books

Students also viewed these Physics questions

Question

=+Discuss the importance of research in social media practices

Answered: 1 week ago