|
[Sponsors] |
December 17, 2016, 18:23 |
Floating point exception error !
|
#1 |
New Member
Join Date: Sep 2012
Posts: 23
Rep Power: 13 |
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 |
|
December 18, 2016, 04:43 |
|
#2 |
Senior Member
|
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. |
|
December 18, 2016, 11:09 |
|
#3 |
New Member
Join Date: Sep 2012
Posts: 23
Rep Power: 13 |
Hi Alexeym
Thank you. You are right. I did not pay attention to that! mag () after sqrt () solved the issue. |
|
|
|
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 |