Lesson-2-Post-Processing-with-Scripts
Lesson-2-Post-Processing-with-Scripts
Static Angle of
Repose Test
Lesson 2 – Post-Processing with
Scripts
1.1.1. OBJECTIVES
The purpose of this tutorial is to calculate the Static Angle of Repose (SAOR) using two methods:
manually using Cross Plots and automatically using a Python script.
• API:PrePost Manual
Important:
Even though this tutorial involves running only one SAOR test, other simulations must be
done in order to calibrate the particle model in full.
Important:
To make use of the Rocky project file provided, you must have Rocky 2024 R1 or
later. If you have an earlier version of Rocky, please upgrade Rocky to the latest
version or complete Part A from scratch.
d. From the Rocky program, click the Open Project button, find the dem_tut02_files folder,
then from the tutorial_02_pre-processing folder, open the tutorial_02_pre-processing.rocky
file.
e. Process the simulation. (From the Simulation toolbar, click the Start button.)
In this method, the Static Repose Angles (green lines) will be calculated manually by following these
steps:
In this tutorial, we will use a Cross Plot to see the projection of the particles pile in the XY plane. In
order to do that, the Particle Y-Coordinate will be plotted against the Particle X-Coordinate.
1. From the Window menu, click New Cross Plot, or use the shortcut Ctrl+R.
2. From the Data panel, select Particles and then from the Data Editors panel, select the Properties
tab.
3. Click and drag Particle Y-Coordinate over the plot window and then release.
4. From the Select Source Curves window that appears, select Particle X-Coordinate from the
Domain drop-down list, and then click OK.
You can choose what instant to analyze using the Time toolbar.
Cross Plot
• Export and Copy: Copy the plot or data; save the plot as a .png, .bmp or .jpg image file; or save
a .csv data file.
• Canvas Background: Change the plot area color and display/hide grid lines.
• Curve Colors: Select curves coloring method: one color for each curve (Unique), identical colors
for the same curves in the same or different entities (Particles/Geometries/Processes) (Property
Based), or identical colors for the same or different curves in the same entities (Entity Based).
• Axes Colors: Enable/disable the axis coloring according to the curve color.
• Axes Layout: Toggle between independent axes for each curve (By Property), or a single axis for
2024 R1 - © ANSYS, Inc. All rights reserved // 6
the same units (By Quantity).
• Time Mark: Enable/disable the vertical dotted line synchronized with the selected instant in the
Time toolbar.
1. Right-click the cross plot view and then select Settings. (Or in the top left corner of the plot, select
the Configure Window icon.)
2. In the Window Editors panel, select the Axes tab, and then under Axis, multi-select both proper-
ties.
4. Set the value for Min, Max and Step for the two separate axes as shown below.
Note:
The values you end up with in your project may vary slightly from the ones shown in this
tutorial.
– SAOR=atan(0.155/0.220) ~ 35.2°
– SAOR=atan(0.150/0.160) ~ 43.1°
Although these values were measured using the cross plot's axis scale, they can be measured using
the mouse. To do that, hold the Shift key and then click the plot to show the cursor's value.
Important:
The provided script was designed for cases with higher particle counts than what was
simplified for this tutorial. As a result, tutorial results may vary significantly.
In this method, the Static Angle of Repose (SAOR) will be calculated using the following steps:
• At a given output, a parallelepiped slice is divided into N vertical cells and placed at the pile center
(as shown).
• Then, the parallelepiped slice is rotated 10 degrees around the vertical axis (Y-direction), and the
maximum height of each cell is collected again. This step is repeated 36 times.
• Using the average of the collected maximum heights for each cell, a regression line is created and
the Static Angle of Repose is calculated.
• Within Rocky, you can record Scripts of the exact steps you take in the user interface.
• Outside of Rocky, you can write Scripts using the Python programming language that makes use
of the API:PrePost.
Although they are generated in different ways, both methods can be played (executed) in the PrePost
Script panel.
1. To start, show the PrePost Script panel by selecting it from the Tools menu.
• (1) Scripts shared across projects: Lists the scripts that can be used for any Rocky project.
• (2) Project scripts: Lists the scripts that can be used for this project only.
• (3) Lists all available scripts that are saved in the default folder for the selected tab.
• (4) Record Script: Creates a script by recording the commands you execute manually in the user
interface.
• (6) Open PrePost Scripts Directory: Based upon the selected tab, opens the default folder where
scripts are saved.
• (7) Reload PrePost Scripts from the Filesystem: Refreshes the available scripts list based upon
the default folder for the selected tab.
Tip:
More PrePost Script panel content is available in the User Manual. (From the Help menu,
point to Manuals, and then click User Manual.)
The Scripts shared across projects tab of the PrePost Script panel will show all the scripts you have
saved in Rocky's default folder: %HOMEPATH%DocumentsRockyScripts.
Now, let's add the provided script to this panel and run it:
2. Click the Open Scripts Directory button. This should take you to the Scripts folder listed above.
3. From dem_tut02_files folder you downloaded earlier, find the script folder and then copy and
paste the provided script script_calibration_SAOR.py to the folder you just opened.
4. The new script will appear in the PrePost Scripts panel on the Scripts shared across projects
tab (as shown).
2024 R1 - © ANSYS, Inc. All rights reserved // 11
5. With this new script selected, click the Playback Script button (as shown).
The dashed regression lines are used to compute the SAOR of the pile.
The black dots represent the average of the maximum heights for each vertical cell.
The dark red area represents the minimum of the maximum heights for each vertical cell.
The light red area represents the maximum of the maximum heights for each vertical cell.
Note:
This script was designed for cases with higher particle counts than what was simplified for
this tutorial. As a result, your tutorial results may vary significantly.
• experiment_data_points.csv: File containing the points used for fitting the lines.
• Further information about this calibration test or other available calibration tests can be found in
the Rocky Calibration Suite page.
As previously shown, the SAOR is calculated from the result of two linear regressions, one starting
from the bottom of the pile and another one starting from the top of the pile.
Both linear regressions are performed initially with minimum number of points. Then, more points
are iteratively added to the regressions until certain conditions are fulfilled. Such details are explained
in the Calibration 1: Static Angle of Repose documentation.
Tip:
The Material Wizard can be used as a time-saving starting point for your calibration process. For
– Controls the cell size, which is defined by N_DIVISIONS_FACTOR Particle Size. As a consequence,
the higher the factor, the bigger the cell size.
– For each SAOR calculation, this defines the number of times the parallelepiped rotates and collects
the maximum height.
– The default value is 36, which rotates the parallelepiped 10 degrees for each collection.
– Increasing this number (thereby reducing the angle of rotation) will give you more points to
average.
1. From the PrePost Script panel, from the Scripts shared across projects tab, click the Open
PrePost Scripts Directory button.
2. From the directory dialog, right-click the script file you want to edit, and then open it with your
favorite Python editor. (For example, Visual Studio Code.)
Important:
In order for Rocky to recognize it, the script file name must begin with script_.
To access it, from the Rocky Help menu, point to Manuals, and then click API:PrePost Manual.
To see the list of APIs available for scripting, navigate through the Class Reference section.
For further information on any topic presented, we suggest searching the User
Manual, which provides in-depth descriptions of the tools and parameters.
To access these options, from the main Toolbar click Help, point to Manuals, and then
click User Manual.
1.1.18. CONCLUSION
Rocky was used to verify the repose profile of particles in order to calculate the Static Angle of
Repose.
Note:
Even though this tutorial involves running only one SAOR test, other
simulations must be done in order to calibrate the particle model in full.
• Use the PrePost Script panel to run a Python script that measured the angles automatically
• Now that you understand the basics on how to set up a script, you are ready to
move on to Part C and learn about PrePost Scripts and the Rocky Scheduler.