Skip to content

Conversation

@Gobot1234
Copy link
Collaborator

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

Copilot AI review requested due to automatic review settings November 3, 2025 10:56
@github-actions github-actions bot added documentation Documentation related (improving, adding, etc) examples Publishing PyFluent examples bug Issue, problem or error in PyFluent labels Nov 3, 2025
Copy link
Contributor

Copilot AI left a 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 deprecation warnings by updating all references from direct solver session settings access (solver.setup.models) to the correct settings-based access pattern (solver.settings.setup.models). Additionally, it adds PEP 723 style dependencies to example scripts and includes minor improvements throughout.

  • Updates deprecated direct access patterns to settings-based access across all test files and examples
  • Adds PEP 723 dependency declarations to example scripts for standalone execution
  • Includes miscellaneous code improvements and cleanups

Reviewed Changes

Copilot reviewed 67 out of 68 changed files in this pull request and generated 4 comments.

File Description
tests/ Updates test files to use solver.settings instead of direct access patterns
examples/ Adds PEP 723 dependency headers and updates deprecated settings access
src/ Updates core library files to use settings-based access pattern
doc/ Updates documentation examples to reflect new access patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Gobot1234
Copy link
Collaborator Author

Anyone have any opinions on #4512 (review)?

Co-authored-by: Sean Pearson <93727996+seanpearsonuk@users.noreply.github.com>
Copilot AI review requested due to automatic review settings December 3, 2025 09:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@seanpearsonuk
Copy link
Collaborator

seanpearsonuk commented Dec 3, 2025

@Gobot1234 I made a number of remarks unconnected with the changes but I didn't want to miss the opportunity to fix some badly broken windows. My comments can be addressed either here or subsequently. For any that we do subsequently, we need to generate Issues from the comments.

Copilot AI review requested due to automatic review settings December 3, 2025 11:59
Copy link
Contributor

Copilot AI left a 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 67 out of 68 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings December 3, 2025 20:50
Copy link
Contributor

Copilot AI left a 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 67 out of 68 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 69 to 74
assert s.split("\n")[-2].split("(")[0] == r"<solver_session>.file.read_case"
else:
assert (
s.split("\n")[-2].split("(")[0]
== r"<solver_session>.settings.file.read_case"
)
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version comparison logic is inverted. For Fluent version >= v251, the assertion expects <solver_session>.file.read_case, but based on the PR description (updating to use solver.settings.*), newer versions should use the .settings. prefix. The conditional branches should be swapped.

Suggested change
assert s.split("\n")[-2].split("(")[0] == r"<solver_session>.file.read_case"
else:
assert (
s.split("\n")[-2].split("(")[0]
== r"<solver_session>.settings.file.read_case"
)
assert (
s.split("\n")[-2].split("(")[0]
== r"<solver_session>.settings.file.read_case"
)
else:
assert s.split("\n")[-2].split("(")[0] == r"<solver_session>.file.read_case"

Copilot uses AI. Check for mistakes.
solver.tui.file.read_case(case_path)
timeout_loop(
lambda: "<solver_session>.settings.file.read_case" in capsys.readouterr().out,
lambda: "<solver_session>.file.read_case" in capsys.readouterr().out,
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion checks for the deprecated access pattern <solver_session>.file.read_case instead of the updated pattern <solver_session>.settings.file.read_case. This contradicts the PR's goal of updating to the new API.

Suggested change
lambda: "<solver_session>.file.read_case" in capsys.readouterr().out,
lambda: "<solver_session>.settings.file.read_case" in capsys.readouterr().out,

Copilot uses AI. Check for mistakes.
absolute_pressure_expression.definition = "AbsolutePressure"

s1_min = solver1.fields.reduction.minimum(
s1_min = solver1.settings.fields.reduction.minimum(
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path solver1.settings.fields.reduction is incorrect. Based on other usage in the codebase, it should be solver1.fields.reduction without the .settings prefix.

Suggested change
s1_min = solver1.settings.fields.reduction.minimum(
s1_min = solver1.fields.reduction.minimum(

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)
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed parameter from version=\"3d\" to dimension=3. Verify that dimension=3 is the correct parameter name and value for specifying 3D mode, as this represents an API change.

Copilot uses AI. Check for mistakes.
@Gobot1234
Copy link
Collaborator Author

Gobot1234 commented Dec 4, 2025

@prmukherj / @seanpearsonuk are you okay with the tests that I've had to bump the markers of here?

Copilot AI review requested due to automatic review settings December 4, 2025 09:21
Copy link
Contributor

Copilot AI left a 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 67 out of 68 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



@pytest.mark.fluent_version(">=24.1")
@pytest.mark.fluent_version(">=25.1")
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum Fluent version requirement was changed from >=24.1 to >=25.1, which may unnecessarily restrict test execution on Fluent 24.x versions where the functionality should still work.

Suggested change
@pytest.mark.fluent_version(">=25.1")
@pytest.mark.fluent_version(">=24.1")

Copilot uses AI. Check for mistakes.


@pytest.mark.fluent_version(">=24.1")
@pytest.mark.fluent_version(">=25.2")
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum Fluent version requirement was changed from >=24.1 to >=25.2. Unless there's a specific feature dependency on 25.2, this unnecessarily restricts test coverage on earlier compatible versions.

Suggested change
@pytest.mark.fluent_version(">=25.2")
@pytest.mark.fluent_version(">=24.2")

Copilot uses AI. Check for mistakes.


@pytest.mark.fluent_version(">=25.1")
@pytest.mark.fluent_version(">=25.2")
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum Fluent version requirement was changed from >=25.1 to >=25.2. This should only be updated if there's a concrete dependency on 25.2 features; otherwise, it reduces test coverage.

Suggested change
@pytest.mark.fluent_version(">=25.2")
@pytest.mark.fluent_version(">=25.1")

Copilot uses AI. Check for mistakes.
Comment on lines +115 to 117
import csv
import math
import os
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The csv import is now placed after the header comment but before other standard library imports (math, os, pathlib). Standard library imports should be grouped together following PEP 8 import ordering guidelines.

Suggested change
import csv
import math
import os
import math
import os
import csv

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 18, 2025 02:20
Copy link
Contributor

Copilot AI left a 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 52 out of 53 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"FileName": wing_intermediary_file,
}
)

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line meshing_session.upload(wing_intermediary_file) was removed before geo_import.Execute(). If geo_import.Execute() depends on the file being uploaded first, this removal will cause a runtime error. Verify that the file upload is handled elsewhere or is no longer needed.

Suggested change
# Ensure the geometry file is available to the meshing session before import.
meshing_session.upload(wing_intermediary_file)

Copilot uses AI. Check for mistakes.
Comment on lines 114 to 116
meshing_session.PartManagement.InputFileChanged(
FilePath=import_file_name, IgnoreSolidNames=False, PartPerBody=False
)
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line meshing_session.upload(import_file_name) was removed before calling PartManagement.InputFileChanged(). If the file needs to be uploaded before it can be referenced by FilePath, this will cause a file-not-found error. Confirm that the upload is handled automatically or is unnecessary.

Copilot uses AI. Check for mistakes.
Comment on lines 1198 to 1208
assert set(solver.results.graphics.contour.command_names) == {
"create",
"delete",
"rename",
"list",
"list_properties",
"make_a_copy",
"display",
"add_to_graphics",
"clear_history",
}
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from issuperset to exact equality check (==). This is stricter and will fail if Fluent adds new commands in future versions. Consider whether this increased strictness is intentional or if issuperset was more appropriate for forward compatibility.

Copilot uses AI. Check for mistakes.
Comment on lines 1222 to 1223
assert solver.results.graphics.contour.rename.argument_names == ["new", "old"]
assert solver.results.graphics.contour.delete.argument_names == ["name_list"]
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed from set comparison to list comparison. This now checks both the names and their order. Verify that the order of argument names is guaranteed to be stable across Fluent versions, or revert to set comparison if order is not significant.

Suggested change
assert solver.results.graphics.contour.rename.argument_names == ["new", "old"]
assert solver.results.graphics.contour.delete.argument_names == ["name_list"]
assert set(solver.results.graphics.contour.rename.argument_names) == {"new", "old"}
assert set(solver.results.graphics.contour.delete.argument_names) == {"name_list"}

Copilot uses AI. Check for mistakes.
)
vertices_data = field_data.get_field_data(vertices_data_request)
assert round(vertices_data["interior-4"].vertices[5][0], 2) == 0.0
assert round(vertices_data["interior-4"][SurfaceDataType.Vertices][5][0], 2) == 0.0
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field data access pattern has changed significantly from using .vertices attribute to dictionary-style access with [SurfaceDataType.Vertices]. Ensure this new pattern is documented and consistent with the current API design, as it represents a breaking change in how users access field data.

Copilot uses AI. Check for mistakes.
@Gobot1234 Gobot1234 force-pushed the jhilton-/example-updates branch from c4ec3bd to 8ea0f85 Compare December 18, 2025 02:28
Copilot AI review requested due to automatic review settings December 18, 2025 02:43
Copy link
Contributor

Copilot AI left a 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 32 out of 33 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mode="meshing",
dimension=3,
precision="double",
processor_count=4,
Copy link

Copilot AI Dec 18, 2025

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 should be verified. While dimension might be inferred or defaulted, ensure that this change doesn't affect the intended 3D simulation behavior.

Suggested change
processor_count=4,
processor_count=4,
dimension=3,

Copilot uses AI. Check for mistakes.
)

meshing_session.upload(wing_intermediary_file)
geo_import.Execute()
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of meshing_session.upload(wing_intermediary_file) at line 125 suggests that file upload is no longer necessary before Execute(). Verify that the file is accessible to the meshing session through other means (e.g., shared filesystem or automatic handling) to ensure the workflow remains functional.

Copilot uses AI. Check for mistakes.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Import the CAD geometry file (``exhaust_system.fmd``) and selectively manage some
# parts.

Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of meshing_session.upload(import_file_name) at line 113 suggests that file upload is no longer necessary before InputFileChanged(). Verify that the file is accessible to the meshing session through other means (e.g., shared filesystem or automatic handling) to ensure the workflow remains functional.

Suggested change
meshing_session.upload(import_file_name)

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 23, 2025 12:51
Copy link
Contributor

Copilot AI left a 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 32 out of 33 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Import the CAD geometry file (``exhaust_system.fmd``) and selectively manage some
# parts.

Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the previous comment, the removed meshing_session.upload(import_file_name) at line 113 suggests the file upload was removed. Verify that import_file_name is accessible to PartManagement.InputFileChanged() without the explicit upload, or document why the upload is no longer necessary.

Suggested change
# Upload the downloaded geometry file into the Fluent meshing session so that
# it is accessible to PartManagement and workflow tasks.
meshing_session.upload(import_file_name)

Copilot uses AI. Check for mistakes.
Comment on lines +763 to +764
graphics.views.camera.position = [1.70, 1.14, 0.29]
graphics.views.camera.up_vector = [-0.66, 0.72, -0.20]
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API usage changed from method calls position(xyz=[...]) and up_vector(xyz=[...]) to direct property assignments. Verify that this is the correct API usage for the camera settings, as this appears to be a breaking change in how camera properties are set. If these were previously callable methods, ensure the new property-based approach is supported.

Suggested change
graphics.views.camera.position = [1.70, 1.14, 0.29]
graphics.views.camera.up_vector = [-0.66, 0.72, -0.20]
graphics.views.camera.position(xyz=[1.70, 1.14, 0.29])
graphics.views.camera.up_vector(xyz=[-0.66, 0.72, -0.20])

Copilot uses AI. Check for mistakes.
Comment on lines +500 to +506
for boundary_name in mesh1.surfaces.allowed_values:
if "wall" in boundary_name:
wall_list.append(boundary_name)
if "periodic" in boundary_name:
periodic_list.append(boundary_name)
if "symmetry" in boundary_name:
symmetry_list.append(boundary_name)
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactored code uses if "wall" in boundary_name instead of if len(item.split("wall")) > 1. These are not equivalent: the new code will match "wall" anywhere in the string (e.g., "my_wall_surface", "wallpaper"), while the original required "wall" to appear as a substring that splits the string into multiple parts. This could lead to different filtering behavior. Use more precise substring matching like if "wall" in boundary_name.split("-") or similar, depending on the expected naming convention.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just wrong

solver_session = pyfluent.launch_fluent(
dimension=3,
precision="double",
processor_count=4,
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dimension=3 parameter was removed from the launch_fluent call. If 3D simulation is required for this ablation model, removing this parameter might cause the solver to launch in a different default dimension. Verify that removing this parameter doesn't affect the intended simulation setup, or document why it's no longer needed.

Suggested change
processor_count=4,
processor_count=4,
dimension=3,

Copilot uses AI. Check for mistakes.
precision="double",
processor_count=2,
version="3d",
processor_count=4,
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version="3d" parameter was removed and processor_count was changed from 2 to 4. While increasing processor count may improve performance, verify that this change is intentional and doesn't affect reproducibility of the DOE/ML example results, as parallel decomposition can sometimes introduce minor numerical variations.

Suggested change
processor_count=4,
version="3d",
processor_count=2,

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue, problem or error in PyFluent documentation Documentation related (improving, adding, etc) examples Publishing PyFluent examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants