View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002889 | OpenFOAM | Bug | public | 2018-03-26 01:28 | 2018-03-26 16:04 |
Reporter | SamMallinson | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Unix | OS | Debian | OS Version | buster |
Fixed in Version | dev | ||||
Summary | 0002889: #calc converts all variables to float | ||||
Description | #calc is a great way to perform simple calcs on the fly, and thus avoid hand calculation errors However, I have noticed a strange behaviour when I use variables that have small values. For example, if I have some parameters defined in a file: // material properties nu 1.0e-8; // data for gradient calculation U0 1.0; dUdx #calc "$U0 / $nu"; which is then #include-d in a dict, then I get a floating point exception. Looking into the dynamicCode generated: dynamicCode/_895f27c8e0b93b41af125bc39eee9041e7fd19d5/codeStreamTemplate.C: os << (1.000000 / 0.000000); i.e. the doubles have been printed in some kind of %f format and reduced to zero. | ||||
Steps To Reproduce | #include a file, with some parameters which are calculated, inside a dict run an application which accesses this dict I've attached a very simple example to demonstrate this | ||||
Additional Information | Obvious workaround - change units (or non-dimensionalize) to eliminate this possibility | ||||
Tags | #calc, codeStream | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2018-03-26 01:28 | SamMallinson | New Issue | |
2018-03-26 01:28 | SamMallinson | File Added: hashcalcexample.tar | |
2018-03-26 01:28 | SamMallinson | Tag Attached: codeStream | |
2018-03-26 01:28 | SamMallinson | Tag Attached: #calc | |
2018-03-26 16:04 | henry | Assigned To | => henry |
2018-03-26 16:04 | henry | Status | new => resolved |
2018-03-26 16:04 | henry | Resolution | open => fixed |
2018-03-26 16:04 | henry | Fixed in Version | => dev |
2018-03-26 16:04 | henry | Note Added: 0009445 |