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

BUG cavitation UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By ghost82
  • 1 Post By ghost82
  • 3 Post By ghost82

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 3, 2014, 11:19
Default
  #1
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
ghost82 will become famous soon enough
It seems there's something more then this...I cannot compare results with the built in Schnerr and Sauer model with a custom udf in which is coded the same model. Results are completely different
I tried both vofV=mafV[c] and vofV=mafV[c]*C_R(c,t)/rhoV[c] but no luck...

This is udf:

Code:
#include "udf.h"

DEFINE_CAVITATION_RATE(custom_cav, c, t, p, rhoV, rhoL, mafV, p_v, cigma, f_gas, m_dot)
{
  real p_vapor = *p_v;
  real n_bubbles = 1.e12;
  real dp, Rb, vofV, source;

  dp = p_vapor-ABS_P(p[c],op_pres);
  vofV = mafV[c]; /* by printing on the console mafV is volume fraction not the mass fraction, probably a fluent bug */
  Rb=pow((3.0*vofV/((1.-vofV)*4.0*M_PI*n_bubbles)), 1./3.);

  if (dp > 0.0)
  {
    source = sqrt(2/3*fabs(dp)/rhoL[c]);
  }
  else
  {
    source = -sqrt(2/3*fabs(dp)/rhoL[c]);

  }
  *m_dot = rhoV[c]*rhoL[c]/C_R(c,t)*3.*vofV*(1.-vofV)/Rb*source;
}
Equations are here:
http://www.arc.vt.edu/ansys_help/flu...avitation.html

Can anybody confirm if there is a bug or something else?

Last edited by wyldckat; November 29, 2015 at 06:26. Reason: first post had been deleted, had to merge both posts to not delete thread
ghost82 is offline   Reply With Quote

Old   November 6, 2014, 08:28
Default
  #2
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
ghost82 will become famous soon enough
I wrote to ansys support..let's see what they say..
__________________
Google is your friend and the same for the search button!

Last edited by ghost82; November 6, 2014 at 13:12.
ghost82 is offline   Reply With Quote

Old   November 13, 2014, 09:42
Default
  #3
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
ghost82 will become famous soon enough
Ok, this is the update from Ansys support, and I agree with their comments:

1-mafV in udf is vapor mass fraction
2-in the initialization panel the vapor fraction is mass fraction for Singhal et al cavitation model and volume fraction for the other models; so for custom cavitation udf the initialization panel requests mass fraction
3-in fluent post-processing when you plot vapor volume fraction, vapor volume fraction is plotted for every cavitation model

My error was to consider in the initialization panel always vapor volume fraction.

So, fluent (solver and post processing) is ok, however, it seems the bug is in cfd-post; I will update this thread if confirmed.
__________________
Google is your friend and the same for the search button!
ghost82 is offline   Reply With Quote

Old   November 18, 2014, 07:48
Default
  #4
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
ghost82 will become famous soon enough
Ok, this is solution to questions, thanks to Ansys support!

1- It is confirmed the bug in CFD-POST 15.0.7: if you define a custom cavitation udf (and maybe when using the Singhal et al cavitation model), save the cas and dat files in fluent, open CFD-POST and load the dat file, if you plot the vapor volume fraction variable it is plotted the vapor mass fraction.
However, if you export from fluent the vapor volume fraction variable and you open the exported files (ascii or binary) in CFD-POST the plotted vapor volume fraction is correct.
A request to solve the bug was posted.

2- Another problem I had is that if you define in udf the vapor volume fraction as:
vofV = 1./(1.+(rhoV[c]/rhoL[c])*(1./mafV[c]-1.))

and you copy vofV values into C_UDMI:

C_UDMI(c,t,0) = vofV

if you plot in fluent cell centered values of C_UDMI(c,t,0) and vapor volume fraction values are different: this is because when you define a custom cavitation mass rate you have to turn on the Singhal et al cavitation model; this model takes into account also the incondensable mass fraction; if it is not zero when you plot the vapor volume fraction in fluent you are plotting secondary phase volume fraction (in my case steam+incondensable, and not only the steam volume fraction). If incondensable mass fraction is zero C_UDMI and vapor volume fraction values are the same.
__________________
Google is your friend and the same for the search button!

Last edited by ghost82; November 18, 2014 at 10:07.
ghost82 is offline   Reply With Quote

Old   November 24, 2015, 19:02
Default
  #5
New Member
 
John
Join Date: Nov 2015
Posts: 1
Rep Power: 0
mechanical engineering is on a distinguished road
Quote:
Originally Posted by ghost82 View Post
Ok, this is solution to questions, thanks to Ansys support!

1- It is confirmed the bug in CFD-POST 15.0.7: if you define a custom cavitation udf (and maybe when using the Singhal et al cavitation model), save the cas and dat files in fluent, open CFD-POST and load the dat file, if you plot the vapor volume fraction variable it is plotted the vapor mass fraction.
However, if you export from fluent the vapor volume fraction variable and you open the exported files (ascii or binary) in CFD-POST the plotted vapor volume fraction is correct.
A request to solve the bug was posted.

2- Another problem I had is that if you define in udf the vapor volume fraction as:
vofV = 1./(1.+(rhoV[c]/rhoL[c])*(1./mafV[c]-1.))

and you copy vofV values into C_UDMI:

C_UDMI(c,t,0) = vofV

if you plot in fluent cell centered values of C_UDMI(c,t,0) and vapor volume fraction values are different: this is because when you define a custom cavitation mass rate you have to turn on the Singhal et al cavitation model; this model takes into account also the incondensable mass fraction; if it is not zero when you plot the vapor volume fraction in fluent you are plotting secondary phase volume fraction (in my case steam+incondensable, and not only the steam volume fraction). If incondensable mass fraction is zero C_UDMI and vapor volume fraction values are the same.
Hi dear ghost82
Thanks for your important and attractive posts.
mechanical engineering is offline   Reply With Quote

Old   August 3, 2016, 09:10
Default
  #6
New Member
 
Mehmet Kaya
Join Date: Jan 2010
Posts: 10
Rep Power: 16
mhmt is on a distinguished road
Dear Ghost82 and others,

Please check Fluent UDF manual the following for define_cavitation_rate;

-----------------------
''Assuming mdot denotes the mass-transfer rate between liquid and vapor phases, we have

Re=max [mdot,0] fl
Rc=max [-mdot,0] fv

where fl and fv are the mass-fraction of the liquid and vapor phase, respectively. DEFINE_CAVITATION_RATE is used to calculate mdot only. The values of Re and Rc are computed by the solver, accordingly.''
---------------------------

It seems the source terms Re and Rc are computed by multiplying mdot with mass fraction terms by the solver. Therefore, considering your UDF for the Schnerr model, I think we need to divide your mdot expression for Re by fl as seen below.

m_dot = rhoV[c]*rhoL[c]/C_R(c,t)*3.*vofV*(1.-vofV)/Rb*source / (1-mafV[c]-f_gas)

What do you think?

With kind regards,
mhmt is offline   Reply With Quote

Old   October 30, 2018, 13:52
Default
  #7
New Member
 
Maharashtra
Join Date: Dec 2017
Posts: 13
Rep Power: 8
Sachin Zanje is on a distinguished road
I am also thinking the same. Ghost82 can you please comment on this?
Sachin Zanje is offline   Reply With Quote

Old   October 30, 2018, 13:58
Default
  #8
New Member
 
Maharashtra
Join Date: Dec 2017
Posts: 13
Rep Power: 8
Sachin Zanje is on a distinguished road
In all the expressions of Ghost82, vofV [c] should be vapor volume fraction and m dot for evaporation and condensation term must be divided by (1-mafV[c]) and mafV[c] respectively.
Are these statements are correct?
Sachin Zanje is offline   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
Dynamic Mesh UDF Qureshi FLUENT 7 March 23, 2017 07:37
HELP! adding a mass source to VOF eqn. by UDF??? ROOZBEH FLUENT 5 December 3, 2016 17:53
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Help Parallelizing UDF AndresC FLUENT 0 February 25, 2010 15:50
DEFINE_DPM_OUTPUT macro UDF HELP Puneet FLUENT 3 November 28, 2003 10:55


All times are GMT -4. The time now is 06:20.