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 averaging example plots #1988

Merged
merged 4 commits into from
Jan 6, 2025
Merged
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
4 changes: 2 additions & 2 deletions examples/09-averaging/00-compute_and_average.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
def compute_von_mises_then_average(analysis):
# Create a model from the results of the simulation and retrieve its mesh
model = dpf.Model(analysis)
mesh = model.metadata.meshed_region

# Apply the stress operator to obtain the stresses in the body
stress_op = dpf.operators.result.stress()
Expand All @@ -120,6 +119,7 @@ def compute_von_mises_then_average(analysis):
min_max.inputs.field.connect(avg_von_mises)
max_val = min_max.outputs.field_max()

avg_von_mises.plot()
return max_val.data[0]


Expand All @@ -135,7 +135,6 @@ def compute_von_mises_then_average(analysis):
def average_then_compute_von_mises(analysis):
# Creating the model from the results of the simulation
model = dpf.Model(analysis)
mesh = model.metadata.meshed_region

# Retrieving the stresses
stress_op = dpf.operators.result.stress()
Expand All @@ -157,6 +156,7 @@ def average_then_compute_von_mises(analysis):
min_max.inputs.field.connect(avg_von_mises)
max_val = min_max.outputs.field_max()

avg_von_mises.plot()
return max_val.data[0]


Expand Down
Loading