|
[Sponsors] |
May 6, 2015, 09:02 |
Lookup_Thread Problem
|
#1 |
New Member
Join Date: Oct 2012
Posts: 11
Rep Power: 14 |
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) } |
|
May 6, 2015, 09:38 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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? |
|
May 6, 2015, 09:46 |
|
#3 |
New Member
Join Date: Oct 2012
Posts: 11
Rep Power: 14 |
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? |
|
May 6, 2015, 09:56 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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? |
|
May 6, 2015, 10:26 |
Udf
|
#5 |
New Member
Join Date: Oct 2012
Posts: 11
Rep Power: 14 |
#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! |
|
May 6, 2015, 17:08 |
|
#6 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
||
May 7, 2015, 03:44 |
Temp_FC
|
#7 |
New Member
Join Date: Oct 2012
Posts: 11
Rep Power: 14 |
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.... |
|
May 7, 2015, 04:05 |
|
#8 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
"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?
|
|
May 7, 2015, 04:13 |
Thermostate UDF (Transient)
|
#9 |
New Member
Join Date: Oct 2012
Posts: 11
Rep Power: 14 |
#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) } |
|
May 7, 2015, 04:28 |
|
#10 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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 |
|
May 7, 2015, 05:46 |
Sort it out!
|
#11 |
New Member
Join Date: Oct 2012
Posts: 11
Rep Power: 14 |
Dear č
The UDF is almost ok.... the problema was that I was not hooked the Define_Adjust..... my fault! Thanks for all your help! |
|
May 7, 2015, 06:28 |
|
#12 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compiling problem | Wouter | Fluent UDF and Scheme Programming | 6 | June 6, 2012 05:43 |
Gambit - meshing over airfoil wrapping (?) problem | JFDC | FLUENT | 1 | July 11, 2011 06:59 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
Is this problem well posed? | Thomas P. Abraham | Main CFD Forum | 5 | September 8, 1999 15:52 |