CFD Online Discussion Forums

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

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

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 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

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


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