|
|||||
|
|
|
#1 |
|
New Member
Join Date: Aug 2009
Posts: 6
Rep Power: 2 |
Hi guys,
I need help!!! I'm not familiar with UDF. I compiled the Udf of cavitation rate which is found at udf manual. I add the last line (Message...) and everything is ok. I can see the values of cavitation mass transfer rate at fluent window. But i want to save these values in a .txt file. How can i do this? Thanks a lot! #include"udf.h" #define c_evap 1.0 #define c_con 0.1 DEFINE_CAVITATION_RATE(user_cav_rate, c, t, p, rhoV, rhoL, mafV, p_v, cigma, f_gas, m_dot) { real p_vapor = *p_v; real dp, dp0, source; p_vapor += MIN(0.195*C_R(c,t)*C_K(c,t), 5.0*p_vapor); dp = p_vapor - ABS_P(p[c], op_pres); dp0 = MAX(0.1, ABS(dp)); source = sqrt(2.0/3.0*rhoL[c])*dp0; if(dp > 0.0) *m_dot = c_evap*rhoV[c]*source; else *m_dot = -c_con*rhoL[c]*source; Message("Cavitation Mass Transfer Rate: %g\n",m_dot); } |
|
|
|
|
|
|
|
|
#2 |
|
Senior Member
Dragos
Join Date: Mar 2009
Posts: 508
Rep Power: 4 |
Code:
#include"udf.h"
#define c_evap 1.0
#define c_con 0.1
DEFINE_CAVITATION_RATE(user_cav_rate, c, t, p, rhoV, rhoL, mafV, p_v, cigma, f_gas, m_dot)
{
FILE *pf;
real p_vapor = *p_v;
real dp, dp0, source;
p_vapor += MIN(0.195*C_R(c,t)*C_K(c,t), 5.0*p_vapor);
dp = p_vapor - ABS_P(p[c], op_pres);
dp0 = MAX(0.1, ABS(dp));
source = sqrt(2.0/3.0*rhoL[c])*dp0;
if(dp > 0.0)
*m_dot = c_evap*rhoV[c]*source;
else
*m_dot = -c_con*rhoL[c]*source;
Message("Cavitation Mass Transfer Rate: %g\n",m_dot);
if(NULL == (pf = fopen("bubu.txt","a")))
Error("Could not open file for append!\n");
fprintf(pf,"%e\n",m_dot);
fclose(pf);
}
|
|
|
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Aug 2009
Posts: 6
Rep Power: 2 |
Thanks friend!!!
It works!!! |
|
|
|
|
|
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| UDF Getting data from file | jreig | FLUENT | 0 | July 10, 2009 08:07 |
| Working directory via command line | Luiz | CFX | 3 | March 31, 2009 17:52 |
| Smallest binary file format to save large data | Zonexo | Main CFD Forum | 2 | June 2, 2008 20:25 |
| Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing: blockMesh | 10 | April 2, 2007 14:00 |
| UDF (write a data file) problem | lichun Dong | FLUENT | 2 | July 29, 2005 11:39 |