# Linearization of implicit terms

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

 October 15, 2012, 09:50 Linearization of implicit terms #1 Senior Member   Join Date: May 2012 Posts: 109 Rep Power: 5 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 For the right hand side lets approximate all as 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

October 15, 2012, 11:35
#2
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
Quote:
 Originally Posted by Simbelmynė 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 For the right hand side lets approximate all as 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...

October 15, 2012, 13:08
#3
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by FMDenaro 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:

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

October 15, 2012, 13:26
#4
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
Quote:
 Originally Posted by Simbelmynė 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: 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...

October 15, 2012, 13:50
#5
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by FMDenaro 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.

October 15, 2012, 14:54
#6
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
Quote:
 Originally Posted by Simbelmynė 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)

October 15, 2012, 15:39
#7
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by FMDenaro 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.

(1)

then approximate the term as

(2)

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

(3)

Anyways, (2) in (1) leads to

I assume that the derivatives can be written using higher order approximations as you state.

October 15, 2012, 17:25
#8
Member

Shenren Xu
Join Date: Jan 2011
Location: London, U.K.
Posts: 63
Rep Power: 6
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ė Thank you for the input. Perhaps what I try to do is not valid (but it still works ), here is some further explanation. (1) then approximate the term as (2) I don't know if this is a valid operation since we could just as well state from (1) that (3) Anyways, (2) in (1) leads to I assume that the derivatives can be written using higher order approximations as you state.

October 16, 2012, 03:17
#9
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by Shenren_CN 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.

October 16, 2012, 03:24
#10
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
Quote:
 Originally Posted by Simbelmynė 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

October 16, 2012, 04:53
#11
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by FMDenaro 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:

(1)

(2)

from (2) we get an expression

(3)

(3) is inserted in (1)

What am I supposed to see?

 October 16, 2012, 09:46 #12 Senior Member   Join Date: Dec 2011 Location: Madrid, Spain Posts: 133 Rep Power: 6 Hi, when they say to write down the higher order terms they mean to actually write them down: (1) and (2) Combining (1) and (2) one gets: Here you see that the expression you came up with results from setting the second derivative to zero. I hope it helps. Cheers, Michujo.

October 16, 2012, 18:08
#13
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by michujo Hi, when they say to write down the higher order terms they mean to actually write them down: (1) and (2) Combining (1) and (2) one gets: 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?

 October 17, 2012, 04:25 #14 Senior Member   Join Date: May 2012 Posts: 109 Rep Power: 5 I think I get your points now. Thank you. For instance if I would have put that would correspond to setting the first derivative to zero. So, is it possible to express 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). 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.

 October 17, 2012, 05:38 #15 Senior Member   Join Date: Dec 2011 Location: Madrid, Spain Posts: 133 Rep Power: 6 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: you could try 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.

October 17, 2012, 06:09
#16
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
Quote:
 Originally Posted by Simbelmynė I think I get your points now. Thank you. For instance if I would have put that would correspond to setting the first derivative to zero. So, is it possible to express 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). 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

October 17, 2012, 06:44
#17
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by FMDenaro 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)

Last edited by Simbelmynė; October 17, 2012 at 06:48. Reason: ;)

 October 17, 2012, 10:41 #18 Senior Member   Join Date: Dec 2011 Location: Madrid, Spain Posts: 133 Rep Power: 6 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: The scheme seems to be conditionally stable (as is the explicit scheme). However, the stability domain is reduced from to 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.

October 17, 2012, 13:08
#19
Senior Member

Join Date: May 2012
Posts: 109
Rep Power: 5
Quote:
 Originally Posted by michujo 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: The scheme seems to be conditionally stable (as is the explicit scheme). However, the stability domain is reduced from to 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

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post khaiching Main CFD Forum 7 June 6, 2013 11:00 nikosb Main CFD Forum 0 January 17, 2010 17:07 CH Main CFD Forum 1 March 14, 2007 08:51 andy Main CFD Forum 5 June 9, 2006 11:03 Ossi Kaario CD-adapco 0 December 11, 2000 06:46

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