Accesing the corresponding cells on either side of a wall - wall shadow zone.


It is sometimes necessary to reference the cells on either side of the wall/wall-shadow zone. Mostly to get the temperature difference. But F_C1 does not work here. Instead, there are a couple of macros that work here -
Thread *t_shadow=THREAD_SHADOW(t);
face_t f_shadow=F_SHADOW(f,t);
These are defined in "mem.h".
The resolution below contains a UDF that uses these macors to compute the temperature difference between a solid cell and fluid cell separated by a wall - wall shadow zone.
#include "udf.h"
#define wall_id 11 /*change this number according to your case */

DEFINE_ON_DEMAND(temp_diff_shadow)
{
Domain *d=Get_Domain(1);
Thread *wall_t=Lookup_Thread(d,wall_id); /* get the wall thread*/
Thread *wall_shadow_t=THREAD_SHADOW(wall_t); /*get the wall shadow thread */

Thread *wall_cell_t,*shadow_cell_t;
cell_t wall_c,shadow_c;
face_t f,f_shadow;
real temp_diff;

begin_f_loop(f,wall_t) /* loop over all the faces of the wall */
{
wall_cell_t=THREAD_T0(wall_t); /* get the cell zone in the wall side */
wall_c=F_C0(f,wall_t);

f_shadow=F_SHADOW(f,wall_t); /*get the corresponding face in the shadow thread */

shadow_cell_t=THREAD_T0(wall_shadow_t); /*get the cell sone in the shadow side */
shadow_c=F_C0(f_shadow,wall_shadow_t);

temp_diff=C_T(wall_c,wall_cell_t)-C_T(shadow_c,shadow_cell_t);
Message("Temp Diff = %gn",temp_diff);
}
end_f_loop(f,wall_t)

}





Show Form
No comments yet. Be the first to add a comment!