CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   help in udf i need export ave temperature on outlet to inlet to next step (https://www.cfd-online.com/Forums/fluent-udf/246681-help-udf-i-need-export-ave-temperature-outlet-inlet-next-step.html)

Martin_Sz December 16, 2022 10:26

help in udf i need export ave temperature on outlet to inlet to next step
 
Hello
Can Anyone help me to make udf file to export average temperature on outlet from previous step to inlet in next step - transient simulation
Best regards

Martin_Sz December 19, 2022 01:03

can anyone help ??/

AlexanderZ December 19, 2022 03:25

show the code you have, explain problems with it, compilation log, domain geometry, do your boundaries have the same mesh or not

Martin_Sz December 19, 2022 04:27

1 Attachment(s)
So in the attachment U have schematic of my model with boundary conditions
I need to make recirculating gas over two gas domains and one porous , so that i need a average temeprature from outlet (domain 2 - previous step) to import on inlet to next step (domain 1 gas).
Mesh is different on outlet and inlet - different areas .

AlexanderZ December 26, 2022 03:33

you should define initial temperature, which will be applied (tavg = 300 K in code)
at define correct ID number for the outlet boundary from your model (you can find it in fluent GUI)
compile code
Code:

#include "udf.h"
real tavg = 300.;
int outlet_id = 11;

DEFINE_EXECUTE_AT_END(get_outlet_t)
{
Domain *d; /* declare domain pointer since it is not passed as an
argument to the DEFINE macro */

real temp,volume,vol_tot;
Thread *t;
cell_t c;

d = Get_Domain(1); /* Get the domain using ANSYS Fluent utility */
/* Loop over all cell threads in the domain */
t = Lookup_Thread (d, outlet_id);
tavg = 0.;
/* Loop over all cells */
begin_c_loop(c,t)
{
volume = C_VOLUME(c,t); /* get cell volume */
temp = C_T(c,t); /* get cell temperature */
vol_tot += volume;
tavg += temp*volume;
}
end_c_loop(c,t)
#if RP_NODE
vol_tot = PRF_GRSUM1(vol_tot);
tavg = PRF_GRSUM1(tavg);
#endif
tavg /= vol_tot;
Message0("\n Tavg = %f\n",tavg);
/* Compute temperature function and store in user-defined memory*/
/*(location index 0) */
}

DEFINE_PROFILE(inlet_temperature, t, position)
{
face_t f;
begin_f_loop(f,t)
{
F_PROFILE(f, t, position) = tavg;
}
end_f_loop(f, t)
}



All times are GMT -4. The time now is 11:18.