|
[Sponsors] |
UDF using Get_Report_Definition_Values correctly |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 3, 2022, 10:25 |
UDF using Get_Report_Definition_Values correctly
|
#1 |
New Member
Join Date: Nov 2022
Posts: 10
Rep Power: 4 |
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"); } } } |
|
November 7, 2022, 00:38 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
compile code and read log
__________________
best regards ****************************** press LIKE if this message was helpful |
|
November 10, 2022, 05:23 |
|
#3 |
New Member
Join Date: Nov 2022
Posts: 10
Rep Power: 4 |
||
Tags |
ansys 18, fluent 18, fluent udfs |
|
|
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 |