Repository navigation
fix: Update get_si_unit_for_fluent_quantity and from_container - #4573
Merged
Merged
Conversation
This was
linked to
issues
Oct 29, 2025
hpohekar
marked this pull request as ready for review
October 29, 2025 03:56
hpohekar
requested review from
mayankansys,
mkundu1,
prmukherj and
seanpearsonuk
as code owners
October 29, 2025 03:56
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issues with unit handling and container-based session launches in PyFluent by updating two key utility functions: get_si_unit_for_fluent_quantity (for more robust unit handling) and from_container (for enhanced container workflow support).
Key Changes:
- Improved
get_si_unit_for_fluent_quantityto handle edge cases: empty lists,None, non-string values, and empty strings - Extended
from_containerwith new parameters (use_docker_compose,use_podman_compose) for greater flexibility in containerized Fluent launches - Re-enabled a previously skipped test for ansys-units integration
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_flobject.py | Removes skip marker from ansys-units integration test, indicating the underlying issue is now resolved |
| src/ansys/fluent/core/solver/flunits.py | Updates unit handling logic to properly handle empty lists and falsy values before type checking |
| src/ansys/fluent/core/session_utilities.py | Adds Docker/Podman Compose parameters to container launch function |
| doc/changelog.d/4573.fixed.md | Documents the fix for these utility functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
prmukherj
approved these changes
Oct 29, 2025
mkundu1
reviewed
Oct 29, 2025
hpohekar
enabled auto-merge (squash)
October 29, 2025 16:06
mkundu1
approved these changes
Oct 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Before this change, certain utility functions in PyFluent — specifically
get_si_unit_for_fluent_quantity(influnits.py) andfrom_container(insession_utilities.py) — had issues handling units or container-based settings correctly. For example,get_si_unit_for_fluent_quantityneeded better handling when the inputquantitywasNone, a list, or an empty string. Also,from_containerhad parameters or logic that required adjustment for container-mode launches and file-transfer workflows. The existing behavior could lead to unexpected results when working with quantity units or launching sessions with containers.Change Summary
The PR makes the following changes:
flunits.py, theget_si_unit_for_fluent_quantityfunction has been updated to improve handling of various cases: whenquantityisNone, when it's a list (especially an empty list), when it is not a string, or when it is a string but empty.session_utilities.py, thefrom_containerfunction signature and/or its default parameters were adjusted (added parameters likegpu: bool | None = None,file_transfer_service: Any | None = None,use_podman_compose: bool | None = None). This expands the function’s ability to launch Fluent in container mode with more flexibility.doc/changelog.d/4573.fixed.md) was added summarizing “Update get_si_unit_for_fluent_quantity and from_container”.tests/test_flobject.py) to reflect updated behavior or remove outdated assertions.Rationale
get_si_unit_for_fluent_quantitychange ensures that unit handling is robust and predictable even for edge cases: lists,None, empty strings. Since PyFluent integrates with theansys-unitslibrary and supports quantity objects, it is important that units are determined correctly.from_containerchanges are motivated by the need to better support containerised workflows of Fluent (e.g., using Docker or Podman) and enabling file transfer services for these sessions. Having additional parameters gives users more control (GPU usage, whether to use Docker Compose or Podman Compose, file transfer service) in launching Fluent via Python.Impact
get_si_unit_for_fluent_quantityandfrom_containerare internal utilities used by the PyFluent core library (ansys.fluent.core). Workflows that involve retrieving or interpreting units of Fluent quantities will benefit (or may require slight adjustments if they relied on previous behavior).from_containernow has more parameters/defaults).units()oras_quantity()on settings objects) may need to consider the changed handling of lists/None/empty strings inget_si_unit_for_fluent_quantity.