Help with handling named expressions in pyfluent #1696
Replies: 1 comment
-
Looking at the error message, you may need to add additional quotes around the expression: See this note about TUI API usage. It is better to verify whether the arguments are of string type from a saved Fluent journal. With Fluent 2023 R1 or later, you can also use settings API for setting up named expressions - https://github.com/ansys/pyfluent/blob/main/tests/test_solvermode/test_named_expressions.py |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am somewhat inexperienced with both pyfluent and fluent named expressions.
I am trying to edit a named expression called expr1 which is already defined in a fluent case file, by loading the case and data into a pyfluent session and using pyfluent commands to change the definition of the named expression. I want to add a variable to the definition of expr1. However, I have been unable to get this to work.
I have attached the case and data file in a zipped folder, if you wish to try to replicate my issue.
casdat.zip
expr1 is defined initially as having the value of 2.0.
After loading the case and data files, I run the following command to view the properties of the named expression
solver.tui.define.named_expressions.list_properties("expr1")
resulting in the following output
which is as expected.
I can successfully change the definition of expr1 to 3.0 by using the following command
solver.tui.define.named_expressions.edit("expr1","definition","3.0")
this gives no output, so it is checked by using
solver.tui.define.named_expressions.list_properties("expr1")
resulting in the following output
Now, the problem. I try to add the static temperature to the definition. I want the definition of expr1 to be 3.0*T. T is the alias for the StaticTemperature variable
solver.tui.define.named_expressions.edit("expr1","definition","3.0*T")
this gives the output
now if I do list_properties
solver.tui.define.named_expressions.list_properties("expr1")
I get the output
The definition has changed to the floating point exception object, but the value is unchanged.
I am not sure what is happening.
I get similar errors if I try to add the units of meters to expr by doing
solver.tui.define.named_expressions.edit("expr1","definition","3.0[m]")
resulting in the output
I am not sure if my syntax is wrong or something else? I appreciate any help.
Beta Was this translation helpful? Give feedback.
All reactions