CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)

 Rich1979 March 18, 2011 03:31

Hi everybody,
I have a question : i have to write an UDF for a thermal load on a surface (lateral surface of a truncated cone).The thermal load follows the law P(z) = a*z^b where z is the distance from the source.
How could i set up my UDF?
Thx mates.

 Amir March 18, 2011 04:05

Hi,
you can do that with DEFINE_PROFILE macro and hook that in heat flux boundary condition.

 Rich1979 March 18, 2011 05:49

Could it be something like :

Quote:
 #include "udf.h" DEFINE a 1 DEFINE b 2 DEFINE_PROFILE (powerload, t, i) { real x[ND_ND]; real y; real z; face_t f; begin_f_loop(f, t) { F_CENTROID(x,f,t); z = x[1]; F_PROFILE(f, t, i) = a*z^b; } end_f_loop(f, t) }
At ND_ND have i to put 3D_3D?

 Amir March 18, 2011 08:34

it needs some changes:
Code:

```#include "udf.h" #include "math.h" #define a 1 #define b 2 DEFINE_PROFILE (powerload, t, i) {   real x[ND_ND];                  real z;      face_t f;   begin_f_loop(f, t)     {       F_CENTROID(x,f,t);       z = x[2];       F_PROFILE(f, t, i) = a*pow(z,b);     }   end_f_loop(f, t) }```
it doesn't need to change ND_ND. it automatically adopts itself.

 Rich1979 March 21, 2011 02:05

Thx a lot Amir,your advise was very useful!I realized my udf :)

 All times are GMT -4. The time now is 23:46.