CFD Online Logo CFD Online URL
Home > Forums > FLUENT

error UDF

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

LinkBack Thread Tools Display Modes
Old   July 6, 2011, 10:34
Default error UDF
New Member
Join Date: Jul 2011
Posts: 23
Rep Power: 8
mecamor is on a distinguished road
Originally Posted by Amir View Post
The easiest way for you is writing a UDF for the piston and hook to to the piston and with appropriate setting in dynamic mesh panel (smoothing & re-meshing) change the fluid zone cells. it's also better to take a look over manual.

Hi Amir
I wrote the UDF of the piston, but when compiling with C 13 or it Fluent There's an error in line 3. How I should do. thank you
Error: C:\Program Files\ANSYS Inc\v130\fluent\ntbin\win64\PISTON2.c: line 3: parse error.

How I should do. thank you
#include "udf.h"
#include "dynamesh_tools.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 ((Dynamic_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 eulerformula */
dv= dtime* force / 50.0;
v_prev+= dv;
CX_Message ("time = %f, x_vel= %f, force = %f\n", time, v_prev, force);
/* set x-component of velocity */
vel[0] = v_prev;
mecamor is offline   Reply With Quote

Old   July 6, 2011, 11:05
Senior Member
Amir's Avatar
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 16
Amir is on a distinguished road
refer to:
Amir is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

All times are GMT -4. The time now is 10:06.