English

Plotting Resultant Forces with the OnScale Solve Jupyter Notebook

By Oliver Mashari 25 March 2021

Following on from our blog post How to Run a Simulation in OnScale Solve this post will teach you how to plot resultant forces using the OnScale Solve Jupyter Notebook. This article will cover:

• Opening results after a simulation
• Opening the Jupyter Notebook
• Using the example python notebooks – this article will focus on plotting resultant forces

After the simulation finishes you will be able to open the results by clicking Load Results. This is how the UI should look if you are following on from this blog post.

Jupyter is a graphical interface in the browser that allows you to run some python code in the cloud (or MATLAB code with Octave). If this is your first time hearing about Jupyter Notebooks, we recommend having a look at the website jupyter.org to get some knowledge about how it works. It has become a really popular tool in data analysis, so understanding it will only benefit you.

To open a Notebook, first click on the second small icon of the floating bar near the right menu:

After clicking this is you should see something similar to the following:

On the left, you will find your simulation data files (raw data files this time!) and on the right, you have the different programs (called “Jupyter Kernels”) that you can use to process your raw data.

Open the example examples/Extract_Force_resultants.ipynb. This example will show you how to fetch data from KPI outputs generated by the OnScale Reflex solver. The data will be imported as a pandas.DataFrame, which we can then use to make bar plots of our data. We can save a .png of this data and export it as a .csv file.

What you see here is an example of a pre-built Notebook available to all users called Extract_Force_Resultants.py.

Each cell has some python code in it and a description explaining what it does. Click on the first cell and then click on the Run button to execute the code (you can also press Shift+ Enter):

This code gets executed cell by cell and does the following for you:

• It finds the resultant force data within the raw data simulation files
• It stores that data into and array and displays the different resultants that you can plot
• It plots the data into a graph and then in a table

The 3rd cell in this example imports sample data from the onscale_data library. If you would like to use this script with the data from your simulation then either remove the 3rd code cell completely or skip this when running the Notebook. Having removed this cell from the script we can plot the resultant forces from the previous simulation.

Got some ideas of post-processing that you would like to perform, but you don’t know how to write the script?

Write and tell us what you want to see and we will make it happen!

Also if you have some useful scripts that you would like to share with us, please don’t hesitate. If you agree, we can even put it in the example folder to benefit all OnScale Solve Users.

How to Get Started With OnScale Solve:

Engineers, designers, analysts, and current OnScale users can learn more about OnScale Solve and run their first cloud engineering simulation study by accessing these resources:

• Create your Free private account here.
• Watch a quick guided video tour of the software, from log in to simulation.
• Run your first simulation by following a 10-minute online tutorial.
• Ask for technical support by emailing support@onscale.com.

We hope to see all your great post-processing ideas coming to life soon with all the new tools we put at your disposal!

You may also like…

Simulating plastic materials in OnScale Solve

By 30 January 2023

Simulate Contact Mechanics

By 19 January 2023

Simulating Spinning Bodies

By 11 January 2023