# temperature sensor

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

 November 30, 2021, 17:16 temperature sensor #1 New Member   Erfan Join Date: Oct 2021 Posts: 14 Rep Power: 4 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

 November 30, 2021, 22:47 #2 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,363 Rep Power: 34 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

 December 1, 2021, 04:15 #3 New Member   Erfan Join Date: Oct 2021 Posts: 14 Rep Power: 4 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

 December 3, 2021, 01:59 #4 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,363 Rep Power: 34 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

 December 4, 2021, 13:57 #5 New Member   Erfan Join Date: Oct 2021 Posts: 14 Rep Power: 4 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.

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post norger FLUENT 10 September 28, 2019 11:43 jason kid FloEFD, FloWorks & FloTHERM 10 October 16, 2016 16:55 HKH FLUENT 0 January 28, 2010 02:45 rogbrito FLUENT 0 June 21, 2009 17:31 La S. Hyuck CFX 1 May 23, 2001 00:07

All times are GMT -4. The time now is 16:58.