CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

solution not converging with UDF. Please help!!

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 6, 2005, 21:06
Default solution not converging with UDF. Please help!!
  #1
shunahshep
Guest
 
Posts: n/a
Hi,

I am just trying to write a simple property UDF and it is not converging (blowing up on energy). i am cut-pasting the complete UDF. can someone pls tell me what i'm doing wrong?

thanks

#include "udf.h"

DEFINE_PROPERTY(cell_viscosity, cell, thread) { real eta_carreau; real eta_carreau1; real temp = C_T(cell, thread); real pressure = C_P(cell, thread); real strain_mag1 = C_STRAIN_RATE_MAG(cell,thread); real strain_mag; real strain_term; real index_1; real tg0 = 362.82; real a1 = 0.29e-06; real c1g = 13.276821; real c2g = 48.52984; real a2 = (-c1g*(temp - tg0)); real a3 = c1g*a1; real a4 = c2g+temp-tg0; real n = 0.294539187; real a = 2.; real eta_inf = 0.0; real eta_zero = 10000.0; real lambda = 0.1;

real ap1 = (a2 + a3*pressure)/(a4 - a1*pressure); real ap = pow(10,ap1);

strain_mag = (strain_mag1)/(ap);

index_1 = (n-1.)/a;

strain_term = pow((lambda*strain_mag),a);

eta_carreau1 = eta_inf + (eta_zero - eta_inf)*pow((1+strain_term),index_1);

eta_carreau = eta_carreau1/(ap);

return eta_carreau; }
  Reply With Quote

Old   March 8, 2005, 06:39
Default Re: solution not converging with UDF. Please help!
  #2
Melaku Habte
Guest
 
Posts: n/a
Hi,

If everything is Ok i.e. the equation that you has no errors in it and you didn't make any typo somewhere in this code then check the following:

1. Units! - just a 5min check will save you hours of headache - I cant stress this more.

2. Check the correlation/empirical equation for what RANGE it is applicable - eg temp range? intermediate values of either pressure or temperature might cause this error. As much as possible try to stay within the range by forcing a good convergence even during the initial iteration.

I included some more below #include "udf.h" DEFINE_PROPERTY(cell_viscosity, cell, thread)

{

/* its always good idea to initialize values if they are needed at first iteration */

real eta_carreau; real eta_carreau1;

real temp = C_T(cell, thread); real pressure = C_P(cell, thread); /* remember your are getting guage pressure here - and am not sure your if equation is based on that */

real strain_mag1 = C_STRAIN_RATE_MAG(cell,thread); real strain_mag; real strain_term;

real index_1; real tg0 = 362.82; real a1 = 0.29e-06; /* 0.29e-6 ? just in case */

real c1g = 13.276821; real c2g = 48.52984; real a2 = (-c1g*(temp - tg0)); real a3 = c1g*a1;

real a4 = c2g+temp-tg0; /* u may check this eqn again */

real n = 0.294539187; real a = 2.; real eta_inf = 0.0; /* you might just omit this if it is always zero */

real eta_zero = 10000.0; real lambda = 0.1; real ap1 = (a2 + a3*pressure)/(a4 - a1*pressure); real ap = pow(10,ap1); /* make sure it is not the other way round pow(ap1,10) */

strain_mag = (strain_mag1)/(ap); index_1 = (n-1.)/a; strain_term = pow((lambda*strain_mag),a);

eta_carreau1 = eta_inf + (eta_zero - eta_inf)*pow((1+strain_term),index_1); eta_carreau = eta_carreau1/(ap);

return eta_carreau;

}

test it and let me know. Also u may get beeter help if you write the coorect equation up here.

regards

Melaku Habte

  Reply With Quote

Old   March 8, 2005, 19:45
Default Re: solution not converging with UDF. Please help!
  #3
shunahshep
Guest
 
Posts: n/a
Hello Melaku,

Thanks for your detailed analysis of my problem. The equation that i have written in my code is indeed the correct equation - i verified it a couple of times.

i'll try to implement the suggestions that you have given - hopefully something will work. for now, i'll just want to thank you for caring to go through my equation and taking out time to offer constructive suggestions. i had almost given up all hope of someone helping me with my UDF.

thanks. shunahshep.
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
parse error while interpreting udf Kristin Fluent UDF and Scheme Programming 3 March 15, 2012 07:43
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF for the heterogeneous gas-char reaction rates, using a numerical solution yummy0917 Fluent UDF and Scheme Programming 0 March 9, 2011 06:44
solution is not converging mkiku FLUENT 2 June 28, 2004 08:01
Wall functions Abhijit Tilak Main CFD Forum 6 February 5, 1999 02:16


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