CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM

Floating point exception error !

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

Like Tree1Likes
  • 1 Post By alexeym

LinkBack Thread Tools Display Modes
Old   December 17, 2016, 19:23
Default Floating point exception error !
New Member
Join Date: Sep 2012
Posts: 23
Rep Power: 7
Zack is on a distinguished road
Hi All

I am modifying one of the solvers in v1606+... Compiling the new lines of the code does not show any error... But when I am running the test case, I am facing below error:

Calculating S_X

#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/OpenFOAM/OpenFOAM-v1606+/platforms/linux64GccDPInt32Opt/lib/"
#1 Foam::sigFpe::sigHandler(int) in "/opt/OpenFOAM/OpenFOAM-v1606+/platforms/linux64GccDPInt32Opt/lib/"
#2 ? in "/lib64/"
#3 Foam::sqrt(Foam::Field<double>&, Foam::UList<double> const&) in "/opt/OpenFOAM/OpenFOAM-v1606+/platforms/linux64GccDPInt32Opt/lib/"
#4 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::sqrt<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh>
onst&) in "/home/ofuser/OpenFOAM/ofuser-v1606+/platforms/linux64GccDPInt32Opt/bin/LTCFoam"
#5 ? in "/home/ofuser/OpenFOAM/ofuser-v1606+/platforms/linux64GccDPInt32Opt/bin/LTCFoam"
#6 __libc_start_main in "/lib64/"
#7 ? in "/home/ofuser/OpenFOAM/ofuser-v1606+/platforms/linux64GccDPInt32Opt/bin/LTFoam"
Floating point exception

My code lines:


//calculating S_X
Info<< "Calculating S_X \n" << endl;
volScalarField S_X




I know the problem is coming from dividing by zero but I still can not manage it! Any suggestion ? What is the proper way of using sqrt and exp functions?

Zack is offline   Reply With Quote

Old   December 18, 2016, 05:43
Senior Member
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,760
Rep Power: 29
alexeym will become famous soon enoughalexeym will become famous soon enough
Send a message via Skype™ to alexeym

No, problem is not division by zero (sigSpe is not necessarily caused by division by zero), it is square root of negative number.

Proper way to use sqrt is to check a sign of its parameter before calling function.
Zack likes this.
alexeym is offline   Reply With Quote

Old   December 18, 2016, 12:09
New Member
Join Date: Sep 2012
Posts: 23
Rep Power: 7
Zack is on a distinguished road
Hi Alexeym

Thank you. You are right. I did not pay attention to that! mag () after sqrt () solved the issue.
Zack is offline   Reply With Quote


Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 datas on one plot Akuji ParaView 46 December 1, 2013 15:06
Floating point error and divergence detected aannjj FLUENT 0 July 2, 2013 03:44
checking the system setup and Qt version vivek070176 OpenFOAM Installation 22 June 1, 2010 12:34
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50
Gmsh and samplesurface touf Open Source Meshers: Gmsh, Netgen, CGNS, ... 2 December 10, 2007 03:27

All times are GMT -4. The time now is 09:35.