Post-processing ASPECT's outputs with pvtu file and extract data points on coutours

Hi all

To simplify what I want to do, from the pvtu data, I would like to get the contours of compositions by coordinate points(i.e extract the coordinates of contours) and use them for some further analysis(e.g. integrate temperature field inside one of the contours).

I didn’t find a solution in visit, but I have explored it myself by looking at the cpp vtk package. With a couple of trials, I am able to get the data points of a contour from a .ptvu file, but I have also encountered some problems.

Most of all, I don’t know if this is the right path to follow or a rabbit hole, I’d like to know how you will proceed with the question since I know you have a lot of experience with visualization and post-processing data.

You can do what you are trying to do with VTK library (either in C++ or in Python, for example), but I think it will be easier to write a postprocessor in ASPECT itself.

Here is an example of a postprocessor that computes density averages and a few other things, for example:

It would be relatively easy to only do these integrals if a certain condition is satisfied – say, if you are on one side of a contour. In other words, you would only integrate the temperature if a certain condition is met.


Thanks for your explanation and the code, I see that this is a good approach to go. And yes, figuring out the vtk package is not so easy.
The only concern is that often time I got a bunch of data first and then have an analysis idea that I want to try. That brings up the question of how I can do the same post-process on the data I got beforehand?

I think for most of us, we set up small computations first to get an idea of how the solution will look like, make changes and add postprocessing options, and iterate this a few times. Only when we are sure that we have what we want do we submit large runs to the queue on supercomputers.

The issue you will generally face is that once the output is converted to VTK/VTU files, you have lost a lot of information that is useful for postprocessing. VTK/VTU is fundamentally a visualization file format (that’s what the V stands for, after all), and it’s good at that, but it’s not so useful for extracting other pieces of information.


Okay, I’ll update on where I am when I have made some progress. Thanks for addressing my question.