|
[Sponsors] |
UDF for modified Herschel-Bulkley rheology model |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 5, 2019, 02:07 |
UDF for modified Herschel-Bulkley rheology model
|
#1 |
New Member
Aashna Raj
Join Date: May 2019
Posts: 7
Rep Power: 7 |
I am trying to write C-code for specifying rheology model of grease. For this, I am using the Herschel-Bulkley model. But my UDF has three compilation errors. I have attached my codes here.
If anyone has any idea about it, please let me know. |
|
July 5, 2019, 02:24 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
put here your code, NOT PICTURE
you need math.h library, make all variable types the same (double or float) 2 and 3 lines are confusing where is information about error you've gotten? best regards |
|
July 5, 2019, 02:47 |
UDF for Herschel-Bulkley rheology model
|
#3 |
New Member
Aashna Raj
Join Date: May 2019
Posts: 7
Rep Power: 7 |
#include ''udf.h''
double pow(double, double); double exp(double); float yst = 189; float m = 1; float k = 4.1; float n = 0.797; define VISCOSITY(cell_viscosity,c,t) { float visco; float rate; rate= (C_STRAIN_RATE_MAG(c,t)); visco =(((yst/rate)*(1-exp((-1)*m*rate)))+(k*pow(rate,(n-1)))); return visco; } The errors displaying are: 1. unable to open include file 'UDF.H' 2. For line8, Declaration syntax error In the Ansys user guide manual, it was given to use udf.h for defining all udfs. Last edited by aashna@iitp; July 5, 2019 at 03:48. |
|
July 5, 2019, 05:31 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you should set appropriate environment variables (windows environment variables)
https://www.cfd-online.com/Wiki/Fluent_FAQ read User-Defined Function (UDF) Related carefully best regards |
|
July 19, 2019, 10:40 |
UDF for Herschel-Bulkley rheology model
|
#5 |
New Member
Aashna Raj
Join Date: May 2019
Posts: 7
Rep Power: 7 |
As suggested, I set up the environment variables and then compiled the UDF. It is getting compiled and I am able to successfully hook it to fluent and use it to set the viscosity variation as per the modified Herschel-Bulkley rheology model.
But when the software solves it, an error message pops up. It reads: ''floating-point exception. Divergence detected.'' This is after the first iteration itself. Can anyone suggest me where am I wrong? Are my codes incorrect or there is any problem with the way it is being hooked? |
|
July 22, 2019, 05:12 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
when you a telling, that there were no errors during compilation, what did you mean?
I've told you, you must put here your code and console output each time! use code Code:
#include "udf.h" #include "math.h" float yst = 189; float m = 1; float k = 4.1; float n = 0.797; DEFINE_PROPERTY(cell_viscosity,c,t) { float visco; float rate; rate= (C_STRAIN_RATE_MAG(c,t)); visco =(((yst/rate)*(1-exp((-1)*m*rate)))+(k*pow(rate,(n-1)))); return visco; } |
|
August 19, 2019, 09:00 |
|
#7 |
Member
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7 |
It likely diverges becauses the equation or coefficients are wrong, from what I have looked up on the Herschel-Bulkley model I cant understand your equation, can you post a link to the paper you get these values and equations from?
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I write Eddy-dissipation model in DEFINE_VR_RATE udf? | swtbkim | FLUENT | 3 | February 25, 2020 18:31 |
Modified k-e turbulence model UDF | Travis | Fluent UDF and Scheme Programming | 7 | November 11, 2018 21:21 |
UDF for Herschel-Bulkely model | emad | Fluent UDF and Scheme Programming | 5 | July 20, 2009 09:16 |
UDF, Herschel-Bulkely model don't have Yielding viscosity term | emad | Fluent UDF and Scheme Programming | 0 | May 19, 2009 13:46 |
UDF of Zimont model in fluent | Z | Main CFD Forum | 0 | February 17, 2005 04:07 |