Skip to content

Commit

Permalink
Fix results extraction for simulation object with given server (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoNegri authored Oct 5, 2023
1 parent f8581eb commit 2a2081c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/ansys/dpf/post/harmonic_mechanical_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ def _get_result(
)
for i_field in range(len(fc)):
bind_support_op = dpf.operators.utility.bind_support(
fc[i_field], submesh
fc[i_field],
submesh,
server=fc._server,
)
fc.add_field(fc.get_label_space(i_field), bind_support_op.eval())

Expand Down
5 changes: 4 additions & 1 deletion src/ansys/dpf/post/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ def _generate_disp_workflow(self, fc, selection) -> Union[dpf.Workflow, None]:
merge_op = dpf.operators.utility.merge_fields_by_label(
fields_container=shell_layer_op.outputs.fields_container_as_fields_container,
label="eltype",
server=fc._server,
)

# Expose output
Expand All @@ -643,7 +644,9 @@ def _create_dataframe(
if submesh is not None:
for i_field in range(len(fc)):
bind_support_op = dpf.operators.utility.bind_support(
fc[i_field], submesh
fc[i_field],
submesh,
server=fc._server,
)
fc.add_field(fc.get_label_space(i_field), bind_support_op.eval())
if unit == "":
Expand Down
22 changes: 22 additions & 0 deletions tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ def test_multi_stage(self, multi_stage_cyclic):
assert "base_sector" not in result.columns.names
assert "stage" not in result.columns.names

@pytest.mark.skipif(
not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_4_0,
reason="Available starting DPF 4.0",
)
def test_with_grpc_server(self, static_rst, grpc_server):
simulation = post.StaticMechanicalSimulation(static_rst, server=grpc_server)
assert simulation._model._server != dpf.SERVER
_ = simulation.displacement()
_ = simulation.displacement(skin=True)

def test_times_argument(self, static_simulation):
_ = static_simulation.displacement(times=1)
_ = static_simulation.displacement(times=1.0)
Expand Down Expand Up @@ -2075,6 +2085,18 @@ def test_multi_stage(self, multi_stage_cyclic):
assert "base_sector" not in result.columns.names
assert "stage" not in result.columns.names

@pytest.mark.skipif(
not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_4_0,
reason="Available starting DPF 4.0",
)
def test_with_grpc_server(self, complex_model, grpc_server):
simulation = post.HarmonicMechanicalSimulation(
complex_model, server=grpc_server
)
assert simulation._model._server != dpf.SERVER
_ = simulation.displacement()
_ = simulation.displacement(skin=True)

def test_displacement(self, harmonic_simulation):
# print(harmonic_simulation)

Expand Down

0 comments on commit 2a2081c

Please sign in to comment.