|
[Sponsors] |
Change in velocity w.r.t specefic cell/zone temperature UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 11, 2019, 19: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: 7 |
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] |
|
July 11, 2019, 23: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, 09:23 |
|
#3 |
New Member
Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
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 |
|
July 14, 2019, 22:55 |
|
#4 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
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, 12:09 |
|
#5 |
New Member
Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 7 |
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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ansys Fluent UDF, Wall Average Temperature Depend On Inlet Velocity | ozgeozge | Fluent UDF and Scheme Programming | 1 | April 15, 2019 02:31 |
UDF for Blasius profile of velocity and temperature | heisenmech | Fluent UDF and Scheme Programming | 0 | March 24, 2019 20:04 |
Multiphase flow - incorrect velocity on inlet | Mike_Tom | CFX | 6 | September 29, 2016 02:27 |
UDF error - parabolic velocity profile - 3D turbine | Zaqie | Fluent UDF and Scheme Programming | 9 | June 25, 2016 20:08 |
Terrible Mistake In Fluid Dynamics History | Abhi | Main CFD Forum | 12 | July 8, 2002 10:11 |