FLUENT 6 - How to change the MRF fluid zone rotational speed with time?
It is desired to run a rotating case (SRF, MRF) and ramp up the rotational speed as a function of the iteration number (or flow time for an unsteady case) in order to get better convergence. However, there is no built-in UDF hook for the rotational speed inside the fluid zone panel. How can we apply these changes to rotational speed? This can be done using Scheme, but a UDF may be easier. One can write a DEFINE_ADJUST UDF which will update the rotational speed "internally" according to an expression. Inside the UDF, the rotational speed can be updated according to: THREAD_VAR(tc).fluid.omega = omega; Other relevant parameters: THREAD_VAR(tc).fluid.origin[0] THREAD_VAR(tc).fluid.origin[1] THREAD_VAR(tc).fluid.origin[2] THREAD_VAR(tc).fluid.axis[0] THREAD_VAR(tc).fluid.axis[1] THREAD_VAR(tc).fluid.axis[2] THREAD_VAR(t1).fluid.velocity[0] THREAD_VAR(t1).fluid.velocity[1] THREAD_VAR(t1).fluid.velocity[2] The following is an example UDF for steady MRF case. %---------------------------------------------------------------------------------% #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 %fn",iter,omega); } } %---------------------------------------------------------------------------------% Alternative UDF is: #include "udf.h" #define Niter 25 #define omg_mx 20.0 #define del_omg 0.2 DEFINE_ADJUST(myadjust,domain) { int zoneID; int iter = (nres==0)?(1):((int)count2[nres-1]); float omega_prv, omega; Thread *tc; zoneID = 2; tc = Lookup_Thread(domain,zoneID); omega_prv = THREAD_VAR(tc).fluid.omega; if ( (iter%Niter)==0 ) { omega = omega_prv + del_omg; if ( omega > omg_mx ) omega = omg_mx; THREAD_VAR(tc).fluid.omega = omega; Message("At iter=%d - update omega to %fn",iter,omega); } } |
||
![]()
|