# Change in velocity w.r.t specefic cell/zone temperature UDF

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

July 11, 2019, 18:03
Change in velocity w.r.t specefic cell/zone temperature UDF
#1
New Member

Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 6
Hello,
I'm designing a UDF that would change the velocity with respect to the specific cell temperature on which the flow is directed of the AC (Simple 2D with one inlet at AC, and outlet at the end of the room. I'll try to attach the picture. Now I know how the flow velocity can be changed w.r.t time in UDF, but i'm having a hard time to code for example if the cell temperature on which the flow is directed is <20 then velocity will be 1 ms-1 if >20 then 3 ms-1. Can someone help? Thanks!
[IMG]file:///C:/Users/HAMZA%20Mehr/Desktop/fyp/usb%20fyp/2d%20roomA/vcontour.jpg[/IMG]
Attached Images
 vcontour.jpg (101.8 KB, 10 views)

 July 11, 2019, 22:19 #2 Senior Member   Alexander Join Date: Apr 2013 Posts: 2,363 Rep Power: 34 1. Show your UDF, which doesn't work 2. what is "cell" you are talking about best regards

July 12, 2019, 08:23
#3
New Member

Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 6
Hi, i'm currently new at UDF, so apologies. I'll tell you the details:I have the objective:
1- Change the inlet velocity which depends on the temperature of the specific Area (the term cell i used) on which flow is directed, as shown in the figure. I have a code which changes velocity with time. i.e

%%%%%%%%%%%%%%%%%%
DEFINE_PROFILE(velocity_magnitude, t, i)
{
real velocity;
real the_current_time;
face_t f;

the_current_time = CURRENT_TIME;

if ((the_current_time>=0) && (the_current_time<10))
{
velocity=3;
}
if ((the_current_time>=10)
{
velocity=1.5;
}
}
%%%%%%%%%%%%
But i want to make a code which changes the velocity as the temperature of the area only on which flow is directed (shown in figure) changes eg if T>20 v=3, T<20 v=1.5.
Regards
Attached Images
 area.jpg (125.6 KB, 4 views)

July 14, 2019, 21:55
#4
Senior Member

Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
Quote:
 But i want to make a code which changes the velocity as the temperature of the area only on which flow is directed
how could you know in advance location of this area?
if you define coordinates (assuming you know it from the very beginning) tahn you can use F_CENTROID macro to get coordinate of faces of model and compare it with your proposed coordinates.
if faces are inside your proposed region, and you may check the temperature there

you may find good examples in Ansys Fluent Customization manual

best regards

 August 31, 2019, 11:09 #5 New Member   Hamza Latif Mehr Join Date: Jul 2019 Posts: 9 Rep Power: 6 Hi, thank you for replying, I have found a code that will give the temperature of the cell ID, and have written a code which should change inlet velocity with the Cell ID's temperature. But it isnt working. I would be grateful if someone would find me a solution. I want to change the inlet velocity or better, inlet temperature depending on the cell ID's temperature. The code is this, #include "udf.h" real tavg; DEFINE_EXECUTE_AT_END(average_temp) { Domain *d; face_t f; real temper = 0.0; real A[ND_ND]; real area = 0.0; real area_tot = 0.0; int ID = 78; /*this is the ID of the boundary wall that I want to get the temperature from*/ Thread *t; int zone_ID; d = Get_Domain(1); t = Lookup_Thread(d,ID); tavg = 0.0; begin_f_loop(f,t) { F_AREA(A,f,t); area = NV_MAG(A)*2.0*M_PI; /*Since the model is axisymmetric, we have to multiply by 2pi*/ area_tot += area; temper = F_T(f,t); tavg += temper*area; } end_f_loop(f,t) tavg /= area_tot; printf("Tavg = %g area_tot = %g\n",tavg,area_tot); } DEFINE_PROFILE(velocity_magnitude, t, i) { real velocity; face_t f; if ((tavg>=305)) { velocity=3; } if ((tavg<305)) { velocity=1.5; } begin_f_loop(f,t) { F_PROFILE(f,t,i) = velocity; } end_f_loop(f,t) } I would be grateful if someone posts a solution, since my thesis depends on it

 Tags hvac, udf, velocity and temperature

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 ozgeozge Fluent UDF and Scheme Programming 1 April 15, 2019 01:31 heisenmech Fluent UDF and Scheme Programming 0 March 24, 2019 19:04 Mike_Tom CFX 6 September 29, 2016 01:27 Zaqie Fluent UDF and Scheme Programming 9 June 25, 2016 19:08 Abhi Main CFD Forum 12 July 8, 2002 09:11

All times are GMT -4. The time now is 07:49.

 Contact Us - CFD Online - Privacy Statement - Top