34  Problem set 4 solutions

Note

Note that Q1 and Q4 are new to complement the coverage on numerical solutions of PDEs.

Q1. Finite difference formulae

  1. Show that U(x+h)=U(x)+hU(x)+h22U(x)+h36U(x)+,U(xh)=U(x)hU(x)+h22U(x)h36U(x)+.

This is straightforwards and by definition of Taylor’s theorem.

  1. By subtracting the two equations above, derive the centred difference formula used for the first-derivatives in our algorithms: U(x)=U(x+h)U(xh)2h+O(h2). This is what’s known as the centred difference formula for the derivative.

Again this is immediate by subtracting the given formulae.

  1. By adding the two Taylor series equations above, derive the centred difference formula used for the second-derivatives in our algorithms: U(x)=U(x+h)2U(x)+U(xh)h2+O(h2).

This part is also immediate. Adding the two equations gives U(x+h)+U(xh)=2U(x)+h2U(x)+O(h3), and simplify.

  1. The centered difference formula for U(x) will not immediately work if it is applied to find the derivative at the first mesh point in a discretisation, e.g. x=x0. Show that the forward difference formula at x=x0 can be derived as U(x0)=3U(x0)+4U(x1)U(x2)2h+O(h2).

Hint: consider as well the Taylor series for U(x+2h) and then combine the expansions for U(x+h) and U(x+2h) to derive the result.

This is a bit more involved. Let us explain firstly why the standard approach doesn’t work: U(x+2h)=U(x)+2hU(x)+2h2U(x)+43h3U(x)+U(x+h)=U(x)+hU(x)+h22U(x)+h36U(x)+.

Now adding gives U(x+2h)+U(x+h)=2U(x)+3hU(x)+5h22U(x)+

However, if we isolate U(x) we obtain a formula where the error term is O(hU(x)) instead of O(h2).

The solution is to consider a linear combination: U(x)=aU(x)+bU(x+h)+cU(x+2h), and insert the above formulae. Keeping track of the term multiplying the second derivative, U(x), we then need: b/2+2c=0b=4c. The remaining two equations are: a+b+c=0,bh+2ch=1.

The second yields c=1/(2h) and hence b=2/h. The first equation then gives a=3/(2h).

Q2. The wine cellar problem I

Separation of variables leads to the equation GG=κHH=λ.

Crucially in considering possible solutions, we want solutions to obey the necessary boundary condition of T(0,t)=Acos(ωt)=G(t)H(0). This is highly restrictive.

We first consider λ=0. Then we have that G(t)=const.. This is then no way to satisfy the time-varying boundary condition.

We next consider λR. Then G(t)=Ceλt. So again the behaviour of the time-dependent part is incompatible with the oscillating boundary conditions.

Therefore the only remaining possibility is λ=iα where α is real. Then we have that G(t)=C1eiαt+C2eiαt. Written in terms of real-valued functions, this gives essentially a linear combination of cos(αt) and sin(αt). In order to be compatible with the boundary conditions, we would thus need G(t)=const.cos(ωt)=const.×Re(eiωt), i.e. taking the imaginary part (if we wish to continue manipulating exponentials).

Now solving for H(x), we set H(x)=erx as a solution ansatz, giving the characteristic equation r2=iωr=±iω. Therefore the general solution for H yields H(x)=D1eiωx+D2eiωx. In order to parse the above form, it is best to re-write the real and complex parts of the exponential argument separately. We note that by Euler’s theorem, i=(eπi/2)1/2=eπi/4=1+i2. So now we can re-write H(x)=D1eω/2xeiω/2κx+D2eω/2κxeiω/2x. By the boundedness assumption, we require that H(x) does not blow up as x. So therefore D1=0. We can finally put the results together, yielding: T(x,t)=const.×Re[eiωteω/2κxeiω/2κx]=const.×Re[eω/2κxei(ω/2κx+ωt)]. Note that the reason you have re-written it with the exponentials arranged in this fashion is because the portion of the exponential with the imaginary argument becomes oscillatory. Taking the real part yields T(x,t)=Aeω/2xcos(ω/2κx+ωt). You can double check that the above solution satisfies all the required conditions, including the condition at x=0 (forcing us to choose the prefactor A).

Q3. The wine cellar problem II

Solution script can be found on the solutions/ folder of the Noteable Python website.

The numerical solution is tricky for two reasons. First, you must consider the right range of parameters. Second, the numerical algorithm suffers from instability, so you must consider the right spatial and time discretisation.

To begin, from the notes , you are given that typical parameters are ω=2π3.15×107s. This has already been converted to seconds, so instead use ω=2πyrs1. Indeed this value of ω was chosen so that cos(ωt) has a wavelength of 1 years.

Next, it is given that κ=0.002cm2/s. We use the fact that 1yr=3.15×107s,1cm=102m. So κ=2103104m23.15×107yr=(2/3.15)m2yr10.635m2yr1. When distributing the typical mesh in the x direction, we want to make sure we go deep enough. We had found that putting the cellar in about 4m deep was enough, so as long as your code solve for a range of x values, say, between x=0 and x=10, this should be sufficient.

The script is given in the solutions folder.

Q4. von Neumann analysis

This note should be filled in soon. The analysis is similar to the analysis for the heat equation as done in the problem class.

Q5. EBMs and variable sun output

  1. Regarding the resultant variation on the Earth’s mean surface.

The variation seems to be very small. Ignoring units, we have T=(1aσγ)1/4Q1/467.3505×Q1/4. Substituting the values of Q given this gives a temperature that ranges from T=289.499K to 289.580K. Converting this to Celsius gives 16.35C to 16.43C i.e. a fraction of a degree.

  1. Regarding the variation using the Budyko model.

We obtain the range of approximately T=17.06C to 17.19C.

  1. Regarding why the disparity between actual surface measurements.

There are many ways to respond, but one major factor is the oceans, which are ignored in our model. The oceans provide a massive energy sink for the planet, and so we would expect that the minor variations of Q due to the 11-year cycle would be smoothed out by the effects of the oceans.

Q6. Phase line analysis

  1. Sketch the solution T(t) of this equation for t>0 if T(0)=230,240,260,270 and 300.

You should be able to do this question by hand, but the following graph is generated via the accompanying Jupyter script in the solutions folder. The point is that once the steady-state solutions are known (dashed) then each solution given by the different initial condition can be approximated by whether it tends towards or away from the nearest fixed point.

Figure 34.1: Graphical solution for Q3a
  1. Sketch the solution T(t) of this equation for t>0 if T(0)=285. Then sketch the solution of this equation with the same initial data in the same coordinate system if C is twice as large. Explain your answer.

The below numerical solution shows blue for C=1 and orange for C=4. Notice that increasing C seems to decrease the rate of change of the evolution. Indeed, since Tt1C, then multiplying C by factor is equivalent to slowing down the evolution by the inverse of that factor. A factor of C that is twice as large would slow down the evolution by half. Note that the oscillations shown in the graph below are numerical artifacts due to the tolerances on the ODE solver (how do you know this?)

Graphical solution for Q3b
  1. If γ is decreased due to the increased greenhouse effect, the entire curve is shifted upwards. Sketch the solution if T(0)=280. Sketch the solution with the same initial data if γ is decreased. Explain your answer.

Decreasing γ has the effect of shifting the curve upwards. The hottest steady state T3 is consequently increased. There are two main effects. First, the steady-state is much hotter, so the system will tend towards a much hotter state. Second, because decreasing $ $ will increase the rate of change of T (since we are subtracting less via the factor γT4), then the evolution towards the hotter state is initially much faster.

You see that in the following diagram.

Graphical solution for Q3c

The above makes sense on a physical level. Decreasing γ is equivalent to increasing greenhouse gases. We do expect the system to tend to a hotter state, then.