Following on from our blog post How to Run a Simulation in OnScale Solve this post will teach you how to extract a field value at an XYZ location using the OnScale Solve Jupyter Notebook. This article will cover:
- Opening results after a simulation
- Opening the Jupyter Notebook
- Uploading a Python Notebook file and executing
Showing results in the UI
After a simulation finishes you will be able to open the results.
Click Load Results and your simulated geometry should appear like what is shown below:
Accessing the Jupyter Notebook
To access Jupyter Notebook functionality, you can click on the icon:
This will open up the interface allowing you to select between using a Python or Octave notebook to process the simulation outputs.
Within this interface, we can also upload our custom Python Notebooks directly into simulation directory. Click on the upload icon and select the notebook file wish to upload:
Your selected python notebook should appear in the working directory allowing you to open/modify and execute the code.
Running the Python Notebook
You can download the python notebook we want to use for the example here:
To run the code, simply use the play icon to step through code section.
The notebook is live and interactive, so outputs are immediately generated and displayed as the code is executed.
The example file should do the following:
- Install PyVista
– A library that handles VTK (The Visualization Toolkit) format (.vtu) - Locate and read the VTK data files (.vtu or .pvtu)
- Determine what array data is available in the data files
- Utilise the numpy library for handling array of points
- Use PyVista functions to return the quantity value at the requested points
This script can be modified to extract any of the calculated data arrays at any point within the mesh bounds.
Simply add or modify the existing points stored in a and b with new XYZ position:
You can modify which array quantity you would like to extract by modifying the array name for the result data structure:
The array names are shown in the mesh or mesh.array_names output
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!