CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF extern variable - mean time moment coefficient (https://www.cfd-online.com/Forums/fluent-udf/70096-udf-extern-variable-mean-time-moment-coefficient.html)

 enry November 14, 2009 07:51

UDF extern variable - mean time moment coefficient

Hi ! I wanna calculate the mean time moment coefficient in an unsteady simulation.
I write a function as DEFINE_EXECUTE_AT_END in order to have the moment coefficient at the end of time step, and the program sum cm every time step.
So I have the sum of every cm for all time step at the end of simulation.
The problem is: how can I declare the variable "sum_cm" as an extern variable, in order to divide it at the end of the simulation?
I try to write the next program:

#include "udf.h"
#include "extfile.h"

DEFINE_EXECUTE_AT_END(moment_coefficient)
{
real NV_VEC(A);
real moment = 0., x_nodo = 0., y_nodo = 0.;
int n;
face_t f,f_sh;
Domain *d;
Node *node;

d = Get_Domain(1); /* Default Interior ID */

if(NULL == d)
printf("Something wrong with your domain id!\n");

printf("Something wrong with your face id!\n");

Error("Something wrong with your face id!\n");
*/

{
{
x_nodo = NODE_X(node);
y_nodo = NODE_Y(node);
moment += F_P(f,f_thread) * A[1] * x_nodo - F_P(f,f_thread) * A[0] * y_nodo;
}
}

{

{
x_nodo = NODE_X(node);
y_nodo = NODE_Y(node);
moment += F_P(f_sh,f_thread_sh) * A[1] * x_nodo - F_P(f_sh,f_thread_sh) * A[0] * y_nodo;
}
}

moment = moment/2;

int_moment += moment;

printf("\n MOMENT = %g \n", moment);
printf("\n INT MOMENT = %g \n", int_moment);
}

where the extfile.h is the following:

#include "udf.h"

extern real int_moment = 0.;

I compile it as "compiled UDF", but Fluent reports some errors, and the most dangerous is the following:

moment_coefficient.c:2:21: error: extfile.h: No such file or directory

CAN ANYBODY HELP ME?!

 All times are GMT -4. The time now is 13:07.