CFD Online Discussion Forums

CFD Online Discussion Forums (
-   STAR-CCM+ (
-   -   Field Function shows an error (

niazaliahmed September 23, 2011 02:42

Field Function shows an error
I am trying to write a vector field function to calculate 17/(Velocity^2)

I have tried


Both have failed. Is this because vector division is not possible, or some other error?

However when I use a single dollar Velocity it shows assembly code.

Please help me asap.

jfcorbett September 23, 2011 04:12

There is no such thing as vector division.

I'm guessing you want to divide by the magnitude of the velocity vector? STAR-CCM+ provides two ways to calculate the magnitude of a vector:

vector magnitude: mag($$u)
vector magnitude squared: mag2($$u)

So for you, the most straightforward expression is: 17/mag2($$Velocity)

For more, see STAR-CCM+ help:
Using Tools > Using Field Functions > Field Function Programming Reference > Vector Functions

niazaliahmed September 23, 2011 08:17

Thank you very much. The problem is solved now.

All times are GMT -4. The time now is 01:50.