CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Algeabraic operation with #calc (http://www.cfd-online.com/Forums/openfoam-bugs/126712-algeabraic-operation-calc.html)

HakikiCanakkaleli November 24, 2013 14:09

Algeabraic operation with #calc
 
Hi

== 1 ==
#calc, used in blockMeshDict context, seems to give different answers for the following:

== 2 ==

b 4;
c 3;
d 10;

// First one-line calculation
a #calc "b / d * c";

// Second one-line calculation
a #calc "(b * c) / d";

== 3 ==
I could not find any reasoning behind the difference; therefore, I thought it would be better to consider it as a small bug.

akidess November 25, 2013 04:54

You don't include the answers you get in your post, which would help debugging a lot. I'm guessing integer division is to blame.

haakon November 25, 2013 05:34

You could try to define b, c and d as scalars:

Code:

b 4.0;
c 3.0;
d 10.0;

and follow up with a detailed description of the input files and the error if it does not solve your problem.


All times are GMT -4. The time now is 23:46.