请教各位,该怎么对边界附近的单元赋值,比如下面这个UDF.我想将一个区域的 C_UDMI(c, tt, 0)全部设置为0,然后边界附近的 C_UDMI(c, tt, 0)设置为1,该怎么操作?谢谢!
void set_zone(Thread* t)
{
cell_t c;
real vol;
Thread *tt = THREAD_SUPER_THREAD(t);
begin_c_loop(c, t)
{
if (THREAD_ID(t) == 1047) {
C_UDMI(c, tt, 0) = 1;
}
end_c_loop(c, lct)
}
void set_cells(Thread *t)
{
Thread *tt = THREAD_SUPER_THREAD(t);
face_t f;
Thread *t_nbr;
cell_t c0, c1;
Domain *mix_domain = Get_Domain(1);
for (int i = 0; i < num_boundaries; i++) {
t_nbr = Lookup_Thread(mix_domain, 1);
begin_f_loop(f, t_nbr){
c0 = F_C0(f, t_nbr);
c1 = F_C1(f, t_nbr);
if (c0 != -1 && THREAD_ID(THREAD_T0(t_nbr)) == 1047) {
C_UDMI(c0, tt, 1) = 0.0;
}
if (c1 != -1 && THREAD_ID(THREAD_T1(t_nbr)) == 1047) {
C_UDMI(c1, tt, 1) = 0.0;
}
}
end_f_loop(f, t_nbr)
}
}
DEFINE_ADJUST(aaa, mix_domain)
{
Thread* mix_thread;
int phase_domain_index = 0;
thread_loop_c(mix_thread, mix_domain)
{
Thread* t = THREAD_SUB_THREAD(mix_thread, phase_domain_index);
if (t != NULL) {
set_capillary_pressure_sources(t);
set_boundary_cells(t);
}
}
}