CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   STAR-CCM+ (https://www.cfd-online.com/Forums/star-ccm/)
-   -   Field Function shows an error (https://www.cfd-online.com/Forums/star-ccm/92721-field-function-shows-error.html)

niazaliahmed September 23, 2011 03:42

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

I have tried

17/(pow($$Velocity,2))
17/($$Velocity*$$Velocity)

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 05: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 09:17

@jfcorbett
Thank you very much. The problem is solved now.


All times are GMT -4. The time now is 19:45.