ansys / ansys/pyfluent

Bug when trying to set arguments of e.g. create_surface_mesh using ansys quantities

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

Description

### 🔍 Before submitting the issue

- [x] I have searched among the existing issues
- [x] I am using a Python virtual environment

### 🐞 Description of the bug

In meshing, I am trying to set arguments of the create_surface_mesh task using ansys quantities, but in the end, i end up with None.

That is
```
q = Quantity(1,"m")
watertight.create_surface_mesh.Arguments.set_state({r'CFDSurfaceMeshControls': {r'MaxSize': q}})
```
results in {'CFDSurfaceMeshControls': {'MaxSize': None}} without warning or error. I only noticed because grids did not differ using different input q.

In solver, i can use ansys quantities like this:
```
q = Quantity(1,"m")
some_bc.turbulence.hydraulic_diameter = q
```
but in mesher, also
```
q = Quantity(1,"m")
watertight.create_surface_mesh.cfd_surface_mesh_controls.max_size = q
```
does not set the value

### 📝 Steps to reproduce

import ansys.fluent.core as pyfluent
from ansys.units import Quantity

infile = r"mixing_elbow.pmdb"

session = pyfluent.launch_fluent(dimension=pyfluent.Dimension.THREE, precision=pyfluent.Precision.DOUBLE,
mode=pyfluent.FluentMode.MESHING, processor_count=1,
ui_mode=pyfluent.UIMode.HIDDEN_GUI, cleanup_on_exit=True) # , cwd=self.directory)

q = Quantity(1,"m")

watertight = session.watertight()
watertight.import_geometry.file_name.set_state(infile)
watertight.import_geometry.length_unit.set_state('m')
watertight.import_geometry()
watertight.create_surface_mesh.Arguments.set_state({r'CFDSurfaceMeshControls': {r'MaxSize': q}})
watertight.create_surface_mesh.Arguments.get_state()
#{'CFDSurfaceMeshControls': {'MaxSize': None}}

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

25R2

### 🐍 Which Python version are you using?

3.13

### 📦 Installed packages

```shell
ansys-api-fluent==0.3.38
ansys-api-platform-instancemanagement==1.1.3
ansys-api-tools-filetransfer==0.1.2
ansys-fluent-core==0.37.2
ansys-platform-instancemanagement==1.1.2
ansys-tools-common==0.4.4
ansys-tools-filetransfer==0.2.1
ansys-units==0.10.1
certifi==2026.2.25
charset-normalizer==3.4.4
click==8.3.1
colorama==0.4.6
defusedxml==0.7.1
Deprecated==1.3.1
docker==7.1.0
googleapis-common-protos==1.72.0
grpcio==1.78.1
grpcio-health-checking==1.78.1
grpcio-status==1.78.1
idna==3.11
importlib_metadata==8.7.1
joblib==1.5.3
nltk==3.9.3
numpy==2.4.2
pandas==2.3.3
platformdirs==4.9.2
protobuf==6.33.5
pyansys-tools-report==0.9.0
python-dateutil==2.9.0.post0
pytz==2025.2
pywin32==311
PyYAML==6.0.3
regex==2026.2.19
requests==2.32.5
scooby==0.11.0
six==1.17.0
tqdm==4.67.3
typing_extensions==4.15.0
tzdata==2025.3
urllib3==2.6.3
wrapt==2.1.1
zipp==3.23.0
```

Contributor guide

Open the contributing guide

Research direction

Start by running the provided meshing reproduction and inspect the create_surface_mesh Arguments.set_state and cfd_surface_mesh_controls.max_size paths. Compare their Quantity handling with the solver property assignment path shown in the issue. Done means a Quantity is retained or converted correctly in both meshing forms, with a regression test covering the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.