CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   The infamous floating point exception (https://www.cfd-online.com/Forums/openfoam/72291-infamous-floating-point-exception.html)

thekay February 1, 2010 11:26

The infamous floating point exception
 
I tried to modify the sonicFoam solver and it went through wmake with no errors. When I run it, I get:

Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.6                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 1.6-f802ff2d6c5a
Exec  : mhdSonicFoam
Date  : Feb 01 2010
Time  : 16:22:49
Host  : stokes
PID    : 22919
Case  : /home/kay/OpenFOAM/OpenFOAM-1.6/my-projects/new-nozzle
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading thermophysical properties

Selecting thermodynamics package ePsiThermo<pureMixture<constTransport<specieThermo<eConstThermo<perfectGas>>>>>
Reading field T

Reading field U

Reading/calculating face flux field phi

Creating turbulence model

Selecting turbulence model type laminar

Starting time loop

Time = 1e-05

#0  Foam::error::printStack(Foam::Ostream&) in "/home/kay/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::sigFpe::sigFpeHandler(int) in "/home/kay/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  ?? in "/lib/libc.so.6"
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/home/kay/OpenFOAM/OpenFOAM-1.6/lib/linux64GccDPOpt/libOpenFOAM.so"
#4  void Foam::divide<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) in "/home/kay/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/mhdSonicFoam"
#5  Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::operator/<Foam::fvsPatchField, Foam::surfaceMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&) in "/home/kay/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/mhdSonicFoam"
#6  main in "/home/kay/OpenFOAM/OpenFOAM-1.6/applications/bin/linux64GccDPOpt/mhdSonicFoam"
#7  __libc_start_main in "/lib/libc.so.6"
#8  _start at /build/buildd/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:116
Floating point exception

Is this a problem of the solver itself, or BC or whatever?

Any help will be greatly appreciated. :confused:

ngj February 4, 2010 04:49

Hi Costas

It is very hard to say, as it is a custom solver, however look at error #4, and your are explicitly told that it has something to do with the division operator. You are probably dividing by zero somewhere in the source.

Bests,

Niels

raghu.tejaswi June 4, 2012 03:48

Hi every1,

any concrete solution to the above problem? I have almost a similar problem but a little different. I am posting the failure below..

Create time

Create fluid mesh for region fluid for time = 0

Create solid mesh for region aluminium for time = 0

*** Reading fluid mesh thermophysical properties for region fluid

Adding to thermoFluid

Selecting thermodynamics package hsRhoThermo<pureMixture<constTransport<specieTherm o<hConstThermo<perfectGas>>>>>
#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 __restore_rt at sigaction.c:0
#3 Foam::hsRhoThermo<Foam::pureMixture<Foam::constTra nsport<Foam::specieThermo<Foam::hConstThermo<Foam: :perfectGas> > > > >::calculate() in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#4 Foam::hsRhoThermo<Foam::pureMixture<Foam::constTra nsport<Foam::specieThermo<Foam::hConstThermo<Foam: :perfectGas> > > > >::hsRhoThermo(Foam::fvMesh const&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#5 Foam::basicRhoThermo::addfvMeshConstructorToTable< Foam::hsRhoThermo<Foam::pureMixture<Foam::constTra nsport<Foam::specieThermo<Foam::hConstThermo<Foam: :perfectGas> > > > > >::New(Foam::fvMesh const&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#6 Foam::basicRhoThermo::New(Foam::fvMesh const&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#7 main in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/bin/chtMultiRegionSimpleFoam"
#8 __libc_start_main in "/lib64/libc.so.6"
#9 Foam::regIOobject::writeObject(Foam::IOstream::str eamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/bin/chtMultiRegionSimpleFoam"
Fließkommafehler

I tried the 'unset' fro $FOAM_SIGFPE but doesnt seem to work at all.
Any ideas? IS there a problem with the libraries or the installation?

gschaider June 4, 2012 04:58

Quote:

Originally Posted by raghu.tejaswi (Post 364575)
Hi every1,

any concrete solution to the above problem? I have almost a similar problem but a little different. I am posting the failure below..

Create time

Create fluid mesh for region fluid for time = 0

Create solid mesh for region aluminium for time = 0

*** Reading fluid mesh thermophysical properties for region fluid

Adding to thermoFluid

Selecting thermodynamics package hsRhoThermo<pureMixture<constTransport<specieTherm o<hConstThermo<perfectGas>>>>>
#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 __restore_rt at sigaction.c:0
#3 Foam::hsRhoThermo<Foam::pureMixture<Foam::constTra nsport<Foam::specieThermo<Foam::hConstThermo<Foam: :perfectGas> > > > >::calculate() in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#4 Foam::hsRhoThermo<Foam::pureMixture<Foam::constTra nsport<Foam::specieThermo<Foam::hConstThermo<Foam: :perfectGas> > > > >::hsRhoThermo(Foam::fvMesh const&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#5 Foam::basicRhoThermo::addfvMeshConstructorToTable< Foam::hsRhoThermo<Foam::pureMixture<Foam::constTra nsport<Foam::specieThermo<Foam::hConstThermo<Foam: :perfectGas> > > > > >::New(Foam::fvMesh const&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#6 Foam::basicRhoThermo::New(Foam::fvMesh const&) in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/lib/libbasicThermophysicalModels.so"
#7 main in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/bin/chtMultiRegionSimpleFoam"
#8 __libc_start_main in "/lib64/libc.so.6"
#9 Foam::regIOobject::writeObject(Foam::IOstream::str eamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const in "/opt/openfoam/OpenFOAM-2.0.1/platforms/linux64GccDPOpt/bin/chtMultiRegionSimpleFoam"
Fließkommafehler

I tried the 'unset' fro $FOAM_SIGFPE but doesnt seem to work at all.
Any ideas? IS there a problem with the libraries or the installation?

If you're developing a new solver you should have a debug-version as well. Because there the stack-trace will give you the actual line numbers in the source where the problem occurred and then it is almost trivial to spot the problem. See for instance http://openfoamwiki.net/index.php/Ho...on_of_OpenFOAM and http://openfoamwiki.net/index.php/Ma...roubleshooting

Nevertheless when I look at the stacktrace my guess is that we're looking at the "YouCan'tHavePressureZeroInACompressibleCase"-problem (so it is a setup problem)

So: start the compilation of a Debug-version. While that is compiling you'll have time to look at your initial conditions ...

raghu.tejaswi June 4, 2012 05:28

Thank you for your response Mr.gschaider .... I am not trying to write a sovler myself, nut unfortunately I am receivng the same error as the one stated above, one of the reasons why I posted my situation here.

I use chtMultiRegionSimpleFoam as the std solver without modifications and also I use an incompressible case. I will definitely try with the debug version

gschaider June 4, 2012 18:24

Quote:

Originally Posted by raghu.tejaswi (Post 364595)
Thank you for your response Mr.gschaider .... I am not trying to write a sovler myself, nut unfortunately I am receivng the same error as the one stated above, one of the reasons why I posted my situation here.

I use chtMultiRegionSimpleFoam as the std solver without modifications and also I use an incompressible case. I will definitely try with the debug version

Didn't read the poster name so I thought you were the guy who was starting the thread. Things like that are the reason why hijacking threads ("Ah. That looks vaguely like my problem. I'll post here") is not very popular: it breaks the "flow" of the conversation.

Your problem may look similar but is not the same as the other: the stack trace is not the problem but a tool to help find the location of the actual problem and your stack trace and the one of the original poster show totally different locations in the important frames #3 and #4

newOFuser August 13, 2012 16:08

Hi raghu

were you able to get rid of the floating point exception? what was the problem?

Thanks
ak

raghu.tejaswi August 14, 2012 02:01

Quote:

Originally Posted by newOFuser (Post 376888)
Hi raghu

were you able to get rid of the floating point exception? what was the problem?

Thanks
ak

Hi newOFUser

if you are refering to the problem I stated (please have a look at the stack trace once again as suggested by gschaider), then the solution to that is to input the perfect boundary conditions for temperature (if constant wall heat flux doesnt work, try constant wall temperature) in 0 folder. And please make doubly sure how the thermophysical properties have to be used (the syntax too).

And yes, my problem is solved by doing the above. If all the above does not work, try to reduce the under-relaxation factor for temp.


All times are GMT -4. The time now is 20:53.