CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   PyFluent postproc - assign report value to a float variable (https://www.cfd-online.com/Forums/fluent/251415-pyfluent-postproc-assign-report-value-float-variable.html)

Zalan August 15, 2023 08:19

PyFluent postproc - assign report value to a float variable
 
Hi All,

I'm new to Ansys PyFluent and I'd like to have an surface-average temperature report value assigned to a numerical (float) variable in PyFluent.
Doing this TUI command within Fluent Console:
/report/surface-integrals/mass-weighted-avg/ycut_1 temperature no
Gave the following output:
Mass-Weighted Average Static Temperature [K]
-------------------------------- --------------------
ycut_1 345.40113




When I run the PyFluent-equivalent command of the above code in Jupyter Notebook, some strange 'False' boolean is given as output:
Commands:
t_bulk = solver.results.report.surface_integrals(report_typ e = "area-weighted-avg", surface_id = ["ycut_1"], cell_report = "temperature", write_to_file = False)
print(t_bulk)


Result:

Area-Weighted Average
Static Temperature [K]
-------------------------------- --------------------
ycut_1 342.32108
False


Assigning this command to a variable results in a 'bool' type variable but this is weird as it seems a string to me:
Command:
type(t_bulk)

Output:

bool


My question is: do you know any trick on how to get just the numerical value of this report (in above example, 342.32108)?


Many thanks in advance.

HB833 August 28, 2023 11:14

I have encountered similar issues, but what I want to store the text, and I use: message_ Session. tui. mesh. manage. list(),the i get all the information about the mesh of all fluid. I want to save it as a string type into a variable, but I failed. I am unable to save some values and text in pyfluent. Have you made any progress on this issue recently? Can you help me?

quiquedios September 4, 2023 15:53

Same question
 
Has anyone figured this out already? I'm finding the same issue

Quote:

Originally Posted by Zalan (Post 855280)
Hi All,

I'm new to Ansys PyFluent and I'd like to have an surface-average temperature report value assigned to a numerical (float) variable in PyFluent.
Doing this TUI command within Fluent Console:
/report/surface-integrals/mass-weighted-avg/ycut_1 temperature no
Gave the following output:
Mass-Weighted Average Static Temperature [K]
-------------------------------- --------------------
ycut_1 345.40113




When I run the PyFluent-equivalent command of the above code in Jupyter Notebook, some strange 'False' boolean is given as output:
Commands:
t_bulk = solver.results.report.surface_integrals(report_typ e = "area-weighted-avg", surface_id = ["ycut_1"], cell_report = "temperature", write_to_file = False)
print(t_bulk)


Result:

Area-Weighted Average
Static Temperature [K]
-------------------------------- --------------------
ycut_1 342.32108
False


Assigning this command to a variable results in a 'bool' type variable but this is weird as it seems a string to me:
Command:
type(t_bulk)

Output:

bool


My question is: do you know any trick on how to get just the numerical value of this report (in above example, 342.32108)?


Many thanks in advance.



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