CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF to rotate (https://www.cfd-online.com/Forums/fluent/37328-udf-rotate.html)

Jon July 20, 2005 07:48

UDF to rotate
 
Hi all,

I'm looking to write a udf to produce a rotating motion (rad/sec) for a volume, around a specified axis (0,0). I've been able to produce udf's that produce a circular motion by specifying a sinusoidal x and y motion, but now need the volume to actually rotate.

Hope you can help,

Thanks,

edi ghirardi July 20, 2005 08:08

Re: UDF to rotate
 
The following is an example on how to ramp up the rotational speed as function of iteration supposing that you use MRF (or SRF). Changing it as function of flow time for unsteady simulations should be straightforward (Rp_Get_Real("Flow Time")).

Hope this helps

Edi.

#include "udf.h"

#define Niter 25 /* iteration update interval */ #define omg_mn 0.00001 /* starting omega */ #define omg_mx 20.0 /* final omega */ #define del_omg 0.2 /* incremental omega */

DEFINE_ADJUST(myadjust,domain) { int zoneID; int iter = (nres==0)?(1):((int)count2[nres-1]); float omega; Thread *tc;

zoneID = 2; tc = Lookup_Thread(domain,zoneID);

if ( (iter%Niter)==0 ) { omega = omg_mn + (iter/Niter)*del_omg; if ( omega > omg_mx ) omega = omg_mx; THREAD_VAR(tc).fluid.omega = omega; Message("At iter=%d - update omega to %f\n",iter,omega); } }

Jon July 20, 2005 08:22

Re: UDF to rotate
 
thanks for your reply Edi. The rotational velocity is constant throughout however (150 radians per second). I just want to make a volume rotate about a central axis at this speed. Ideally, the udf would use t and simply increment the angle of rotation based on the value of t during interation.

Thanks again,

edi ghirardi July 20, 2005 08:42

Re: UDF to rotate
 
Sorry, might be a silly question, maybe I misunderstood your problem again, but what about defining a moving wall? In the BC panel you can define the rotational speed (relative to adjacent cell zone) and axis of rotation.

Edi.


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