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

Floating Point Exception -after adding a filter

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 29, 2014, 02:21
Default Floating Point Exception -after adding a filter
  #1
Member
 
Thamali
Join Date: Jul 2013
Posts: 55
Rep Power: 5
Thamali is on a distinguished road
Dear Foamers,
I am running a case with a solver developed by me for packed bed wood chip combustion.My problem is when the input radiation temperature is increased to about 1100K the iterations stop around 2600 with a floating point exception.According to the error it is in the following equation;

Code:
volScalarField rCH4=AG*exp(-AF/tg)*pow(YCH4*rho/(16*pow(scalar(10),-3)),0.7)*pow(YO2*rho/(32*pow(scalar(10),-3)),0.8);
  • as i figured out "YO2" values become (-)ve in the last iteration.
  • But i have added following filter before the equation.
Code:
forAll(YO2,cellI)
            {if (YO2[cellI]<0.0)
                YO2[cellI]=1.0e-60;
                           }
still the floating point exception occurs at same iteration.
  • "YCH4" and "rho" has not become zero.
the error shown is
Code:
#0  Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OSspecific/POSIX/printStack.C:221
#1  Foam::sigFpe::sigHandler(int) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OSspecific/POSIX/signals/sigFpe.C:117
#2   in "/lib/x86_64-linux-gnu/libc.so.6"
#3   in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::pow(double, double) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/doubleFloat.H:78
#5  Foam::pow(Foam::Field<double>&, Foam::UList<double> const&, double const&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/fields/Fields/scalarField/scalarField.C:118 (discriminator 2)
#6  void Foam::pow<Foam::fvPatchField>(Foam::FieldField<Foam::fvPatchField, double>&, Foam::FieldField<Foam::fvPatchField, double> const&, double const&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/scalarFieldField.C:94 (discriminator 2)
#7  void Foam::pow<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensioned<double> const&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/GeometricScalarField.C:275
#8  
 at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/GeometricScalarField.C:328
#9  
 at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/GeometricScalarField.C:350
#10  
 at ~/OpenFOAM/thamali-2.2.2/applications/solvers/my_fireFoam14dryDiffwithPfilterschanged/UEqn.H:145 (discriminator 3)
#11  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#12  
 at ??:?
Floating point exception (core dumped)

can someone tell me any thing wrong in the filter or what my problem would be??

Last edited by Thamali; May 29, 2014 at 02:31. Reason: adding error
Thamali is offline   Reply With Quote

Old   May 29, 2014, 03:50
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,698
Rep Power: 27
ngj will become famous soon enoughngj will become famous soon enough
Hi Thamali,

The only thing I see is that Y02 can be allowed to be 0, which should not be a problem. However, whenever I have this type of problem, I always go for a little bit more conservative solution:

Code:
if (Y02[cellI] < SMALL)
{
    Y02[cellI] = SMALL;
}
Furthermore, I have noticed the computation of static values, e.g.:

Code:
16.0*Foam::pow(scalar(10), -3)
I would suggest simply to either recompute this value before hand and insert a variable or simply hard-code 0.016. This will safe you a little bit of computations.

Finally, I would recommend that you always add

Code:
Foam::
in front of e.g. pow, sin, cos, exp, etc, to make sure that the compiler knows that you want to use the OF-overloaded functions and not those from the std:: namespace.

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 29, 2014, 03:51
Default
  #3
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,698
Rep Power: 27
ngj will become famous soon enoughngj will become famous soon enough
P.S. You can also use
Code:
 VSMALL
as call name.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 29, 2014, 05:17
Default
  #4
Member
 
Thamali
Join Date: Jul 2013
Posts: 55
Rep Power: 5
Thamali is on a distinguished road
First of all,thank you very much for your reply.

Yeah I edited the code as you mentioned,but it still my problem remains.
I don't get why this "Floating Point Exception" error still occurring,after the filter is added.
When I check the values of "YO2" using "write()" function,it shows the VSMALL(1e-300) value,but why that value is not taking in to account of calculating rCH4 in the next step?? (This problem occurs at only one point)

Code:
volScalarField rCH4=AG*exp(-AF/tg)*Foam::pow(YCH4*rho/0.016,0.7)*Foam::pow(YO2*rho/0.032,0.8)
or this is not the real error,although it shows like;
Code:
#0  Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OSspecific/POSIX/printStack.C:221
#1  Foam::sigFpe::sigHandler(int) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OSspecific/POSIX/signals/sigFpe.C:117
#2   in "/lib/x86_64-linux-gnu/libc.so.6"
#3   in "/lib/x86_64-linux-gnu/libm.so.6"
#4  Foam::pow(double, double) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/doubleFloat.H:78
#5  Foam::pow(Foam::Field<double>&, Foam::UList<double> const&, double const&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/fields/Fields/scalarField/scalarField.C:118 (discriminator 2)
#6  void Foam::pow<Foam::fvPatchField>(Foam::FieldField<Foam::fvPatchField, double>&, Foam::FieldField<Foam::fvPatchField, double> const&, double const&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/scalarFieldField.C:94 (discriminator 2)
#7  void Foam::pow<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensioned<double> const&) at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/GeometricScalarField.C:275
#8  
 at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/GeometricScalarField.C:328
#9  
 at ~/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/GeometricScalarField.C:350
#10  
 at ~/OpenFOAM/thamali-2.2.2/applications/solvers/my_fireFoam14dryDiffwithPfilterschanged/UEqn.H:135 (discriminator 3)
#11  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#12  
 at ??:?
Floating point exception (core dumped)
I am stuck,please help??

Last edited by Thamali; May 29, 2014 at 05:18. Reason: error
Thamali is offline   Reply With Quote

Old   May 29, 2014, 09:05
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,698
Rep Power: 27
ngj will become famous soon enoughngj will become famous soon enough
You could try to evaluate each term with an Info statement in between. This will narrow it down to which of the two pow, which cause the problem.

Thereafter, you can look at the values of the fields, which go wrong and the whole argument, e.g. by use of the write() method of volField<Type>.

Could it be that your values at thw boundaries become negative? If you do not use correctBoundaryConditions() method after the filter, then zeroGradient type boundary conditions will still hold the original value of the internal field.

Good luck,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   May 30, 2014, 02:36
Default
  #6
Member
 
Thamali
Join Date: Jul 2013
Posts: 55
Rep Power: 5
Thamali is on a distinguished road
Dear Niels,

HTML Code:
Could it be that your values at thw boundaries become negative? If you  do not use correctBoundaryConditions() method after the filter, then  zeroGradient type boundary conditions will still hold the original value  of the internal field.
You were right.It is (-)ve in the boundary condition.So,i tried to solve the problem using a groovyBC as one of the following methods;

Code:
interFace
    {
       
    type        groovyBC;
    valueExpression        "1e-25";
    gradientExpression    "0";
    fractionExpression    "(internalField(YO2) == 1e-25) ? 1 : 0";
    value        0.2314;
    }
Code:
interFace
    {
        
    type        groovyBC;
    valueExpression        "1e-25";
    gradientExpression    "0";
    fractionExpression    "(internalField(YO2) <0) ? 1 : 0";
    value        0.2314;
    }
Code:
interFace
    {
         
    type        groovyBC;
    valueExpression        "1e-25";
    gradientExpression    "0";
    fractionExpression    "(YO2 <0) ? 1 : 0";
    value        0.2314;
    }
But nothing worked.Still the value is (-)ve.
Do you see anything wrong??

Thanks in advance.
Regards,
Thamali
Thamali is offline   Reply With Quote

Old   May 30, 2014, 04:57
Default
  #7
Member
 
Thamali
Join Date: Jul 2013
Posts: 55
Rep Power: 5
Thamali is on a distinguished road
ok.I added the following just after the filter in the solver and it worked.

Code:
YO2.correctBoundaryConditions();
Thank you very much Neils.
Thamali
Thamali is offline   Reply With Quote

Old   May 30, 2014, 05:04
Default
  #8
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,698
Rep Power: 27
ngj will become famous soon enoughngj will become famous soon enough
You are welcome. Good that it worked.

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj 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
Floating point exception with pimpleDyMFoam ebah6 OpenFOAM Running, Solving & CFD 8 May 13, 2013 09:01
Inlet Velocity Profile BC - Floating Point exception during solution initialization Janshi STAR-CCM+ 4 March 14, 2012 11:21
simpleFoam Floating point exception error -help sudhasran OpenFOAM Running, Solving & CFD 3 March 12, 2012 17:23
Pipe flow in settlingFoam floating point exception jochemvandenbosch OpenFOAM Running, Solving & CFD 4 February 16, 2012 04:24
block-structured mesh for t-junction Robert@cfd ANSYS Meshing & Geometry 20 November 11, 2011 05:59


All times are GMT -4. The time now is 18:32.