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/)
-   -   turbulent viscosity built-in vs implemented (https://www.cfd-online.com/Forums/fluent-udf/186075-turbulent-viscosity-built-vs-implemented.html)

Ionut G April 10, 2017 06:20

turbulent viscosity built-in vs implemented
 
4 Attachment(s)
Hi guys,

I want to define a new turbulent viscosity model.

First I want to implement the equation from help manual.
I extracted and stored in C_UDMIs the values of Turbulent Kinetic Energy, Turbulent Kinetic Energy Dissipation Rate and Turbulent Viscosity. I compared them with the same built-in variables from fluent and I have some differences between each other.

Is it ok to have these differences if I compared, theoretically, the same variables?

For each figure, Series 1 represents the built-in variable from fluent, Series 2 represents the extracted variables and Series 3 (for the 3rd figure) is the calculated turbulent viscosity using the formula provided in help.

The 4th figure shows the line from which the variables was extracted and the comparison was made.

Thank you for the support.

I attached the code below:
Code:

// Preprocessors
#include "udf.h"
#include "mem.h"

// Constants
#define CMU 0.09
#define DENSITY 998.2

DEFINE_TURBULENT_VISCOSITY(trb_visc,c,t)
{       
  real mu_t, k, epsilon;
 
  k = C_K(c,t);
  C_UDMI(c,t,0) = k;
 
  epsilon = C_D(c,t);
  C_UDMI(c,t,1) = epsilon;
 
  mu_t_c = DENSITY*CMU*(k*k)/epsilon;
  C_UDMI(c,t,2) = mu_t;

  mu_t_e = C_MU_T(c,t);
  C_UDMI(c,t,3) = C_MU_T(c,t);
 
  return mu_t_e;
}


vcvedant July 19, 2017 12:05

It is not ok to have these differences. The results should be same for both the cases. Also, what you are doing is just returning FLUENT's own viscosity instead of user-defined.
I am also trying to modify turbulent viscosity using this macro. I get the same results as the built-in models when I set the CMU value same as that of GUI panel. It seems that DEFINE_TURBULENT_VISCOSITY() is unable to affect diffusivity of the transport equations. Can you please help me with this.


All times are GMT -4. The time now is 10:44.