CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

HELP! adding a mass source to VOF eqn. by UDF???

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

LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2003, 03:18
Default HELP! adding a mass source to VOF eqn. by UDF???
Posts: n/a
Hi all; I want to model the sheet cavitation with the VOF method. But this model has not any mass source terms to model the mass transfer during the cavitation. I have written a UDF. But when I compiled my UDF by "INTERPRETED" option successfully,during the initialization I resived an "access violation" error.

I think that I shoud compile my udf with the "compile" option. But I can not compile my udf.

Please see my UDF and tell me a suggestion if you have an experience.

My source terms are combination of evaporation and condensation process. I have take Inance senocak model.

I think and found that my main problem is from the macro :"C_VOF(cell,pt[1])" , because without this macro I have not any problem during the initialization after compilation by "interpreted" option, but I require this macro! ****************** my udf *************************

#include "udf.h"

#define Cdest 9e5

#define Cprod 3e4

#define Vdens .5542

#define Ldens 998.2

#define pv 101175

#define U 1

#define Lch .136 DEFINE_SOURCE(Vcond, cell, thread, dS, eqn) { Thread **pt; double source; double vof;

vof = C_VOF(cell,pt[1]); source = (Cprod * Vdens * (pow((1-vof),2) - pow((1-vof),3))) / (Ldens * (Lch / U)); dS[eqn] = (Cprod * Vdens * (2 * (1-vof) - 3 * pow((1-vof),2))) / (Ldens * (Lch / U));

return source; }

/* ************************************************** ***** */

DEFINE_SOURCE(Levap, cell, thread, dS, eqn) { Thread **pt; /* initialize pt */ double source; double vof; double p; double min; double pabs;

vof = C_VOF(cell,pt[1]); p = C_P(cell,thread); pabs = p + 101325; min = 0;

if ( (pabs-pv) < 0 )

min = (pabs-pv);

source = (Cdest * Vdens * (1-vof) * min) / (Ldens * .5 * Ldens * (U*U) * (Lch / U)); dS[eqn] = (Cdest * Vdens * min) / (Ldens * .5 * Ldens * (U*U) * (Lch / U));

return source; }

  Reply With Quote

Old   May 27, 2003, 09:43
Default Re: HELP! adding a mass source to VOF eqn. by UDF?
Shiping Liu
Posts: n/a
why don't use "patch"?
  Reply With Quote

Old   May 27, 2003, 18:15
Default Re: HELP! adding a mass source to VOF eqn. by UDF?
Raja Banerjee
Posts: n/a
The reason you are getting an access violation is because you are not using the correct thread when calling the C_VOF macro. The thread that you are passing from the DEFINE_SOURCE is most probably in the mixture domain. It depends from where you are calling this udf inside FLUENT. If the thread refers to mixture domain, you need to extract the phase thread. Say you want to volume fraction of the secondary phase, then use secondary_thread=THREAD_SUB_THREAD(thread,1) where "thread" is from your DEFINE_SOURCE function. In your code you are using *pt, which is not defined anywhere. HEnce the access violation. Also, remember, the "thread" is phase thread if you are calling it from boundary condition->fluid->(your phase)->source term. From all other places it is mixture thread.
  Reply With Quote

Old   May 28, 2003, 22:20
Default Re: HELP! adding a mass source to VOF eqn. by UDF?
Posts: n/a
Try to compile in Visual C++ until no error occur, then follow the procedure to link the library to FLUENT , so that you can use 'compile' option in UDF, not 'interprete' option. I also try the same. Good luck
  Reply With Quote

Old   May 29, 2003, 09:54
Default Re: HELP! adding a mass source to VOF eqn. by UDF?
Posts: n/a
Dear roozbeh,

While adding a source term to ur udf, it is called through the respective phase. So its better to first access the mixture domain using the phase & then again access the phases u want in your computation.

Can u send me the model & its info u r used for solving it. Because I am also slving a problem for condensation ( Using Mixture model).


  Reply With Quote

Old   December 3, 2016, 17:53
Default Help
New Member
Join Date: Dec 2016
Posts: 1
Rep Power: 0
amino is on a distinguished road
Hi every one .I want to model the boiling with vof model and it you need ,udf (volumetric heat source term) show like that :

amino is offline   Reply With Quote


Thread Tools Search this Thread
Search this Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
wmake compiling new solver mksca OpenFOAM Programming & Development 14 June 22, 2018 06:29
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18
Mass Transfer UDF using Fluent VOF Anirudh_Deodhar FLUENT 0 February 7, 2011 15:10
Mass source, Momentum source theory. diffo FLUENT 4 August 21, 2009 10:26
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24

All times are GMT -4. The time now is 22:34.