UDF for modified Herschel-Bulkley rheology model
1 Attachment(s)
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. |
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 |
UDF for Herschel-Bulkley rheology model
#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. |
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 |
UDF for Herschel-Bulkley rheology model
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? |
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" |
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?
|
All times are GMT -4. The time now is 02:35. |