|
[Sponsors] |
![]() |
![]() |
#1 |
Senior Member
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 20 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
Many thanks Do;
But it's not resolved though! Any special header like #include < stdio.h> needed? Masoud |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 20 ![]() |
You can try to include stdio.h
Do |
|
![]() |
![]() |
![]() |
![]() |
#5 |
Member
Nathan
Join Date: Aug 2010
Posts: 62
Rep Power: 16 ![]() |
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! |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
MASOUD
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
Not for fprint, 'Message' worked well though.
|
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compiling problem | Wouter | Fluent UDF and Scheme Programming | 6 | June 6, 2012 05:43 |
Incoherent problem table in hollow-fiber spinning | Gianni | FLUENT | 0 | April 5, 2008 11:33 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
Is this problem well posed? | Thomas P. Abraham | Main CFD Forum | 5 | September 8, 1999 15:52 |