CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Lookup_Thread Problem

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 6, 2015, 08:02
Default Lookup_Thread Problem
  #1
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 4
Regenerator is on a distinguished road
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)
}
Regenerator is offline   Reply With Quote

Old   May 6, 2015, 08:38
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 369
Rep Power: 4
`e` is on a distinguished road
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?
`e` is offline   Reply With Quote

Old   May 6, 2015, 08:46
Default
  #3
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 4
Regenerator is on a distinguished road
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?
Regenerator is offline   Reply With Quote

Old   May 6, 2015, 08:56
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 369
Rep Power: 4
`e` is on a distinguished road
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?
`e` is offline   Reply With Quote

Old   May 6, 2015, 09:26
Default Udf
  #5
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 4
Regenerator is on a distinguished road
#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!
Regenerator is offline   Reply With Quote

Old   May 6, 2015, 16:08
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 369
Rep Power: 4
`e` is on a distinguished road
Quote:
Originally Posted by `e` View Post
Does "temp_FC" hold one single value or is it unique for each face?
You're only saving one value of "temp_FC" on each node. Is the temperature on your boundary uniform?
`e` is offline   Reply With Quote

Old   May 7, 2015, 02:44
Default Temp_FC
  #7
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 4
Regenerator is on a distinguished road
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....
Regenerator is offline   Reply With Quote

Old   May 7, 2015, 03:05
Default
  #8
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 369
Rep Power: 4
`e` is on a distinguished road
"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?
`e` is offline   Reply With Quote

Old   May 7, 2015, 03:13
Default Thermostate UDF (Transient)
  #9
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 4
Regenerator is on a distinguished road
#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)
}
Regenerator is offline   Reply With Quote

Old   May 7, 2015, 03:28
Default
  #10
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 369
Rep Power: 4
`e` is on a distinguished road
This code also does not calculate the average temperature over a boundary.

Have a read of the discussion and code in this thread: Resolved: Changing boundary condition with UDF according to pressure outlet boundary
`e` is offline   Reply With Quote

Old   May 7, 2015, 04:46
Default Sort it out!
  #11
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 4
Regenerator is on a distinguished road
Dear č

The UDF is almost ok.... the problema was that I was not hooked the Define_Adjust..... my fault!

Thanks for all your help!
Regenerator is offline   Reply With Quote

Old   May 7, 2015, 05:28
Default
  #12
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 369
Rep Power: 4
`e` is on a distinguished road
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!
`e` is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


All times are GMT -4. The time now is 04:44.