CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to solve Floating point exception error (https://www.cfd-online.com/Forums/openfoam/115969-how-solve-floating-point-exception-error.html)

mmkr825 April 10, 2013 08:17

How to solve Floating point exception error
 
Hi 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"
#1  Foam::sigFpe::sigHandler(int) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2  Uninterpreted:
#3  in "/lib/i386-linux-gnu/libm.so.6"
#4  pow in "/lib/i386-linux-gnu/libm.so.6"
#5  Foam::pow(Foam::Field<double>&, Foam::UList<double>  const&, double const&) in  "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#6  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField,  Foam::volMesh> > Foam::pow<Foam::fvPatchField,  Foam::volMesh>(Foam::tmp<Foam::GeometricField<double,  Foam::fvPatchField, Foam::volMesh> > const&,  Foam::dimensioned<double> const&) at  /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricScalarField.C:273
#7 
 at /opt/openfoam211/src/OpenFOAM/lnInclude/GeometricScalarField.C:349
#8  __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#9 
 in "/home/malli_reddy/OpenFOAM/malli_reddy-2.1.1/platforms/linuxGccDPOpt/bin/SBM25Foam"
Floating point exception

Even the geometry pass the checkMesh test. Could someone please help me to understand though my solver is steady state why it is grid dependent. Thanks in advance.

Regards
Reddy

erichu April 10, 2013 08:47

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.

mmkr825 April 11, 2013 04:28

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

atmcfd April 12, 2013 22:10

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:

 
 -DFULLDEBUG -g -O0

to the end of the EXE_INC = \ in your options file.

Let me know if this works.

good luck,
Atm

mmkr825 April 13, 2013 03:16

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

atmcfd April 13, 2013 17:25

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.

mmkr825 April 16, 2013 05:28

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:
attempt to read beyond EOF

file: /home/malli_reddy/OpenFOAM/malli_reddy-2.1.1/run/caseFile4/system/fvSchemes::divSchemes::div(Epnn1) at line 32.

    From function ITstream::read(token&)
    in file db/IOstreams/Tstreams/ITstream.C at line 83.

FOAM exiting

Could you please explain me why it is giving the above error. Thanks in advance.

Regards
M Reddy

atmcfd April 16, 2013 14:39

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

mmkr825 April 18, 2013 09:22

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 08:47.