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

reasons for floating point error

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By cyss38

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 4, 2018, 08:03
Default reasons for floating point error
  #1
Senior Member
 
krishna kant
Join Date: Feb 2016
Location: Hyderabad, India
Posts: 133
Rep Power: 10
kk415 is on a distinguished road
I am getting problem in a very simple line in OF4.1


i.e. psifine += mag(psi0fine)/psi0fine;


where psi0fine and psifine are volScalarField


#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? at sigaction.c:?
#3 Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
#4 void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:perator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#6 ? at ??:?
#7 __libc_start_main at ??:?
#8 ? at ??:?
Floating point exception (core dumped)


Can anyone suggest what could be the possible cause for the error?
kk415 is offline   Reply With Quote

Old   October 4, 2018, 10:11
Default divide by zero
  #2
New Member
 
Eric Bringley
Join Date: Nov 2016
Posts: 14
Rep Power: 10
ebringley is on a distinguished road
is your psi0fine zero anywhere?
ebringley is offline   Reply With Quote

Old   October 4, 2018, 11:50
Default
  #3
Senior Member
 
krishna kant
Join Date: Feb 2016
Location: Hyderabad, India
Posts: 133
Rep Power: 10
kk415 is on a distinguished road
NOPE... I tried to print the values of psi0fine over the entire field. It is never zero. And the boundary condition is cyclic.
kk415 is offline   Reply With Quote

Old   October 4, 2018, 17:14
Default
  #4
Member
 
cyss38's Avatar
 
Cyrille Bonamy
Join Date: Mar 2015
Location: Grenoble, France
Posts: 86
Rep Power: 11
cyss38 is on a distinguished road
if i understand correctly, you want the sign of volScalarField.

So try this codeline :

psifine += sign(psi0fine);
kk415 likes this.
cyss38 is offline   Reply With Quote

Old   October 5, 2018, 08:12
Default
  #5
Senior Member
 
krishna kant
Join Date: Feb 2016
Location: Hyderabad, India
Posts: 133
Rep Power: 10
kk415 is on a distinguished road
Thanks that way is working
kk415 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
Building OpenFOAM1.7.0 from source ata OpenFOAM Installation 46 March 6, 2022 14:21
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 01:21
[blockMesh] error EOF in blockMesh Ahmed Khattab OpenFOAM Meshing & Mesh Conversion 7 May 17, 2012 01:37
CGNS lib and Fortran compiler manaliac Main CFD Forum 2 November 29, 2010 07:25
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51


All times are GMT -4. The time now is 03:25.