VBA Assessment 1 & Written Assessment 1 – Results

I have been very ill over the last two weeks but have gotten some meds from the doctor and hope to get these back to you ASAP.

Weeks 8 & 9

I missed the 09:00 class on the Tuesday of Week 8 with illness.

In the afternoon, we did two examples: of the Shooting Method and of Finite Differences (for the temperature along a rod). Please see Shooting_and_FiniteDifferences_Examples.

In Week 9, we started looking at partial differential equations by looking at Laplace’s Equation.

In VBA, in Week 8 we had MCQ VI and we did the Boundary Value Problems lab.

In VBA, in Week 9 we did the Laplace Equation Lab (which also had some 1-d boundary value stuff). I will email on a VBA file of the 1-D finite differences problem.

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 2017 (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 the shooting method equation 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 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 the shooting method equation 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, Problem 2], to produce approximations to $T(x)$ for $0\leq x\leq L$.

I will send on 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,

Week 12 — 40% Written Test

The 40% Written Assessment will be broken up into two parts.
• Theory Element Tuesday 30 April 09:00 (30 minutes worth but given an hour).

• Calculation Element in your Week 12 VBA time, (45 minutes worth but given an hour and 45 minutes)

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