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

Floating point exception error !

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

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Display Modes
Old   December 17, 2016, 19:23
Default Floating point exception error !
  #1
New Member
 
Join Date: Sep 2012
Posts: 23
Rep Power: 6
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, 05:43
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,652
Rep Power: 27
alexeym will become famous soon enoughalexeym will become famous soon enough
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, 12:09
Default
  #3
New Member
 
Join Date: Sep 2012
Posts: 23
Rep Power: 6
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

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 00:42.