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

Whats is wrong with my UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2017, 12:55
Default Whats is wrong with my UDF
  #1
New Member
 
Join Date: Aug 2017
Posts: 1
Rep Power: 0
gelogghe is on a distinguished road
Hi,

I'm trying to model blood flow on a backward facing step (2D) using a shear-dependent viscosity (non-newtonian). When I use a UDF-defined carreau viscosity, I get normal convergence and results. However, when I'm using a UDF-defined viscosity for both the power-law viscosity and Walburn-Schneck model, I getting following messege (before any iterations took place).

"Error: Divergence detected in AMG solver: x-momentum
Error Object: #f"

code for carreau-viscosity:

#include "udf.h"
#define LAMBDA 3.313
#define N 0.3568
#define MU_ZERO 0.056
#define MU_INF 0.0035

DEFINE_PROPERTY(carr_viscosity,c,t)
{

real mu; /*I created a variable mu*/
real strain_rate;

strain_rate = C_STRAIN_RATE_MAG(c,t);

mu = MU_INF+(MU_ZERO-MU_INF)*pow((1+pow((LAMBDA*strain_rate),2)),(N-1)/2);
return mu;
}


Code for power-law:

#include "udf.h"
#define N 0.6
#define MU_ZERO 0.035

DEFINE_PROPERTY(cell_viscosity,c,t)
{
real mu;
real strain_rate;
strain_rate = C_STRAIN_RATE_MAG(c,t);
mu = MU_ZERO*pow(strain_rate,N-1);
return mu;
}

code for Walburn-Schneck:

#include "udf.h"
#define C_1 0.00797
#define C_2 0.0608
#define C_3 0.00499
#define C_4 14.585
#define H 0.40
#define TPMA 25.9
#define E 2.71828182846

DEFINE_PROPERTY(cell_viscosity,c,t)
{
real mu;
real strain_rate;

strain_rate = C_STRAIN_RATE_MAG(c,t);

mu = C_1*pow(E,C_2*H)*pow(E,C_4*TPMA/pow(H,2))*pow(strain_rate,-C_3*H);

return mu;
}

Could someone tell me what I'm doing wrong?

Thanks!
gelogghe is offline   Reply With Quote

Old   September 3, 2018, 19:43
Default
  #2
Member
 
Liliana de Luca Xavier Augusto
Join Date: Feb 2013
Posts: 69
Rep Power: 13
liliana is on a distinguished road
Hi,

try to set the relaxation factor to a lower value on your initialization. It worked for me.
liliana is offline   Reply With Quote

Old   September 5, 2018, 16:58
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Not the problem, but really ugly:
Code:
pow(E,C_2*H)
Please replace this (and other places where you take the exponent of E) by:
Code:
exp(C_2*H)
To solve your real problem: I think you just made a mistake in your equations, and have a viscosity that is much too large/small.

- Initialize your case with the carreau-viscosity that worked.
- Change the viscosity to the power law. Don't run the simulation!
- Plot the viscosity, and look which values you get. Are they reasonable?
pakk is offline   Reply With Quote

Reply

Tags
non-newtonian, power-law, udf, walburn-schneck


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
udf for valve closing a pipe using dynamic mesh chem engineer Fluent UDF and Scheme Programming 2 May 13, 2017 10:39
whats wrong with this udf ? h.mortezaee Fluent UDF and Scheme Programming 3 September 14, 2015 08:32
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
something wrong when compiling udf, however the code is correct when interpreting richard ben Fluent UDF and Scheme Programming 7 May 11, 2013 08:36
what's wrong with the UDF major FLUENT 6 March 3, 2005 07:39


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