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

UDF using Get_Report_Definition_Values correctly

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 3, 2022, 10:25
Question UDF using Get_Report_Definition_Values correctly
  #1
New Member
 
Join Date: Nov 2022
Posts: 10
Rep Power: 4
hsze is on a distinguished road
Hello,

I'm trying to access a temperature report definition value in my udf for further computing.
I've set the report definition in the GUI and also set a report plot for the report definition (called "t_out").

I get the error: Get_Report_Definition_Values: undeclared variable
everytime I try to interpret a udf that's using the macro.

I've looked into the manual and looked at two other Threads concerning get_report_definition_values and I think I'm using it as everyone else and I also think I'm declaring all the needed variables, so I cannot seem to find my mistake. I also tried copy pasting the udfs from others (and adjusted the report names of course) but I get the undeclared variable error anyways.

Can someone spot my error or give me ideas for further debugging?

Thanks in advance!

My UDF:

#include "udf.h"
DEFINE_EXECUTE_AT_END(get_report)
{
int nrOfvalues=0;
real *values;
int *ids;
int index;
int counter;
/*First call to get the number of values. For number of values,
the int pointer is passed, which is 0 for iterations.*/
int rv;
rv = Get_Report_Definition_Values("t_out", 0, &nrOfvalues, NULL, NULL,NULL);
if (rv==0 && nrOfvalues)
{

Message("Report definition evaluated at iteration has %d values\n", nrOfvalues);
/*Memory is allocated for values and ids.*/
values = (real*) malloc(sizeof(real)* nrOfvalues);
ids = (int*) malloc(sizeof(int)* nrOfvalues);
/* Second call to get data. The number of values is null, but the last
* three are not.*/
rv = Get_Report_Definition_Values("area-avg-tot-pressure", 0, NULL, values, ids, &index);
Message("Values correspond to iteration index:%d\n", index);
for ( counter = 0; counter < nrOfvalues; counter++ )
{
Message("report definition values: %d, %f\n", ids[counter], values[counter]);
}
/*Memory is freed.*/
free(values);
free(ids);
}
else
{
/*The command can be unsuccessful if the report definition does not exist
or if it has not been evaluated yet.*/
if (rv == 1)
{
Message("report definition: %s does not exist\n", "area-avg-tot-pressure");
}
else if ( nrOfvalues == 0 )
{
Message("report definition: %s not evaluated at iteration level\n", "area-avg-tot-pressure");
}
}
}
hsze is offline   Reply With Quote

Old   November 7, 2022, 00:38
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
compile code and read log
__________________
best regards


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

Old   November 10, 2022, 05:23
Default
  #3
New Member
 
Join Date: Nov 2022
Posts: 10
Rep Power: 4
hsze is on a distinguished road
Hi Alexander,

thanks for your reply!
It really seems to have been an interpreting issue, works with compiling!

Thanks again,
Helen

Quote:
Originally Posted by AlexanderZ View Post
compile code and read log
hsze is offline   Reply With Quote

Reply

Tags
ansys 18, fluent 18, fluent udfs


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
UDF for vapor pressure anuarun Fluent UDF and Scheme Programming 13 June 23, 2024 14:12
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 07:12
Simulation with UDF for species mass fraction and velocity profile virgy Fluent UDF and Scheme Programming 8 February 7, 2012 05:30
DEFINE_DPM_OUTPUT macro UDF HELP Puneet FLUENT 3 November 28, 2003 11:55
UDF : Chemical Reaction in Catalytic Converter adhimac FLUENT 1 March 27, 2001 15:04


All times are GMT -4. The time now is 19:42.