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/)
-   -   UDF for heat flux in a wall (https://www.cfd-online.com/Forums/fluent-udf/231308-udf-heat-flux-wall.html)

franc1 October 30, 2020 12:59

UDF for heat flux in a wall
 
Hi everybody,

i have a cubic solid element in Fluent. This element is at an initial temperature of 600K. In one of the 6 face of the cube i have to apply a UDF which withdraw heat time by time, depending on the temperature of the face of the cube itself.

Is there a way to write that kind of UDF?
If yes, how can i do it?

AlexanderZ November 1, 2020 23:22

Ansys FLuent Customization manual, look for DEFINE_PROFILE macro

franc1 November 2, 2020 04:58

Thank you AlexanderZ for the fast reply.

I would appreciate if you post here an example of heat flux UDF. I didn't find in the customization manual any specific example for heat flux.
I tried to do that by the following UDF:

Code:

#include "udf.h"

DEFINE_PROFILE(wallheatflux, t, i)
{
        real ctime = CURRENT_TIME;

        face_t f;
        real hflux = 0.;

        begin_f_loop(f, t)
        {
                if (F_T(f, t) > 373.)
                        hflux = -10000;
                else
                        hflux = -5000;

                F_PROFILE(f, t, i) = hflux;
        }
        end_f_loop(f, t)
}

It is just a first attempt udf, in which i have variable negative heat flux with the threshold temperature of 373K.
Since i don't have yet the real dimensions of the problem i just write a random value for the heat flux. My question is: if i would have the real values for the heat flux, will it run?

pakk November 2, 2020 05:14

Why don't you just test it??? It takes one minute to test it... Why would you put it here and make other people think about whether it would run or not, when you can just put it in your computer and make sure if it runs?

AlexanderZ November 2, 2020 05:57

I agree here with Pakk, you do better try to run it next time

but this code is correct

franc1 November 2, 2020 10:05

I'm sorry, it was not my intention to be a loss of time.

I tried the code before asking the question and it gave me bad results, so i just wanted to understand whether the problem is about either the dimension of the HF or the code for the udf.

AlexanderZ answered to my question. Anyway thank you both

pakk November 2, 2020 13:29

Quote:

Originally Posted by franc1 (Post 786570)
I'm sorry, it was not my intention to be a loss of time.

I tried the code before asking the question and it gave me bad results, so i just wanted to understand whether the problem is about either the dimension of the HF or the code for the udf.

AlexanderZ answered to my question. Anyway thank you both

I was not concerned with you wasting our time, but with you wasting your own time.

Anyway: the fact that you had already tried your code and got bad results is very relevant information, that you probably should have added when you asked the question.

franc1 November 2, 2020 14:38

next time i'll do it, thank for suggestions Pakk


All times are GMT -4. The time now is 04:49.