Lookup_Thread Problem
Dear all,
I am trying to read the temperatura in a face with the (ID=20 for example) and use the temperatura to compute the heat_flux in a diferent face (ID=10 for example). I am in a steady state simulation and the program is not reading any temperatura (consider the value 0) This is the UDF DEFINE_ADJUST(temp_HOT, domain) { face_t f; int ID = 20; /* Zone ID for wall-1 zone from Boundary Conditions panel */ Thread *thread = Lookup_Thread(domain, ID); begin_f_loop(f, thread) { temp_FC=F_T(f,thread); } end_f_loop(f, thread) } DEFINE_PROFILE(heat_flux_FC,t,i) { face_t f; begin_f_loop(f,t) { F_PROFILE(f,t,i)=12*(temp_FC*0.000329*I_teg); } end_f_loop(f,t) } |
Where is the variable "temp_FC" declared and initialised, is this variable global? Does "temp_FC" hold one single value or is it unique for each face?
The DEFINE_ADJUST macro is executed immediately before the solvers are called whereas the DEFINE_PROFILE macro is executed when the properties are updated (at the end of an iteration). Why not extract your temperature profile from the other boundary within the profile UDF? |
Hello e
The function temp_FC is declared but I have not copied in the post. I need the temperatura of a different face, it is not the same face where I applied the heat_flux. For that reason I need the look_up thread with the ID.... But I think that it is something related with your comments about the iterations.... Can you help me please? |
I understand that you're trying to extract temperature values from a boundary other than your heat flux boundary. You're correct in using the Lookup_Thread macro for this task.
Are the faces of the two boundaries coincident? If the two boundaries have different mesh topologies then you'll need to interpolate your temperature face values onto your heat flux boundary faces. Could you post your full UDF to see why your code is returning a zero temperature value? |
Udf
#include "udf.h"
real temp_FC; /* Temperatura del foco caliente [K] */ int I=1.5; /*Intensidad [A]*/ int Sc=3.77E-4;/*Seebeck [V/K]*/ int R=0.0329; /*Resistance [ohm]*/ int Nc=12; /*Number of couple*/ DEFINE_ADJUST(temp_HOT, domain) { face_t f; int ID = 16; /* Zone ID for wall-1 zone from Boundary Conditions panel */ Thread *thread = Lookup_Thread(domain, ID); begin_f_loop(f, thread) { temp_FC=F_T(f,thread); } end_f_loop(f, thread) } DEFINE_PROFILE(heat_flux_FC,t,i) { face_t fh; begin_f_loop(fh,t) { F_PROFILE(fh,t,i)=-Nc*(temp_FC*Sc*I-I*I*R/2)/9.91e-5; } end_f_loop(fh,t) } Thank you! |
Quote:
|
Temp_FC
Temp_FC is the average temperatura of the face.
I have a similar UDF for a thermostate in transient simulation and that Works... I donīt know what is the porblem.... |
"temp_FC" does not give the average temperature in the code you've shown, this variable holds the value of the last cell in the face loop on each process node. What is the UDF that you used for your "thermostate" which worked?
|
Thermostate UDF (Transient)
#include "udf.h"
real T_agua; /*Temperatura del agua*/ DEFINE_ADJUST(temp_agua, domain) { face_t f; int ID = 31; /* Zone ID for wall-1 zone from Boundary Conditions panel */ Thread *thread = Lookup_Thread(domain, ID); begin_f_loop(f, thread) { T_agua=F_T(f,thread); } end_f_loop(f, thread) } DEFINE_SOURCE(heater_pulse, cell, thread, dS, eqn) { real source; /* Energy Source Heater [W/m3] */ face_t f; /*40*/ begin_f_loop(f, thread) { real t = RP_Get_Real("flow-time"); /* Obtain real time step [s] */ int pulse= t/41.5; if (T_agua>358) if (t/41.5-pulse<=0.11084) source=4932356; else source=0; else source=4932356; return source; } end_f_loop(f, thread) } |
This code also does not calculate the average temperature over a boundary.
Have a read of the discussion and code in this thread: http://www.cfd-online.com/Forums/flu...-boundary.html |
Sort it out!
Dear č :rolleyes:
The UDF is almost ok.... the problema was that I was not hooked the Define_Adjust..... my fault! Thanks for all your help! |
I still don't believe your code in the DEFINE_ADJUST macro is calculating the average temperature on your boundary but if it's working now as you want then that's great!
|
All times are GMT -4. The time now is 19:06. |