CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Position of the center of gravity (

dam114 September 25, 2013 10:27

Position of the center of gravity
Hi everyone,

I am working on a "Vortex induced vibration" simulation and for now I managed to simulated a plate which is moving because of the air flow..

The thing is I would be glad if I can output the position of the center of gravity for each timestep in a transient simulation..

I spent a lot of time in CDF-Post and I have no idea how I can do that.. That is why I did a "DEFINE_EXECUTE_AT_END" UDF.. However I am not able to compile it with Ansys Fluent..

I will be very thankful if somebody can help me with this issue..

This is my UDF ==========================================

#include "udf.h"

DEFINE_EXECUTE_AT_END (execute_at_end, dt, time, dtime)

FILE * fp; /* Declaring file variable */

/* record the kinematic data in the file */
fp = fopen ("Motion.txt", "a"); /* Open a file to add data to the end */

/* Format output data file */

fprintf (fp, "% E", CURRENT_TIME); /* Current time in */
fprintf (fp, "% E", DT_CG(dt)[0]); /* center of gravity position */

fclose (fp); /* Closing the file */

All times are GMT -4. The time now is 09:36.