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

Using GET_REPORT_DEFINITION_VALUES correctly

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 25, 2021, 14:02
Default Using GET_REPORT_DEFINITION_VALUES correctly
  #1
New Member
 
Join Date: Jan 2018
Posts: 22
Rep Power: 5
UchihaMadara is on a distinguished road
Has anyone been able to successfully use the above macro correctly?
Or if anyone could share a MWE for retrieving a report definition variable via a udf, that would be really helpful.


I tried running the example given in the manual, but get the following error, and I am not sure how do i solve this?


Code:
#include "udf.h"
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 = Get_Report_Definition_Values("area-avg-tot-pressure", 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");
    }
}



Error
Code:
..\..\src\get_report.c(9): error C2099: initializer is not a constant ..\..\src\get_report.c(10): error C2059: syntax error: 'if'
 ..\..\src\get_report.c(29): error C2059: syntax error: 'else'
UchihaMadara is offline   Reply With Quote

Old   March 25, 2021, 14:27
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,784
Rep Power: 22
pakk will become famous soon enough
Split line 9.
Code:
int rv;
rv =...
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   March 26, 2021, 02:41
Default
  #3
New Member
 
Join Date: Jan 2018
Posts: 22
Rep Power: 5
UchihaMadara is on a distinguished road
Same error!!
No change!
UchihaMadara is offline   Reply With Quote

Old   March 26, 2021, 12:59
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,784
Rep Power: 22
pakk will become famous soon enough
Same line numbers?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   March 28, 2021, 18:58
Default
  #5
Member
 
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 16
Yasser is on a distinguished road
You have to add this inside a function ... DEINE_ON_DEMAND for example
Yasser is offline   Reply With Quote

Reply

Tags
c2099, report definition udf, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[OpenFOAM] How to correctly show the result of #codeStream# internalField? chengdi ParaView 22 July 3, 2020 07:02
SIMPLER Code Temperatures not coming correctly Dharma Vedula Main CFD Forum 5 July 5, 2017 21:34
chtMultiRegionSimpleFoam planeWall2D case dont run correctly in OPenFOAM 1606+ shengqiming OpenFOAM Running, Solving & CFD 0 August 7, 2016 14:15
SU2 optimization does not work correctly with CGNS format Andrei SU2 Shape Design 1 April 22, 2016 10:35
interFoam running blowing up sandy13 OpenFOAM Running, Solving & CFD 2 May 5, 2015 07:16


All times are GMT -4. The time now is 03:57.