CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF - C_STRAIN_RATE returns 0 (http://www.cfd-online.com/Forums/fluent/48404-udf-c_strain_rate-returns-0-a.html)

Grzegorz June 3, 2008 08:50

UDF - C_STRAIN_RATE returns 0
 
Hello! I have problem with macro C_STRAIN_RATE(c,t). I wrote an UDF and I'm using this macro. The problem is that FLUENT returns zero. If I replace C_STRAIN_RATE(c,t) with C_U(c,t) (velocity component) UDF work well. Do you have any idea what is wrong?

#include "udf.h" #include "mem.h"

FILE *fout;

void Strain_Rate_Distribution(Domain *domain, int id) {

cell_t c;

Thread *t = Lookup_Thread(domain, id);

real j,k;

int i,n = 3;

real tau_max = 500000;

for (i = 1; i <= n; i++)

{

real temp = 0.0;

j = i * (tau_max/n);

k = (i-1) * (tau_max/n);

begin_c_loop(c,t)

{

real strain_rate = C_STRAIN_RATE_MAG(c,t);

real volume = C_VOLUME(c,t);

if (strain_rate > k && strain_rate < j)

{

temp += volume;

}

}

end_c_loop(c,t)

fprintf(fout,"%g - %g %g\n", k,j,(temp/0.000075190329)*100);

} }

DEFINE_ON_DEMAND(strain_rate_distribution) {

Domain *domain;

domain = Get_Domain(1);

fout = fopen("strain_rate_distribution.out", "w");

Strain_Rate_Distribution(domain, 2);

fclose(fout); }


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