Skip to content
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

Fix/Nightly test run for 23.1 #935

Merged
merged 5 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions tests/test_pro/test_pro_cht.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"] = {}
Expand Down
54 changes: 39 additions & 15 deletions tests/test_pro/test_pro_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 """)
Expand All @@ -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",
Expand Down Expand Up @@ -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,
Expand All @@ -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"] = {}
Expand Down
2 changes: 2 additions & 0 deletions tests/test_pro/test_pro_settings_pbcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_pro/test_pro_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_pro/test_pro_turbulence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions tests/test_solvermode/test_boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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),
prmukherj marked this conversation as resolved.
Show resolved Hide resolved
"ke_spec": "Intensity and Hydraulic Diameter",
"turb_intensity": 0.05,
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions tests/util/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down