- **FLUENT**
(*http://www.cfd-online.com/Forums/fluent/*)

- - **solution not converging with UDF. Please help!!
**
(*http://www.cfd-online.com/Forums/fluent/35944-solution-not-converging-udf-please-help.html*)

solution not converging with UDF. Please help!!
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; } |

Re: solution not converging with UDF. Please help!
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 |

Re: solution not converging with UDF. Please help!
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. |

All times are GMT -4. The time now is 21:59. |