Вы находитесь на странице: 1из 2

UDF for initializing phase volume fraction

******************************************************************/

#include "udf.h"

#include "models.h"

/* domain pointer that is passed by INIT function is mixture domain */

DEFINE_INIT(my_init_function, mixture_domain)

int phase_domain_index;

cell_t cell;

Thread *cell_thread;

Domain *subdomain;

real xc[ND_ND];

/* loop over all subdomains (phases) in the superdomain (mixture) */

sub_domain_loop(subdomain, mixture_domain, phase_domain_index)

/* loop if secondary phase */

if (DOMAIN_ID(subdomain) == 3)

/* loop over all cell threads in the secondary phase domain */

thread_loop_c (cell_thread,subdomain)

/* loop over all cells in secondary phase cell threads */

begin_c_loop_all (cell,cell_thread)

C_CENTROID(xc,cell,cell_thread);

if (sqrt(ND_SUM(pow(xc[0] - 0.,2.),

pow(xc[1] - 0.,2.),

pow(xc[2] - 0.,2.))) < 2.1)

/* set volume fraction to 1 for centroid */

C_VOF(cell,cell_thread) = 1.; else


/* otherwise initialize to zero */

C_VOF(cell,cell_thread) = 0.;

end_c_loop_all (cell,cell_thread)

Вам также может понравиться