You are on page 1of 10

HOMEWORK REPORT

AE305 - NUMERICAL METHODS


AEROSPACE ENGINEERING DEPARTMENT

Homework #1
Team #Y
Authors:
Name of student A (Id: )
Name of student B (Id: )
Name of student C (Id: )

Date: October 22, 2018

1
1 Introduction
Radioactive atoms decays in time because of their unstable nucleus. It is not valid to talk about
half-life of a single atom, however when they stay together with sufficient amount of mass, there are
characteristic probability of time to decay to half of the mass for different elements. It is called half-
life of atoms.

In this study, we are going to examine the half-life of Cobalt-60. The half-life for this element is
5.2714 years. Below, the formula to calculate the half-life of atoms is given.
𝑡
𝑁𝑡 = 𝑁0 ∗ 𝑒 −𝜏 ... (1)
𝑇1
2
𝜏 = 𝑙𝑛2 … (2)

Where, 𝑁𝑡 is final amount of mass, 𝑁0 is initial mass and t is elapsed time.


𝑇1 is half-life of the atoms and in our case it is 5.2714 years.
2
𝑇1
2 5.2714
So, 𝜏 = 𝑙𝑛2 = = 7.605 years
𝑙𝑛2

And, the mass at time ‘t’ is calculated using below formula:


𝑡
𝑁
𝑁𝑡′ = − ( 𝜏0 ) ∗ 𝑒 −𝜏 … (3)

Applying numerical solutions (Euler’s method, Heun’s method, RK2 method) on this formula, we
calculated the half-life of Cobalt-60. Those solutions were compared to each other and analytical
solution. Step-size effect on the solutions and relative errors were also examined in this study.

2 Method
Describe the numerical methods used. State the necessary equations. Here is how you insert an
equation:
𝜕𝑣
+ 𝑽 ⋅ 𝜵𝑣 = 𝜓 + 𝛱 − 𝛷…(1)
𝜕𝑡
Where 𝑣 is the eddy viscosity, 𝑽 is the velocity vector. The terms on the right hand side of
Equation 1 represent diffusion, production and destruction, respectively.
--- next section must start in a new page ---

2
2 Results and Discussion
Numerical solutions are obtained and plotted for Euler’s method, Heun’s method, RK2 method
and they are compared to analytical solution in same graph for different step-sizes. The plots are
shown below.

Figure 1: comparison of each solutions with step-size 0.2

Figure 2: comparison of each solutions with step-size 0.5

3
Figure 3: comparison of each solutions with step-size 1

As it is seen in the gprahs, Euler’s method gives the less accurate result. Because the mass is
decreasing, the effect of slope causes Euler’s method underestimate the result and find less amount
of mass compared to exact solution. Although, the other methods have some errors too, as expected,
they gave more accurate results. Apparently, Heun’s methods give more accurate result than RK2
method with p=0.4 in our case.

Increasing the step size causes Euler’s method to give even less accurate result where the others
are still close to exact solution.

Relative error data was also plotted and shown below.

4
Figure 4: relative errors for step-size 0.2

Figure 5: relative errors with step-size 0.5

5
Figure 6: relative errors with step-size 1

It is seen that relative errors increasing with bigger step-sizes for all methods. So, for more
accurate results, the step-sizes must be reduced.

To obtain a close relative error between Euler’s method and Heun’s method, we decreased the
step-size of the Euler’s method gradually. It is concluded that when we use step-size 0.022 for
Euler’s method, the relative error is very close, about the same compared to Heun’s method with
step-size 1. The result is shown below in Figure 7.

Figure 7: step-size comparison between Heun's and Euler's methods

6
3.1 e.g. Write the method name
Here are some examples of tables (see Table 1), and figures (see Figure 1, Figure 2).

Table 1: Every table needs a caption on top.


x (m) V (m/s)

0.045 20.1

0.216 50.4

0.365 64.2

0.831 108.7

Figure 1: Every figure MUST have a caption. This is an example of good plot.

7
Results should be presented in compact graphs with proper, readable legends and captions (see
Figure 1). Keep your figures and plots at a reasonable size, make sure that they have
explanatorylegends. Avoid the common mistakes in preparing graphs (see Figure 2). Again, do not
include numerical data tables!

Figure 2: This is an example of bad plot.

After each finding (e.g. figure), do not forget to explain what you observe in that specific result
briefly. Save your general conclusions and comparisons to the conclusion section.

3.1 e.g. Write the other method name


Here is another subsection.

4 Conclusion
Finally, conclude your study with comparisons and discussions considering your results.
Conclusion section should be about HALF a page.

-- DO NOT PUT YOUR CODE IN THE REPORT --


You will submit your code as a separate plain text file on ODTUCLASS.

figure

8
plot(time_year_02_an,exactmass_02_an,'-k',time_year_02_eu,eu_02,'--
k',time_year_02_heun,heun_02,':k',time_year_02_rk2,rk2_02,'-.k')

title('Analytical and numerical solutions of half-life of Cobalt with stepsize


0.2')
xlabel('Time(year)')
ylabel('Mass(kg)')
legend('analytical','euler','heun','rk2')

figure
plot(time_year_05_an,exactmass_05_an,'-k',time_year_05_eu,eu_05,'--
k',time_year_05_heun,heun_05,':k',time_year_05_rk2,rk2_05,'-.k')

title('Analytical and numerical solutions of half-life of Cobalt with stepsize


0.5')
xlabel('Time(year)')
ylabel('Mass(kg)')
legend('analytical','euler','heun','rk2')

figure
plot(time_year_1_an,exactmass_1_an,'-k',time_year_1_eu,eu_1,'--
k',time_year_1_heun,heun_1,':k',time_year_1_rk2,rk2_1,'-.k')

title('Analytical and numerical solutions of half-life of Cobalt with stepsize


1')
xlabel('Time(year)')
ylabel('Mass(kg)')
legend('analytical','euler','heun','rk2')

figure
plot(time_year_02_eu,error_02_eu,'-k',time_year_02_heun,error_02_heun,'--
k',time_year_02_rk2,error_02_rk2,':k')

title('Comparison of relative errors with stepsize 0.2')


xlabel('Time(year)')
ylabel('Mass(kg)')
legend('euler','heun','rk2')

figure
plot(time_year_05_eu,error_05_eu,'-k',time_year_05_heun,error_05_heun,'--
k',time_year_05_rk2,error_05_rk2,':k')

title('Comparison of relative errors with stepsize 0.5')


xlabel('Time(year)')
ylabel('Mass(kg)')
legend('euler','heun','rk2')

figure
plot(time_year_1_eu,error_1_eu,'-k',time_year_1_heun,error_1_heun,'--
k',time_year_1_rk2,error_1_rk2,':k')

title('Comparison of relative errors with stepsize 1')


xlabel('Time(year)')

9
ylabel('Mass(kg)')
legend('euler','heun','rk2')

figure
plot(time_year_eu_0022,error_eu_0022,'-k',time_year_1_heun,error_1_heun,'--k')

title('error comparison of heun and euler method with stepsize 0.022')


xlabel('Time(year)')
ylabel('Mass(kg)')
legend('euler','heun')

figure
plot(time_year_02_an,exactmass_02_an,'-k',time_year_1_heun,heun_1,':k')

title('Maximum stepsize for convergent solution (1)')


xlabel('Time(year)')
ylabel('Mass(kg)')
legend('analytical','heun')

figure
plot(time_year_05_an,exactmass_05_an,'-
k',time_year_05_heun,heun_05,':k',time_year_05_rk2,rk2_05,'-.k')

title('Analytical vs Heun vs RK2 of half-life of Cobalt with stepsize 0.5')


xlabel('Time(year)')
ylabel('Mass(kg)')
legend('analytical','heun','rk2')

figure
plot(time_year_05_heun,error_05_heun,'--k',time_year_05_rk2,error_05_rk2,':k')

title('Comparison of relative errors of Heun and RK2 with stepsize 0.5')


xlabel('Time(year)')
ylabel('Mass(kg)')
legend('heun','rk2')
figure
plot(time_it_5,error_it_5,'-k',time_it_20,error_it_20,'--
k',time_it_100,error_it_100,':k')

title('RK2 iteration comparison at stepsize 0.1')


xlabel('Time(year)')
ylabel('Mass(kg)')
legend('5 iteration','20 iteration','100 iteration')

10

You might also like