We are trying to do calculations with the fields output by ASPECT. Does anyone have a Paraview script that does this that we can use to start with? Alternatively, does anyone have a Matlab script that can read in ASPECT’s (vtu) output files?
The hdf5 output is often easier to deal with in other programs.
Some time ago there was discussion and generally positive support for creating a set of example postprocessing scripts. I have some scripts that I could share with you or open a PR with but they’re for a couple of specific use cases
reading 2D model results in MATLAB from hdf5 files
reading 3D spherical geometry model results with python, averaging onto a regular or equispaced mesh and doing spherical harmonic expansions.
I have a script that loads vtu files from a 2D or 3D cartesian geometry into numpy arrays if that would be helpful. I imagine there must also be a way to load numpy arrays into Matlab.
Another option is to output data from Paraview in csv format and load that into Matlab or python.
@maxrudolph - it would be great if you can add those scripts to the repository at some point! I’ve been meaning to add mine as well.
ParaView also has a trace function that tracks all that you do manually and then outputs it as a ParaView python script that you can adapt and then again with pvbatch. It’s under Tools->Start trace and Tools->Stop trace when you’re done.
@jbnaliboff where do you think that these belong in the aspect repository? I see that there is some python/jupyter code on contrib/python. One option would be to move this into a series of subdirectories with a top-level readme file.
@maxrudolph I think in the contrib/python folder is the right place and I agree we should organize this directory into multiple sub-folders with a top-level readme file. In fact a README.md file already exists. The same structure could be implemented for a matlab folder.
Hi John,
I hope you are doing well. Could you please share the script that loads vtu files from a 2D and 3D cartesian geometry into NumPy arrays because that is exactly what we need right now? Much appreciated!
Thank you for updating this discussion with your question!
An example of the vtk workflow for loading data into python can be found on the first post of the related form post Loading VTK data into Python.
I also just updated that forum post with an example of how to accomplish the same thing using PyVista, which provides a much more streamlined solution.
Please feel free to follow up with any questions here or on the other forum post!