The new routines!

The new routines!

Well, I’ve already left Nice and I have finished my experience with PRACE, so let’s review a bit of what has come out of this work I’ve dedicated my time to.

As I said in my previous post, I have focused on implementing two new routines within the same code, so that they are performed efficiently and in parallel without the need to store much heavier data that would later be used to get the desired information: one to calculate the tensor of temperatures in the whole space, in a coordinate system relative to the magnetic field, and another to calculate the energy spectrum of the particles in the simulation.

The Temperature Tensor

One of the relevant quantities when analyzing a plasma system is the temperature at each point in space. This temperature is related in a straightforward manner under reasonable assumptions to the pressure, which, in general, does not have to be isotropic: that is, it is not, as we are used to, a unique value associated with each spatial point, but a mathematic object representing the forces exerted on a on a differential element of area of the fluid. This is the pressure tensor.

This tensor is what the code gave before this work, creating 6 different files (the tensor is symmetric) with the value of each component of the tensor in all the cells of the plasma simulation box. Now, there is a catch here. You want to calculate the temperature tensor from here, but not in the code’s cartesian coordinates, but in coordinates relative to the magnetic field in each point of space. This means that you have to take the 6 components of the tensor and realize a change of basis to the matrix to define the tensor in a coordinate system where the principal axis are one parallel to the magnetic field and two perpendicular to it. Note that this coordinates are dependent of the point in space where they are calculated, because the magnetic field is not going to be uniform in general.

The code works iteratively from given initial conditions, and you can ask it what information you want it to write to files in which cycles. So, I have implemented a new routine that calculates the temperature tensor in the cycles you ask for. In addition, this routine doesn’t create 6 different files for each component, but a single file with all the information of the tensor for each point and a format adequate for visualization. Now it is super easy to take temperature information of the simulations.

The Energy Spectra

Observationally, if we want to study plasma particles in space, what we do is count the number of particles that are in different energy ranges, moving in a particular direction. This means that we are not interested in knowing the positions and velocities of all the particles, but only in knowing the energy spectrum at each point: that is, the probability that a particle has one energy or another.

This information is much less burdensome than the complete information of all particles in a simulation. In the cycles of interest, we could simply calculate how many particles are in each cell of the simulation box and place them in different energy bins. In that way, what used to be hundreds of particles per cell, each with its velocity vector, is now simply a series of numbers indicating the number of particles that fall between different energy ranges chosen by the user. A substantial improvement worth implementing directly in the code for parallel calculation.

This is more complicated than the previous example. Let’s think about how the code is designed: the different processes running in parallel have an associated region of space, in which they perform all their computations and which contains certain specific cells. Those cells, in turn, have a certain number of particles inside them.

Each process thus has its own set of particles, and I can make each of them perform a cycle by going through all its particles and putting them in “their place”. Each particle is in a certain cell (its spatial location) and has a certain energy (its corresponding energy bin to construct the energy spectra).

You do this with all particles and you end with a complete 3D matrix, which each space element having an array of N integer values, where N is the number of established energy bins, and the values correspond to the number of particles in these bins. With this, you can construct plots as the one you see above.

These two new routines will allow anyone using the code for the study of plasma in space to have access to relevant information that can be compared almost directly with observational data without having to deal with inefficient post-processing and space problems. The code itself directly provides the relevance information and calculates it by making full use of its parallel design.

I hope that these two new routines will be useful for the study of space plasma in the future!

Tagged with: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.