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

Lookup_Thread Problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 6, 2015, 09:02
Default Lookup_Thread Problem
  #1
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 14
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, 09:38
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`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, 09:46
Default
  #3
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 14
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, 09:56
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`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, 10:26
Default Udf
  #5
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 14
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, 17:08
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`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, 03:44
Default Temp_FC
  #7
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 14
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, 04:05
Default
  #8
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`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, 04:13
Default Thermostate UDF (Transient)
  #9
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 14
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, 04:28
Default
  #10
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`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: http://www.cfd-online.com/Forums/flu...-boundary.html
`e` is offline   Reply With Quote

Old   May 7, 2015, 05:46
Default Sort it out!
  #11
New Member
 
Join Date: Oct 2012
Posts: 11
Rep Power: 14
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, 06:28
Default
  #12
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`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


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 Off
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 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


All times are GMT -4. The time now is 14:59.