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

UDF problem to obtain maximum temperature

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 14, 2021, 11:20
Default UDF problem to obtain maximum temperature
  #1
New Member
 
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 5
erfan2000 is on a distinguished road
Hello all
I use a udf to obtain the maximum temperature in each timestep and use it in another udf.to get the maximum temperature I wrote this udf:
Code:
real tmax=0.;
DEFINE_ON_DEMAND(on_demand_calc)
 {
 Domain *d; 
 real temp;
 Thread *t;
 cell_t c;
 d = Get_Domain(1); /* Get the domain using ANSYS Fluent utility */
 /* Loop over all cell threads in the domain */
 thread_loop_c(t,d)
 {
 /* Compute max temperature */
 /* Loop over all cells */
 begin_c_loop(c,t)
{
 temp = C_T(c,t); /* get cell temperature */
 if (temp > tmax || tmax == 0.) tmax = temp;
 }
 end_c_loop(c,t)
 printf("\n Tmax = %g ",tmax);
 }
 }
but it prints about 11 tmax in every timestep that the first ones are 0 but the last one I think are correct.I execute this udf from execute on demand and User-Defined Function Hooks>execute at end.
Can anyone Help me please or it will work properly?
P.S: My case consist of several zones.
thanks in advanced
erfan2000 is offline   Reply With Quote

Old   November 15, 2021, 00:20
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
parallelize your code, make it works on several nodes

more information in ansys fluent customization manual
erfan2000 likes this.
__________________
best regards


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

Old   November 15, 2021, 06:19
Default
  #3
New Member
 
Erfan
Join Date: Oct 2021
Posts: 14
Rep Power: 5
erfan2000 is on a distinguished road
thank you Alexander for your help but as I'm not an expert in writing a UDF I want to know if my code works properly without any changes then I just use it.
In the first timesteps, the last printed tmax for each timestep was correct.
erfan2000 is offline   Reply With Quote

Old   November 16, 2021, 01:03
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
as you are not an expert in writing a UDF, you've asked question here, got an answer.
now you can follow recommendations or ignore
__________________
best regards


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

Reply

Tags
tmax, udf


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
temperature store and monitoring UDF indsujin Fluent UDF and Scheme Programming 1 July 9, 2021 05:08
UDF problem- time dependent temperature at inlet kaeran FLUENT 1 June 16, 2015 22:48
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 07:56
UDF Wall Temperature Problem - Coordinates Marc FLUENT 1 July 3, 2008 12:10


All times are GMT -4. The time now is 18:10.