|
[Sponsors] |
September 25, 2019, 19:55 |
UDF Time-dependent problem
|
#1 |
New Member
Join Date: Sep 2018
Posts: 8
Rep Power: 8 |
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, 22: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 |
|
September 26, 2019, 01:32 |
|
#3 | |
New Member
Join Date: Sep 2018
Posts: 8
Rep Power: 8 |
Quote:
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; } |
||
September 26, 2019, 01:35 |
|
#4 |
New Member
Join Date: Sep 2018
Posts: 8
Rep Power: 8 |
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; } |
|
September 26, 2019, 03: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<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 27, 2019, 13:38 |
|
#6 | |
New Member
Join Date: Sep 2018
Posts: 8
Rep Power: 8 |
Quote:
|
||
September 29, 2019, 22: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 |
|
|
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 |