CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   udf for Cd calculation (http://www.cfd-online.com/Forums/fluent/29076-udf-cd-calculation.html)

Micaela Demichela November 15, 2001 06:22

udf for Cd calculation
 
Hi, I'm trying to use a compiled udf to change the cd coefficient used by Fluent 5.4, but the procedure written on fluent manual doesn't fit with the one described in makefile file, that, in any case, doesn't work. Someone has any suggestion for me? Thanks and best regards Micaela

gino November 15, 2001 10:49

udf information
 
Hi!I'm a Fluent 5 user and i would to known how can to write on a file the value for a variable declaired into the UDF subroutine. Thanks and best regards. Gino

joby November 16, 2001 00:40

Re: udf information
 
try below program , it's correctly, DEFINE_ADJUST(adj_func,domain) is calculated math equation , after the answer deliver transfer into DEFINE_SOURCE(name,c,t,ds,eqn).so DEFINE_ADJUST is subroutine , DEFINE_SOURCE(name,c,t,ds,eqn)is main program . best regards for you

#include "udf.h"

Thread *t; cell_t c;

real Yo2; real Pc; real Xo2;

DEFINE_ADJUST(adj_func, domain) { thread_loop_c(t, domain) { if( THREAD_ID(t) == 4 ) /* "4" shows your fourth floor ID */ {

begin_c_loop(c, t)

{

Yo2 = C_YI(c, t, 0); /* gets cell mass fraction */

Pc = C_P(c, t); /* gets cell pressure */

Xo2 = Yo2*Pc;

C_UDMI(c,t,0) = Pc*Xo2;

}end_c_loop(c, t) } } }

DEFINE_SOURCE(ff,c ,t, dS, eqn) { real source; source = C_UDMI(c,t,0)*12.; dS[eqn] = 12.;

return source; }


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