|
[Sponsors] |
DEFINE_PROFILE: flow time does not increase within UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 1, 2019, 09:37 |
DEFINE_PROFILE: flow time does not increase within UDF
|
#1 |
New Member
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8 |
Dear Community,
I want to modify a boundary condition. Luckily, the example "2.3.24.11. Example 9 - Mass Flow Rate UDF for a Mass-Flow Inlet or Mass-Flow Outlet" from the "ANSYS Fluent Customization Manual" is almost want I need. With minor variations I defined as an interpreted UDF: --------------------------------------------- #include "udf.h" DEFINE_PROFILE(Test_07_mass_flow,th,i) { face_t f; real flow_time = CURRENT_TIME; begin_f_loop(f,th) { if(flow_time <= 906.0) F_PROFILE(f,th,i) = -(0.00006*flow_time-0.0779); else F_PROFILE(f,th,i) = 0.0; } end_f_loop(f,th); printf("\n flow_time = %f F_PROFILE(f,th,i) = %f\n", flow_time, F_PROFILE(f,th,i) ); } ---------------------------------------------- Mass flow is an output parameter, and I get a value of 0.0779. The term in parentheses is evaluated at every instant, but only with flow_time=0, even though flow_time augments in the course of the simulation. Why is what ? Evidently, FLUENT does find the UDF as the initial value is correct. And why is printf to the console not executed ? Fringe question: how can I have the data written to an additional file ? I tried FILE *fp; fp = fopen("data.txt","w"); fprintf(fp, "%4.2f %4.2f\n", flow_time, F_PROFILE(f,th,i) ); fclose(fp); /* close the file pointed to by fp */ but FLUENT does not like "FILE *fp". I use the FLUENT "Academic Student Release" 19.2 on a Windows-PC in stand-alone mode (not using Workbench). Thank you dearly for sharing your expertise and your kind advice, FrankR |
|
April 1, 2019, 11:43 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I have to ask, because you did not mention it: are you sure that you are running a transient simulation, and not steady-state?
And printf is executed, but it does not print to the console. To print to the console, you should use the Message() command. |
|
April 1, 2019, 11:51 |
|
#3 |
New Member
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8 |
It is transient.
Message works only for compiled UDF. Our System Administrator will not have time to install anything for me. Thanks, FrankR |
|
April 2, 2019, 01:45 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use
Code:
real flow_time; flow_time = RP_Get_Real("flow-time"); |
|
April 2, 2019, 08:55 |
|
#5 |
New Member
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8 |
Dear AlexanderZ
thank you so much, this did the trick. I found your advice in the same manual, chapter "3.5. Time-Dependent Macros". The difference between these two definitions is not elaborated. Printing to screen is possible. The printf-command must be placed inside the loop. Outside the loop F_PROFILE(f,th,i) is zero. The chapter "8.2.1.2. Transient Pressure Outlet Profile for Flow in a Tube" reveals that the "Profile Update Interval" must be set to 1 so that the UDF is evaluated in every iteration. There is just one aspect that is irritating me: that same chapter speaks of a "Surface Monitor dialog box" in the context of the example given. This dialog box can ostensibly be accessed via Solution → Monitors → Surface New... This option does not exist, this dialog box does not pop up anywhere. Under Tree, Solution, Monitors I find only Residual, Report Files, Report Plots, Convergence Conditions. Any idea ? Is there a way to extend this menu ? Thank you again, FrankR |
|
April 2, 2019, 09:09 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Ah, that is something from the past...
It existed in Fluent 16.2, and it was gone by Fluent 18.0. (I don't have Fluent 17.X available now.) Apparently, when the monitor system was updated in Fluent, they forgot to update this part of the manual. |
|
April 2, 2019, 09:46 |
|
#7 |
New Member
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8 |
If that is true, then it means that Ansys provides a very miserable documentation. Because I use release 19.2.
Maybe they forget to browse their old Manuals. |
|
Tags |
define profile, flow time, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AMI speed performance | danny123 | OpenFOAM | 21 | October 24, 2020 05:13 |
LES, Courant Number, Crash, Sudden | Alhasan | OpenFOAM Running, Solving & CFD | 5 | November 22, 2019 03:05 |
How to export time series of variables for one point? | mary mor | OpenFOAM Post-Processing | 8 | July 19, 2017 11:54 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 05:03 |
Orifice Plate with a fully developed flow - Problems with convergence | jonmec | OpenFOAM Running, Solving & CFD | 3 | July 28, 2011 06:24 |