- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **How nonlinear discretised equations are linearised in OpenFoam**
(*https://www.cfd-online.com/Forums/openfoam-solving/60167-how-nonlinear-discretised-equations-linearised-openfoam.html*)

Hi,
I am a new user to OpenFOHi,
I am a new user to OpenFOAM (and to CFD methods as well :D). After going through the user's and programmer's guide, I notice that these manuals don't give information on linearisation method. i.e. when one uses discretisation method for all the terms in a equation, what we get is a non-linear (but discretised) algebraic equation (if u've steady state). How is this equation linearised to get the standard form Ax=b? I've been looking for this in Fluent as well, which also doesn't give any information. I suspect that a newton form of method is used, to arrive at the linearised form, because after that one can use krylov subspace methods to avoid calculating the jacobian exactly and getting matrix vector products instead. If Krylov methods are not used in OpenFOAM, how is the jacobian calculated (by algorithmic differenciation/any other method which I don't know)?? Ashish |

Most CFD codes (OpenFOAM and tMost CFD codes (OpenFOAM and the segregated solver in FLUENT included) do not use Newton-type linearizations for nonlinear terms. The linearization approach is based on Patankar's SIMPLE algorithm. Most any CFD book will give an good discussion of this approach. Essentially, nonlinear terms in convection use lagged values for the mass/volume flux. In OpenFOAM, you can see this as the explicit construction of the phi flux field, that is then used for all convective terms which (for momentum, at least) are nonlinear terms.
Other terms, say nonlinear source terms, are linearized in a modified Newton fashion. Typically, the source terms are expanded in a Talyor series about the old iteration/timestep value and yields a constant term that goes into the b vector and a linear term (proportional to the field value) that goes on the diagonal of A. I say this is a modified Newton form because it doesn't use full Jacobian data...only the derivative of the source function with respect to the solved variable at hand. Dependencies on other field variables are evaluated based on old iteration/timestep values. That brings up an essential feature of CFD codes based on SIMPLE and its variants. Each field variable is solved one at a time rather than in a fully coupled way. This is necessary and effective for a variety of reasons, but the biggest reason was (and still is) the memory requirements and solution difficulties associated with a full-sized sparse matrix that includes all field variables. There are certainly other CFD approaches that do either linearized yet fully coupled solution of all of the field variables (FLUENT's coupled solver, CFX5 solver). Other's directly apply the Newton linearization and invert the full Jacobian or (more efficiently) build approximate Jacobian data and seeks solutions using Krylov methods. The latter are called Matrix-Free Newton-Krylov (MFNK) methods and are in the process of being developed. Right now, none of these coupled approaches are being done in any of the OpenFOAM solvers to my knowledge. The full-Jacobian/linearized coupled schemes will require a block solver infrastructure that OpenFOAM doesn't have yet. The MFNK methods could be implemented using existing OpenFOAM capabilities, but I've not seen anyone do that. Good luck. |

Thanks Micheal,
I think this Thanks Micheal,
I think this helps me a lot. |

All times are GMT -4. The time now is 19:29. |