|
[Sponsors] |
UDF for mass fraction (spilled organic liquid) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 21, 2009, 05:56 |
UDF for mass fraction (spilled organic liquid)
|
#1 |
Guest
Posts: n/a
|
Hi,
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 |
|
February 22, 2009, 06:58 |
Re: UDF for mass fraction (spilled organic liquid)
|
#2 |
Guest
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. /M |
|
February 22, 2009, 11:22 |
Re: UDF for mass fraction (spilled organic liquid)
|
#3 |
Guest
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-25°C, 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) } |
|
February 23, 2009, 04:16 |
Re: UDF for mass fraction (spilled organic liquid)
|
#4 |
Guest
Posts: n/a
|
ok
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 |
|
July 28, 2009, 02:27 |
|
#5 |
New Member
siva kumar
Join Date: Jul 2009
Posts: 13
Rep Power: 17 |
Arey please send the source code for radiation for ch4.........mean udf???plz da...
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Volume fraction to mass fraction | Torsaki | CFX | 10 | March 10, 2018 04:41 |
volume fraction,mass fraction,bulk mass flow | nick | CFX | 0 | April 25, 2008 10:51 |
How set volume fraction and species mass fraction | Reginaldo Cotto | FLUENT | 0 | August 31, 2006 05: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 06:53 |