CFD Online Logo CFD Online URL
Home > Forums > FLUENT

UDF for mass fraction (spilled organic liquid)

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

LinkBack Thread Tools Display Modes
Old   February 21, 2009, 05:56
Default UDF for mass fraction (spilled organic liquid)
Klemens Schatka
Posts: n/a

I wanted do model the evaporation of spilled organic liquid in Fluent 6 and tried to write an udf with DEFINE_SOURCE (depending on temperature, ...). My source is a wall with mass frac for the organic species. Without udf at constant mass frac the result is not so bad compared to usual calculations, but does not take account of temperature, etc.

No error message when interpreting, but when I hook it to the source I get this error message: wrong return type: void udf function expected. The udf function returns a real (as defined in udf.h) but no return value is expected. Can someone give me a hint how to set the mass frac to model a species source?

Maybe it's better to model the evaporation as a flux from the wall element?

Thx Klemens
  Reply With Quote

Old   February 22, 2009, 06:58
Default Re: UDF for mass fraction (spilled organic liquid)
Posts: n/a
you should return the source value in a DEFINE_SOURCE udf. I am a bit confused about your problem... Do you have something like:

{ real source; ... .calc source(T); ... return source; }


then it should work. Otherwise try it in compiled version.

  Reply With Quote

Old   February 22, 2009, 11:22
Default Re: UDF for mass fraction (spilled organic liquid)
Klemens Schatka
Posts: n/a
Hello mange,

my code is similar to the code you posted.

My idea was to model an area which is emitting an organic substance (free evaporation in moving air) for calculating zones of hazardous atmospheres (explosion, workers safety). So first I defined a bottomarea as a wall element with fixed mass fraction (according to the vapor pressur at given surface temperature which is proportional to the volume fraction). Air flowing over the surface of this area is then "saturated" with exactly this fraction. This is a very rough model, but when corrected by the local temperatur and maybe some boundary layer calculation including local velocity, heat transport, radiation, etc. hopefully it will be a better result.

My first UDF I tried was using a macro DEFINE_SOURCE which shows this error because mass fraction of a wall does not expect a return value. After wasting the last night I tried to read the UDF handbook ;-) The mass frac on a wall element can be set by a profile macro and not by a source macro. So I made a DEFINE_PROFILE and set up all face elements to a fixed (and later calculated) value. The UDF is hooked to the species massfrac of a wall. Now it works, but I don't know if this is a correct solution. The next steps will be the comparison with some common models we use in safety analysis, implementation of the (very simple) Clausius-Clapeyron equation for p_vap(T) and maybe later some VLE-calculation for mixtures of liquids especially for water soluble substances.

My udf now looks like this
DEFINE_PROFILE(massfrac_profile, t, i)
face_t f;

begin_f_loop(f, t)
// for testing set mass frac of face element to 0.02 [kg/kg]
// later this will be replaced by a more sophisticated formula
// e.g. for water saturated at 15-25C, linear approx from hx-diagram: F_PROFILE(f, t, i)= 0.0155 + 0.001 * (F_T(f, t)-293.15)
F_PROFILE(f, t, i)=0.2
end_f_loop(f, t, i)
  Reply With Quote

Old   February 23, 2009, 04:16
Default Re: UDF for mass fraction (spilled organic liquid)
Posts: n/a

Now i see what you want to do. You are right about using the DEFINE_PROFILE for the wall. DEFINE_SOURCE is for interior cells.

good luck /M
  Reply With Quote

Old   July 28, 2009, 01:27
New Member
siva kumar
Join Date: Jul 2009
Posts: 13
Rep Power: 8
shshiva17 is on a distinguished road
Arey please send the source code for radiation for ch4.........mean udf???plz da...
shshiva17 is offline   Reply With Quote


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
Volume fraction to mass fraction Torsaki CFX 9 February 21, 2015 11:46
volume fraction,mass fraction,bulk mass flow nick CFX 0 April 25, 2008 09:51
How set volume fraction and species mass fraction Reginaldo Cotto FLUENT 0 August 31, 2006 04:58
volume fraction, Mass fraction and Bulk Mass flow Dr.jones CFX 1 January 25, 2006 05:32
How to use liquid fraction in UDF? FengYun FLUENT 0 October 27, 2005 05:53

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