|
[Sponsors] |
How to write a code that can have the below function: Define a heat flux, it is 0 whe |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 19, 2020, 16:58 |
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 |
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?
|
|
July 20, 2020, 02:37 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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); 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 |
|
July 20, 2020, 12:35 |
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 |
Quote:
|
||
July 21, 2020, 03:02 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
show your code and we will try to fix it if necessary
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 21, 2020, 17:20 |
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 |
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) } |
|
|
|
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 |