# the variable heat flux using UDF

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

 March 11, 2020, 10:25 the variable heat flux using UDF #1 New Member   Tunisia Join Date: Mar 2020 Posts: 2 Rep Power: 0 someone can help me please How do I create the variable heat flux with time in axisymmetric two-dimensional model using UDF. thanks

 March 11, 2020, 10:32 Variation with Time #2 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 1,305 Blog Entries: 1 Rep Power: 21 If the variation is only with time, you do not require a UDF. You can use a profile as follows ((varHeatFlux transient 3 0) (time 0 1 2.2 ) (hf 234.23 21.34 893.2 )) varHeatFlux and hf are variable names and you can use whatever names you want. transient is a keyword and should be used as it is. 3 is number of points. 0 refers to periodicity. For a time periodic profile, use 1. Rest are data points in SI. Save this with an extension .prof and then read using File > Read > Profile. Hook it on any boundary or cell zone for anything. Fluent will use the numbers as the field where the hooking is done, i.e., if hooked to heat flux then the numbers represent W/sq.m., if hooked at temperature, then numbers represent K, etc. Do note that time should be in ascending order. For time values in between given time values, Fluent uses linear interpolation. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared on the Forum

 March 11, 2020, 14:33 #3 New Member   Tunisia Join Date: Mar 2020 Posts: 2 Rep Power: 0 Someone can help me please How to create the variable heat flux using UDF in axisymmetric two-dimensional model Q(t)=-0.003∙t^3+0.2245∙t^2-22.138∙t+5000 #include "udf.h" DEFINE_PROFILE(ramp_heat,thread,position) { float t,heat; face_t f; t=RP_Get_Real("flow-time"); heat=(((-0.003)*(t*t*t))+((0.2245)*(t*t))-22.138*(t)+5000); begin_f_loop(f,thread) { F_PROFILE(f,thread,position) =heat; } end_f_loop(f,thread) }

 March 11, 2020, 16:02 UDF Code #4 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 1,305 Blog Entries: 1 Rep Power: 21 As you might observe, same value is being applied on each face. Therefore, a UDF is an overkill for this work. Yet, the code you have written is alright and should work. For power, C provides a function called pow and it is used with two arguments, e.g., pow(t,3) implies (t*t*t). Secondly, Fluent provides C variable CURRENT_TIME that provides value of current simulation time. So, no need to use RP call. RP call is much more time consuming than a C based call. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared on the Forum