|
[Sponsors] |
the udf has been hooked to the fluent successfully,but it does not work! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 3, 2011, 03:57 |
the udf has been hooked to the fluent successfully,but it does not work!
|
#1 |
New Member
Join Date: Jun 2011
Posts: 1
Rep Power: 0 |
I want to use udf (DEFINE_CG_MOTION) to determine the motion of a rectangular body (2D) according to the pressure on the top and bottom faces. The udf has been successfully hooked to the FLUENT, and the zone has also been successfully defined. But the rectangular body's motion was not affected by the udf and it did not move at all. I'm sure that there is a big difference of the pressure on both faces. There were no error information at all. Additionally, I try to use the command "message" to output the value of some parameters, but no information was shown up in the TUI windows.
I really appreciate your help. Thank you. Here is my udf: #include "udf.h" #include "dynamesh_tools.h" /* velocities */ static real v_invalve1 = 0.0; static real v_exvalve1 = 0.0; /* displacement */ static real s_invalve1 = 0.0; static real s_exvalve1 = 0.0; static real lift = -0.0015; DEFINE_CG_MOTION(invalve1,dt,vel,omega,time,dtime) { Thread *t1, *t2; face_t f; real NV_VEC(A); real force, dv, a, ds; Domain * domain; int zone_id1=81; int zone_id2=91; /* reset velocities */ NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); if (!Data_Valid_P()) return; /* get the thread pointer for which this motion is defined */ domain=THREAD_DOMAIN(DT_THREAD(dt)); t1=Lookup_Thread(domain,zone_id1); t2=Lookup_Thread(domain,zone_id2); /* compute pressure force on body by looping through all faces */ force = 0.0; begin_f_loop(f,t1) { F_AREA(A,f,t1); force += F_P(f,t1) * A[1]; } end_f_loop(f,t1) begin_f_loop(f,t2) { F_AREA(A,f,t2); force += F_P(f,t2) * A[1]; } end_f_loop(f,t2) /* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */ a=force/0.1089; ds=0.5*a*dtime*dtime; if(s_invalve1+ds<=lift) { v_invalve1=(lift-s_invalve1)/dtime; s_invalve1=lift; } else if(s_invalve1+ds>=0) { v_invalve1=(0-s_invalve1)/dtime; s_invalve1=0; } else { dv = dtime * a; v_invalve1 += dv; s_invalve1 += ds; } Message ("time = %f, y_vel = %f, force = %f\n", time, v_invalve1, force); /* set y-component of velocity */ vel[1] = v_invalve1; } |
|
July 8, 2011, 04:31 |
|
#2 |
New Member
paaresh
Join Date: Mar 2009
Posts: 19
Rep Power: 17 |
Hi,
First calculate the pressure force and velocity using DEFINE_EXECUTE_AT_END . Second use that velocity in DEFINE_CG_MOTION I hope it will work |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trouble: Sandia UV UDF on FLUENT 12.0.16 | RPJones | Fluent UDF and Scheme Programming | 31 | May 25, 2011 11:15 |
HELP! Fluent UDF Iterate error | Sam | FLUENT | 2 | July 10, 2008 21:29 |
compiling my UDF | Seyed Farid Hosseinizadeh | FLUENT | 22 | February 14, 2006 10:19 |
UDF problem caused by various version of Fluent | Yurong | FLUENT | 3 | January 15, 2006 10:57 |
UDF of Zimont model in fluent | Z | Main CFD Forum | 0 | February 17, 2005 03:07 |