|
[Sponsors] |
GET_REPORT_DEFINITION_VALUES not returning correct values |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 20, 2021, 01:54 |
GET_REPORT_DEFINITION_VALUES not returning correct values
|
#1 |
Member
Join Date: Jan 2018
Posts: 31
Rep Power: 8 |
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); } |
|
March 27, 2021, 08:18 |
|
#2 |
Member
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 19 |
rv is an integer and it returns a 0 when successful.
What about values[0] ? |
|
March 28, 2021, 14:43 |
|
#3 |
Member
Join Date: Jan 2018
Posts: 31
Rep Power: 8 |
I have defined a report and after executing on demand, everytime the message printed is that of the last elseif condition.
|
|
March 28, 2021, 14:55 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
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". |
|
March 28, 2021, 15:23 |
|
#5 |
Member
Join Date: Jan 2018
Posts: 31
Rep Power: 8 |
Checked.
Yes it does. |
|
March 28, 2021, 18:44 |
|
#6 |
Member
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 19 |
Are you running steady simulation?
|
|
March 28, 2021, 18:46 |
|
#7 |
Member
Join Date: Jan 2018
Posts: 31
Rep Power: 8 |
yes indeed.
Would have taken the transient example given after the above in the manual, if I was doing that, which I am not. |
|
March 28, 2021, 18:51 |
|
#8 |
Member
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 19 |
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?
|
|
March 28, 2021, 19:31 |
|
#9 |
Member
Join Date: Jan 2018
Posts: 31
Rep Power: 8 |
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!!! |
|
March 28, 2021, 20:19 |
|
#10 |
Member
Yasser Selima
Join Date: Mar 2009
Location: Canada
Posts: 52
Rep Power: 19 |
Good it works!!
Thanks for sharing the reason! I agree with you, the manual should point this |
|
Tags |
report definition, report definition udf, udf |
|
|
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 |