View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003622 | OpenFOAM | Bug | public | 2021-02-04 16:16 | 2021-02-04 17:06 |
Reporter | marniemann | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | GNU/Linux | OS | Ubuntu 18.04 | OS Version | (please specify) |
Summary | 0003622: Variable caluclation fails for divisions | ||||
Description | Calculating variables using the #calc statement fails for divisions, if the slash operator is not separated by spaces. Example: a 1; b 2; c #calc "$a / $b"; // works d #calc "$a+$b"; // works e #calc "$a/$b"; // does NOT work The last statement to compute variable e leads to a declaration error: ‘$a’ was not declared in this scope Since the last statement was still valid in OpenFOAM-6, I assume (but am not sure) that the issue might stem from this new feature: https://github.com/OpenFOAM/OpenFOAM-dev/commit/a7b842569064ede1574a77210b731904a206182a | ||||
Tags | No tags attached. | ||||
|
I have updated the documentation for #calc: Class Foam::functionEntries::calcEntry Description Uses dynamic compilation to provide calculating functionality for entering dictionary entries. E.g. \verbatim a 1.0; b 3; c #calc "$a*$b"; \endverbatim Note the explicit trailing 0 ('1.0') to force a to be read (and written) as a floating point number. Special care is required for calc entries that include a division since "/" is also used as the scoping operator to identify keywords in sub-dictionaries. For example, "$a/b" expects a keyword "b" within a sub-dictionary named "a". A division can be correctly executed by using a space between a variables and "/", e.g. \verbatim c #calc "$a / $b"; \endverbatim or "()" scoping around the variable, e.g. \verbatim c #calc "($a)/$b"; \endverbatim |
|
Resolved by commit 2d9c05f8cb5d52a35dc7068c5d268d8b995d9f95 |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-02-04 16:16 | marniemann | New Issue | |
2021-02-04 17:05 | henry | Note Added: 0011843 | |
2021-02-04 17:06 | henry | Assigned To | => henry |
2021-02-04 17:06 | henry | Status | new => resolved |
2021-02-04 17:06 | henry | Resolution | open => fixed |
2021-02-04 17:06 | henry | Fixed in Version | => 8 |
2021-02-04 17:06 | henry | Note Added: 0011844 |