CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Floating point exception error !

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2016, 18:23
Default Floating point exception error !
  #1
New Member
 
Join Date: Sep 2012
Posts: 23
Rep Power: 13
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/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/opt/OpenFOAM/OpenFOAM-v1606+/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so"
#2 ? in "/lib64/libc.so.6"
#3 Foam::sqrt(Foam::Field<double>&, Foam::UList<double> const&) in "/opt/OpenFOAM/OpenFOAM-v1606+/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so"
#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/libc.so.6"
#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
(
IOobject
(
"S_X",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),

S_turb*Foam::sqrt(1.+tauTurbPrime/(runTime-tO)*(Foam::exp(-1.*(runTime-tO)/tauTurbPrime)-1.))

);

.........


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?

Tnx.
Zack
Zack is offline   Reply With Quote

Old   December 18, 2016, 04:43
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

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, 11:09
Default
  #3
New Member
 
Join Date: Sep 2012
Posts: 23
Rep Power: 13
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

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[General] 2 datas on one plot Akuji ParaView 46 December 1, 2013 14: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] Gmsh and samplesurface touf OpenFOAM Meshing & Mesh Conversion 2 December 10, 2007 02:27


All times are GMT -4. The time now is 12:14.