CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

fprint problem

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 4, 2010, 14:38
Default fprint problem
  #1
Senior Member
 
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 8
MASOUD is on a distinguished road
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
MASOUD is offline   Reply With Quote

Old   June 4, 2010, 19:14
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 10
DoHander is on a distinguished road
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
DoHander is offline   Reply With Quote

Old   June 4, 2010, 23:23
Default
  #3
Senior Member
 
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 8
MASOUD is on a distinguished road
Many thanks Do;

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

Masoud
MASOUD is offline   Reply With Quote

Old   June 5, 2010, 23:10
Default
  #4
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 10
DoHander is on a distinguished road
You can try to include stdio.h

Do
DoHander is offline   Reply With Quote

Old   October 28, 2011, 13:46
Default
  #5
Member
 
Nathan
Join Date: Aug 2010
Posts: 64
Rep Power: 6
natantyt is on a distinguished road
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!
natantyt is offline   Reply With Quote

Old   October 30, 2011, 17:08
Default
  #6
Senior Member
 
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 8
MASOUD is on a distinguished road
Not for fprint, 'Message' worked well though.
MASOUD is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Incoherent problem table in hollow-fiber spinning Gianni FLUENT 0 April 5, 2008 10:33
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


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