CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   STAR-CCM+ (https://www.cfd-online.com/Forums/star-ccm/)
-   -   User Function (https://www.cfd-online.com/Forums/star-ccm/86979-user-function.html)

 racerdude777 April 7, 2011 16:04

User Function

I'm modeling a 3-D wing in a wind tunnel and am looking to oscillate the flow direction in a sinusoidal fashion. I am looking to use a simple user function to accomplish this but Star-CCM+ can't compile it. Can somebody take a look and shed some light on whats wrong with it? Thank you.

First Code:
(\$Time > 0) :
\$\$Velocity[0] = 24.218*COS*(0.2094395+0.174533*SIN*((0.2079*\$Time) ));
\$\$Velocity[1] = 24.218*SIN*(0.2094395+0.174533*SIN*((0.2079*\$Time) ));
\$\$Velocity[2] = 0;

Second Code:
(\$Time > 0)? [24.218*COS*(0.2094395+0.174533*SIN*((0.2079*\$Time) )), 24.218*SIN*(0.2094395+0.174533*SIN*((0.2079*\$Time) )), 0] : [0,0,0])

racerdude777

 f-w April 7, 2011 17:17

Try:

[(\$Time > 0) ? 24.218*cos(0.2094395+0.174533*sin(0.2079*\$Time)) : 0, (\$Time > 0) ? 24.218*sin(0.2094395+0.174533*sin(0.2079*\$Time) ) : 0, 0]

 abdul099 April 14, 2011 02:58

\$\$Velocity[x] with x = 0,1,2 (from the first code) adresses the velocity field generated by the solver. You can not assign any values to one of the default field functions, so the statement "\$\$Velocity[0] = " can not work.
In general, your second code should work, but there are some * too much between the sin and cos functions and the following brackets. Even on your calculator, you don't type "sin * (5*PI)", you type sin(5*PI).

Try
(\$Time > 0)? [24.218*COS(0.2094395+0.174533*SIN((0.2079*\$Time) )), 24.218*SIN(0.2094395+0.174533*SIN((0.2079*\$Time) )), 0] : [0,0,0])

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