- **OpenFOAM**
(*http://www.cfd-online.com/Forums/openfoam/*)

- - **How to solve Floating point exception error**
(*http://www.cfd-online.com/Forums/openfoam/115969-how-solve-floating-point-exception-error.html*)

How to solve Floating point exception errorHi Foamers,
I am doing simulations on 2D rectangular channel by using steady state solver. I prepared my solver by modifying "simpleFoam" solver. The dimensions (length*breadth) of the channel are 0.143*0.0017 (m). My geometry has 500*10 grids in x- and y- directions respectively. When i run my solver with 500*10 grids, it is giving good results. But when I refine grids or increase the dimensions of the channel, It is giving the following error. Error:Code:
`#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"` Regards Reddy |

I had a similar problem just a couple of days ago. I found that if I refine the mesh I get problems with vortices that causes the sovler to abort.
Are you running with turbulence models? In that case, try lowering relaxation factors, i.e. for k and epsilon. You can also save every iteration and later on analyse flow vectors (U) the last steps before the crash using Paraview and a glyph filter. |

Dear Erichu,
Thanks for your quick reply. I am running with laminar flow only. As you noticed, i saved each iteration data and found the values are tending to infinite. I also tried by lowering relaxation factors but the same result. Could you please suggest me is anything should i change? Thanks M Reddy |

Hey mmkr,
though I am not able to exactly point out the root cause, one thing I can suggest is "bounding" the solution values in your fvSchemes file. Usually this works for RANS turbulence models when the k and epsilon values overshoot often to cause sigFpe. You may try something like that. And if you are not sure which parameter to bound, you have to compile the code in debug mode. Here your error appears in a pow() operation....Compiling in the debug mode will actually give you the exact line number in your solver and associated header files, which will make it easier for you to trace the parameter causing the issue. If I remember right, to compile in debug mode you need to add Code:
` ` Let me know if this works. good luck, Atm |

Dear Atm,
Thanks for your response. I compiled my code in debug mode and found the exact line number which causing the errors. In my solver after few iterations the values for the field T (let say) tends to very high value (O(10^39)). Moreover i have one more parameter "f" which is pow(T) and this operation causing the error. Could you please tell me how to bound this in "fvSchemes" file. Thanks M Reddy |

Hi M. Reddy,
The 10^39 squared will give you a number very high which causes the sigFpe. I guess bounding should work here, but I am not sure of the parameters since you are running a steady state case. You may actually try using flux limiters to bound the values, and this feature is there in OpenFOAM. In case you are running turbulence, I would suggest bounding scalar k and epsilon values as Code:
`div(phi,k) Gauss limitedVanLeer <lower limit> <Upper limit>;` The choice of schemes here can be changed. However, to get a complete idea of how bounding can be done, refer to this thread http://www.cfd-online.com/Forums/ope...g-epsilon.html Also, bounding scalars which are part of the modeling scheme is more advisable than bounding state variables like velocity etc, since that might lead to huge errors due to continuity equation. |

Dear Atm,
Thank you very much for your valuable information. I would like to explain in more detail about my solver. In my solver i have three field variables (p, U & T) and it is steady and the flow is laminar. I modified "simpleFoam" to fit my needs (I commented the lines where turbulent related terms are present). Since in my solver i am using shear rate term good initial guess for the velocity is necessary. I plotted the residuals plots. For the field variable "T", the residual plot has oscillations and the residuals are increasing gradually. At present i am using "Gauss linear" for the div operations. As you suggested i tried to change the div schemes to "Gauss upwind" but the following error is coming. Error:Code:
`--> FOAM FATAL IO ERROR: ` Regards M Reddy |

Dear M Reddy,
the EOF refers to the code trying to read beyond the "end of file" looking for an identifier, or an OpenFOAM option, which you might have missed. most of the time this happens due to incorrect declaration of numerical schemes - Did you miss including a "Gauss" or a "phi" somewhere? Please check the OF website for the settings and makes sure this is consistent. If thats fine, check if you have not missed a ";" at the end of the statement. These are the most common causes in my experience. Atm |

Dear Atm,
I corrected the error but still after few iterations the solution is diverging. For the first few iterations the solution seems qualitatively OK but as the iterations increases the values for the field "T" going beyond bounds. Physically the solution for T should be in between (0, 0.68). When T value exceeds 0.68 it is diverging. I didn't encounter this problem for coarser mesh. Could you please tell me how to bound T in between (0, 0.68). Thanks M Reddy |

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