CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

error UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 6, 2011, 10:34
Default error UDF
  #1
New Member
 
mecamor
Join Date: Jul 2011
Posts: 23
Rep Power: 14
mecamor is on a distinguished road
Quote:
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.

Amir
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 ())
return;
/* 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
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
refer to:
http://www.cfd-online.com/Forums/flu...-rotation.html
Amir is offline   Reply With Quote

Reply


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



All times are GMT -4. The time now is 16:39.