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

UDF-reference to a different thread

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 19, 2011, 09:56
Default UDF-reference to a different thread
  #1
Senior Member
 
Bionico's Avatar
 
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 16
Bionico is on a distinguished road
Hi everybody,
I have to create a UDF for a wall: in particular the wall temperature must depend on the temperature of a point not next to the boundary (in this point there's a temperature sensor and the wall temperature changes thanks to a feedback)
I don't now how to create the thread, in the UDF, referring to this point (so that I can use C_T function...)
I should have, in the end, two threads in my UDF: the one belonging to the boundary (declared in DEFINE_PROFILE) and this new thread...
Some suggestions?
(excuse for my bad english)

Last edited by Bionico; December 19, 2011 at 10:56.
Bionico is offline   Reply With Quote

Old   December 19, 2011, 13:13
Default
  #2
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Quote:
Originally Posted by Bionico View Post
Hi everybody,
I have to create a UDF for a wall: in particular the wall temperature must depend on the temperature of a point not next to the boundary (in this point there's a temperature sensor and the wall temperature changes thanks to a feedback)
I don't now how to create the thread, in the UDF, referring to this point (so that I can use C_T function...)
I should have, in the end, two threads in my UDF: the one belonging to the boundary (declared in DEFINE_PROFILE) and this new thread...
Some suggestions?
(excuse for my bad english)
Dear Flavio,

you can easily separate your desired volume which encompasses the sensor with this procedure:
1) Adapt->region ..... (define your volume as small as possible which contains the sensor location)
2) grid ->separate-> cells ..... (separate the selected volume)
3) define-> boundary condition ..... (find its ID)
4) if this volume contains more than 1 cell, do proper consideration in UDF such as finding average of properties in this volume and then use it as sensor variable...
5) Enjoy!

Bests,
__________________
Amir
Amir is offline   Reply With Quote

Old   December 20, 2011, 05:20
Default
  #3
Senior Member
 
Bionico's Avatar
 
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 16
Bionico is on a distinguished road
Thank you very much, Amir
I haven't tried your solution yet because I would prefer one independent on the mesh
I have written this UDF, but it doesn't work

Code:
 
DEFINE_ADJUST(tsensor,domain)
{
 real trif_coordinate[ND_ND];
 real trif;
 real xmin;
 real xmax;
 real ymin; 
 real ymax;
 real zmin; 
 real zmax;
 real x,y,z,nt;
 
 cell_t c;
 Domain *d;
 Thread *t;
 d = Get_Domain(1);
 
 xmin=-1.940;
 xmax=-1.860;
 ymin=-1.040;
 ymax=-0.960;
 zmin=1.360;
 zmax=1.440;
 
 thread_loop_c(t,d)
 {
 nt=0.0;
 begin_c_loop(c,t)
 {
  C_CENTROID(trif_coordinate,c,t);
 
  x=trif_coordinate[0];
  y=trif_coordinate[1];
  z=trif_coordinate[2];
 
 
  if ((x >= xmin) && (x <= xmax))
  { 
   if ((y >= ymin) && (y <= ymax))
   {
    if ((z >= zmin) && (z <= zmax))
    {
     trif=trif + C_T(c,t);      
     nt=nt+1.0;       
    }
   }
  }
 }
 end_c_loop(c,t)
 }
 trif=trif/nt;
}
 
DEFINE_PROFILE(twall, thread, position)
{
 real trif;
 real tlimit;
 face_t f;
 tlimit=291.65;
 if (trif>tlimit)
 
   begin_f_loop(f,thread)
 {
     F_PROFILE(f, thread, position) = 291.15-(trif-291.15);  
 }
   end_f_loop(f, thread)
 else
   begin_f_loop(f,thread)
 {
     F_PROFILE(f, thread, position) = 291.15;    
 }
   end_f_loop(f, thread)
 
}

wall temperature doesn't decrease even if trif>tlimit
maybe in DEFINE_PROFILE trif isn't the one defined in the previuos function (DEFINE_ADJUST)?
Bionico is offline   Reply With Quote

Old   December 20, 2011, 05:47
Default
  #4
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 23
Amir is on a distinguished road
Yes; use global variable for "trif"

Bests,
__________________
Amir
Amir 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
Second Derivative Zero - Boundary Condition fu-ki-pa OpenFOAM 11 March 27, 2021 05:28
It would be wonderful if a tool for FoamToTecplot is available luckyluke OpenFOAM Post-Processing 165 November 27, 2012 07:54
How to Reference an Adjacent Cell in a UDF ? jeff8541 FLUENT 0 March 8, 2011 11:33
Installing OpenFOAM-1.5-dev on a cluster ZKM OpenFOAM Installation 4 December 25, 2010 16:59
Windows Installation BugsComments on Petrbs patch brooksmoses OpenFOAM Installation 48 April 16, 2006 01:20


All times are GMT -4. The time now is 00:06.