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

How to write a code that can have the below function: Define a heat flux, it is 0 whe

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2020, 16:58
Default How to write a code that can have the below function: Define a heat flux, it is 0 whe
  #1
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
How to write a udf code that can have the below function: define a heat flux, it is 0 when the mass flow of outlet (one boundary ) is zero, and is 1000 w/m^2 when the mass flow of outlet (one boundary ) is over zero?
hitzhwan is offline   Reply With Quote

Old   July 20, 2020, 02:37
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
to make it works you need:
1. Define mass-flow rate as global variable
2. Find mass-flow rate value in boundary you are wanted by thread ID
Code:
int zone_ID = 2;
Thread *thread_name = Lookup_Thread(domain,zone_ID);
3. You may organize it in DEFINE_ADJUST macro to get mass-flow rate before each timestep (or iteration if steady state)
4. Set heat-flux value using DEFINE_PROFILE macro

for more details check Ansys Fluent Customization manual
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 20, 2020, 12:35
Default Because I am not familar with udf, would you please share me the code for me ,thank
  #3
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
to make it works you need:
1. Define mass-flow rate as global variable
2. Find mass-flow rate value in boundary you are wanted by thread ID
Code:
int zone_ID = 2;
Thread *thread_name = Lookup_Thread(domain,zone_ID);
3. You may organize it in DEFINE_ADJUST macro to get mass-flow rate before each timestep (or iteration if steady state)
4. Set heat-flux value using DEFINE_PROFILE macro

for more details check Ansys Fluent Customization manual
Because I am not familar with udf, would you please share me the code for me ,thank you so much.
hitzhwan is offline   Reply With Quote

Old   July 21, 2020, 03:02
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
show your code and we will try to fix it if necessary
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 21, 2020, 17:20
Default I am familar with Profile macro,but I do not know how to use get_adjust macro, could
  #5
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
show your code and we will try to fix it if necessary
I am familar with Profile macro,but I do not know how to use get_adjust macro, could you help me revise it , thank you so much.

#include "udf.h"

DEFINE_ADJUST(my_adjust,d)
{
Thread *t;
/* Integrate dissipation. */
real flow time;
cell_t c;

thread_loop_c(t,d)
{
begin_c_loop(c,t)
flow time= C_D(c,t)*
C_VOLUME(c,t);
end_c_loop(c,t)
}

printf("Volume integral of turbulent dissipation: %g\n", sum_diss);
}

#include "udf.h"



DEFINE_PROFILE(hf_change,thread,position)
{
face_t f;
real time,heat_flux1,heat_flux2;
heat_flux1 = 10;
heat_flux2 = 100;
time=CURRENT_TIME;
begin_f_loop(f,thread)
{

if (time<flow time)
{
F_PROFILE(f,thread,position)=heat_flux1;
}

else if (time>=flow time)
{
F_PROFILE(f,thread,position)=heat_flux2;
}

}
end_f_loop(f,thread)
}
hitzhwan is offline   Reply With Quote

Reply


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
Laminar Kinetic Energy Model (Walters 2008) logoswort Fluent UDF and Scheme Programming 2 May 19, 2017 20:41
Define heat flux on specific faces of mesh Irene Pavlakis Fluent UDF and Scheme Programming 0 August 22, 2013 12:35
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
Missing math.h header Travis FLUENT 4 January 15, 2009 12:48
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


All times are GMT -4. The time now is 15:41.