# Why decreasing time step makes diffusion more significant for diffusion equation?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 15, 2018, 13:29 Why decreasing time step makes diffusion more significant for diffusion equation? #1 Senior Member   Join Date: Oct 2017 Location: United States Posts: 233 Blog Entries: 1 Rep Power: 9 I am trying to solve a simple diffusion equation where a & b are some given constant, for the sake of simplicity, let's say they are both 1, and the spatial domain is [-1, 1] with periodic BC, the initial condition is numerical delta function . Solving this by simply using a naive schemes: When I compare results from different time step sizes, the smaller the time step size, the more diffusive it appears to be: the wave, or the delta function, spreads out much faster in space (smoothed out) when advance in time, with smaller time step size. But according to the scheme, lowering time step size will obviously reducing the 2nd-order derivative, i.e., the diffusion term, as well, thus it should have lead to less diffusion for smaller . So where does this conflict come from? Thx! Last edited by TurbJet; February 15, 2018 at 14:48.

 February 15, 2018, 14:18 #2 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,793 Rep Power: 71 Well, there are some issues to discuss. First, look at the local truncation error of your discretization: LTE=-0.5*dt*(a^2*d2u/dx^2-2*a*b*d3u/dx^3+b^2*d4u/dx^4) +... and, I am right, you have a higher order term in the form dx^3/dt (try to develop the LTE). Therefore, for fixed dx and vanishing dt you should get an increasing in the error. This is due to the fact that you need convergence for dx and dt going both to zero. Second, you cannot use a Dirac initial function to test such PDE as it is a non regular function.

February 15, 2018, 14:30
#3
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro Well, there are some issues to discuss. First, look at the local truncation error of your discretization: LTE=-0.5*dt*(a^2*d2u/dx^2-2*a*b*d3u/dx^3+b^2*d4u/dx^4) +... and, I am right, you have a higher order term in the form dx^3/dt (try to develop the LTE). Therefore, for fixed dx and vanishing dt you should get an increasing in the error. This is due to the fact that you need convergence for dx and dt going both to zero. Second, you cannot use a Dirac initial function to test such PDE as it is a non regular function.
I see your point. but I am not sure about your formula for LTE: it seems all terms are with , which still leads to decreasing with smaller . Maybe some minor mistake in it?

February 15, 2018, 14:42
#4
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
Quote:
 Originally Posted by TurbJet I see your point. but I am not sure about your formula for LTE: it seems all terms are with , which still leads to decreasing with smaller . Maybe some minor mistake in it? And could you tell me how you derive this formula?

I wrote only the term of O(dt), of course you have also terms of O(dx^2). The LTE is determined by substituting the Taylor expansion in time and space in your FTCS scheme. You can do it by hand, is a bit long to manage, or you can use Maple.

However, you cannot use the Dirac as initial condition and the study of the convergence requires to use dt/dx->0

February 15, 2018, 15:04
#5
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I wrote only the term of O(dt), of course you have also terms of O(dx^2). The LTE is determined by substituting the Taylor expansion in time and space in your FTCS scheme. You can do it by hand, is a bit long to manage, or you can use Maple. However, you cannot use the Dirac as initial condition and the study of the convergence requires to use dt/dx->0
Taylor series! How stupid I am !

Anyway, I wrote out the formula for LTE only with leading order terms (probably some mistakes in those coefficients):

so by lowering the time step size, the LTE for time derivative would not increase, but the LTE for spatial derivative will. So which means it will increase the spatial error, and it appears to be like diffusion.

Am I correct?

 February 15, 2018, 15:19 #6 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,793 Rep Power: 71 As you see, if dx is taken constant while dt is diminished, you have both a dispersion and dissipation effects. However, you should still expand d2u/dt^2 using the PDE equation

February 15, 2018, 15:24
#7
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro As you see, if dx is taken constant while dt is diminished, you have both a dispersion and dissipation effects. However, you should still expand d2u/dt^2 using the PDE equation
Yes, now everything is clear. But what do you mean by "expand using the PDE equation"? Do you actually mean by instead ?

February 15, 2018, 15:29
#8
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
Quote:
 Originally Posted by TurbJet Yes, now everything is clear. But what do you mean by "expand using the PDE equation"? Do you actually mean by instead ?
I mean to develop

d2u/dt^2= d/dt ( -a*du/dx+b*d2u/dx^2) = d/dx (-a*du/dt+b*d/dx(du/dt)) = ...

February 15, 2018, 15:34
#9
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I mean to develop d2u/dt^2= d/dt ( -a*du/dx+b*d2u/dx^2) = d/dx (-a*du/dt+b*d/dx(du/dt)) = ...
Oh~~, and then plug it back to the LTE formula derived above to replace the term, right?

February 15, 2018, 15:38
#10
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
Quote:
 Originally Posted by TurbJet Oh~~, and then plug it back to the LTE formula derived above to replace the term, right?

yes, there is some arrangement to manage...

February 15, 2018, 15:39
#11
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro yes, there is some arrangement to manage...
Gotcha. Thx very much. You have been really helpful !!

 February 15, 2018, 15:42 #12 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,793 Rep Power: 71 Again, you see that using the Taylor expansion requires the solution to be regular...

February 15, 2018, 15:49
#13
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro Again, you see that using the Taylor expansion requires the solution to be regular...
Um, theoretically speaking, yes. But when I actually ran it with discretized form of Dirac function, in this case, 2/dx, it did not show some wired behavior aside from strong diffusion....

February 15, 2018, 16:05
#14
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
Quote:
 Originally Posted by TurbJet Um, theoretically speaking, yes. But when I actually ran it with discretized form of Dirac function, in this case, 2/dx, it did not show some wired behavior aside from strong diffusion....
That's not exact. Your initial solution has still a spike in a point so that you cannot define the derivatives across it.
Also from a numerical point of view, on a grid of size h the smallest wavelength you can represent is 2*h and that requires to describe a sine by using at least three grid points.

February 15, 2018, 16:11
#15
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro That's not exact. Your initial solution has still a spike in a point so that you cannot define the derivatives across it. Also from a numerical point of view, on a grid of size h the smallest wavelength you can represent is 2*h and that requires to describe a sine by using at least three grid points.

I have been trying to manage all the terms, and here is what I get

but it seems the only affect those terms in the brackets; can't see any terms in the form of

I am confused again...

 February 15, 2018, 16:14 #16 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,793 Rep Power: 71 I should check all the procedure, I remember some further terms...

February 15, 2018, 16:22
#17
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I should check all the procedure, I remember some further terms...
I attach my derivation below. Please check it if you have time.

February 15, 2018, 16:23
#18
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I should check all the procedure, I remember some further terms...
Pic 1 derivation
Attached Images
 Screenshot from 2018-02-15 14:20:27.jpg (146.3 KB, 8 views)

February 15, 2018, 16:26
#19
Senior Member

Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I should check all the procedure, I remember some further terms...
pic 2 derivation
Attached Images
 Screenshot from 2018-02-15 14:23:50.png (95.7 KB, 9 views)

February 16, 2018, 12:25
#20
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
I checked in my old notes and I extracted the LTE expression, it appears clearly that, provided that the dx allows to get the Reynolds cell number <=2, you have a global positive diffusion coefficient.
Now the issue is that if you compare the solution at some time T, when you decreases the time step you need more iteration to reach that time and the error effects summ.
Attached Files
 LTE di FTCS.pdf (148.7 KB, 5 views)

 Tags diffusion equation, time step size