-
Notifications
You must be signed in to change notification settings - Fork 56
fix: solver session settings access in tests and examples #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
############################################################################### | ||
# Confirm and update boundaries | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Confirm and update the boundaries. | ||
|
||
meshing_session.workflow.TaskObject["Update Boundaries"].Execute() | ||
|
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.
############################################################################### | |
# Confirm and update boundaries | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Confirm and update the boundaries. | |
meshing_session.workflow.TaskObject["Update Boundaries"].Execute() |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Confirm and update the boundaries. | ||
|
||
meshing_session.workflow.TaskObject["Update Boundaries"].Execute() |
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.
This looked sus (moving the code around)
meshing_session.workflow.TaskObject["Update Boundaries"].Execute() | |
############################################################################### | |
# Confirm and update boundaries | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Confirm and update the boundaries. | |
meshing_session.workflow.TaskObject["Update Boundaries"].Execute() |
tests/test_search.py
Outdated
|
||
pyfluent.config.print_search_results = False | ||
results = pyfluent.search("local*", api_path="<solver_session>.setup") | ||
results = pyfluent.search("local*", api_path="<solver_session>.setup.") |
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.
results = pyfluent.search("local*", api_path="<solver_session>.setup.") | |
results = pyfluent.search("local*", api_path="<solver_session>.setup") |
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.
👍
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.
tests/test_reduction.py
Outdated
solver.fields.reduction.area( | ||
locations=[solver.setup.boundary_conditions.velocity_inlet] | ||
locations=[ | ||
solver.settings.setup.gs.setup.boundary_conditions.velocity_inlet |
Copilot
AI
Oct 9, 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.
There's an incorrect duplicate 'setup' path segment in this line. Should be solver.settings.setup.boundary_conditions.velocity_inlet
instead of solver.settings.setup.gs.setup.boundary_conditions.velocity_inlet
.
solver.settings.setup.gs.setup.boundary_conditions.velocity_inlet | |
solver.settings.setup.boundary_conditions.velocity_inlet |
Copilot uses AI. Check for mistakes.
def test_parameters_list_function(static_mixer_settings_session): | ||
solver = static_mixer_settings_session | ||
solver.tui.define.parameters.enable_in_TUI("yes") | ||
solver.tui.define.settings.parameters.enable_in_TUI("yes") |
Copilot
AI
Oct 9, 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 TUI path is incorrect. It should be solver.tui.define.parameters.enable_in_TUI("yes")
without the .settings
segment, as TUI commands don't use the settings API.
solver.tui.define.settings.parameters.enable_in_TUI("yes") | |
solver.tui.define.parameters.enable_in_TUI("yes") |
Copilot uses AI. Check for mistakes.
outlet_vel_avg.surface_names = ["outlet"] | ||
|
||
create_output_param = solver.tui.define.parameters.output_parameters.create | ||
create_output_param = solver.tui.define.settings.parameters.output_parameters.create |
Copilot
AI
Oct 9, 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 TUI path is incorrect. It should be solver.tui.define.parameters.output_parameters.create
without the .settings
segment, as TUI commands don't use the settings API.
create_output_param = solver.tui.define.settings.parameters.output_parameters.create | |
create_output_param = solver.tui.define.parameters.output_parameters.create |
Copilot uses AI. Check for mistakes.
def test_parameters_list_function(static_mixer_settings_session): | ||
solver = static_mixer_settings_session | ||
solver.tui.define.parameters.enable_in_TUI("yes") | ||
solver.tui.define.settings.parameters.enable_in_TUI("yes") |
Copilot
AI
Oct 9, 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 TUI path is incorrect. It should be solver.tui.define.parameters.enable_in_TUI("yes")
without the .settings
segment, as TUI commands don't use the settings API.
solver.tui.define.settings.parameters.enable_in_TUI("yes") | |
solver.tui.define.parameters.enable_in_TUI("yes") |
Copilot uses AI. Check for mistakes.
outlet_vel_avg.surface_names = ["outlet"] | ||
|
||
create_output_param = solver.tui.define.parameters.output_parameters.create | ||
create_output_param = solver.tui.define.settings.parameters.output_parameters.create |
Copilot
AI
Oct 9, 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 TUI path is incorrect. It should be solver.tui.define.parameters.output_parameters.create
without the .settings
segment, as TUI commands don't use the settings API.
create_output_param = solver.tui.define.settings.parameters.output_parameters.create | |
create_output_param = solver.tui.define.parameters.output_parameters.create |
Copilot uses AI. Check for mistakes.
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.
solver.solution.initialization.hybrid_initialize() | ||
# After reading the static-mixer case in Fluent, case-modified? flag is somehow True | ||
solver.settings.solution.initialization.hybrid_initialize() | ||
# After reading the static-mixer case in Fluent, case-modifed? flag is somehow True |
Copilot
AI
Oct 9, 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.
Corrected spelling of 'modifed' to 'modified'.
# After reading the static-mixer case in Fluent, case-modifed? flag is somehow True | |
# After reading the static-mixer case in Fluent, case-modified? flag is somehow True |
Copilot uses AI. Check for mistakes.
solver_session = pyfluent.launch_fluent( | ||
dimension=3, | ||
precision="double", | ||
processor_count=4, |
Copilot
AI
Oct 9, 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 removed dimension=3 parameter should be restored as it explicitly specifies the 3D solver mode for this ablation modeling example.
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 9, 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 parameter name has been changed from 'version' to 'dimension', but the comment on line 74 still mentions 'version'. Consider updating the comment to reflect the correct parameter name.
Copilot uses AI. Check for mistakes.
mode="meshing", | ||
dimension=3, | ||
precision="double", | ||
processor_count=4, |
Copilot
AI
Oct 9, 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 removed dimension=3 parameter should be restored as it's needed to specify 3D meshing mode for this conjugate heat transfer example.
processor_count=4, | |
processor_count=4, | |
dimension=3, |
Copilot uses AI. Check for mistakes.
) | ||
|
||
meshing_session.upload(wing_intermediary_file) | ||
geo_import.Execute() |
Copilot
AI
Oct 9, 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 removed line 'meshing_session.upload(wing_intermediary_file)' should be restored as it's needed to upload the geometry file before executing the import operation.
Copilot uses AI. Check for mistakes.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# Import the CAD geometry file (``exhaust_system.fmd``) and selectively manage some | ||
# parts. | ||
|
Copilot
AI
Oct 9, 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 removed line 'meshing_session.upload(import_file_name)' should be restored as it's needed to upload the CAD file before calling InputFileChanged.
meshing_session.upload(import_file_name) |
Copilot uses AI. Check for mistakes.
Definitely needs testing cause it was a big find and replace job