setExprFields floatingPointException evaluating log of variable
Summary
When using an expressing in setExprFields containing log of a variable it exits with a floating point exception.
Steps to reproduce
Run setExprFields using a an expression that contains log(variable)
Example case
Modify tutorials/compressible/rhoPimpleFoam/RAS/TJunctionAverage/system/setExprFieldsDict
so that the expression is:
expression
#{
300
+ log(radius)
#};
Additionally this also doesn't work:
expression
#{
300
+ log(10*radius)
#};
However this works correctly:
expression
#{
300
+ log(1/radius)
#};
What is the current bug behaviour?
Exits with a floating point exception when a strange set of criteria is met.
What is the expected correct behavior?
The variable is evaluated correctly and the correct field values are applied.
Relevant logs and/or images
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2006 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : _295eef47-20201012 OPENFOAM=2006 patch=201012
Arch : "LSB;label=32;scalar=64"
Exec : setExprFields
Date : Oct 21 2020
Time : 10:01:35
Host : chimera
PID : 18880
I/O : uncollated
Case : /****/TJunctionAverage
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Create mesh for time = 0
Time = 0
Modify field: T (type volScalarField) time=0
Expression:
>>>>
300
+ log(10*radius)
<<<<
Condition:
>>>>
(mag(pos() - vector(0.21,0,0.01)) < radius)
&& pos((pos() - vector(0.21,0,0.01)).y()) > 0
<<<<
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in /lib64/libpthread.so.0
#3 log in /lib64/libm.so.6
#4 Foam::log(Foam::Field<double>&, Foam::UList<double> const&) at ??:?
#5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::log<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ??:?
#6 ? at volumeExprLemonParser.cc:?
#7 Foam::expressions::volumeExpr::parser::parse(int, Foam::expressions::volumeExpr::scanToken*) at ??:?
#8 Foam::expressions::volumeExpr::scanner::process(std::string const&, unsigned long, unsigned long, Foam::expressions::volumeExpr::parseDriver&) at ??:?
#9 Foam::expressions::volumeExpr::parseDriver::parse(std::string const&, unsigned long, unsigned long) at ??:?
#10 ? at ??:?
#11 ? at ??:?
#12 __libc_start_main in /lib64/libc.so.6
#13 ? at ??:?
Floating point exception (core dumped)
Environment information
- OpenFOAM version : v2006
- Operating system : centoOS 7
- Hardware info : Intel E5-1620, 64GB RAM
- Compiler : gcc 4.8.5
OpenFOAM installed using the yum package manager as described in the release notes.
Possible fixes
Edited by Joshua Dyson