CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   Math form expressed in OpenFoam (

vvqf November 10, 2005 04:34

volVectorField A = (a, b, c)
volVectorField A = (a, b, c)
volVectorField U = (u, v, w)

a*u + b*v + c*w

How to describe this expression in OpenFoam?

I express it as A*grad(U), grad(U) is then a tensor. Is that right?
I tried many ways to denote it in the codes, well, each time i got errors like "no match ..."

in OpenFoam,(U . )U is expressed as div(phi,U), phi = rho*U?

vvqf November 10, 2005 08:26

original form: axu + b
original form:

axu + b<font size="-1">xv + cxw</font>
ayu + b<font size="-1">yv + cyw</font>
azu + b<font size="-1">zv + czw</font>

Thanks a lot.

eugene November 10, 2005 08:35

Check section one for a general overview of OpenFOAM tensor algebra and notation. Very useful document IMO.

vvqf November 10, 2005 09:50

Thank you so much. I mixed
Thank you so much.

I mixed * and &.

and operator calculation order is the written/appearing order, *, /, ect, do not have precedence to +, -.

grtabor November 10, 2005 10:38

Yes - the one thing you can't
Yes - the one thing you can't redefine (or one of the things you can't redefine) in c++ is the order of precedence for the various binary operators. Its probably worth adding lots of brackets into your expressions to compensate for this.


All times are GMT -4. The time now is 13:36.