ansys / pyfluent

Pythonic interface to Ansys Fluent
https://fluent.docs.pyansys.com
MIT License
254 stars 42 forks source link

Setting a property to unallowed value fails silently #494

Closed seanpearsonuk closed 2 years ago

seanpearsonuk commented 2 years ago

Setting a property to a value outside of the allowed values fails but nothing is reported in PyFluent. In Fluent meanwhile "Invalid selection" is displayed in the console. It would be appropriate to propagate an exception*.

>>> s.solver.root.setup.models.viscous.model.get_attr('allowed-values')
['inviscid', 'laminar', 'k-epsilon-standard', 'k-omega-standard', 'mixing-length', 'spalart-allmaras', 'k-kl-w', 'transition-sst', 'reynolds-stress', 'scale-adaptive-simulation', 'detached-eddy-simulation', 'large-eddy-simulation']
>>> s.solver.root.setup.models.viscous.model='bob'
>>> s.solver.root.setup.models.viscous.model()
'k-omega-standard'

* this would change the current TUI behaviour if it uses the API for this.

dnwillia-work commented 2 years ago

Yeah, I would have thought that the second command threw an exception already or put the API into some sort of invalid/error state.

gyeole commented 2 years ago

@dnwillia-work @seanpearsonuk I have created PR for this

seanpearsonuk commented 2 years ago

tested, thanks @gyeole