Skip to content

Commit 899d8e2

Browse files
Apply suggestions from code review
Co-authored-by: Luisa Felix Salles <[email protected]>
1 parent cdfb01b commit 899d8e2

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

doc/source/user_guide/tutorials/animate/animate_time.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ the :ref:`ref_tutorials_import_data` tutorial section.
4545
from ansys.dpf.core import examples
4646
# Import the operators module
4747
from ansys.dpf.core import operators as ops
48-
# Define the result file
48+
49+
# Define the result file path
4950
result_file_path = examples.find_msup_transient()
5051
# Create the model
5152
model = dpf.Model(data_sources=result_file_path)
@@ -61,7 +62,7 @@ For more information on how to define a scoping, see the ``Narrow down data`` tu
6162
.. jupyter-execute::
6263

6364
# Get a scoping of all time steps available
64-
time_scoping = model.metadata.time_freq_support.time_frequencies
65+
time_steps = model.metadata.time_freq_support.time_frequencies
6566

6667
Extract the results
6768
-------------------
@@ -77,15 +78,14 @@ Extract the results to animate. In this tutorial, you extract the displacement a
7778
.. jupyter-execute::
7879

7980
# Get the displacement fields (already on nodes) at all time steps
80-
disp_fc = model.results.displacement(time_scoping=time_scoping).eval()
81+
disp_fc = model.results.displacement(time_scoping=time_steps).eval()
8182
print(disp_fc)
8283

8384
.. jupyter-execute::
8485

8586
# Get the stress fields on nodes at all time steps
86-
stress_fc = model.results.stress.on_location(
87-
location=dpf.locations.nodal).on_time_scoping(
88-
time_scoping=time_scoping).eval()
87+
# Request the stress on |Nodal| location as the default |ElementalNodal| location is not supported.
88+
stress_fc = model.results.stress.on_location(location=dpf.locations.nodal).on_time_scoping(time_scoping=time_steps).eval()
8989
print(stress_fc)
9090

9191
Animate the results
@@ -306,9 +306,9 @@ Fixed camera
306306
:hide-output:
307307

308308
# Define the camera position
309-
cpos = [[0., 2.0, 0.6], [0.05, 0.005, 0.5], [0.0, 0.0, 1.0]]
309+
cam_pos = [[0., 2.0, 0.6], [0.05, 0.005, 0.5], [0.0, 0.0, 1.0]]
310310
# Animate the stress with a custom fixed camera position
311-
stress_fc.animate(cpos=cpos)
311+
stress_fc.animate(cpos=cam_pos)
312312

313313
.. jupyter-execute::
314314
:hide-code:
@@ -328,10 +328,10 @@ Moving camera
328328
.. jupyter-execute::
329329
:hide-output:
330330

331-
# Define the list of camera positions
332331
import copy
333-
cpos_list = [cpos]
334-
# Incrementally decrease the y coordinate of the camera by 0.2 for each frame
332+
# Define the list of camera positions
333+
cpos_list = [cam_pos]
334+
# Incrementally increase the x coordinate of the camera by 0.1 for each frame
335335
for i in range(1, len(disp_fc)):
336336
new_pos = copy.deepcopy(cpos_list[i-1])
337337
new_pos[0][0] += 0.1

0 commit comments

Comments
 (0)