Вы находитесь на странице: 1из 8

Time Evolution of a One-Dimensional Equation

Alikhan K. Shambul,
Nazarbayev University

Nomenclature
v
n
f
dt

=
=
=
=

viscosity
grid resolution
function of the fluid
time step

I. Introduction

his project demonstrates the application of Burgers equation and finite difference method in
MATLAB to examine the unstable behavior of solutions at different conditions for grid and time
step. The equation was considered in periodic domain of length 1 with viscosity v=0.01. Three
different resolutions were chosen and tested for stability considerations. Provided codes for linear
advection-diffusion equations were utilized via MATLAB to obtain the plots of solutions.
II. Procedure
At the very beginning the original equation was discretized by means of finite difference method in
order to obtain the solutions.

f
f
2 f
+f
=v 2 (1)
t
x
x
The following forms of central differences of space and forward differences of time were defined then
we substitute these values into equation (1) above.
n
n
f f j+1f j1
=
x
2h

f f j+12 f j + f j1
=
2
2
x
h
n +1
n
f f j f j
=
t
t

Therefore, the final form would be as follows and this form is used for the MATLAB code .
n
f n+1
j =f j

f t n
v t
f j+1f nj1) + 2 ( f nj+1 2 f nj +f nj1 )
(
2h
h

Three resolutions for grid n=40, n=100 and n=200 were chosen. For the resolution of n=200 which
represents the finest grid in our system the highest value of dt at which the solution will remain stable
have to be determined. Then the mentioned value of time step dt for the highest resolution would be

applicable for coarser grids. For the grid of n=200 the stability limit was defined to be at dt=0.00127
meaning that all solutions above this value showed to be unstable. Furthermore, the solutions for the
remaining two resolutions were plotted in order to understand the relation between time step and
resolution. After that the solutions of equation for resolution of n=100 were plotted at three different times
of 0.2508 s, 0.5004 s and 0.75 s respectively. Finally, two different resolutions for n=200 and n=100 were
tested for stability limits. Which was done by iterative approach of applying different values of dt and
monitoring the obtained plots until the instabilities represented by spikes and divergences were found.
III. Results and Discussion

Figure 1. Solution for n=40 at dt=0.00127

Figure 2. Solution for n=100 at dt=0.00127

Figure 3. Solution for n=200 at dt=0.00127

Figure 4. Solution for n=100 at dt=0.001127 and time 0.2508 seconds

Figure 5. Solution for n=100 at dt=0.001127 and time 0.5004 seconds.

Figure 6. Solution for n=100 at dt=0.001127 and time 0.75 seconds

Figure 7. Solution for n=200 at dt=0.00127 (top left), dt= 0.0011 (top right), dt=0.001 (bottom)

Figure 8. Solution for n=40 at dt=0.01 (top left), dt=0.008 (top right), dt=0.00127 (bottom)

Figure 9. Solution for n=100 at dt=0.00545 (top left), dt=0.0045 (top right), dt=0.0035 (bottom)

As it can be observed from the obtained plots above as the number of grid points increase the graph
becomes smoother. Also at higher resolutions the value of stability limit dt is smaller in comparison with
lower resolutions. Therefore it its convenient to apply the lower time step of highest resolution for coarser
grids and the solutions would still remain stable. Furthermore, the coarse grid with lower values of dt
does not provide us with the most accurate results as it was shown for n=40.

As for the stability limits, two resolutions were tested namely n=100 and n=200.

Figure 10. Unstable solution for n=100 at dt=0.0055 (higher than dt=0.00545)

Figure 11. Unstable solution for n=200 at dt=0.00128 (higher than dt=0.00127)
Finally, the stability limits for two grid resolutions of n=200 and n=100 were determined. The stability of
solution is connected to time step dt. As it can be observed from the obtained graphs above the stability
limits for n=100 and n=200 were found to be at dt=0.00545 and dt=0.00127 respectively. Meaning that in
cases of higher values of dt the solution would become unstable and as the dt increases further it will
finally diverge.
IV. Conclusion
The paper has demonstrated that the stability of solution is connected to resolution and time step.
According to the obtained results it was determined that the higher resolution values require smaller
values of dt for stability. In addition, the obtained stability limit for higher resolution is applicable for
lower resolutions and the solutions would still remain stable due to the fact that their stability limits
become higher as the resolution decreases. However, at lower resolutions the accuracy of results
decreases.

Appendix
Code used to obtained solutions for the Burgers equation. The value of n was changed for each different
resolution.

%onedimensionaladvetiondiffusionbytheFTCSscheme

n=201;
length=1.0;
dx=length/(n1);
dt=0.00127;
nstep=1/dt;
v=0.01;%viscosity

f=zeros(n,1);y=zeros(n,1);time=0.0;%matrices

fori=1:n,f(i)=sin(2*pi*dx*(i1))+1;%initialconditions

end;

form=1:nstep,m,time;

plot(f,'linewidt',2);axis([1n0,2]);%plotsolution

gridon

xlabel('n');

ylabel('f');

legend('Plotforresolutionn=200')

%pause;%plotexactsolution

y=f;

fori=2:n1,

f(i)=y(i)0.5*y(i)*(dt/dx)*(y(i+1)y(i1))+v*(dt/dx^2)*(y(i+1)2*y(i)
+y(i1));%advectbycentreddifferences

end;

f(n)=y(n)0.5*y(n)*(dt/dx)*(y(2)y(n1))+v*(dt/dx^2)*(y(2)2*y(n)+y(n
1));%doendpointsfor

f(1)=f(n);%periodicboundaries

time=time+dt

end

Вам также может понравиться