# Implicit vs Explicit

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

 January 29, 2017, 00:52 Implicit vs Explicit #1 New Member   rik houthuys Join Date: Jan 2017 Posts: 27 Rep Power: 9 Hello every one, My understanding of the difference between implicit and explicit methods is that (correct me if I'm wrong): In the explicit methods we use: d(Φ)/dt = F(Φ_n-1), where F(Φ_n-1) represents the spatial derivatives evaluated using the value of Φ in the previous time step which is known. This leads to an explicit formula to calculate Φ in the current time step. In the implicit methods we use: d(Φ)/dt = F(Φ_n), where F(Φ_n) represents the spatial derivatives evaluated using the value of Φ in the the current time step which is unknown. This leads to a system of equations which in the form of [A][Φ]=[b] which can be solved using direct or iterative solver to get the value of Φ in the current time step. So my question is: if we evaluate some term in RHS explicitly while other terms are calculated implicitly, i.e.: d(Φ)/dt = g(Φ_n-1)+h(Φ_n). While solving this equation iteratively should we use the value from the previous time step or the previous iteration to evaluate g(Φ_n-1)? Quasar_89 and granzer like this.

 January 29, 2017, 03:45 #2 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,777 Rep Power: 71 I am not sure about what you would perform.... I try to give you a general suggestion. Consider the continuous differential equation, valid for any time t. dΦ/dt = F(Φ) Now integrate between tn and tn+1 Φ(tn+1) - Φ(tn) = Int[tn,tn+1] F(Φ) dt That result is exact, no discretization being introduced. Now you can consider: explicit: the RHS is discretized using only value at tn (or previous values for multi-step method) fully implicit: the RHS is discretized using only value at tn+1 implicit: the RHS is discretized using values both at tn and tn+1 granzer likes this.

January 29, 2017, 04:48
#3
Senior Member

Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,152
Blog Entries: 29
Rep Power: 39
Quote:
 Originally Posted by Houthuys Hello every one, My understanding of the difference between implicit and explicit methods is that (correct me if I'm wrong): In the explicit methods we use: d(Φ)/dt = F(Φ_n-1), where F(Φ_n-1) represents the spatial derivatives evaluated using the value of Φ in the previous time step which is known. This leads to an explicit formula to calculate Φ in the current time step. In the implicit methods we use: d(Φ)/dt = F(Φ_n), where F(Φ_n) represents the spatial derivatives evaluated using the value of Φ in the the current time step which is unknown. This leads to a system of equations which in the form of [A][Φ]=[b] which can be solved using direct or iterative solver to get the value of Φ in the current time step. So my question is: if we evaluate some term in RHS explicitly while other terms are calculated implicitly, i.e.: d(Φ)/dt = g(Φ_n-1)+h(Φ_n). While solving this equation iteratively should we use the value from the previous time step or the previous iteration to evaluate g(Φ_n-1)?
If I got correctly what you meant, the main difference between the two approaches you are considering stems from the original nature of your equation.

If it is linear then there is no actual point to evaluate g at the previous time step or iteration. The only cases where you would do that are those in which g represents part of some backward time discretization. As you might have got, in this case you consider the previous time step, not the previous iteration.

For non linear equations you may have the same unsteady terms of the linear case, and the same as above applies. But you may also have terms which you can't just write exactly at the next time, because of the nonlinearity.

Nonlinearity is typically solved by adding outer iterations, which are different from the iterations used to solve the system.

In practice they are just needed to update all those non linear terms. You set up and solve your system (with inner linear iterations), update your non linear terms, go to the next outer iterations and solve again, etc. Once you converge in outer iterations you can actually go to the next time step.

To more concretely answer your question, non linear terms are never updated while solving the linear system itself (i.e., during the inner iterations) because it would mea changing the actual system while solving it and no method would work.

In practice, you can achieve something very similar to this by using only 1 inner iteration, which you understand that typically means not actually solving the system, with all its consequences.

 January 29, 2017, 05:02 #4 Senior Member     Paolo Lampitella Join Date: Mar 2009 Location: Italy Posts: 2,152 Blog Entries: 29 Rep Power: 39 Note that multigrid, used to solve the inner iterations, might somehow seem to escape this picture, as it is sltypically used with only 1 cycle for non linear problems. In practice, however, each multigrid cycle involves solving several linear systems with different matrices so, in practice, you are still solving the inner linear system with more than 1 iteration.

 January 29, 2017, 05:37 #5 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,777 Rep Power: 71 I still have doubt about the original question... it seems that the example of the Crank-Nicholson (diffusion) and Adams-Bashfort (convection) should be the best fit to the issue, isn't it?

January 29, 2017, 06:46
#6
Senior Member

Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,152
Blog Entries: 29
Rep Power: 39
Quote:
 Originally Posted by FMDenaro I still have doubt about the original question... it seems that the example of the Crank-Nicholson (diffusion) and Adams-Bashfort (convection) should be the best fit to the issue, isn't it?
Now that i read again the question, i might have gone too far.

I guess then that the answer is even more simple: if n is the time level, than that's it, it can't change with the linear system iterations, for which an additional iteration counter should be added for clarity, say, k.

 January 29, 2017, 10:49 #7 New Member     Join Date: Dec 2016 Posts: 14 Rep Power: 9 Simple difference is modelling unknow terms with help of know quantities is called implicit . Modelling unknown interms of another unknown is explicit Sent from my HTC Desire 526GPLUS dual sim using CFD Online Forum mobile app

 January 29, 2017, 13:16 #8 New Member   rik houthuys Join Date: Jan 2017 Posts: 27 Rep Power: 9 Thanks for you all for this enlightening reply and sorry if I made confusion. I, myself, confused. To make it more clear I will give an example of what I'm asking about. Consider solving the incompressible NSE. Usually this is done using a pressure-velocity decoupling algorithm, e.g. SIMPLE algorithm. In this algorithm the Momentum equation is solved first (momentum predictor) to obtain velocity field that satisfy the momentum equation but not the continuity equation. To solve this nonlinear equation we evaluate both pressure and face flux explicitly using values from previous iteration or initial guess. Then the pressure correction equation is solved to satisfy the continuity constrain. Then the velocity and pressure is corrected and we start over again. So in the momentum equation some terms (velocity components) are treated implicitly (as unknown) while other terms (pressure and face flux) are treated explicitly (as known). So, I just wondering, is it precise to call this solution implicit solution or not because some terms are evaluated in explicit way? Or this is totally different discussion. granzer likes this.

 January 29, 2017, 13:27 #9 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,777 Rep Power: 71 well, you should differentiate the implicit time scheme from the coupling in a system of PDE.... the terms implicit integration is just valid for a single PDE equation discretized in such a way that the algebric form is A. f_n+1= f_n.

January 30, 2017, 03:16
#10
Senior Member

Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,152
Blog Entries: 29
Rep Power: 39
Quote:
 Originally Posted by Houthuys So in the momentum equation some terms (velocity components) are treated implicitly (as unknown) while other terms (pressure and face flux) are treated explicitly (as known). So, I just wondering, is it precise to call this solution implicit solution or not because some terms are evaluated in explicit way? Or this is totally different discussion.
Well, this is a totally different matter. This only concerns the coupling among equations. There are several possibilities which go beyond the one cited by you (which, for example, is the default one in OF). As you can imagine, the coupling is fully implicit only if the equations are solved in a coupled fashion (1 larger system with momentum and pressure equations put together with the relative mixed coefficients in the matrix). Otherwise, it is explicit. SIMPLE actually stands for Semi-Implicit Method for Pressure-Linked Equations.

 January 31, 2017, 16:17 #11 Senior Member   Hector Redal Join Date: Aug 2010 Location: Madrid, Spain Posts: 243 Rep Power: 16 Hi, Is there any reference / book that explains what is the different between explicit / implicit and innter itteration vs outer itterations? I have Anderson's Book and Fletger's book. Is it explained in this references? BR

January 31, 2017, 16:30
#12
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,777
Rep Power: 71
Quote:
 Originally Posted by HectorRedal Hi, Is there any reference / book that explains what is the different between explicit / implicit and innter itteration vs outer itterations? I have Anderson's Book and Fletger's book. Is it explained in this references? BR

give also a look to Chap. 6 and 7 of the book of Peric & Ferziger

 February 1, 2017, 02:46 #13 Senior Member   Hector Redal Join Date: Aug 2010 Location: Madrid, Spain Posts: 243 Rep Power: 16 I have not access to Ferziger's book. I will look for the information in the Fletcher's book. I have taken a look at the Anderson's book, but the information appearing is reduced (not much more elaborated).

February 1, 2017, 07:04
#14
Senior Member

Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,152
Blog Entries: 29
Rep Power: 39
Quote:
 Originally Posted by HectorRedal Hi, Is there any reference / book that explains what is the different between explicit / implicit and innter itteration vs outer itterations? I have Anderson's Book and Fletger's book. Is it explained in this references? BR
I have none of the two, and i have never read them (for what matters). However, the matter is pretty simple. Consider the following code snippet taken from OF (there are several, but most of them employ exhotic approaches, this instead is pretty clear about the matter):

http://www.openfoam.com/documentatio...8C_source.html

In particular, just watch the lines 97-130.

The outermost loop is in time. You have this only for unsteady problems.

The next loop (lines 108-123) represents the so called "outer iterations". They handle non linearity, higher order discretizations (typically, for unstructured grids) and/or coupling among the equations.

Inner iterations refers instead to the iterations used to solve a linear system of equations, assuming of course that you are using some sort of iterative method to solve them, say, gauss-seidel.

If you look in the two files peqn.H and ueqn.H, they both assemble a specific linear system and solve it by inner iterations. Consider, for example, the pressure (file peqn.H, http://www.openfoam.com/documentatio...8H_source.html). At the lines 36-39 the system of equations for the pressure is assembled; at the line 43 it is solved. You don't actually see here the inner iterations because they are part of the method used to solve the linear system; they are just embedded in the command of line 43. Similar arguments also hold for the momentum equations (in UEqn.H).

For what concerns the coupling, in this case you have a segregated approach: the momentum (UEqn) is first advanced with the old (in terms of outer iterations) pressure, then the pressure is solved (pEqn) by using the new velocity field, and over and over again until convergence in outer iterations. You can notice this in the matrix assembly lines (e.g., lines 36-39 for the pressure): implicit terms are those with fvm, explicit ones (i.e., using last available values) are those with fvc.

Nonlinearity is here all embedded in the term phi, the mass flux, computed after the pressure equation, and kept frozen in the momentum equation.

The handling of high-order discretizations in this framework is difficult to explain to a novice. It is based on the deferred correction approach. Just get to it when you have a clearer picture.

One thing to highlight here is that nothing is ever updated between inner iterations. Just as nothing could be updated if a direct resolution method was used instead of an iterative one.

 February 2, 2017, 16:07 #15 New Member   rik houthuys Join Date: Jan 2017 Posts: 27 Rep Power: 9 Dear Paolo, Thank you so much. sbaffini likes this.

 February 3, 2017, 11:17 #16 Senior Member   Hector Redal Join Date: Aug 2010 Location: Madrid, Spain Posts: 243 Rep Power: 16 Hi Paolo, Thanks for your response. I think I have grasped a good picture of explicity and implicit techniques. Best regards, Hector. sbaffini likes this.