|
[Sponsors] |
April 23, 2018, 11:18 |
property UDF compiles but runs with error
|
#1 |
New Member
Sathish
Join Date: Apr 2018
Location: germany
Posts: 5
Rep Power: 8 |
hi guys,
i used a couple of UDFs to define viscosity, thermal conductivity, heat capacity and density of water as function of temperature...compilation wasnt a problem with visual studio express 15 (Fluent 17.2) yet after running the simulation, getting the error '' temperature limited to 1 on 12000 cells on zone 7 in domain 1'' for example... when these functions are implemented directly in Fluent material database as piecewise polynomial, no such messages appear in TUI.. these are relatively simply polynomial fucntion UDFs...can anyone please point out what should i change regarding the setup ...thanks in advance |
|
April 23, 2018, 11:21 |
|
#2 |
New Member
Sathish
Join Date: Apr 2018
Location: germany
Posts: 5
Rep Power: 8 |
these are the udfs....
#include "udf.h" DEFINE_SPECIFIC_HEAT(sfc_heat, T, Tref, h, yi) { real cp; if (T > 700.) { cp = 14000; *h = cp * (T - Tref); } else if (T > 678.2) { cp = (-12066.64 + 35. * T - 0.0253 * pow(T,2.)) * 1000; *h = (-12066.64 * (T - Tref) + 17.5 * (T * T - Tref * Tref) - 0.00843 * (pow(T,3.) - pow(Tref,3.))) * 1000; } else if (T > 614.8) { cp = (-10342.5 + 49.32 * T - 0.0784 * pow(T,2.) + 4.16e-5 * pow(T,3.)) * 1000; *h = (-10342.5 * (T - Tref) + 24.66 * (T * T - Tref * Tref) - 0.02613 * (pow(T,3.) - pow(Tref,3.)) + 1.04e-5 * (pow(T,4.) - pow(Tref,4.))) * 1000; } else if (T > 273.) { cp = (-0.5112 + 0.0371 * T - 9.935e-5 * pow(T,2.) + 9.0e-8 * pow(T,3.)) * 1000; *h = (-0.5112 * (T - Tref) + 0.0189 * (T * T - Tref * Tref) - 3.312e-5 * (pow(T,3.) - pow(Tref,3.)) + 2.25e-8 * (pow(T,4.) - pow(Tref,4.))) * 1000; } else { cp = 4000; *h = cp * (T - Tref); } return cp; } DEFINE_PROPERTY(therm_cond,c,t) { real ktc; real T = C_T(c,t); if (T > 700.) ktc = 240.1e-3; else if (T > 601.1) ktc = (59597. - 282. * T + 0.45 * pow(T,2.) - 2.43e-4 * pow(T,3.)) * 1.e-3; else if (T > 273.) ktc = (-617.55 + 7.37 * T - 0.0123 * pow(T,2.) + 5.7e-6 * pow(T,3.)) * 1.e-3; else ktc = 560.1e-3; return ktc; } DEFINE_PROPERTY(density,c,t) { real rho; real T = C_T(c,t); if (T > 700.) rho = 270.; else if (T > 585.9) rho = 62651. - 303.4 * T + 0.5 * pow(T,2.) - 2.75e-4 * pow(T,3.); else if (T > 273.) rho = 967.6 + 0.61 * T - 0.0014 * pow(T,2.) - 5.82e-7 * pow(T,3.); else rho = 1020.; return rho; } DEFINE_PROPERTY(viscosity,c,t) { real mu; real T = C_T(c,t); if (T > 700.) mu = 37.1e-6; else if (T > 355.6) mu = (3436.2 - 16.8 * T + 0.029 * pow(T,2.) - 1.65e-5 * pow(T,3.)) * 1.e-6; else if (T > 273.) mu = (122974. - 1074.9 * T + 3.16 * pow(T,2.) - 0.003 * pow(T,3.)) * 1.e-6; else mu = 1750.1e-6; return mu; } |
|
April 23, 2018, 12:08 |
|
#3 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
Hi Sam_1913,
One important issue is that you have not integrated the piecewise polynomial in order to reach h -- for each temperature interval, you have integrated that interval's polynomial. To get from Tref to 690K, for example, you should not integrate "cp = (-12066.64 + ...) * 1000;" all the way -- first you integrate "cp = (-0.5112 +...) * 1000;" from Tref to 614.8, etc. Since your polynomials go to absurd values outside their chosen ranges (because that's what polynomials always do), I would expect that this is quite a big problem. Maybe try it in a spreadsheet. You can rely on Tref being 298.15K unless you change it, and I would not advise changing it. While you're trying a spreadsheet, see whether you are happy with the discontinuities in Cp (and maybe others) across your intervals. When I tried your polynomials, I got a jump from 5.66e3 to 1.30e4 at T=614.8K, for example. I might have made a mistake, or these might be intentional, but big jumps won't help stability. This is a much smaller problem than integrating h. Possibly you have created beautifully matching polynomials, but you are quoting the coefficients with low precision -- this is a common mistake. Good luck! Ed |
|
April 24, 2018, 10:52 |
|
#4 | |
New Member
Sathish
Join Date: Apr 2018
Location: germany
Posts: 5
Rep Power: 8 |
Quote:
Thanks once again Regards Sam |
||
Tags |
property udf, temperature limited |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compile calcMassFlowC | aurore | OpenFOAM Programming & Development | 13 | March 23, 2018 08:43 |
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh | gschaider | OpenFOAM Community Contributions | 300 | October 29, 2014 19:00 |
Undeclared Identifier Errof UDF | SteveGoat | Fluent UDF and Scheme Programming | 7 | October 15, 2014 08:11 |
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) | Yogini | Fluent UDF and Scheme Programming | 7 | October 3, 2012 08:24 |
UDF: DEFINE_CG_MOTION for vertical jump motion of an electrode! | alban | Fluent UDF and Scheme Programming | 2 | June 8, 2010 19:54 |