CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   fprint problem (http://www.cfd-online.com/Forums/fluent-udf/76805-fprint-problem.html)

MASOUD June 4, 2010 14:38

fprint problem
 
Hi folks,

Believe or not, I'm struggling with fprint command!

I wanna see some defined parameters value in the console while the iteration is going on.

Here is my one of my UDFs for energy source term:

----------------------

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

static real ACT_AREA_C=300000;
static real REF_EXCH_CURR_C=0.40;
static real REV_POT=1.02;
static real MW_O2=0.032;
static real MW_CO2=0.044;
static real MW_MIX;
static real X_O2;
static real X_CO2;
static real ALPHA_A=1.5;
static real ALPHA_C=0.5;
static real NO_ELEC=2;
static real FARADAY=96485;
static real UNI_GAS_CONS=8.314;
static real STOCH=-0.5;
static real RXN_RATE_C;
static real Z;
static real ZZ;
static real ZZZ;

static real ELEC_COND=1300;
static real CARB_COND=140;
static real OVERPOT_C;
static real SOURCE_1;
static real SOURCE_2;
static real SOURCE_3;
static real SOURCE_4;
static real SOURCE;
static real A;
static real B;
static real J_S;
static real J_L;

DEFINE_SOURCE(ENERGY_SOURCE_CATHODE,c,t,dS,eqn)
{

A=NV_MAG(C_UDSI_G(c,t,0));
B=NV_MAG(C_UDSI_G(c,t,1));
J_S=A*ELEC_COND;
J_L=B*CARB_COND;

SOURCE_1=pow(J_S,2)/ELEC_COND;

SOURCE_2=pow(J_L,2)/CARB_COND;


MW_MIX=MW_O2*C_YI(c,t,1)+MW_CO2*C_YI(c,t,2);
X_O2=C_YI(c,t,1)*MW_O2/MW_MIX;
X_CO2=C_YI(c,t,2)*MW_CO2/MW_MIX;

Z=ACT_AREA_C*REF_EXCH_CURR_C*pow(X_O2,0.375)*pow(X _CO2,(-1.25));

ZZ=exp((ALPHA_A*FARADAY*(C_UDSI(c,t,0)-C_UDSI(c,t,1)-REV_POT))/(UNI_GAS_CONS*C_T(c,t)));

ZZZ=exp(-(ALPHA_C*FARADAY*(C_UDSI(c,t,0)-C_UDSI(c,t,1)-REV_POT))/(UNI_GAS_CONS*C_T(c,t)));

RXN_RATE_C=Z*(ZZ-ZZZ);

OVERPOT_C=C_UDSI(c,t,0)-C_UDSI(c,t,1)-REV_POT;

SOURCE_3=RXN_RATE_C*OVERPOT_C;

printf("Z= %d\n", Z);
printf("ZZ= %d\n", ZZ);
printf("ZZZ= %d\n", ZZZ);
printf("RXN_RATE_C= %d\n", RXN_RATE_C);
printf("J_L= %d\n", J_L);
printf("J_S= %d\n", J_S);
printf("SOURCE_1= %d\n", SOURCE_1);
printf("SOURCE_2= %d\n", SOURCE_2);
printf("SOURCE_3= %d\n", SOURCE_3);
printf("SOURCE_4= %d\n", SOURCE_4);


SOURCE_4=0;

SOURCE=(SOURCE_1+SOURCE_2+SOURCE_3+SOURCE_4);

dS[eqn]=0;

return SOURCE;

}

--------------------------------
--------------------------------

The problem is: I can't see these parameters value in the console, nothing.

Please help me out.

Masoud

DoHander June 4, 2010 19:14

First be sure that your UDF is loaded and is running in Fluent (it is hooked to a model), then you can try to use Message instead of printf, Message is Fluent's own replacement for printf.

Do

MASOUD June 4, 2010 23:23

Many thanks Do;

But it's not resolved though! Any special header like #include < stdio.h> needed?

Masoud

DoHander June 5, 2010 23:10

You can try to include stdio.h

Do

natantyt October 28, 2011 13:46

Hi

did you find any answer to the "printf" problem?, I want to see some values on the console and it does not show up. Thank You!

MASOUD October 30, 2011 17:08

Not for fprint, 'Message' worked well though.


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