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

GET_REPORT_DEFINITION_VALUES not returning correct values

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 20, 2021, 01:54
Default GET_REPORT_DEFINITION_VALUES not returning correct values
  #1
New Member
 
Join Date: Jan 2018
Posts: 22
Rep Power: 5
UchihaMadara is on a distinguished road
Hello all,



I am trying to print my pressure to an external file so that I could read and assign it to another inlet of a similar geometry (2D section of a pipe along its axis).


For this, C_P(f, outletthreadID) returned only static pressure, while I need the total pressure, so instead tried to create a report-definition in the setup. I found that there is a Macro (GET_REPORT_DEFINITION_VALUES in 3.8.3 of fluent customization manual) that claims to give access to "last calculated report definition values for any report defintion values created in fluent".


The problem is the code (one shown in example of 3.8.3, and below, is unable to give a result as desired).


Could someone give any pointers regarding the same?
The defined report definition in my outlet (id=7) gives total pressure of 8.2 Pa, while the below rv value returns 0.



Code:
DEFINE_ON_DEMAND(get_report)
{ 
  //const char *name = "pressure_outlet";
  int iteration = 0;
  int nrOfvalues;
  real *values;
  int *ids;
  int *index;
  int counter;
  int rv;

  rv = Get_Report_Definition_Values("pressure_outlet", 0, &nrOfvalues, NULL, NULL,NULL);
  if (rv==0 && nrOfvalues)
  {
    Message("Report definition evaluated at iteration has %d values\n", nrOfvalues);
  
    values = (real*) malloc(sizeof(real)* nrOfvalues);
    ids = (int*) malloc(sizeof(int)* nrOfvalues);
  
  rv = Get_Report_Definition_Values("pressure_outlet", 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]);
    }
  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(" %s does not exist\n", "pressure_outlet");
     }
     else if ( nrOfvalues == 0 )
     {    
         Message(" %s not evaluated at iteration level\n", "pressure_outlet");
         Message("rv value is: %g \n", rv);
     }
  }
  Message("report def is: %g\n", rv);
}
UchihaMadara is offline   Reply With Quote

Old   March 27, 2021, 08:18
Default
  #2
Member
 
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 16
Yasser is on a distinguished road
rv is an integer and it returns a 0 when successful.

What about values[0] ?
Yasser is offline   Reply With Quote

Old   March 28, 2021, 14:43
Default
  #3
New Member
 
Join Date: Jan 2018
Posts: 22
Rep Power: 5
UchihaMadara is on a distinguished road
I have defined a report and after executing on demand, everytime the message printed is that of the last elseif condition.
UchihaMadara is offline   Reply With Quote

Old   March 28, 2021, 14:55
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,781
Rep Power: 22
pakk will become famous soon enough
Does the name of your report definition exactly match the name in the UDF?
__________________
"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, 15:23
Default
  #5
New Member
 
Join Date: Jan 2018
Posts: 22
Rep Power: 5
UchihaMadara is on a distinguished road
Checked.
Yes it does.
UchihaMadara is offline   Reply With Quote

Old   March 28, 2021, 18:44
Default
  #6
Member
 
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 16
Yasser is on a distinguished road
Are you running steady simulation?
Yasser is offline   Reply With Quote

Old   March 28, 2021, 18:46
Default
  #7
New Member
 
Join Date: Jan 2018
Posts: 22
Rep Power: 5
UchihaMadara is on a distinguished road
yes indeed.
Would have taken the transient example given after the above in the manual, if I was doing that, which I am not.
UchihaMadara is offline   Reply With Quote

Old   March 28, 2021, 18:51
Default
  #8
Member
 
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 16
Yasser is on a distinguished road
As you go to the last else if, the function finds the report definition and it doesn't find any values calculated. So, can you check that your report do actually calculate the desired value?
Yasser is offline   Reply With Quote

Old   March 28, 2021, 19:31
Default
  #9
New Member
 
Join Date: Jan 2018
Posts: 22
Rep Power: 5
UchihaMadara is on a distinguished road
Thank you for your pointing that out Yasser.


As it turns out, apart from creating a "Report Definition" in the Gui, I should have also created the "Report-plot" while creating the report definition. Hence the udf going to the else-if condition at the end.



I'd also like to argue, that this is fairly an important point that is missing out from the manual, don't you think?



After this, I could see the results on the console.....phew!!!
UchihaMadara is offline   Reply With Quote

Old   March 28, 2021, 20:19
Default
  #10
Member
 
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 16
Yasser is on a distinguished road
Good it works!!
Thanks for sharing the reason!

I agree with you, the manual should point this
Yasser is offline   Reply With Quote

Reply

Tags
report definition, 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
Is my Dynamic mesh setup correct? cfd seeker FLUENT 16 October 30, 2020 06:16
Turbulence injection via fvOptions: addSup, constrain, or correct? pbachant OpenFOAM Programming & Development 1 May 22, 2020 22:48
Periodic (rotational)flow: a bit of confusion concerning reference values Mr.Goodcat FLUENT 0 March 22, 2016 07:31
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Reference values resetting? cad2blender FLUENT 1 December 13, 2012 22:54


All times are GMT -4. The time now is 14:21.