
[Sponsors] 
October 16, 2008, 18:35 
UDF for energy source

#1 
Guest
Posts: n/a

Sponsored Links
I am trying to model the flow and heat transfer to a supercritical fluid (compressed gas above its critical pressure and critical temperature) near the pseudo critical point, the fluid is CO2. Near the pseudo critical point, the specific heat increases extraordinarily what makes it difficult to model by using polynomial functions of temperature (the first thing I tried!), so I developed a UDF to calculate the value of the specific heat as a function of both pressure and temperature, the problem is that I cannot hook this UDF to the Materials form. As a way to overcome this constrain I thought of defining an extra term in the energy equation defining it as an energy source through all the domain occupied by the gas, here it is: DEFINE_SOURCE(cell_energy,c,t,dS,eqn) { real source ; real cp ; real vol = C_VOLUME(c,t) ; real cubic_root_vol = pow(vol,0.3333333) ; real twall = 323 ; begin_c_loop(c,t) { /* source term */ source = C_R(c,t) * C_U(c,t) * (cp  840.37) * C_T(c,t) / cubic_root_vol ; /* derivative of source term */ dS[eqn] = C_R(c,t) * (cp  840.37) * C_U(c,t) / cubic_root_vol ; return source ; } end_c_loop(c,t) } But I am not sure if everything's ok with the definition of the energy source (my geometry is simply a straight tube and its axis is on the zdirection). The energy source should account for both radial and axial temperature gradients of temperature. Can you tell me how to do this if the previous UDF is not correct? Many thanks in advance, Best regards Joćo 

Sponsored Links 
October 16, 2008, 19:11 
Re: UDF for energy source

#2 
Guest
Posts: n/a

I'm not sure if the method you are trying to use will work or not. Can you use the piecewiselinear function for Cp?
As for the UDF, take out the begin_c_loop(c,t), you don't need it for a DEFINE_SOURCE UDF. The UDF is automatically called for each cell so you only need to return the value for a single cell. 

October 16, 2008, 19:37 
Re: UDF for energy source

#3 
Guest
Posts: n/a

Hi CDE!
I tried first the polynomials and piecewise linear, but for instance at the pressure of 80bar, the cp can variate from 3000 J/kg.K to 60000 J/kg.K if the temperature changes by 4 or 5 degrees. To describe such variations I have to use polynomials of high degree. Other problem is the coefficients of the polynomials, since for the larger coefficients even the round up Fluent does can change extraordinarily the magnitude of the value of the Cp calculated. Maybe you can have some comments on this. Thank you very much, in deed, for answering so quickly, Best regards, Joćo 

October 16, 2008, 21:32 
Re: UDF for energy source

#4 
Guest
Posts: n/a

If you define enough points in the piecewise linear function in the temperature regions you are most interested in, then the temperature dependance of Cp should be accurate. Try defining 40 points over the 45 degrees region.
The only other option I can see is to disable the heat transfer calculation in Fluent and define it completely using UDF source terms and Cp. 

October 17, 2008, 04:53 
Re: UDF for energy source

#5 
Guest
Posts: n/a

Hi again CDE,
I would like to thank you very much your suggestions, I will follow your advice namely the piecewise linear function. I have the UDF for the calculation of Cp, can you give me some hints about how to solve the problem disabling the heat transfer and just using UDFs and energy sources? I am a new user of Fluent and this method seems to be very complicated, anyway I would appreciate a lot your considerations about how to apply it. Once again, many thanks in advance, Best regards Joćo 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Please help...energy source W/m^3?  Nady  FLUENT  2  June 22, 2007 04:43 
energy source UDF  Jason  FLUENT  3  August 2, 2006 14:30 
Energy source  fluidwork  FLUENT  0  April 11, 2005 09:28 
Set energy source  Bogesz  CFX  2  March 27, 2002 00:45 
source of energy  Benoit  FLUENT  1  July 12, 2001 04:05 
Sponsored Links 