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

DEFINE_PROFILE: flow time does not increase within 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   April 1, 2019, 09:37
Default DEFINE_PROFILE: flow time does not increase within UDF
  #1
New Member
 
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8
FrankR is on a distinguished road
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
FrankR is offline   Reply With Quote

Old   April 1, 2019, 11:43
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   April 1, 2019, 11:51
Default
  #3
New Member
 
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8
FrankR is on a distinguished road
It is transient.

Message works only for compiled UDF. Our System Administrator will not have time to install anything for me.

Thanks,
FrankR
FrankR is offline   Reply With Quote

Old   April 2, 2019, 01:45
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
use
Code:
real flow_time;
 flow_time = RP_Get_Real("flow-time");
best regards
sanketdange2007 likes this.
AlexanderZ is offline   Reply With Quote

Old   April 2, 2019, 08:55
Default
  #5
New Member
 
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8
FrankR is on a distinguished road
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
FrankR is offline   Reply With Quote

Old   April 2, 2019, 09:09
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
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.
Attached Images
File Type: png fluent162.png (4.8 KB, 9 views)
pakk is offline   Reply With Quote

Old   April 2, 2019, 09:46
Default
  #7
New Member
 
Frank Richter
Join Date: Oct 2018
Posts: 13
Rep Power: 8
FrankR is on a distinguished road
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.
FrankR is offline   Reply With Quote

Reply

Tags
define profile, flow time, 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
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


All times are GMT -4. The time now is 00:25.