ansys / pyfluent

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

Orthotropic conductivity setting does not work through root settings API #390

Closed mkvani closed 2 years ago

mkvani commented 2 years ago

Feature: Root settings API (solid material property) Issue: Solid material property for cylindrical orthotropic conductivity is not getting updated. Fluent throws error (improper list). The same API command works if executed second time in same session (after executing first time, it only sets "cyl-orthotropic" without setting any conductivity data and throws error in Fluent console. For second time execution, it updates the conductivity data correctly)

API command used:


        root.setup.materials.solid['copper']={'density': {'option': 'constant', 'constant': density}, \
            'specific_heat': {'option': 'constant', 'constant': cp}, 'thermal_conductivity': {'option': 'cyl-orthotropic', \
            'var_class': {'constant': 401.0, 'cyl-orthotropic': {'k1': {'constant': tangential_cond}, \
            'direction-0': [0.0, 0.0, 0.0], 'direction-1': [0.0, 0.0, 1.0], 'k0': {'constant': radial_cond}, 'k2': {'constant': axial_cond}}}}}

Error message in Fluent console:

Error: GENERAL-CAR-CDR: invalid argument [1]: improper list
Error Object: #f
seanpearsonuk commented 2 years ago

@gyeole

>>> root.setup.materials.solid['copper'].thermal_conductivity.option.get_attr('allowed-values')
['constant', 'piecewise-linear', 'piecewise-polynomial', 'polynomial', 'expression', 'biaxial', 'cyl-orthotropic', 'orthotropic', 'principal-axes-values', 'anisotropic', 'user-defined-anisotropic-k', 'user-defined']
>>> root.setup.materials.solid['copper'].thermal_conductivity.option='cyl-orthotropic'
2022-05-10 09:34:27,572 root         ERROR    GRPC_ERROR: GENERAL-CAR-CDR: invalid argument [1]: improper list
Error Object: #f
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "e:\ansysdev\pyfluentnew7\pyfluent\src\ansys\fluent\core\solver\flobject.py", line 391, in __setattr__
    getattr(self, name).set_state(process_value(value))
  File "e:\ansysdev\pyfluentnew7\pyfluent\src\ansys\fluent\core\solver\flobject.py", line 212, in set_state
    return self.flproxy.set_var(self.path, self.to_scheme_keys(state))
  File "e:\ansysdev\pyfluentnew7\pyfluent\src\ansys\fluent\core\services\settings.py", line 85, in _fn
    return fn(self, *args, **kwds)
  File "e:\ansysdev\pyfluentnew7\pyfluent\src\ansys\fluent\core\services\settings.py", line 145, in set_var
    self.__service_impl.set_var(request)
  File "e:\ansysdev\pyfluentnew7\pyfluent\src\ansys\fluent\core\services\error_handler.py", line 18, in func
    raise RuntimeError(ex.details()) from None
RuntimeError: GENERAL-CAR-CDR: invalid argument [1]: improper list
Error Object: #f
>>> root.setup.materials.solid['copper'].thermal_conductivity.option='polynomial'
>>>

It works fine in the TUI and GUI.

mkvani commented 2 years ago

Hi @seanpearsonuk and @gyeole , The corresponding command in TUI does not provide correct response to exception handling. I have logged another issue for that (#392 )

Thank you, Manoj

seanpearsonuk commented 2 years ago

[FLUENT BUG 684764]