Week 9

We finished talking about Laplace’s Equation and started talking about the Heat Equation.

In VBA we looked at finite difference methods for Laplace’s Equation. This completes the examinable VBA material. The Heat Equation that we cover in Week 10 will not be examinable. 

Week 10

We will look at finite differences for the Heat Equation. This completes the examinable written material.

In VBA we will implement same.

Week 11 — 2nd 20% VBA Assessment

In the 09:00 class we will have a revision session, geared towards the 20% VBA Assessment 2.

In the 12:00 class we will have a revision session, geared towards the 40% Written Assessment 2.

Formulae will be provided in the VBA 2 Assessment.

To understand how your student numbers generate constants (see below) see this VBA Test 2 from last year (do not read this as a sample – it included e.g. the Heat Equation which you will not be examined on and the Laplace’s Equation might be slightly simpler than what ye will have).

The VBA 20% Assessment 2 format will be as follows.

Q. 1. Boundary Value Problem with a Shooting Method

Specifically,

\displaystyle \frac{d^2M}{dx^2}=-w(x);    M(0)=0, M(L)=0,

for some w(x), L, and step-size h determined by your student number.

I want Euler Shooting Method approximations to M(x) for 0\leq x\leq L.

You can use:

  • An Excel Worksheet, or
  • Excel’s Goal Seek, or
  • A VBA program

but you have to use a Shooting Method (technically Goal Seek takes loads of shots so I am happy to call it a shooting method).

It is up to you to understand which method is easiest for you.

Example

Use a shooting method to solve the following with h=0.1:

\displaystyle \frac{d^2M}{dx^2}=-\cos (x/6), M(0)=0, M(6)=0.

Solution: The preliminary work is to turn this into a system of first order initial value problems. To do so introduce a new variable V for the first derivative (as it happens V is the shear).

Let \displaystyle \frac{dM}{dx}=V together with the initial value M(0)=0.

If V is the first derivative of M with respect to x then

\displaystyle \frac{dV}{dx}=\frac{d^2M}{dx^2}

so that we have

\displaystyle \frac{dV}{dx}=-\cos(x/6).

We have no initial value for V so we just guess for the moment… say V(0)=0.

Worksheet Solution

Please see the first worksheet of Shooting Method for Bending Moment (it will be emailed) for the implementation of Euler’s Method for the system:

\displaystyle \frac{dM}{dx}=V;     M(0)=0,

\displaystyle \frac{dV}{dx}=-\cos(x/6);     V(0)=?,

The first shot with V(0)=0\sim v_a produced M(6)\approx -16.3423\sim y_a, an undershoot (we are trying to get M(6)=0\sim y(x_1)).

We try again with a larger V(0), say V(0)=10\sim v_b. This produces an overshot of M(6)\approx 43.6576\sim y_b.

Now use equation (3.38) on p. 130 of the notes to find the correct V(0)\sim v(0):

\displaystyle v(0)= v_b+\frac{y(x_1)-y_b}{y_a-y_b}(v_a-v_b)

\displaystyle \Rightarrow V(0)=10+\frac{0-43.6576}{-16.3423-43.6576}(0-10)\approx 2.72372.

Now see the worksheet where the Euler Method is run with this value and the resulting graph (I am happy with just the values but if you can input the graph). Note this value of V(0) yields M(6)\approx 10^{-5}\approx 0 as required.

(Usually in engineering we plot M(x) underneath the x-axis… don’t worry about this.)

Goal Seek Solution

Very similar set-up to the previous except we don’t have to take any shots and instead ask Excel to try a load of shots.

See Worksheet 2 of Shooting Method for Bending Moment.

So perhaps just put V(0)=0 as a placeholder.

Now do Goal Seek (see p. 131). This produces V(0)\approx 2.72372178054585 and M(0)\approx 10^{-15}\approx 0.

VBA Solution

Again the set up is similar but we run the Euler Method via VBA.

See Worksheet 3 of Shooting Method for Bending Moment (or moreover the code behind the worksheet).

We have to take two shots and use equation (3.38) to get V(0)\approx 2.72372. Finally, we must run the program one more time.

Q. 2. Boundary Value Problem with Finite Differences

Specifically,

\displaystyle \frac{d^2T}{dx^2}+h'(T_a-T(x))=0;      T(0)=T_0 and T(L)=T_1

for some T_a, h', T_0, T_1 and L. These constants will be determined by your student number.

Use a Finite Difference Method with a mesh size \Delta x (determined by your student number) [Sample: Lab 7, p.134, Problem 2], to produce approximations to T(x) for 0\leq x\leq L.

I have actually sent ye an email on 11 April with a worked example of this.

Q. 3 Laplace’s Equation

Specifically,

\displaystyle \frac{\partial^2 T}{\partial x^2}+\frac{\partial^2 T}{\partial y^2}=0

for T(x,y) the temperature at the point (x,y) of a rectangular plate \mathcal{R} with boundary conditions given by T_{\partial \mathcal{R}}(x,y)=f(x,y), where \partial \mathcal{R} is the boundary/perimeter of the rectangular plate \mathcal{R}.

The boundary temperature f(x,y) will be given in terms of your student number.

The above equation, Laplace’s equation, can instead by framed as the Mean Value Property  which can be approximated using the ‘four adjacent gridpoint average’ once the rectangular plate is meshed using a \Delta x=\Delta y square grid.

Sample Question: Lab 7, Problem 1, P. 133

Week 12 — 40% Written Test

I have not yet decided the format of the 40% Written Test but am toying with the idea of splitting the Test in two.

The problem with this is that I can do the first part of the test at 09:00 on the Tuesday in B242 but A183L is too small to conduct an assessment in.

I might consider putting the second part of the test into your VBA slot.

To ensure some kind of fairness, this would work as follows:

The first part of the Test would take place at 09:00 . It would be designed to be easily completed in 30-40 minutes. It would be geared more towards theoretical questions.

The second part of the Test would take place in your VBA slot. I would have to tell you in advance what questions are coming up, e.g. maybe

  1. Q. 1 Second Order Problem Using Heun’s Method
  2. Q. 2 Euler Shooting Method
  3. Q. 3 Heat Equation

Each group would get questions with only minor variations from the sample questions. I will confirm this next week.

Study

Study should consist of

  • doing exercises from the notes
  • completing VBA exercises

Student Resources

Please see the Student Resources tab on the top of this page for information on the Academic Learning Centre, etc..

Advertisements