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

UDF for modified Herschel-Bulkley rheology model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 5, 2019, 01:07
Default UDF for modified Herschel-Bulkley rheology model
  #1
New Member
 
Aashna Raj
Join Date: May 2019
Posts: 7
Rep Power: 6
aashna@iitp is on a distinguished road
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.
Attached Images
File Type: png note.PNG (19.4 KB, 46 views)
aashna@iitp is offline   Reply With Quote

Old   July 5, 2019, 01:24
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
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
AlexanderZ is offline   Reply With Quote

Old   July 5, 2019, 01:47
Default UDF for Herschel-Bulkley rheology model
  #3
New Member
 
Aashna Raj
Join Date: May 2019
Posts: 7
Rep Power: 6
aashna@iitp is on a distinguished road
#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 02:48.
aashna@iitp is offline   Reply With Quote

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

Old   July 19, 2019, 09:40
Default UDF for Herschel-Bulkley rheology model
  #5
New Member
 
Aashna Raj
Join Date: May 2019
Posts: 7
Rep Power: 6
aashna@iitp is on a distinguished road
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?
aashna@iitp is offline   Reply With Quote

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

Old   August 19, 2019, 08:00
Default
  #7
Member
 
Sebi
Join Date: Mar 2019
Posts: 49
Rep Power: 7
bloodflow is on a distinguished road
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?
bloodflow is offline   Reply With Quote

Reply


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
How can I write Eddy-dissipation model in DEFINE_VR_RATE udf? swtbkim FLUENT 3 February 25, 2020 17:31
Modified k-e turbulence model UDF Travis Fluent UDF and Scheme Programming 7 November 11, 2018 20:21
UDF for Herschel-Bulkely model emad Fluent UDF and Scheme Programming 5 July 20, 2009 08:16
UDF, Herschel-Bulkely model don't have Yielding viscosity term emad Fluent UDF and Scheme Programming 0 May 19, 2009 12:46
UDF of Zimont model in fluent Z Main CFD Forum 0 February 17, 2005 03:07


All times are GMT -4. The time now is 02:30.