Ansys Learning Forum Forums Discuss Simulation Fluids UDS equation is not reflected Reply To: UDS equation is not reflected

Ramesh Chandra Mishra
Subscriber

Hi

I have a problem after exporting UDF output to a text file. I am running simulation on a cluster and it runs well. I basically have 2 issues:
a)The value of UDS appears to be zero in the console for all the iterations. UDS is for the concentration of species which are emitted from a cell zone. Please note that the source is specifies in GUI and not the UDF. A snippet of my code is as follows:

DEFINE_ON_DEMAND(pch_udf)
{
FILE* fp_pch;
fp_pch = fopen("PCH.txt", "a");
Thread *t,*to, ;
face_t f;
cell_t co;
Domain *d;
d = Get_Domain(1);

real A[ND_ND];
real x[ND_ND];

real PCH_turb_roof=0;




//loop for turbulent component of PCH(Roof)
thread_loop_f(t, d)
{
begin_f_loop(f,t)
{
F_CENTROID(x, f, t);
if (x[0] >= 108 && x[0] <= 126 && x[1] == 18 && x[2] >= 90 && x[2] <= 126 )
{
F_AREA(A,f,t);
co = F_C0(f, t);
to = THREAD_T0(t);
real integrand;
real conc_grad_roof;
real mu_t_roof = C_MU_T(co,to);
C_UDSI(co,to,0)= C_YI(co,to,0) * RHO_1;
conc_grad_roof=(C_UDSI_G(co,to,0)[1]);
integrand = (mu_t_roof /0.7)*conc_grad_roof;
PCH_turb_roof -= integrand*NV_MAG(A);
}
}

end_f_loop(f,t)
}
fprintf(fp_pch, "PCH_turb_roof %g\n",PCH_turb_roof);
}

b) After complete simulations, the parameters defined under execute on demand are 0 for some iterations and non zero for some in the output text file. but it should be non-zero after every iteration as far as I understand. Please let me know if I am doing something wrong or interpreting them wrong. A snippet of the output file is as follows:

PCH_turb_roof 0
PCH_turb_side1 0
PCH_turb_side2 0
PCH_mean_roof 0
PCH_mean_side1 0
PCH_mean_side2 0
PCH_turb_roof 0
PCH_turb_side1 0
PCH_turb_side2 0
PCH_mean_roof 0
PCH_mean_side1 0
PCH_mean_side2 0
PCH_turb_roof 0
PCH_turb_side1 0
PCH_turb_side2 0
PCH_mean_roof 0
PCH_mean_side1 0
PCH_mean_side2 0
PCH_turb_roof 0
PCH_turb_side1 0
PCH_turb_side2 0
PCH_mean_roof 0
PCH_mean_side1 -4.6371
PCH_mean_side2 4.36109
PCH_turb_roof 0
PCH_turb_side1 0
PCH_turb_side2 0
PCH_mean_roof 0
PCH_mean_side1 0
PCH_mean_side2 0
PCH_turb_roof 0
PCH_turb_side1 0
PCH_turb_side2 0
PCH_mean_roof 0
PCH_mean_side1 0
PCH_mean_side2 0
PCH_turb_roof 0
PCH_turb_side1 0
PCH_turb_side2 0
PCH_mean_roof 0
PCH_mean_side1 0
PCH_mean_side2 -4.1951

 

Please note that other parameters visible in the text file have been specified in the code but not mentioned here.

Can you tell me how can i fix it?