# UDF Time-dependent problem

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

 September 25, 2019, 18:55 UDF Time-dependent problem #1 New Member   Join Date: Sep 2018 Posts: 8 Rep Power: 7 Hi everyone that concerns, I have a problem when writing a UDF for time-dependent fluids in Fluent. In my assumption, the viscosity will change when time changes. This means the viscosity will change as location of cell changes when fluid moves in pipe. How can I define that? Who can help me? Thanks so much.

 September 25, 2019, 21:42 #2 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,363 Rep Power: 34 Ansys Fluent Customization manual start with DEFINE_PROPERTY macro best regards dagang likes this.

September 26, 2019, 00:32
#3
New Member

Join Date: Sep 2018
Posts: 8
Rep Power: 7
Quote:
 Originally Posted by AlexanderZ Ansys Fluent Customization manual start with DEFINE_PROPERTY macro best regards
Hi AlexanderZ,
I have written a UDF. But, I don't know whether it's right or not. I want to make it clear. I am studying thixotropic fluids, so call time-dependent fluids. I assume that flow doesn't occur when shear rate doesn't exceed a critical value. If shear rate is larger than critical shear rate, the viscosity starts to decrease with time.

As for the viscosity, I don't know how to represent its change with time. Hence, I assume that at time t, the particle moves with a constant velocity. Then I can know how long it takes to pass each cell(here I assume the length of cell as 0.00001). this time interval can be used in the definite integral on time, in order to get the change of viscosity in this time interval at time t.

Because I am unfamilar with UDF. I can't to write a simpler UDF, instead, I made lots of assumptions.

Here I attach my UDF:

/* UDF for Thixotropic fluid */
#include "udf.h"
#include "mem.h"

FILE *fp;

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

DEFINE_PROPERTY(Thixotropy-Viscosity, c, t)

{

/* Input Parameters for Viscosity Definition */

real vis; /*define viscosity*/
real shear_rate;
real time_L;
real critical_rate=0.1;
real deta_T;

shear_rate = C_STRAIN_RATE_MAG(c,t);

/************ Thixotropic Fluidefinition of Viscosity **********/
if (shear_rate<critical_rate)
vis=12;
else
time_L=pow((12.348/(C_MU_L(c,t)-0.2)-1),0.61)/0.27; /* time when one particle starts to move */
deta_T=0.00001/sqrt(C_U(c,t)*C_U(c,t)+C_V(c,t)*C_V(c,t)+C_W(c,t)* C_W(c,t)); /*calculate the time interval, 0.00001 is the length particle passed in the time interval*/
vis = 0.2+12.348/(1+pow(0.27*(time_L+deta_T),1.65)); /*definite integral */
return vis;

}

 September 26, 2019, 00:35 #4 New Member   Join Date: Sep 2018 Posts: 8 Rep Power: 7 Hi AlexanderZ, I have written a UDF. But, I don't know whether it's right or not. I want to make it clear. I am studying thixotropic fluids, so call time-dependent fluids. I assume that flow doesn't occur when shear rate doesn't exceed a critical value. If shear rate is larger than critical shear rate, the viscosity starts to decrease with time. As for the viscosity, I don't know how to represent its change with time. Hence, I assume that at time t, the particle moves with a constant velocity. Then I can know how long it takes to pass each cell(here I assume the length of cell as 0.00001). this time interval can be used in the definite integral on time, in order to get the change of viscosity in this time interval at time t. Because I am unfamilar with UDF. I can't to write a simpler UDF, instead, I made lots of assumptions. Please help me. I am new to this. Thank you so much. Here I attach my UDF: /* UDF for Thixotropic fluid */ #include "udf.h" #include "mem.h" FILE *fp; /* ************************************************* */ DEFINE_PROPERTY(Thixotropy-Viscosity, c, t) { /* Input Parameters for Viscosity Definition */ real vis; /*define viscosity*/ real shear_rate; real time_L; real critical_rate=0.1; real deta_T; shear_rate = C_STRAIN_RATE_MAG(c,t); /************ Thixotropic Fluidefinition of Viscosity **********/ if (shear_rate

 September 26, 2019, 02:12 #5 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,363 Rep Power: 34 compile this code Code: ```#include "udf.h" #include "mem.h" #include "math.h" DEFINE_PROPERTY(Thixotropy_Viscosity, c, t) { /* Input Parameters for Viscosity Definition */ real vis; /*define viscosity*/ real shear_rate; real time_L; real critical_rate=0.1; real deta_T; shear_rate = C_STRAIN_RATE_MAG(c,t); /************ Thixotropic Fluidefinition of Viscosity **********/ if (shear_rate

September 27, 2019, 12:38
#6
New Member

Join Date: Sep 2018
Posts: 8
Rep Power: 7
Quote:
 Originally Posted by dagang Hi AlexanderZ, I have written a UDF. But, I don't know whether it's right or not. I want to make it clear. I am studying thixotropic fluids, so call time-dependent fluids. I assume that flow doesn't occur when shear rate doesn't exceed a critical value. If shear rate is larger than critical shear rate, the viscosity starts to decrease with time. As for the viscosity, I don't know how to represent its change with time. Hence, I assume that at time t, the particle moves with a constant velocity. Then I can know how long it takes to pass each cell(here I assume the length of cell as 0.00001). this time interval can be used in the definite integral on time, in order to get the change of viscosity in this time interval at time t. Because I am unfamilar with UDF. I can't to write a simpler UDF, instead, I made lots of assumptions. Please help me. I am new to this. Thank you so much. Here I attach my UDF: /* UDF for Thixotropic fluid */ #include "udf.h" #include "mem.h" FILE *fp; /* ************************************************* */ DEFINE_PROPERTY(Thixotropy-Viscosity, c, t) { /* Input Parameters for Viscosity Definition */ real vis; /*define viscosity*/ real shear_rate; real time_L; real critical_rate=0.1; real deta_T; shear_rate = C_STRAIN_RATE_MAG(c,t); /************ Thixotropic Fluidefinition of Viscosity **********/ if (shear_rate
There is a question. to represent the time-dependent property of non-Newtonian fluids. I assume particles under low shear rate don't flow in local zone. If critical shear rate was exceeded, shear occurs. Therefore, for each particle, its time point when starting to flow is different. I want to know how to describe the length of cell in UDF. Here I want to get the time how long particle gets through the cell, which can be used in definite integral to determine the change of viscosity with changing time. Note that I want to simulate the time-dependent property of fluids with steady calculation.

 September 29, 2019, 21:22 #7 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,363 Rep Power: 34 I'm not sure about your concept, to find the speed of change, when you have no time in model (because of steady state simulation). It's hard to imagine for me if you are interested in particle behavior, probably you should take a look into Discrete Phase Models (DPM) in fluent best regards

 Tags fluids, time-dependent, udf