CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (

Craig August 13, 2008 18:11

/* This function initializes my domain on the left side with species 0 at 300K and species 1 at 600K on the right side. domain is 1 meter long */

#include "udf.h"

DEFINE_INIT(my_init_function,d) { cell_t c; Thread *t; real xc[ND_ND];

thread_loop_c(t,d) {

begin_c_loop_all (c,t)



if (xc[0] < 0.5)


C_T(c,t) = 300.;

C_YI(c,t,0) = 0.;




C_T(c,t) = 600.;

C_YI(c,t,0) = 1.;



end_c_loop_all(c,t) } }

Craig August 13, 2008 18:16

The above UDF compiles and runs when hooked. The temperature on the left is 300K and the temp on the right is 600K. Species 0 is on the left and Species 1 is on the right.

However, when i zoom into the walls on the right side, the wall nodes appear to be initialized with Species 0.

I think that I need to add an f_loop to initialize nodes on the wall but the temperature loop seemed to work fine. Any ideas?

Smith_K August 14, 2008 01:28

Assign the species mass fraction in the wall boundary conditions. By default the mass fraction of all the species will be zero. You do not need a UDF to assign the same on the walls. Regards,

Craig August 14, 2008 17:34

Thanks for the response.

My wall boundary is set to: Zero Diffusive Flux for species and 0 Heat Flux for Temp. So, my wall species and Temp is allowed to float based on what happens in the interior.

When I initialize the domain to one temp and species without the UDF using solve/initialize I see that all interior nodes and wall nodes are at the initialized species and temperature.

When I initialize the domain using my UDF I find that only the interior nodes are properly initialized (because I have only looped on cell centroids).

Since I don't want to specify species or temp as a boundary condition, I believe that I must do something extra with my UDF to initialize the remaining part of my domain that my begin_c_loop missed.

Thanks again.

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