|
[Sponsors] |
November 30, 2021, 18:16 |
temperature sensor
|
#1 |
New Member
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 5 |
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) } |
|
November 30, 2021, 23: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) }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 1, 2021, 05:15 |
|
#3 |
New Member
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 5 |
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" |
|
December 3, 2021, 02: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) }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
December 4, 2021, 14:57 |
|
#5 |
New Member
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 5 |
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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shadow Wall and temperature | norger | FLUENT | 10 | September 28, 2019 12:43 |
heat transfer coefficient value in floefd | jason kid | FloEFD, FloWorks & FloTHERM | 10 | October 16, 2016 17:55 |
difference of temperature | HKH | FLUENT | 0 | January 28, 2010 03:45 |
monitoring point of total temperature | rogbrito | FLUENT | 0 | June 21, 2009 18:31 |
chemical reaction - decompostition | La S. Hyuck | CFX | 1 | May 23, 2001 01:07 |