Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Comupute the temperature vs time in Python code The following code has errors which will not allow to continue : def RK45(h,x0,n): if (x0 <59):

Comupute the temperature vs time in Python code

The following code has errors which will not allow to continue:

def RK45(h,x0,n):

if (x0<59):

W=4320000# [J/s]

xk1=f(x0)

xk2=f(x0+0.5*xk1*h)

xk3=f(x0+0.5*xk2*h)

xk4=f(x0+xk3*h)

xn=x0+(h/6.0)*(xk1+2.0*xk2+2.0*xk3+xk4)

elif (x0>61):

W=0

xk1=f(x0)

xk2=f(x0+0.5*xk1*h)

xk3=f(x0+0.5*xk2*h)

xk4=f(x0+xk3*h)

xn=x0+(h/6.0)*(xk1+2.0*xk2+2.0*xk3+xk4)

xk1=f(x0)

xk2=f(x0+0.5*xk1*h)

xk3=f(x0+0.5*xk2*h)

xk4=f(x0+xk3*h)

xn=x0+(h/6.0)*(xk1+2.0*xk2+2.0*xk3+xk4)

def f(x):

cp=4186.0

ro=1.0

U=12558.0

S=1.20

tin=17.0

ta=20.0

V=80.0

if (t>=0.0 and t<=7.0):

Q=0.0

elif(t>7.0 and t<=9.0):

Q=70.0

elif(t>9.0 and t<=14.0):

Q=40.0

elif(t>14.0 and t<=15.0):

Q=30.0

elif(t>15.0 and t<=19.0):

Q=10.0

elif(t>19.0 and t<=20.0):

Q=50.0

elif(t>20.0 and t<=24.0):

Q=10.0

f=(Q/V)*(tin-x)-(U*S*(x-ta))/(V*ro*cp)+W/(V*ro*cp)

h=0.001

n=24

n1=int(n/h)

x0=60

t=0

W=0

for i in range (0,n1):

RK45(h,x0,n)

x0=xn;

t=t+h;

print("time:\t",t,"Temperature:\t",xn)

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

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions

Question

1. Why do people tell lies on their CVs?

Answered: 1 week ago

Question

2. What is the difference between an embellishment and a lie?

Answered: 1 week ago