CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Initialisation of UDS at t=0 (https://www.cfd-online.com/Forums/fluent/122508-initialisation-uds-t-0-a.html)

moloykb August 21, 2013 06:54

Initialisation of UDS at t=0
 
Dear All,

I want to calculate the concentration contour, in the three fluid zone in a transient situation. For that I need to initialize concentration equal to 1 at zone 1 at t=0 whereas for zone 2,3 concentration is equal to 0 at t=0. I am using only 1 single UDS equation. How to implement this initial condition. Any help is highly appreciated.

bigfootedrockmidget August 22, 2013 08:47

Find the fluid id's of the different zones, and then do something like this: copy,paste,build,load and set function hook.

Code:

#define ID_FLUID_1 136
#define ID_FLUID_2 242
#define ID_FLUID_3 281

DEFINE_INIT(Set_start_conc,d){
cell_t c;
Thread *t;
double x[ND_ND];
   
t=Lookup_Thread(d,ID_FLUID_1);
begin_c_loop(c,t){
  C_UDSI(c,t,0) = 1.0 // value of user defined scalar 0   
}
end_c_loop(c,t)
       

t=Lookup_Thread(d,ID_FLUID_2);
begin_c_loop(c,t){
  C_UDSI(c,t,0) = 0.0;           
}
end_c_loop(c,t)

t=Lookup_Thread(d,ID_FLUID_3);
begin_c_loop(c,t){
  C_UDSI(c,t,0) = 0.0;           
}
end_c_loop(c,t)
}



All times are GMT -4. The time now is 16:24.