diff --git a/tests/test_pro/test_pro_cht.py b/tests/test_pro/test_pro_cht.py index 1d1195dae91a..c09ee8351cbf 100644 --- a/tests/test_pro/test_pro_cht.py +++ b/tests/test_pro/test_pro_cht.py @@ -209,7 +209,7 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2): solver.execute_tui( r"""/surface/iso-clip z-coordinate clip-z-coordinate solid_up:1 -101.8218025565147 -44. """ ) - assert solver.results.graphics.pathline["pathlines-1"].surfaces_list() == [ + assert sorted(solver.results.graphics.pathline["pathlines-1"].surfaces_list()) == [ "inlet", "inlet1", "inlet2", @@ -246,18 +246,11 @@ def test_pro_cht(launch_fluent_solver_3ddp_t2): "field": "temperature", "surfaces_list": ["inlet", "inlet1", "inlet2", "mid-plane-z", "outlet", "out1"], } - surface_list = solver.results.graphics.contour[ - "contour-temperature" - ].surfaces_list() - surface_list.sort() - assert surface_list == [ - "inlet", - "inlet1", - "inlet2", - "mid-plane-z", - "out1", - "outlet", - ] + + assert sorted( + solver.results.graphics.contour["contour-temperature"].surfaces_list() + ) == ["inlet", "inlet1", "inlet2", "mid-plane-z", "out1", "outlet"] + solver.execute_tui(r"""/display/surface-mesh clip-z-coordinate () """) solver.results.graphics.contour.add_to_graphics(object_name="contour-temperature") solver.results.graphics.contour["contour-temperature-manifold"] = {} diff --git a/tests/test_pro/test_pro_post.py b/tests/test_pro/test_pro_post.py index 7ab724f47b1b..dea110c8aba5 100644 --- a/tests/test_pro/test_pro_post.py +++ b/tests/test_pro/test_pro_post.py @@ -10,6 +10,7 @@ @pytest.mark.solve @pytest.mark.fluent_231 def test_pro_post(launch_fluent_solver_3ddp_t2): + out = str(Path(pyfluent.EXAMPLES_PATH) / "out") if not Path(out).exists(): Path(out).mkdir(parents=True, exist_ok=False) @@ -199,9 +200,15 @@ def test_pro_post(launch_fluent_solver_3ddp_t2): "partitions": False, "overset": False, } - surface_list = solver.results.graphics.mesh["mesh-1"].surfaces_list() - surface_list.sort() - assert surface_list == ["bottom", "front", "left", "right", "top"] + + assert sorted(solver.results.graphics.mesh["mesh-1"].surfaces_list()) == [ + "bottom", + "front", + "left", + "right", + "top", + ] + solver.results.graphics.mesh.add_to_graphics(object_name="mesh-1") solver.results.graphics.mesh.display(object_name="mesh-1") solver.execute_tui(r"""/display/set/rendering-options/driver quit """) @@ -218,9 +225,8 @@ def test_pro_post(launch_fluent_solver_3ddp_t2): ], "field": "pressure", } - surface_list = solver.results.graphics.contour["contour-1"].surfaces_list() - surface_list.sort() - assert surface_list == [ + + assert sorted(solver.results.graphics.contour["contour-1"].surfaces_list()) == [ "bottom", "default-interior", "front", @@ -260,9 +266,15 @@ def test_pro_post(launch_fluent_solver_3ddp_t2): }, "shrink_factor": 0.5, } - surfaces_list = solver.results.graphics.mesh["mesh-1"].surfaces_list() - surfaces_list.sort() - assert surfaces_list == ["bottom", "front", "left", "right", "top"] + + assert sorted(solver.results.graphics.mesh["mesh-1"].surfaces_list()) == [ + "bottom", + "front", + "left", + "right", + "top", + ] + assert solver.results.graphics.mesh["mesh-1"].options() == { "nodes": False, "edges": True, @@ -285,16 +297,28 @@ def test_pro_post(launch_fluent_solver_3ddp_t2): "surfaces_list": ["top", "bottom", "front", "left", "right"] } solver.results.graphics.pathline.display(object_name="pathlines-1") - surface_list = solver.results.graphics.pathline["pathlines-1"].surfaces_list() - surface_list.sort() - assert surface_list == ["bottom", "front", "left", "right", "top"] + + assert sorted(solver.results.graphics.pathline["pathlines-1"].surfaces_list()) == [ + "bottom", + "front", + "left", + "right", + "top", + ] + solver.results.plot.xy_plot["xy-plot-1"] = {} solver.results.plot.xy_plot["xy-plot-1"] = { "surfaces_list": ["top", "bottom", "left", "right", "front"] } - surface_list = solver.results.plot.xy_plot["xy-plot-1"].surfaces_list() - surface_list.sort() - assert surface_list == ["bottom", "front", "left", "right", "top"] + + assert sorted(solver.results.plot.xy_plot["xy-plot-1"].surfaces_list()) == [ + "bottom", + "front", + "left", + "right", + "top", + ] + solver.results.plot.xy_plot.display(object_name="xy-plot-1") solver.results.scene["scene-1"] = {} solver.results.scene["scene-1"].graphics_objects["contour-1"] = {} diff --git a/tests/test_pro/test_pro_settings_pbcs.py b/tests/test_pro/test_pro_settings_pbcs.py index fd6f42217d6e..34ebc4ec817c 100644 --- a/tests/test_pro/test_pro_settings_pbcs.py +++ b/tests/test_pro/test_pro_settings_pbcs.py @@ -10,9 +10,11 @@ @pytest.mark.solve @pytest.mark.fluent_231 def test_pro_settings_pbcs(launch_fluent_solver_3ddp_t2): + out = str(Path(pyfluent.EXAMPLES_PATH) / "out") if not Path(out).exists(): Path(out).mkdir(parents=True, exist_ok=False) + solver = launch_fluent_solver_3ddp_t2 input_type, input_name = download_input_file("pyfluent/nozzle", "nozzle_3d.msh") solver.file.read(file_type=input_type, file_name=input_name) diff --git a/tests/test_pro/test_pro_species.py b/tests/test_pro/test_pro_species.py index 9654f37a03f6..1ebb9e8a3bd2 100644 --- a/tests/test_pro/test_pro_species.py +++ b/tests/test_pro/test_pro_species.py @@ -10,9 +10,11 @@ @pytest.mark.solve @pytest.mark.fluent_231 def test_pro_species(launch_fluent_solver_2ddp_t2): + out = str(Path(pyfluent.EXAMPLES_PATH) / "out") if not Path(out).exists(): Path(out).mkdir(parents=True, exist_ok=False) + solver = launch_fluent_solver_2ddp_t2 input_type, input_name = download_input_file("pyfluent/2d_box", "pro_species.cas") solver.file.read(file_type=input_type, file_name=input_name) diff --git a/tests/test_pro/test_pro_turbulence.py b/tests/test_pro/test_pro_turbulence.py index a350afd2151a..a66b029500c9 100644 --- a/tests/test_pro/test_pro_turbulence.py +++ b/tests/test_pro/test_pro_turbulence.py @@ -10,9 +10,11 @@ @pytest.mark.solve @pytest.mark.fluent_231 def test_pro_turbulence(launch_fluent_solver_3ddp_t2): + out = str(Path(pyfluent.EXAMPLES_PATH) / "out") if not Path(out).exists(): Path(out).mkdir(parents=True, exist_ok=False) + solver = launch_fluent_solver_3ddp_t2 input_type, input_name = download_input_file("pyfluent/elbow", "elbow.msh.h5") solver.file.read(file_type=input_type, file_name=input_name) diff --git a/tests/test_solvermode/test_boundaries.py b/tests/test_solvermode/test_boundaries.py index ecb82c4a2ef7..0d2a4ceb441d 100644 --- a/tests/test_solvermode/test_boundaries.py +++ b/tests/test_solvermode/test_boundaries.py @@ -4,6 +4,7 @@ import pytest from util.fixture_fluent import get_name_info +from util.solver import ApiNames as api_names from util.solver import SettingsValDict as D from util.solver import assign_settings_value_from_value_dict as assign_dict_val @@ -40,7 +41,7 @@ def test_boundaries_elbow(load_mixing_elbow_mesh): "velocity_spec": "Magnitude, Normal to Boundary", "frame_of_reference": "Absolute", "vmag": D(0.4), - "p_sup": D(0), + api_names(solver_session).initial_gauge_pressure: D(0), "t": D(293.15), "ke_spec": "Intensity and Hydraulic Diameter", "turb_intensity": 0.05, @@ -62,12 +63,13 @@ def test_boundaries_elbow(load_mixing_elbow_mesh): "velocity_spec": "Magnitude, Normal to Boundary", "frame_of_reference": "Absolute", "vmag": D(1.2), - "p_sup": D(0), + api_names(solver_session).initial_gauge_pressure: D(0), "t": D(313.15), "ke_spec": "Intensity and Hydraulic Diameter", "turb_intensity": 0.05, "turb_hydraulic_diam": {"expression": "1 [in]", "constant": 1}, } == solver_session.setup.boundary_conditions.velocity_inlet["hot-inlet"]() + solver_session.setup.boundary_conditions.pressure_outlet[ "outlet" ].turb_viscosity_ratio = 4 diff --git a/tests/util/solver.py b/tests/util/solver.py index bd9e21b445c2..79a334009aad 100644 --- a/tests/util/solver.py +++ b/tests/util/solver.py @@ -16,6 +16,18 @@ def assign_settings_value_from_value_dict(setting, value): setting.set_state({"option": "constant or expression", "constant": value}) +class ApiNames: + def __init__(self, session): + self.session = session + + @property + def initial_gauge_pressure(self): + if self.session.get_fluent_version() == "22.2.0": + return "p_sup" + else: + return "initial_gauge_pressure" + + def settings_value_from_value_dict(dict_value) -> bool: if "option" in dict_value: option = dict_value["option"]