CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Why decreasing time step makes diffusion more significant for diffusion equation? (https://www.cfd-online.com/Forums/main/198717-why-decreasing-time-step-makes-diffusion-more-significant-diffusion-equation.html)

TurbJet February 15, 2018 13:29

Why decreasing time step makes diffusion more significant for diffusion equation?
 
I am trying to solve a simple diffusion equation

\partial_{t}u + a\partial_{x}u = b\partial_{xx}u

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 u^{0} = \delta(x-0) = \frac{1}{\Delta x}.

Solving this by simply using a naive schemes:

u^{n+1}_{i} = u^{n}_{i} - a\Delta t\frac{u^{n}_{i+1} - u^{n}_{i-1}}{2\Delta x} + b\Delta t\frac{u^{n}_{i+1} - 2u^{n}_{i} + u^{n}_{i-1}}{\Delta x^{2}}

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 \Delta t will obviously reducing the 2nd-order derivative, i.e., the diffusion term, as well, thus it should have lead to less diffusion for smaller \Delta t.

So where does this conflict come from?

Thx!:D

FMDenaro February 15, 2018 14:18

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.

TurbJet February 15, 2018 14:30

Quote:

Originally Posted by FMDenaro (Post 681632)
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 \frac{\Delta t}{\Delta x}, which still leads to decreasing with smaller \Delta t. Maybe some minor mistake in it?

FMDenaro February 15, 2018 14:42

Quote:

Originally Posted by TurbJet (Post 681634)
I see your point. but I am not sure about your formula for LTE: it seems all terms are with \frac{\Delta t}{\Delta x}, which still leads to decreasing with smaller \Delta t. 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

TurbJet February 15, 2018 15:04

Quote:

Originally Posted by FMDenaro (Post 681636)
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):

LTE \approx -\Delta tu_{tt} - \frac{\Delta x^{2}}{3}u_{xxx} + \frac{\Delta x^{2}}{12}u_{xxxx} = \Delta t(-u_{tt} - \frac{\Delta x^{2}}{3\Delta t}u_{xxx} + \frac{\Delta x^{2}}{12\Delta t}u_{xxxx})

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?

FMDenaro February 15, 2018 15:19

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

TurbJet February 15, 2018 15:24

Quote:

Originally Posted by FMDenaro (Post 681642)
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 u_{tt} using the PDE equation"? Do you actually mean by u_{xx} instead u_{tt}?

FMDenaro February 15, 2018 15:29

Quote:

Originally Posted by TurbJet (Post 681643)
Yes, now everything is clear. But what do you mean by "expand u_{tt} using the PDE equation"? Do you actually mean by u_{xx} instead u_{tt}?

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)) = ...

TurbJet February 15, 2018 15:34

Quote:

Originally Posted by FMDenaro (Post 681645)
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 u_{tt} term, right?

FMDenaro February 15, 2018 15:38

Quote:

Originally Posted by TurbJet (Post 681646)
Oh~~, and then plug it back to the LTE formula derived above to replace the u_{tt} term, right?


yes, there is some arrangement to manage...

TurbJet February 15, 2018 15:39

Quote:

Originally Posted by FMDenaro (Post 681647)
yes, there is some arrangement to manage...

Gotcha. Thx very much. You have been really helpful !!

FMDenaro February 15, 2018 15:42

Again, you see that using the Taylor expansion requires the solution to be regular...

TurbJet February 15, 2018 15:49

Quote:

Originally Posted by FMDenaro (Post 681649)
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....

FMDenaro February 15, 2018 16:05

Quote:

Originally Posted by TurbJet (Post 681650)
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.

TurbJet February 15, 2018 16:11

Quote:

Originally Posted by FMDenaro (Post 681652)
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 see your point.

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

LTE \approx -0.5 * \Delta t(a^{2}u_{xx} - abu_{xxx} + b^{2}u_{xxxx}) - \frac{a\Delta x^{2}}{6}u_{xxx} + \frac{b\Delta x^{2}}{12}u_{xxxx} + ...

but it seems the \Delta t only affect those terms in the brackets; can't see any terms in the form of \frac{\Delta x}{\Delta t}

I am confused again...

FMDenaro February 15, 2018 16:14

I should check all the procedure, I remember some further terms...

TurbJet February 15, 2018 16:22

Quote:

Originally Posted by FMDenaro (Post 681656)
I should check all the procedure, I remember some further terms...

I attach my derivation below. Please check it if you have time.

TurbJet February 15, 2018 16:23

1 Attachment(s)
Quote:

Originally Posted by FMDenaro (Post 681656)
I should check all the procedure, I remember some further terms...

Pic 1 derivation

TurbJet February 15, 2018 16:26

1 Attachment(s)
Quote:

Originally Posted by FMDenaro (Post 681656)
I should check all the procedure, I remember some further terms...

pic 2 derivation

FMDenaro February 16, 2018 12:25

1 Attachment(s)
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.


All times are GMT -4. The time now is 04:37.