Skip to content

Commit

Permalink
Update test_fluid_simulation.py per comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Jul 26, 2023
1 parent f76a819 commit 4204663
Showing 1 changed file with 37 additions and 28 deletions.
65 changes: 37 additions & 28 deletions tests/test_fluid_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,44 +191,50 @@ def test_results_fluent_averaging_from_elemental_faces(self, fluent_simulation):
assert result._core_object[0].location == post.locations.elemental

def test_results_cfx_cross_locations_on_nodes(self, cfx_simulation):
result = cfx_simulation.density_on_nodes(node_ids=cfx_simulation.mesh.node_ids)
result = cfx_simulation.temperature_on_nodes(
node_ids=cfx_simulation.mesh.node_ids
)
assert result.index.mesh_index.location == post.locations.nodal
assert len(result.index.mesh_index) == cfx_simulation.mesh_info.num_nodes
ref = """
results RHO (kg*m^-3)
results TEMP (K)
set_ids 1
phase Water at 25 C (2) Copper (3)
node_ids
1 9.9700e+02
2 9.9700e+02
3 9.9700e+02
4 9.9700e+02
5 9.9700e+02
6 9.9700e+02
1 3.0550e+02
2 3.0445e+02
3 3.0147e+02
4 3.0157e+02
5 3.0301e+02
6 3.0478e+02
... ... ...
""" # noqa: W291, E501
assert str(result) == ref
result = cfx_simulation.density_on_nodes(
result = cfx_simulation.temperature_on_nodes(
cell_ids=cfx_simulation.mesh.element_ids
)
assert result.index.mesh_index.location == post.locations.nodal
assert len(result.index.mesh_index) == cfx_simulation.mesh_info.num_nodes
ref = """
results RHO (kg*m^-3)
results TEMP (K)
set_ids 1
phase Water at 25 C (2) Copper (3)
node_ids
3149 9.9700e+02
4143 9.9700e+02
3140 9.9700e+02
3158 9.9700e+02
3154 9.9700e+02
4146 9.9700e+02
3149 3.0212e+02
4143 3.0047e+02
3140 3.0107e+02
3158 3.0132e+02
3154 3.0473e+02
4146 3.0047e+02
... ... ...
""" # noqa: W291, E501
assert str(result) == ref
result = cfx_simulation.density_on_nodes(face_ids=cfx_simulation.mesh.face_ids)
result = cfx_simulation.temperature_on_nodes(
face_ids=cfx_simulation.mesh.face_ids
)
assert result.index.mesh_index.location == post.locations.nodal
ref = """
results RHO (kg*m^-3)
results TEMP (K)
set_ids 1
phase Water at 25 C (2) Copper (3)
node_ids
Expand Down Expand Up @@ -256,10 +262,12 @@ def test_results_cfx_cross_locations_on_faces(self, cfx_simulation):
# """ # noqa: W291, E501
# assert str(result) == ref
# result.plot()
result = cfx_simulation.density_on_faces(face_ids=cfx_simulation.mesh.face_ids)
result = cfx_simulation.temperature_on_faces(
face_ids=cfx_simulation.mesh.face_ids
)
assert result.index.mesh_index.location == post.locations.faces
ref = """
results RHO (kg*m^-3)
results TEMP (K)
set_ids 1
phase Water at 25 C (2) Copper (3)
face_ids
Expand All @@ -271,21 +279,22 @@ def test_results_cfx_cross_locations_on_faces(self, cfx_simulation):
result.plot()

def test_results_cfx_cross_locations_on_cells(self, cfx_simulation):
result = cfx_simulation.density_on_cells(
result = cfx_simulation.temperature_on_cells(
cell_ids=cfx_simulation.mesh.element_ids
)
assert result.index.mesh_index.location == "cells"
assert len(result.index.mesh_index) == cfx_simulation.mesh_info.num_cells
ref = """
results RHO (kg*m^-3)
results TEMP (K)
set_ids 1
phase Water at 25 C (2) Copper (3)
cell_ids
1 9.9700e+02
2 9.9700e+02
3 9.9700e+02
4 9.9700e+02
5 9.9700e+02
6 9.9700e+02
1 3.0124e+02
2 3.0200e+02
3 3.0184e+02
4 3.0071e+02
5 3.0327e+02
6 3.0063e+02
... ... ...
""" # noqa: W291, E501
assert str(result) == ref
Expand Down

0 comments on commit 4204663

Please sign in to comment.