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 generalized power law viscosity model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 23, 2018, 05:03
Default UDF for generalized power law viscosity model
  #1
New Member
 
Hoai
Join Date: Feb 2018
Posts: 2
Rep Power: 0
whynam is on a distinguished road
Hello guys, I'm new with UDF and I'm trying to implement a new viscosity model, but I've got some issues, if someone can help me, I'll be really thankful:

#include "udf.h"
DEFINE_PROPERTY(generalized_power_law,c,t)
{
real mu;
real strain_rate;

real k;
real n;

real eta_inf=0.035;
real dEta=0.25;
real a=50;
real b=3;

real n_inf=1;
real dn=0.45;
real c=50;
real d=4;

strain_rate=C_STRAIN_RATE_MAG(c,t);

k=eta_inf+dEta*exp(-(1+(strain_rate/a))*exp(-b/strain_rate));
n=n_inf-dn*exp(-(1+(strain_rate/c))*exp(-d/strain_rate));

mu=0.1*k*pow(strain_rate,n-1);
return mu;
}

I've got these line of error :

c definition shadows previous definition
Error: D:/***/udf/viscosity/viscosity_GPL.c: line 21: non-integer subscript expression: float.

I have no idea what to do..
Thank you very much.
whynam is offline   Reply With Quote

Old   March 23, 2018, 10:47
Default
  #2
Member
 
annan
Join Date: Nov 2016
Posts: 72
Rep Power: 10
annan is on a distinguished road
Hello Whynam,
I think your problem might come from these two lines :

real c=50;

strain_rate=C_STRAIN_RATE_MAG(c,t);

For C_STRAIN_RATE_MAG, what you need is a cell and a cell thread => C_STRAIN_RATE_MAG(cell,cell_thread). The problem is that you named the constant and you cell "c", so Fluent cannot find the strain rate value.

What I'd recommand is to name your constant with another name rather than c (real constant = 50; ), and don't forget to change its name in the expression of n otherwise you'll get an error too.

n=n_inf-dn*exp(-(1+(strain_rate/c))*exp(-d/strain_rate));

Hope this will help.
Good luck
annan is offline   Reply With Quote

Old   March 26, 2018, 10:32
Default
  #3
New Member
 
Hoai
Join Date: Feb 2018
Posts: 2
Rep Power: 0
whynam is on a distinguished road
Hi,

Thank you very much, it was helpful
whynam 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
Non-Newtonian Power Law for Viscosity John FLUENT 16 September 12, 2015 07:18
Herschel-Bulkley non-Newtonian viscosity model has term with sign error pbryant OpenFOAM Bugs 5 June 19, 2013 00:53
UDF for drag law - Eulerian Model fevi84 Fluent UDF and Scheme Programming 0 July 16, 2012 14:41
Power Law for Non-Newtonian Viscosity mannobot FLUENT 1 April 23, 2010 10:40
new parameter for non newtonian power law model! Antoine FLUENT 0 July 21, 2008 05:30


All times are GMT -4. The time now is 19:15.