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

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

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2019, 19:03
Post 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
hlmehr is on a distinguished road
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
File Type: jpg vcontour.jpg (101.8 KB, 10 views)
hlmehr is offline   Reply With Quote

Old   July 11, 2019, 23:19
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
1. Show your UDF, which doesn't work
2. what is "cell" you are talking about

best regards
AlexanderZ is offline   Reply With Quote

Old   July 12, 2019, 09:23
Default
  #3
New Member
 
Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 7
hlmehr is on a distinguished road
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
File Type: jpg area.jpg (125.6 KB, 4 views)
hlmehr is offline   Reply With Quote

Old   July 14, 2019, 22:55
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
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
hlmehr likes this.
AlexanderZ is offline   Reply With Quote

Old   August 31, 2019, 12:09
Default
  #5
New Member
 
Hamza Latif Mehr
Join Date: Jul 2019
Posts: 9
Rep Power: 7
hlmehr is on a distinguished road
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
hlmehr is offline   Reply With Quote

Reply

Tags
hvac, udf, velocity and temperature


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
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


All times are GMT -4. The time now is 14:04.