CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   the variable heat flux using UDF (https://www.cfd-online.com/Forums/fluent-udf/225012-variable-heat-flux-using-udf.html)

Sarra March 11, 2020 10:25

the variable heat flux using UDF
 
someone can help me please
How do I create the variable heat flux with time in axisymmetric two-dimensional model using UDF.
thanks

vinerm March 11, 2020 10:32

Variation with Time
 
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.

Sarra March 11, 2020 14:33

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)

}

vinerm March 11, 2020 16:02

UDF Code
 
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.

mahdi fa January 31, 2022 18:59

thanks a lot:):):)


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