CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT


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

LinkBack Thread Tools Search this Thread Display Modes
Old   January 16, 2007, 05:23
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 ())


/* 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 .
  Reply With Quote

Old   January 16, 2007, 09:36
Venkatesh V
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
  Reply With Quote

Old   January 17, 2007, 00:15
Posts: n/a

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
  Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 06:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56
UDF problem mansha goraya FLUENT 0 October 29, 2007 00:31
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
UDF problem chiseung FLUENT 4 January 10, 2002 09:58

All times are GMT -4. The time now is 05:42.