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

UDF Time-dependent problem

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 25, 2019, 19:55
Unhappy UDF Time-dependent problem
  #1
New Member
 
Join Date: Sep 2018
Posts: 8
Rep Power: 8
dagang is on a distinguished road
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.
dagang is offline   Reply With Quote

Old   September 25, 2019, 22:42
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Ansys Fluent Customization manual

start with DEFINE_PROPERTY macro

best regards
dagang likes this.
AlexanderZ is offline   Reply With Quote

Old   September 26, 2019, 01:32
Default
  #3
New Member
 
Join Date: Sep 2018
Posts: 8
Rep Power: 8
dagang is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
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.



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<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;

}
dagang is offline   Reply With Quote

Old   September 26, 2019, 01:35
Default
  #4
New Member
 
Join Date: Sep 2018
Posts: 8
Rep Power: 8
dagang is on a distinguished road
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<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;

}
dagang is offline   Reply With Quote

Old   September 26, 2019, 03:12
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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<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;
}
best regards
AlexanderZ is offline   Reply With Quote

Old   September 27, 2019, 13:38
Default
  #6
New Member
 
Join Date: Sep 2018
Posts: 8
Rep Power: 8
dagang is on a distinguished road
Quote:
Originally Posted by dagang View Post
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<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;

}
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.
dagang is offline   Reply With Quote

Old   September 29, 2019, 22:22
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Reply

Tags
fluids, time-dependent, udf


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
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 10:10
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 05:13
simpleFoam error - "Floating point exception" mbcx4jc2 OpenFOAM Running, Solving & CFD 12 August 4, 2015 03:20
AMI interDyMFoam for mixer nu problem danny123 OpenFOAM Programming & Development 8 September 6, 2013 03:34
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


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