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

temperature sensor

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By AlexanderZ
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 30, 2021, 17:16
Default temperature sensor
  #1
New Member
 
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 4
erfan2000 is on a distinguished road
Hello dear friends
I have a problem in which there's a solid and a pipe is on top of it with water flow. I want to write a UDF which changes the water inlet velocity corresponding to the temperature of a specific location of the solid. I'll be thankful if you help me with this frustrating problem. I've written this UDF which needs to be corrected.
Code:
DEFINE_PROFILE(InletVelocity, t, i)
{

face_t f;
begin_f_loop (f,t)
{
        real temp=0.;
	real thermosensor_coordinate[ND_ND];
	cell_t c;
	Domain *d;
	Thread *t;
	d = Get_Domain(1);
	real xmin=0.0049215709;
 	real ymin=-0.049582131;
 	real zmin=-0.028587651;
	real tmax=0.;
	real x,y,z;	
        temp=C_T(c,t);
	if (temp>=305 && temp<=315)
		F_PROFILE(f,t,i) = 5;
	else if (temp>315)
		F_PROFILE(f,t,i) = 10;
	else
		F_PROFILE(f,t,i) = 1;
}
end_f_loop(f,t)
}
thanks in advance
erfan2000 is offline   Reply With Quote

Old   November 30, 2021, 22:47
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile code
Code:
DEFINE_PROFILE(InletVelocity, t, i)
{
cell_t c;
CX_Cell_Id cx_cell;
Thread *t;
face_t f;
real NV_VEC(pt);
real tmax=0.;
real temp=0.;
NV_D(pt, =, 0.0049215709, -0.049582131, -0.028587651);
CX_Start_ND_Point_Search();
cx_cell=*CX_Find_Cell_With_Point(pt);
CX_End_ND_Point_Search();
c = RP_CELL(&cx_cell); //the right cell number
t = RP_THREAD(&cx_cell); // the thread
temp=C_T(c,t);
begin_f_loop (f,t)
{
	if (temp>=305 && temp<=315)
		F_PROFILE(f,t,i) = 5;
	else if (temp>315)
		F_PROFILE(f,t,i) = 10;
	else
		F_PROFILE(f,t,i) = 1;
}
end_f_loop(f,t)
}
erfan2000 likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 1, 2021, 04:15
Default
  #3
New Member
 
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 4
erfan2000 is on a distinguished road
thank you but these errors have occurred during compiling:
Code:
warning: cast to 'void * __ptr32' from smaller integer type 'unsigned long' [-Wint-to-void-pointer-cast]
    return((void * POINTER_32) (unsigned long) (ULONG_PTR) p);

warning: incompatible redeclaration of library function 'strncasecmp' [-Wincompatible-library-redeclaration]
int strncasecmp (const char *, const char *, int);

note: 'strncasecmp' is a builtin with type 'int (const char *, const char *, unsigned long long)'

fatal error: 'ud_io1.h' file not found
#  include "ud_io1.h"
thank you
erfan2000 is offline   Reply With Quote

Old   December 3, 2021, 01:59
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
compile code
Code:
#include "udf.h"
#include "cxndsearch.h"

DEFINE_PROFILE(InletVelocity, t, i)
{
static ND_Search *domain_table=NULL;
cell_t c;
CX_Cell_Id cx_cell;
Thread *tc;
face_t f;
real NV_VEC(pt);
real tmax=0.;
real temp=0.;
NV_D(pt, =, 0.0049215709, -0.049582131, -0.028587651);

domain_table = CX_Start_ND_Point_Search( domain_table,TRUE,-1);
cx_cell = *CX_Find_Cell_With_Point(domain_table,pt,0.0);
domain_table=CX_End_ND_Point_Search(domain_table);

c = RP_CELL(&cx_cell); //the right cell number
tc = RP_THREAD(&cx_cell); // the thread
temp=C_T(c,tc);
begin_f_loop (f,t)
{
	if (temp>=305 && temp<=315)
		F_PROFILE(f,t,i) = 5;
	else if (temp>315)
		F_PROFILE(f,t,i) = 10;
	else
		F_PROFILE(f,t,i) = 1;
}
end_f_loop(f,t)
}
erfan2000 likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 4, 2021, 13:57
Default
  #5
New Member
 
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 4
erfan2000 is on a distinguished road
thank you
Now I have a new problem with this UDF. When I compile this and apply it to the velocity, this message is showed and the fluent suddenly closed.

do you know what's wrong? and as I really have a problem with compiled UDF. Can I change this UDF in a way to be used as an interpreted UDF?
thanks a lot, and sorry for asking a lot of questions.
erfan2000 is offline   Reply With Quote

Reply

Tags
sensors, temperature, udf


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
Shadow Wall and temperature norger FLUENT 10 September 28, 2019 11:43
heat transfer coefficient value in floefd jason kid FloEFD, FloWorks & FloTHERM 10 October 16, 2016 16:55
difference of temperature HKH FLUENT 0 January 28, 2010 02:45
monitoring point of total temperature rogbrito FLUENT 0 June 21, 2009 17:31
chemical reaction - decompostition La S. Hyuck CFX 1 May 23, 2001 00:07


All times are GMT -4. The time now is 13:26.