Simply the best answers.Get 100$ bonus
Face temperatures F_T(face,thread) are not available in UDF for interior faces. If required, it should be reconstructed.
The UDF example reconstructs the face value based on cell temperature and cell temperature gradient stored on each side of the face.
This value is copied in UDM-0 in each cell located on each side of the face.
The temperature profile on interior-12 is also written in a file.
# include <stdio.h>
#define INTERIOR_ID 12
#define filename "temperature_int12.out"
/* variable declarations*/
real x, y, z;
Thread *tc0, *tc1;
/* lookup face thread of interior-12 */
Thread *tf = Lookup_Thread(domain, INTERIOR_ID);
/* Alloc_Storage_Vars memory for reconstructed gradient(RG)
and gradient(G) NOTE: must get RG to get G
T_derivatives computes RG and G
Free_Storage_Vars frees memory that was used for RG */
Alloc_Storage_Vars(domain, SV_T_RG, SV_T_G, SV_NULL);
Free_Storage_Vars(domain, SV_T_RG, SV_NULL);
temp_file = fopen(filename, "w");
fprintf(temp_file,"(%10s %10s %10s %10s)n",
/* Definition */
/* get index of cells next to INTERIOR_ID */
/* get index of thread next to INTERIOR_ID */
/* get cell and face centroids */
/* Operations */
/* NV_VV is a macro for vectorA = vectorB +- vectorC
NV_VV(A, =, B, +or-, C) returns vectorA */
/* ds0 is coordinate distance between face and cell center */
/* Calcul */
/*C_T_G gets cell temperature gradient */
T0 = C_T(c0,tc0) + NV_DOT(C_T_G(c0,tc0),ds0);
T1 = C_T(c1,tc1) + NV_DOT(C_T_G(c1,tc1),ds1);
T_surface = (T0+T1)/2.;
/* print to file in table format x y z T_surface
where x, y, and z are face coordinates*/
fprintf(temp_file, "%10.3e %10.3e %10.3e %10.3en", xf, xf, xf, T_surface);
Free_Storage_Vars(domain, SV_T_G, SV_NULL);