Skip to content

Commit

Permalink
Fix averaging example plots (#1988)
Browse files Browse the repository at this point in the history
* Fix averaging example plots

The first example of the averaging section lost its calls to plot methods at some point, not fitting the description anymore. This PR adds them back to fix the example.

* Update examples/09-averaging/00-compute_and_average.py

* Update examples/09-averaging/00-compute_and_average.py

* Update 00-compute_and_average.py
  • Loading branch information
PProfizi authored Jan 6, 2025
1 parent 2f94493 commit ff8e662
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit ff8e662

Please sign in to comment.