# UDF PROBLEM

 Register Blogs Members List Search Today's Posts Mark Forums Read

 January 16, 2007, 05:23 UDF PROBLEM #1 anant Guest   Posts: n/a Hi everybody, I have a 2 D model in which I am using a UDF to give motion to a body(named valve) which inturn is immersed in a control volume. The model is like this. A rectangular object(valve) is placed inside another rectangular control volume. the valve is expected to move up in the Y direction while the flow is on. Bdry conditions are : inlet--- mass flow inlet outlet---pressure outlet valve--- waLL (with the option moving wall enabled in the dynamic zone panel) I am modelling it as a dynamic mesh problem and am using the following UDF, #include "udf.h" static real v_prev = 0.0; DEFINE_CG_MOTION(piston, dt, vel, omega, time, dtime) { Thread *t; face_t f; real NV_VEC (A); real force, dv; /* 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 */ t = DT_THREAD (dt); /* compute pressure force on body by looping through all faces */ force = 0.0; begin_f_loop (f, t) { F_AREA (A, f, t); force += F_P (f, t) * NV_MAG (A); } end_f_loop (f, t) /* compute change in velocity, i.e., dv = F * dt / mass velocity update using explicit Euler formula */ dv = dtime * force / 50.0; v_prev += dv; Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, force); /* set y-component of velocity */ vel[1] = v_prev; } I create ONLY the valve as the "Dynamic zone". After the udf is compiled and the ITERATIONS initiated in an unsteady flow, the vlave DOES'T MOVE. i am doing problem to ascertain the changes in the flow var as the valve moves up in the Y direction. I am unable to identify the error . can some one help . thanks .

 January 16, 2007, 09:36 Re: UDF PROBLEM #2 Venkatesh V Guest   Posts: n/a I hope Fluent did correct by not moving the valve. You are assigning v_prev to Y Velocity i.e vel[1]. But in the starting of the code you have initialized v_prev to zero and you have not changed to some number after that. If your objective is to only move the valve in y direction, no need to use UDF you can jut input these parameters in Dynamic Mesh control panel. I hope this would help you. Thanks Venkatesh V

 January 17, 2007, 00:15 Re: UDF PROBLEM #3 anant Guest   Posts: n/a THANKS VENKATESH FOR A QUICK REPLY, I am an not very conversant with UDF, however can you please explain how do I go about giving "motion" to the valve by entering the parameters in the Dynamic Mesh control panel. where do I enter the values of the motion ? Is there any tutorial problem rewgarding this ? regards Ananth