联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-05-28 10:45

Final Projects Math104 C 1

Prof. Hector Ceniceros

Instructions: Choose one of the problems and write a jupyter notebook to integrate all

the parts of the problem solution; this includes any analytic calculations and theory, code,

results and analysis of the results.

1. The cellar. Neglecting the curvature of the Earth and the diurnal (daily) variation of

temperature, the distribution of temperature T(x, t) at a depth x and a time t is given

by the Heat equation:

Here κ is thermometric diffusivity of soil whose value is approximately κ = 2 ×103cm2/sec (the fundamental time scale is a year, 3.15 × 107

sec). Assume that the

temperature f(t) at the surface of the Earth (x = 0) has only two values, a “summer”

value for half of the year and a “winter” value for the other half, and that this pattern

is repeated every year (i.e. at x = 0 the temperature is periodic with a period of a

year). The temperature T should decay to zero as x → ∞.

a) Show that the backward (implicit Euler) difference scheme for (1) is consistent

and unconditionally stable. What is the order of the scheme?

b) Implement the backward difference scheme to find a numerical approximation to

(1). Consider the initial condition u0(x) = f(t)e

your computational spatial domain take a sufficiently long interval so that the

right-end boundary condition u = 0 can be used. Select k and h small enough to

resolve well the numerical solution. Plot the numerical solution at several times.

c) From your numerical solution, find the depth xc at which the temperature is

opposite in phase to the surface temperature, i.e, it is summer at xc when is

winter at the surface. Note that the temperature variation at xc is much smaller

than that at the surface. This makes the depth xc ideal for a wine cellar or

vegetable storage.

2. A simple model for air quality control. An air pollutant gets advected by the wind

and at the same time diffuses as it travels. The time evolution of the concentration

u(x, y, t) of the pollutant at position (x, y) and at time t can be modelled by the

advection diffusion equation

ut + Uwux + Vwuy = D(uxx + uyy), (2)

1All course materials (class lectures and discussions, handouts, homework assignments, examinations, web

materials) and the intellectual content of the course itself are protected by United States Federal Copyright

Law, the California Civil Code. The UC Policy 102.23 expressly prohibits students (and all other persons)

from recording lectures or discussions and from distributing or selling lectures notes and all other course

materials without the prior written permission of the instructor.

1

where (Uw, Vw) are the components of the wind velocity and D > 0 is the diffusivity

coefficient (assumed small) of the pollutant in the air.

a) The one-dimensional case of (2) is

ut + Uwux = Duxx. (3)

(If D = 0, this is the simple one-way wave equation (also called advection equation)

we have seen in class). Assuming Uw < 0 (and constant) find the stability

condition for the scheme

b) If D = 0, one gets an “upwind” scheme for the one-way way equation. Find the

modified (model) equation for the “upwind” scheme and show that the scheme

is dissipative. How do you have to take your numerical parameters to guarantee

that your numerical diffusion is much less than the “real” diffusion when D 6= 0.

Explain

c) Write a code to implement (4) with homogeneous boundary conditions (u = 0 at

the boundary) and use it to solve (3) in [5, 1] with initial condition

u0(x) = (1 for 0 ≤ x ≤ 1/20 otherwise

(5)Take Uw = 1 and D = 0.1 and select k and h small enough to resolve well the

numerical solution. Plot the solution at t = 1, 2, 3.

3. Acoustic waves. The air pressure p(x, t) in an organ pipe is governed by the wave equation.(6)

where l is the length of the pipe and c is a constant. If the pipe is open, the boundary

cinditions are given by

p(0, t) = p0 and p(l, t) = p0. (7)

If the pipe is closed at the end x = l the boundary conditions are

p(0, t) = p0 and px(l, t) = 0. (8)

Assume that c = 1, l = 1, and the initial conditions are

p(x, 0) = p0 cos 2πx, and p

t(x, 0) = 0 0 ≤ x ≤ 1. (9)

a) Write down an explicit finite difference method for (5) and give stability conditions

and the order of the method.

2

b) Implement your method given in a) for the open pipe with p0 = 0.9, and with

step sizes k = h = 0.05. Plot your numerical solution at t = 0.5 and t = 1.0.

c) Implement your method given in a) for the closed pipe at x = l with p0 = 0.9,

and with step sizes k = h = 0.05. Plot your numerical solution at t = 0.5 and

t = 1.0.

d) Repeat b) for k = h = 0.025. Construct a higher order approximation by extrapolating

your numerical solutions corresponding to k = h = 0.05 and k = h = 0.025.

What’s the order of the new approximation.

3


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp