CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Heat flux with position dependent on time (

LuisDo November 19, 2019 15:56

Heat flux with position dependent on time
Hi everyone,

I'm trying to use a UDF to define my problem, which like the title says, is a heat flux changing position each second. I tried looking for examples in here but I was not able to find any, if you know want please share it to me.

So, this is the code I used, but apparently it's not working pretty well because the heat source doesn't move with time.

#include "udf.h"

#define r 5/10000

real x[ND_ND];
real source = 84745;
face_t f;
F_PROFILE(f,t,i) = M_PI*pow(r+x[0],2)*source*x[2];

r is the raidus in meters of the area I want my heat source to heat.
ti should be the time step
source is the heat source (w/m^2)
So, I have a rectangle prism, and I want this circle of r radius to heat one face of the prism in the z direction.
Since F_centroid will locate me in the center of the face, with x[1]=x[1]+x[1] I'm triyng to locate me in the the surface of the prism and not in the middle.
x[2] should be z so I want the initial position of x[2], in the center, to move each time step.
F_Profile I'm trying to build the circle of r radius and multiply it by the source power.

Can anyone please tell me where am I having a mistake?
or any suggestions

I would be very grateful.

AlexanderZ November 20, 2019 23:51

this is strange part from my point of view

change to
or something like that.

I recommend to use this structure of code:
real ti;

LuisDo November 21, 2019 22:02

Hi Alexander,
First of all thank you for answering, secondly I wrote :

because if x[n], represents the actual position, then I want x[2] to be changing. I don't know if I making myself clear.

If I write

How does fluent will know that z is this x[2]? I z values would be the ones I want of the position, but my main objective is the actual z position of the heat flux being in these changing places.

I'm new in the field, so maybe I'm mistaking, please tell me if I'm wrong.


AlexanderZ November 21, 2019 23:48

x[n] are coordinates of this cell(face)
and you can't change it. (if you want to move cell(face) you should use dynamic mesh)

if you want your flux(heat source) "move" than you may vary the magnitude of flux in this cell(face). For example:
1sec flux = 1
2 sec flux = 2
3 sec flux = 3
4 sec flux = 10
5sec flux = 3
6sec flux = 2
7 sec flux = 1

for the neighbor cell(face) flux could be:
1sec flux = 0
2 sec flux = 1
3 sec flux = 2
4 sec flux = 3
5sec flux = 10
6sec flux = 3
7 sec flux = 2

I hope my idea is clear

All times are GMT -4. The time now is 19:55.