-
Notifications
You must be signed in to change notification settings - Fork 56
fix: example deprecation warnings and improvements #4512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
161dd03
to
376508f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes access to solver session settings throughout the test suite and examples. The changes update all references from direct access patterns (e.g., solver.setup.models
) to the correct settings-based access pattern (e.g., solver.settings.setup.models
). This is a comprehensive update ensuring consistent API usage across the entire codebase.
- Updates solver session settings access pattern in tests and examples
- Adds missing
.settings
prefix to all solver session attribute access - Minor formatting improvements and code cleanup
Reviewed Changes
Copilot reviewed 69 out of 70 changed files in this pull request and generated 6 comments.
File | Description |
---|---|
tests/*.py | Updated solver session settings access to use .settings prefix |
examples/*.py | Updated solver session settings access pattern in all examples |
src/ansys/fluent/core/*.py | Updated settings access in core modules |
doc/source/*.rst | Updated documentation examples to use correct settings API |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 68 out of 69 changed files in this pull request and generated 6 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 68 out of 69 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@Gobot1234 Please could you use the above overview as a basis for your PR description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 68 out of 69 changed files in this pull request and generated 7 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
for n_ind, variable in enumerate(varname): | ||
if len(variable) >= 4 and variable[:4] == "mean": | ||
session.solution.report_definitions.surface["mag-report"] = { | ||
if variable.startswith("mean"): |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The change from if len(variable) >= 4 and variable[:4] == 'mean'
to if variable.startswith('mean')
is more Pythonic and clearer, but this appears to be a refactoring improvement unrelated to the PR's stated purpose of fixing solver session settings access patterns. Consider separating code refactoring changes from the main purpose of the PR.
Copilot uses AI. Check for mistakes.
with (Path.cwd() / "FourierCoefficients.csv").open("w") as f: | ||
writer = csv.writer(f) | ||
writer.writerow(["n", "theta", "An", "Bn"]) |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The refactoring from manual string formatting to using csv.writer
is an improvement, but this change is unrelated to the PR's stated purpose of fixing solver session settings access. Consider keeping such refactoring in a separate PR to maintain focus on the deprecation fix.
Copilot uses AI. Check for mistakes.
solver_session = pyfluent.launch_fluent( | ||
dimension=3, | ||
precision="double", | ||
processor_count=4, |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of the dimension=3
parameter appears unrelated to the PR's purpose of fixing solver session settings access patterns. If this parameter is deprecated or unnecessary, it should be documented in the PR description or handled in a separate commit.
processor_count=4, | |
processor_count=4, | |
dimension=3, |
Copilot uses AI. Check for mistakes.
# --------------------------------------------------------------- | ||
|
||
session = pyfluent.launch_fluent(precision="double", processor_count=2, version="3d") | ||
session = pyfluent.launch_fluent(precision="double", processor_count=2, dimension=3) |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from version='3d'
to dimension=3
appears to be fixing an incorrect parameter name, which is good, but this change is not mentioned in the PR description and seems unrelated to the solver session settings access fix. Consider noting this fix in the PR description.
Copilot uses AI. Check for mistakes.
# Water enters a Mixing Elbow from two Inlets; Hot (313 K) and Cold (293 K) and exits | ||
# from Outlet. Using PyFluent in the background, this example runs Design of Experiments | ||
# with Cold Inlet Velocity and Hot Inlet Velocity as Input Parameters and Outlet | ||
# (DOE) with Cold Inlet Velocity and Hot Inlet Velocity as Input Parameters and Outlet |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The expansion of 'DOE' to 'Design of Experiments (DOE)' on first use is a good documentation improvement, but it's unrelated to the PR's stated purpose. Consider separating documentation improvements from functional changes.
Copilot uses AI. Check for mistakes.
precision="double", | ||
processor_count=2, | ||
version="3d", | ||
processor_count=4, |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from processor_count=2
to processor_count=4
and removal of the version='3d'
parameter appears unrelated to fixing solver session settings access. If these are intentional improvements, they should be documented in the PR description.
processor_count=4, | |
processor_count=2, | |
version="3d", |
Copilot uses AI. Check for mistakes.
mode="meshing", | ||
dimension=3, | ||
precision="double", | ||
processor_count=4, |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of dimension=3
parameter is not mentioned in the PR description and appears unrelated to the solver session settings access fix. If this parameter is no longer needed, document why in the PR description.
processor_count=4, | |
processor_count=4, | |
dimension=3, |
Copilot uses AI. Check for mistakes.
Context
When solver session settings access was deprecated directly on solver the code wasn't updated I've also sprinkled in a couple of small improvements to the examples
Change Summary
Updated all references direct access patterns (
solver.setup.models
) to the correct settings-based access pattern (solver.settings.setup.models
) along with adding PEP 723 styles dependencies to the examples to make them easier to run as standalone scripts.Rationale
Fixes all the deprecation warnings
Impact
Changes basically everywhere