Skip to content

Commit

Permalink
Merge branch 'main' into millerj97/doc_change
Browse files Browse the repository at this point in the history
  • Loading branch information
millerj97 authored Dec 17, 2024
2 parents 22e7810 + a42a081 commit 496dc11
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,13 @@ def new_solver_session():
solver.exit()


@pytest.fixture
def new_solver_session_t4():
solver = create_session(processor_count=4)
yield solver
solver.exit()


@pytest.fixture
def new_solver_session_sp():
solver = create_session(precision="single")
Expand Down Expand Up @@ -329,6 +336,14 @@ def mixing_elbow_settings_session(new_solver_session):
return solver


@pytest.fixture
def mixing_elbow_case_session_t4(new_solver_session_t4):
solver = new_solver_session_t4
case_name = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
solver.settings.file.read(file_type="case", file_name=case_name)
return solver


@pytest.fixture
def mixing_elbow_case_data_session(new_solver_session):
solver = new_solver_session
Expand Down
27 changes: 27 additions & 0 deletions tests/test_solution_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,30 @@ def test_solution_variable_does_not_modify_case(new_solver_session):
domain_name="mixture",
)
assert not solver.scheme_eval.scheme_eval("(case-modified?)")


@pytest.mark.fluent_version(">=25.2")
def test_solution_variable_udm_data(mixing_elbow_case_session_t4):
solver = mixing_elbow_case_session_t4
solver.tui.define.user_defined.user_defined_memory("2")
solver.settings.solution.initialization.hybrid_initialize()
solver.settings.solution.run_calculation.iterate(iter_count=1)
udm_data = solver.fields.solution_variable_data.get_data(
solution_variable_name="SV_UDM_I",
domain_name="mixture",
zone_names=["wall-elbow"],
)["wall-elbow"]
np.testing.assert_array_equal(udm_data, np.zeros(4336))
udm_data[:2168] = 5
udm_data[2168:] = 10
solver.fields.solution_variable_data.set_data(
solution_variable_name="SV_UDM_I",
domain_name="mixture",
zone_names_to_solution_variable_data={"wall-elbow": udm_data},
)
new_array = solver.fields.solution_variable_data.get_data(
solution_variable_name="SV_UDM_I",
domain_name="mixture",
zone_names=["wall-elbow"],
)["wall-elbow"]
np.testing.assert_array_equal(new_array, udm_data)

0 comments on commit 496dc11

Please sign in to comment.