CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Linearization of implicit terms

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 15, 2012, 09:50
Default Linearization of implicit terms
  #1
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Hey,

If we discretize the (1d) heat equation implicitly. Is it possible to approximate some of the implicit terms using known values in time as follows

\frac{T^{n+1}_{i}-T^{n}_{i}}{\Delta} = \frac{\alpha}{(\Delta x)^{2}}\left( T_{i-1} - 2T_{i} + T_{i+1}\right)|^{n+1}

For the right hand side lets approximate all T^{n+1} as

T^{n+1}=2T^{n}-T^{n-1}

This yields an equation that has an explicit dependence. However, there does not seem to be any stability benefits of the approach over regular explicit discretization. Question is why
Simbelmynė is offline   Reply With Quote

Old   October 15, 2012, 11:35
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
FMDenaro will become famous soon enough
Quote:
Originally Posted by Simbelmynė View Post
Hey,

If we discretize the (1d) heat equation implicitly. Is it possible to approximate some of the implicit terms using known values in time as follows

\frac{T^{n+1}_{i}-T^{n}_{i}}{\Delta} = \frac{\alpha}{(\Delta x)^{2}}\left( T_{i-1} - 2T_{i} + T_{i+1}\right)|^{n+1}

For the right hand side lets approximate all T^{n+1} as

T^{n+1}=2T^{n}-T^{n-1}

This yields an equation that has an explicit dependence. However, there does not seem to be any stability benefits of the approach over regular explicit discretization. Question is why

what you have written corresponds to have a second derivative in time equated to zero at tn ...
I don't see why to do that, you have a simply linear algebraic system to solve with a Thomas algorithm...
FMDenaro is online now   Reply With Quote

Old   October 15, 2012, 13:08
Default
  #3
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
what you have written corresponds to have a second derivative in time equated to zero at tn ...
I don't see why to do that, you have a simply linear algebraic system to solve with a Thomas algorithm...
Hey, thank you for your reply. I am aware of how to solve the system implicitly, but I wish to solve it explicitly (not necessarily the 1d heat equation, but that is good enough for the example) and was thinking of ways to reduce the time-step constraint.

Let me put down the full equation:


\frac{T^{n+1}_{i}-T^{n}_{i}}{\Delta t} = \frac{\alpha}{(\Delta x)^{2}}\left( 2T^{n}_{i-1} - T^{n-1}_{i-1}- 2(2T^{n}_{i} - T^{n-1}_{i})+ T^{n}_{i+1} - T^{n-1}_{i+1} \right)

The above discretization works, but it is not any better than standard explicit discretization with regard to the time-step.
Simbelmynė is offline   Reply With Quote

Old   October 15, 2012, 13:26
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
FMDenaro will become famous soon enough
Quote:
Originally Posted by Simbelmynė View Post
Hey, thank you for your reply. I am aware of how to solve the system implicitly, but I wish to solve it explicitly (not necessarily the 1d heat equation, but that is good enough for the example) and was thinking of ways to reduce the time-step constraint.

Let me put down the full equation:


\frac{T^{n+1}_{i}-T^{n}_{i}}{\Delta t} = \frac{\alpha}{(\Delta x)^{2}}\left( 2T^{n}_{i-1} - T^{n-1}_{i-1}- 2(2T^{n}_{i} - T^{n-1}_{i})+ T^{n}_{i+1} - T^{n-1}_{i+1} \right)

The above discretization works, but it is not any better than standard explicit discretization with regard to the time-step.

if you force the second derivative in time to be zero, you are supposing simply a linear behavior of T between time step tn-1 and tn+1. That means the first derivative is approximated as a constant function (first order accurate). To get higher accuracy you have to use more accurate explicit schemes...
FMDenaro is online now   Reply With Quote

Old   October 15, 2012, 13:50
Default
  #5
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
if you force the second derivative in time to be zero, you are supposing simply a linear behavior of T between time step tn-1 and tn+1. That means the first derivative is approximated as a constant function (first order accurate). To get higher accuracy you have to use more accurate explicit schemes...
I don't think that I follow how I force the second derivative in time to be zero. What I did was approximate the original equation using a forward difference for the time derivative and assuming the space derivative is evaluated at time level (n+1). I then used a Taylor expansion to approximate T(n+1) and truncated after the second term (first derivative). I approximated the derivative using a backward difference. I am not interested in accuracy (yet) only stability.

When I look at the resulting difference equation it seems that for small time-steps it should correspond to standard explicit differencing, forward time centered space.
Simbelmynė is offline   Reply With Quote

Old   October 15, 2012, 14:54
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
FMDenaro will become famous soon enough
Quote:
Originally Posted by Simbelmynė View Post
I don't think that I follow how I force the second derivative in time to be zero. What I did was approximate the original equation using a forward difference for the time derivative and assuming the space derivative is evaluated at time level (n+1). I then used a Taylor expansion to approximate T(n+1) and truncated after the second term (first derivative). I approximated the derivative using a backward difference. I am not interested in accuracy (yet) only stability.

When I look at the resulting difference equation it seems that for small time-steps it should correspond to standard explicit differencing, forward time centered space.

I am not sure to understand what you are looking for...
Consider the differenzial equation:

dT/dt = alpha*d^2T/dx^2

that can be integrated in time as

Tn+1 - Tn = alpha* Int [tn, tn+1] d^2T/dx^2 dt

The LHS can be written by means of Taylor expansion as

Tn+1 - Tn = dt*|dT/dt|n + dt^2/2 * |d^2T/dt^2|n + ...

Then

Tn+1 - Tn = dt*alpha*|d^2T/dx^2|n + dt^2/2 * |d^2T/dt^2|n + ...

Now, you can use a Lax-Wendroff type procedure:
d^2T/dt^2 = d/dt (alpha*d^2T/dx^2)= alpha^2*d^4T/dx^4

This leads to a single-step second order accurate time-discretization that is explicit.

Your procedure (Tn+1=2*Tn-Tn-1) is equivalent to say that

(Tn+1 -2*Tn +Tn-1)/dt^2 = d^2T/dt^2 + O(dt^2) = 0

Therefore, you force that
d^2T/dt^2 = O(dt^2)
FMDenaro is online now   Reply With Quote

Old   October 15, 2012, 15:39
Default
  #7
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
I am not sure to understand what you are looking for...
Consider the differenzial equation:

dT/dt = alpha*d^2T/dx^2

that can be integrated in time as

Tn+1 - Tn = alpha* Int [tn, tn+1] d^2T/dx^2 dt

The LHS can be written by means of Taylor expansion as

Tn+1 - Tn = dt*|dT/dt|n + dt^2/2 * |d^2T/dt^2|n + ...

Then

Tn+1 - Tn = dt*alpha*|d^2T/dx^2|n + dt^2/2 * |d^2T/dt^2|n + ...

Now, you can use a Lax-Wendroff type procedure:
d^2T/dt^2 = d/dt (alpha*d^2T/dx^2)= alpha^2*d^4T/dx^4

This leads to a single-step second order accurate time-discretization that is explicit.

Your procedure (Tn+1=2*Tn-Tn-1) is equivalent to say that

(Tn+1 -2*Tn +Tn-1)/dt^2 = d^2T/dt^2 + O(dt^2) = 0

Therefore, you force that
d^2T/dt^2 = O(dt^2)
Thank you for the input. Perhaps what I try to do is not valid (but it still works ), here is some further explanation.

T^{n+1}_{i} = T^{n}_{i} + \left(\frac {\partial T}{\partial t}\right)^{n}_{i}\Delta t (1)

then approximate the \left(\frac {\partial T}{\partial t}\right)^{n}_{i} term as

\left(\frac {\partial T}{\partial t}\right)^{n}_{i} = \frac{T^{n}_{i} - T^{n-1}_{i}}{\Delta t} (2)

I don't know if this is a valid operation since we could just as well state from (1) that

\left(\frac {\partial T}{\partial t}\right)^{n}_{i} = \frac{T^{n+1}_{i} - T^{n}_{i}}{\Delta t} (3)

Anyways, (2) in (1) leads to

T^{n+1}=2T^{n}-T^{n-1}

I assume that the derivatives can be written using higher order approximations as you state.
Simbelmynė is offline   Reply With Quote

Old   October 15, 2012, 17:25
Default
  #8
Member
 
Shenren Xu
Join Date: Jan 2011
Location: London, U.K.
Posts: 63
Rep Power: 6
Shenren_CN is on a distinguished road
When you start writing those finite difference equations using \approx or using \equal but including the H.O.T. you'll find the subtle difference.

Quote:
Originally Posted by Simbelmynė View Post
Thank you for the input. Perhaps what I try to do is not valid (but it still works ), here is some further explanation.

T^{n+1}_{i} = T^{n}_{i} + \left(\frac {\partial T}{\partial t}\right)^{n}_{i}\Delta t (1)

then approximate the \left(\frac {\partial T}{\partial t}\right)^{n}_{i} term as

\left(\frac {\partial T}{\partial t}\right)^{n}_{i} = \frac{T^{n}_{i} - T^{n-1}_{i}}{\Delta t} (2)

I don't know if this is a valid operation since we could just as well state from (1) that

\left(\frac {\partial T}{\partial t}\right)^{n}_{i} = \frac{T^{n+1}_{i} - T^{n}_{i}}{\Delta t} (3)

Anyways, (2) in (1) leads to

T^{n+1}=2T^{n}-T^{n-1}

I assume that the derivatives can be written using higher order approximations as you state.
Shenren_CN is offline   Reply With Quote

Old   October 16, 2012, 03:17
Default
  #9
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by Shenren_CN View Post
When you start writing those finite difference equations using \approx or using \equal but including the H.O.T. you'll find the subtle difference.
I am sorry I have no idea what you mean with \approx or \equal in this context. Is it possible for you to show what you mean?

Thank you.
Simbelmynė is offline   Reply With Quote

Old   October 16, 2012, 03:24
Default
  #10
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
FMDenaro will become famous soon enough
Quote:
Originally Posted by Simbelmynė View Post
I am sorry I have no idea what you mean with \approx or \equal in this context. Is it possible for you to show what you mean?

Thank you.

I think he said that Eq.s (2) and (3) have to be written as approximation. If you use "equal to" then you have to explicitate the local truncation error, this way you will see what you are disregarding
FMDenaro is online now   Reply With Quote

Old   October 16, 2012, 04:53
Default
  #11
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
I think he said that Eq.s (2) and (3) have to be written as approximation. If you use "equal to" then you have to explicitate the local truncation error, this way you will see what you are disregarding
Ok, I might do this wrong because I don't see your point here, but here goes:


T^{n+1}_{i} = T^{n}_{i} + \left(\frac {\partial T}{\partial t}\right)^{n}_{i}\Delta t + HOT...O(\Delta t)^{2} (1)


T^{n-1}_{i} = T^{n}_{i} - \left(\frac {\partial T}{\partial t}\right)^{n}_{i}\Delta t + HOT...O(\Delta t)^{2} (2)

from (2) we get an expression

\left(\frac {\partial T}{\partial t}\right)^{n}_{i}\Delta t = T^{n}_{i} - T^{n-1}_{i} + HOT...O(\Delta t)^{2} (3)

(3) is inserted in (1)

T^{n+1}_{i} = T^{n}_{i} +T^{n}_{i} - T^{n-1}_{i} + HOT...O(\Delta t)^{2}

What am I supposed to see?
Simbelmynė is offline   Reply With Quote

Old   October 16, 2012, 09:46
Default
  #12
Senior Member
 
Join Date: Dec 2011
Location: Madrid, Spain
Posts: 133
Rep Power: 6
michujo is on a distinguished road
Hi, when they say to write down the higher order terms they mean to actually write them down:

T^{n+1}=T^n+\frac{dT}{dt}\cdot \Delta t+\frac{d^2T}{dt^2}\cdot\frac{(\Delta t)^2}{2}+\frac{d^3T}{dt^3}\cdot\frac{(\Delta t)^3}{6} +\mathcal{O}(\Delta t)^4 (1)

and

T^{n-1}=T^n-\frac{dT}{dt}\cdot \Delta t+\frac{d^2T}{dt^2}\cdot\frac{(\Delta t)^2}{2}-\frac{d^3T}{dt^3}\cdot\frac{(\Delta t)^3}{6} +\mathcal{O}(\Delta t)^4 (2)

Combining (1) and (2) one gets:

T^{n+1}+T^{n-1}=2T^n+\frac{d^2T}{dt^2}\cdot\frac{(\Delta t)^2}{2}+\mathcal{O}(\Delta t)^4

Here you see that the expression you came up with results from setting the second derivative to zero.

I hope it helps.

Cheers,
Michujo.
michujo is offline   Reply With Quote

Old   October 16, 2012, 18:08
Default
  #13
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by michujo View Post
Hi, when they say to write down the higher order terms they mean to actually write them down:

T^{n+1}=T^n+\frac{dT}{dt}\cdot \Delta t+\frac{d^2T}{dt^2}\cdot\frac{(\Delta t)^2}{2}+\frac{d^3T}{dt^3}\cdot\frac{(\Delta t)^3}{6} +\mathcal{O}(\Delta t)^4 (1)

and

T^{n-1}=T^n-\frac{dT}{dt}\cdot \Delta t+\frac{d^2T}{dt^2}\cdot\frac{(\Delta t)^2}{2}-\frac{d^3T}{dt^3}\cdot\frac{(\Delta t)^3}{6} +\mathcal{O}(\Delta t)^4 (2)

Combining (1) and (2) one gets:

T^{n+1}+T^{n-1}=2T^n+\frac{d^2T}{dt^2}\cdot\frac{(\Delta t)^2}{2}+\mathcal{O}(\Delta t)^4

Here you see that the expression you came up with results from setting the second derivative to zero.

I hope it helps.

Cheers,
Michujo.
Ok, thank you. To me it just says that I set the second derivative to zero if I wish to maintain fourth order accuracy.

However, being semi-smart I realize that after three people here trying to explain the phenomena I should have got it by now. I think that I will try tomorrow when the beer from the fantastic game between Germany and Sweden wears off (guess my nationality). Also, I do get some angry comments from the beautiful woman in the next room. Why does she not understand the fun of CFD?
Simbelmynė is offline   Reply With Quote

Old   October 17, 2012, 04:25
Default
  #14
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
I think I get your points now. Thank you.

For instance if I would have put

T^{n+1} = T^{n}

that would correspond to setting the first derivative to zero.

So, is it possible to express T^{n+1} in terms of known values?

Edit:

One more thing;

It is not uncommon to extrapolate values around boundaries using mean value over the boundary (same as above essentially).

T_{i-1} = 2T_{i} - T_{i+1}

So this also forces the second (space) derivative to be zero at the boundary, correct?

Last edited by Simbelmynė; October 17, 2012 at 05:14. Reason: More questions.
Simbelmynė is offline   Reply With Quote

Old   October 17, 2012, 05:38
Default
  #15
Senior Member
 
Join Date: Dec 2011
Location: Madrid, Spain
Posts: 133
Rep Power: 6
michujo is on a distinguished road
Hi, you could try a higher order discretization of your time derivative if you wish to increase time accuracy. Instead of discretizing the time derivative as:

\frac{\partial T}{\partial t}=\frac{T^{n+1}-T^n}{\Delta t}

you could try

\frac{\partial T}{\partial t}=\frac{3\cdot T^{n+1}-4\cdot T^n+T^{n-1}}{2\cdot \Delta t}

This expression is second order in time. The RHS of your equation is left untouched (fully implicit).

Cheers,
Michujo.

P.S: I took this scheme from Versteeg&Malalasekera, 2nd Edition, page 264.
michujo is offline   Reply With Quote

Old   October 17, 2012, 06:09
Default
  #16
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
FMDenaro will become famous soon enough
Quote:
Originally Posted by Simbelmynė View Post
I think I get your points now. Thank you.

For instance if I would have put

T^{n+1} = T^{n}

that would correspond to setting the first derivative to zero.

So, is it possible to express T^{n+1} in terms of known values?

Edit:

One more thing;

It is not uncommon to extrapolate values around boundaries using mean value over the boundary (same as above essentially).

T_{i-1} = 2T_{i} - T_{i+1}

So this also forces the second (space) derivative to be zero at the boundary, correct?
yes, such a condition is typical of an outflow BC for developed flows
FMDenaro is online now   Reply With Quote

Old   October 17, 2012, 06:44
Default
  #17
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
yes, such a condition is typical of an outflow BC for developed flows
Really? Isn't a zero gradient condition used in such cases?

I would rather use the above condition if the variables are given on the boundary and the computational nodes do not coincide with the boundary.

Anyways, could you explain why forcing the second derivative to be zero is a bad thing in my case? Since I am not concerned with accuracy and I truncate the second derivative term, it could be "over 9000" as far as I am concerned

Edit:

Perhaps you were referring to the zero gradient (1st order)

T^{n+1} = T^{n}

while my comment was about

T_{i-1} = 2T_{i} - T_{i+1}

Last edited by Simbelmynė; October 17, 2012 at 06:48. Reason: ;)
Simbelmynė is offline   Reply With Quote

Old   October 17, 2012, 10:41
Default
  #18
Senior Member
 
Join Date: Dec 2011
Location: Madrid, Spain
Posts: 133
Rep Power: 6
michujo is on a distinguished road
Hi, I did a stability analysis of your scheme (with the substitution of all the T^n+1 terms on the RHS by 2*T^n-T^n-1).

After a very long calculation I came up with the condition:

\frac{\alpha \cdot \Delta t}{(\Delta x)^2}<\frac{1}{6}

The scheme seems to be conditionally stable (as is the explicit scheme). However, the stability domain is reduced from \frac{\alpha \cdot \Delta t}{(\Delta x)^2}<\frac{1}{2} to \frac{\alpha \cdot \Delta t}{(\Delta x)^2}<\frac{1}{6}


You could check this behaviour in your code. I might have made some mistakes on the way, the calculation was a bit cumbersome.
In short: the trick you made does not help in the stability of the scheme, but rather it leads to a worse situation...

Did it help?

Cheers,
Michujo.
michujo is offline   Reply With Quote

Old   October 17, 2012, 13:08
Default
  #19
Senior Member
 
Join Date: May 2012
Posts: 109
Rep Power: 5
Simbelmynė is on a distinguished road
Quote:
Originally Posted by michujo View Post
Hi, I did a stability analysis of your scheme (with the substitution of all the T^n+1 terms on the RHS by 2*T^n-T^n-1).

After a very long calculation I came up with the condition:

\frac{\alpha \cdot \Delta t}{(\Delta x)^2}<\frac{1}{6}

The scheme seems to be conditionally stable (as is the explicit scheme). However, the stability domain is reduced from \frac{\alpha \cdot \Delta t}{(\Delta x)^2}<\frac{1}{2} to \frac{\alpha \cdot \Delta t}{(\Delta x)^2}<\frac{1}{6}


You could check this behaviour in your code. I might have made some mistakes on the way, the calculation was a bit cumbersome.
In short: the trick you made does not help in the stability of the scheme, but rather it leads to a worse situation...

Did it help?

Cheers,
Michujo.

Thank you this is in accordance with my own simulations (as stated in my original post).

So as usual, there are no shortcuts
Simbelmynė is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
linearization of k-e source terms khaiching Main CFD Forum 7 June 6, 2013 11:00
Implicit treatment of advection terms and pressure correction nikosb Main CFD Forum 0 January 17, 2010 17:07
Implicit or explicit treatment of convective terms CH Main CFD Forum 1 March 14, 2007 08:51
Point implicit treatment of k-e source terms andy Main CFD Forum 5 June 9, 2006 11:03
Implicit droplet source terms (SW70,71) Ossi Kaario CD-adapco 0 December 11, 2000 06:46


All times are GMT -4. The time now is 18:44.