ansys / ansys/pyfluent

General(solver).units = UnitSystem General(solver).units[DIMENSION] = Unit

Open
#4,856 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
497
Forks
77
Avg merge
22h 37m
Merged PRs (30d)
45

Description

### 📝 Description of the feature

I'm not quite set on whether this should be on the units object directly or if you should have to do `General(solver).units.units = C` or similar for unit system, to me it feels overly verbose.

In general though the current state of this is very verbose
```py
General(solver).units.set_units(
quantity="temperature", units_name="C", scale_factor=1.0, offset=273.15
)
```
Currently trying to do this will raise
```py
>>> General(solver).units.units = C

Error: CAR: invalid argument [1]: wrong type [not a pair]
Error Object: -249804576

Error: CAR: invalid argument [1]: wrong type [not a pair]
Error Object: -249804576
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\ANSYS Inc\v261\commonfiles\CPython\3_10\winx64\Release\Ansys\PyFluentCore\ansys\fluent\core\solver\flobject.py", line 1229, in __setattr__
return attr.set_state(value)
File "C:\Program Files\ANSYS Inc\v261\commonfiles\CPython\3_10\winx64\Release\Ansys\PyFluentCore\ansys\fluent\core\solver\flobject.py", line 857, in set_state
self.flproxy.set_var(
File "C:\PROGRA~1\ANSYSI~1\v261\fluent\fluent26.1.0\cortex\pylib\flapi\flproxy.py", line 16, in set_var
return scheme.fl_set_var(path, value)
File "C:\PROGRA~1\ANSYSI~1\v261\fluent\fluent26.1.0\cortex\pylib\flapi\scheme.py", line 27, in newf
return f(*args, **kwds)
File "C:\PROGRA~1\ANSYSI~1\v261\fluent\fluent26.1.0\cortex\pylib\flapi\scheme.py", line 115, in fl_set_var
return _fl_set_var(path, value)
RuntimeError: CAR: invalid argument [1]: wrong type [not a pair]
Error Object: -249804576
```

### 💡 Steps for implementing the feature

Unsure

### 🔗 Useful links and references

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the General(solver).units object and its current set_units(quantity, units_name, scale_factor, offset) interface, then reproduce the reported General(solver).units.units = C failure. Done should be a decided, documented unit-system assignment API that accepts the intended value without the CAR type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.