Repository navigation
feat: physical quantities baseline code - #3988
Closed
seanpearsonuk wants to merge 13 commits into
Closed
seanpearsonuk wants to merge 13 commits into
seanpearsonuk wants to merge 13 commits into
Conversation
seanpearsonuk
commented
Apr 30, 2025
| LAUNCH_FLUENT_SKIP_PASSWORD_CHECK = False | ||
|
|
||
| # `ansys.physicalquantities` will eventually be a separate package. Until then: | ||
| # Inject `physicalquantities` into the `ansys` namespace if it doesn't already exist |
Collaborator
Author
There was a problem hiding this comment.
In order to use it this way requires importing PyFluent up front.
hpohekar
reviewed
May 5, 2025
Comment on lines
+185
to
+187
| if not hasattr(sys.modules["ansys"], "physicalquantities"): | ||
| sys.modules["ansys.physicalquantities"] = physicalquantities | ||
| sys.modules["ansys"].physicalquantities = physicalquantities |
Collaborator
There was a problem hiding this comment.
Hardcoding module names as strings can lead to typos and makes refactoring harder. We can use constants or variables so that it will improve the error handling as follows::
ANSYS_MODULE = "ansys"
QUANTITIES_ATTR = "physicalquantities"
ANSYS_QUANTITIES_MODULE = f"{ANSYS_MODULE }.{QUANTITIES_ATTR }"
ansys_module = sys.modules.get(ANSYS_MODULE)
if ansys_module is not None and not hasattr(ansys_module , QUANTITIES_ATTR):
sys.modules[ANSYS_QUANTITIES_MODULE] = QUANTITIES_ATTR
setattr(ansys_module, QUANTITIES_ATTR, QUANTITIES_ATTR )
else:
raise ImportError(f"Module '{ANSYS_MODULE}' not found in sys.modules")
hpohekar
reviewed
May 5, 2025
Comment on lines
+29
to
+40
| Example | ||
| ------- | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| >>> from ansys.fluent.core.physicalquantities import PhysicalQuantities | ||
| >>> from ansys.fluent.core.physicalquantities.strategies.fluent import FluentSVarStrategy | ||
|
|
||
| >>> quantity = PhysicalQuantities.PRESSURE | ||
| >>> strategy = FluentSVarStrategy() | ||
|
|
||
| >>> print(strategy.to_string(quantity)) |
Collaborator
There was a problem hiding this comment.
👍
This will help to improve both user guide and API reference section.
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.
This is just for demonstration purposes.
Provides a structured, extensible way to represent physical quantities (e.g., pressure, velocity) independently of any product-specific naming conventions.