Anda di halaman 1dari 6

Nguyn Anh Quang

CFD_Assignment 1

V1002583_HK10VP

Assignment 1
The differences of the results of a simple differential equation
given by three different approximating methods:
Forward Euler, Backward Euler and Trapezoidal Rule
I.

Introduction

As we all know, Forward Euler, Backward Euler and Trapezoidal Rule are some
of the methods could be used to find the solution of differential equations which has time
integration. However, the solutions of these methods, like many other methods, contain
errors comparing to the analytical result.
df
f
In this assignment, using a simple equation dt
, we will find these errors, as
f 0 1

well as the relationship of the error with t (the gap between the points in the timeline,
we use this t to divide the continuous time into discrete time).

II.

Results of 3 numerical methods

A.
Forward Euler Method
Figure 1 indicates the relationship between t and the numerical results using
Forward Euler. With different t values, such as t=0.125 (blue line), t=0.25 (black
line) and t=0.5 (green line), we have separated distances to the true result (red line). The
Y-axis of the figure is the value of f, while the X-Axis represents the timeline.

Figure 1: The differences of Forward Euler Results with different t

Nguyn Anh Quang

CFD_Assignment 1

V1002583_HK10VP

The true result of our equation should be f t et .From the above figure, we can have
two conclusions:
The smaller the value of t, the smaller the gap between the numerical result and
the analytical one. It means that the Error E f numerical _ method t ftrue t shares the
same trend with t. When t reaches 0, we would have a continuous timeline,
which is our analytical solution f t et
No matter what is the value of t, the numerical solution at a specific time t is
always smaller than the true value at the same time. As can be seen from the
graph, all of the other curves are always under the red curve.
These conclusions can be explained easily. For the first one, it is naturally that the more
points we have to describe a continuous curve, the more exact the curve would be. If we
have a small enough value for t, we would get a curve which looks likely to the
analytical solution. This relationship will be discussed particularly in chapter III. For the
second conclusion, we can find the explanation from the basic concept of Forward Euler
Method, and it will not be mentioned further in this report.

B.
Backward Euler
Figure 2 shows the relationship between t and the numerical results using
Backward Euler. With different t values, in this case, t=0.125 (blue line), t=0.25
(black line) and t=0.5 (green line), we have separated gaps to the true result (red line).
The Y-axis of the figure indicates the value of f, while the X-Axis represents the timeline.

Figure 2: The differences of Backward Euler Results with different t

Nguyn Anh Quang

CFD_Assignment 1

V1002583_HK10VP

From figure 2, we also have two conclusions:


Like Forward Euler results, the smaller the value of t, the closer the gap between
the Backward Euler result and the analytical one. When t reaches 0, we will have
a continuous result, which is our analytical solution f t et
No matter what is the value of t, the numerical solution at a specific time t is
always bigger than the true value at the same time. As can be seen from the graph,
all of the other curves are always above the red curve.
We will present more about the relationship between t and the result in the next part of
this report

C.
Trapezoidal Rule
Figure 3 shows the same results with the two above figures, but this time we use
the Trapezoidal Rule to approximate the solutions.

Figure 3: The differences of Trapezoidal Rule Results with different t

With Trapezoidal Rule Method, we have quite a few differences comparing to figure 1
and 2. It is obviously that Trapezoidal Rule gives the results much closer to the analytical
one. In this case, we cannot indicate the 3 curves, the one with t=0.125, the one with
t=0.25 and the true one. They seem to collapse to each other.

Nguyn Anh Quang

CFD_Assignment 1

V1002583_HK10VP

III. Relationship between t and the errors E at a specific time


(t=2.5)
This part of the report will focus on the error E f numerical _ method t ftrue t at a
specific time value, in this case t=2.5, and see what would happen if the value of t
increases or decreases.
As can be seen from figure 4, the bigger the value of t, the bigger the Error E.
Using the equation E f nm 2.5 exp t , we determined the Error at t=2.5 (Y-axis) with
various values of t (X-axis). The errors of Trapezoidal Rule (black dots), as can be seen
in advance from figure 3, are really small; meanwhile, the errors of Forward Euler (green
squares) and Backward Euler (red x) seem to have the same trend, and they increase
gradually along with t.

Figure 4: Different Errors with different t

Figure 4 already indicated the relationship of t and error at t=2.5. Nevertheless,


we need to find a way to describe this relationship with mathematical equation. Figure 5
below has done that task with a very simple solution. This time, we draw a graph shows
the relationship between log(E) (Y-axis) and log(1/ t) (X-axis), using the same symbols
with figure 4.

Nguyn Anh Quang

CFD_Assignment 1

Figure 5: Relationship between log(E) and log(1/

V1002583_HK10VP

t) at t=2.5

One again, it is clear that Forward Euler and Backward Euler share the same trend,
and from figure 6, we get the equation of these lines
log Y A log X

log Y B 2 log X

with A and B are constants depending on the curve. Therefore, the red line representing
for the Euler Methods has the slope of -1, meanwhile, the black line of Trapezoidal Rule
has the slope of -2.

Figure 6: Identify the slope of two lines

Nguyn Anh Quang

CFD_Assignment 1

V1002583_HK10VP

As mentioned in part I of this report, Trapezoidal Rule Method gives us the more
precise result comparing to Forward Euler and Backward Euler Method at the same value
of t. Moreover, from figure 6 we can also get the conclusion that the approximating
method which has the bigger slope in the log(E)-log(1/ t) graph will have the closer
result to the analytical solution.

*Reference
[1]Nguyn Ch Cng, Finite Difference Approximations-I, Department of Aerospace
Engineering, Ho Chi Minh University of Technology, 2010

Anda mungkin juga menyukai