CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

UDF for energy source

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 16, 2008, 19:35
Default UDF for energy source
  #1
JoĆ£o Fernandes
Guest
 
Posts: n/a
Hi there, folks!

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 z-direction). 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
  Reply With Quote

Old   October 16, 2008, 20:11
Default Re: UDF for energy source
  #2
CDE
Guest
 
Posts: n/a
I'm not sure if the method you are trying to use will work or not. Can you use the piecewise-linear 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.
  Reply With Quote

Old   October 16, 2008, 20:37
Default Re: UDF for energy source
  #3
JoĆ£o Fernandes
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

  Reply With Quote

Old   October 16, 2008, 22:32
Default Re: UDF for energy source
  #4
CDE
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 4-5 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.
  Reply With Quote

Old   October 17, 2008, 05:53
Default Re: UDF for energy source
  #5
JoĆ£o Fernandes
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
  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 14:42.