CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   BUG cavitation UDF (https://www.cfd-online.com/Forums/fluent-udf/143817-bug-cavitation-udf.html)

ghost82 November 3, 2014 11:19

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 :confused:
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?

ghost82 November 6, 2014 08:28

I wrote to ansys support..let's see what they say..

ghost82 November 13, 2014 09:42

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.

ghost82 November 18, 2014 07:48

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.

mechanical engineering November 24, 2015 19:02

Quote:

Originally Posted by ghost82 (Post 519762)
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.

mhmt August 3, 2016 09:10

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,

Sachin Zanje October 30, 2018 13:52

I am also thinking the same. Ghost82 can you please comment on this?

Sachin Zanje October 30, 2018 13:58

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?


All times are GMT -4. The time now is 16:07.