MECH 202讲解、辅导Engine cooling Python程序

- 首页 >> Python编程


MECH 202 Jupyter Notebook Written Report – Engine cooling

MECH 202

Jupyter Notebook Written Report

Engine cooling

Due date: Sunday of Week 8

Grading & Weight: This assignment is out of 100 marks, as further specified in the rubric at the

end of this document, and is worth 8.5% of your overall final grade in the course

Late Penalty: Late submissions will be penalized at 10% each day for up to 5 days in which

case a grade of zero will be given. 1. Overview

For this assignment, you will predict an engine’s temperature using numerical methods to solve

an ordinary differential equation. As explained in class, there are two parts to this project. PART I : Calculate the time-dependence of the temperature of an engine after it is shut off. PART II : Calculate the top speed that a motor vehicle can reach before overheating. You will submit a report in the form of a Jupyter notebook. This assignment directly aligns with the following Course Learning Outcomes (CLO):

CLO (3): Solve first-order ordinary differential equations analytically

CLO (5): Solve ordinary differential equations numerically, coding in Python

1.1 Time for completion

This assignment will take approximately six (6) hours to complete. You will begin working on

this assignment in the two hour tutorial of Week 7, and finish on your own time before the

deadline. 2. Instructions

For this assignment, you will implement the ODE solving techniques that we saw in the online

content and in-class. You will submit a report in the form of a Jupyter notebook. Your Jupyter

notebook must contain the following information:  Introduction

o In your introduction, include pertinent theoretical background. This can be

completed in about three paragraph (200-300 words). Include references as you

judge pertinent. You might want to refer to some of those presented in class.  Completion of the tasks and discussion

o Include code required to correctly complete the task

MECH 202 Jupyter Notebook Written Report – Engine cooling

o Include comments to explain your thought process and code logic

o Discuss the results of what was found and answer the questions in the task list  Conclusion

o Discuss what you learned, what surprised you, and how you could extend this

work. This can be completed in about 250 words.  Optional reference list

o Include a references if sources are used

o This can be included at the end of the intro, or at the end of the document. This

esthetic choice is up to you!  Format

o See the report template in onQ to format your report. Part 1 Engine cooling on a cold winter day

Context:

The normal operating range for a car engine is in the region of 80-90

oC. Here, you will model the

temperature of the engine using Newton’s heat equation. Set the initial engine temperature at 90

oC and

outdoor temperature at -20

oC. Suppose a cooling rate of 0.07 min

-1

. In all cases, you will estimate the

temperature evolution over 20 minutes. Steps:

1. Implement Euler’s method to solve this problem. Use a timestep of 0.2. Plot your answer and

show the final temperature value. (5 marks)

2. Implement Runge-Kutta’s method (4

th order) to solve this problem. Use a timestep of 0.2. Plot

your answer and show the final temperature value. (5 marks)

3. Implement the implicit trapezoid (implicit R-K) method to solve this problem. Use a timestep of

0.2. Plot your answer and show the final temperature value. (5 marks)

PS: see some code to help you out attached in OnQ!

4. Solve the problem using the odeint or solve_ivp method pre-built in Python. Make sure to note

the number of function codes (‘nfe’ in the dictionnary). Plot your answer and show the final

temperature value. (5 marks)

5. Solve the problem analytically. Plot your answer and show the final temperature value. (5 marks)

6. Plot the difference, as a function of time, between the output of each numerical method (i.e. tasks 1 through 4) and the analytical solution. (5 marks)

7. In tasks 1 through 3, a different total number of function calls were made for each method. For

example, Euler’s method required 1/4 of the function calls required by the R-K 4

th order method. Here, re-solve the problem, using the same number of function calls. For each scenario, provide

the engine temperature after 20 minutes (no need to plot the temperature as a function of time)

a. Perform 24 Euler steps (i.e. 24 function calls). (4 marks)

b. Perform 6 Runge-Kutta 4

th order steps (i.e. 24 function calls). (5 marks)

c. Perform 8 implicit trapezoid steps (i.e. 24 function calls). (5 marks)

MECH 202 Jupyter Notebook Written Report – Engine cooling

d. Which method provides the best accuracy, when performing the same number of

function calls? (4 marks)

8. What stepsize should you use to calculate the engine temperature after 20 minutes, within

0.01% of the analytical solution?

a. Use Euler’s method. How many function calls were made? (4 marks)

b. Use Runge-Kutta’s 4

th order method. How many function calls were made? (4 marks)

c. Use the implicit trapezoid method. How many function calls were made? (4 marks)

PS: By now, we hope that you are convinced that Euler does not perform well, compared to

alternatives. However, the situation is worst than what you uncovered up until now. If the

function being calculated fluctuates rapidly in time—i.e. rapid oscillations—then Euler will

perform even worse. In fact, even Runge-Kutta 4

th order will behave badly if the solution varies

too rapidly (technically, these are called stiff equations). In these cases, implicit solvers are best. We will come back to these concepts in module 6, where you will solve a second-order ODE, that involves a stiff equation. Part 2 Top speed before overheating

Consider the following scenario:  The velocity-independent cooling rate is k = 0.07 min

-1

.  The velocity-dependent cooling rate is 0.005 min

-1 / (m.s

-1

). (in other words, the faster the car

goes, the more cooling is provided to the engine)  The engine block weighs 200 kg. Its specific heat capacity is 900 J / (kg.K).  At maximum acceleration, the engine generates 450kW of waste heat.  Maximum acceleration is 3 m/s

2

.  The car starts at rest, and the engine is initially at 80

oC.  The outside temperature is -20

oC. Steps:

1. How fast is the car going when it can no longer accelerate without overheating the engine?

Assume that engine overheat occurs when temperature exceeds 110 ∘ C. Ignore terminal

velocity from drag. (20 marks)

2. Plot the engine temperature as a function of time. You’ll notice that the temperature increase is

non-linear. Why is this? (5 marks)

3. What could be done to the car so that the temperature plateaus at a lower level, before the

car’s maximum velocity is reached (i.e. make drag force the limiting factor, rather than engine

temperature)? (5 marks)

MECH 202 Jupyter Notebook Written Report – Engine cooling

Your assignment will be evaluated using the following criterion:

Criteria Mastery (A+) High Quality (A) Developing (B) Marginal (C) Not

MECH 202 Jupyter Notebook Written Report – Engine cooling

(ie. Clarity, structure, format, spelling &

grammar)


站长地图