Skip to content

Tutorial 2c: Plotting Results ​


Now that we've run the simulation, we can use a variety of pre-built plotting functions from DiplodocusPlots to plot and analyse the results.

Load the Simulation Output ​

First thing to do is load the simulation output using the same fileLocation and fileName as before:

julia
using Diplodocus

fileName = "tutorial2_output.jld2"
fileLocation = joinpath(pwd(),"Data","Tutorial2")
(PhaseSpace,sol) = SolutionFileLoad(fileLocation,fileName)

Particle Distribution ​

We only have isotropic distributions of particles in this simulation, these may be plotted using the function MomentumDistributionPlot0D. We can specify the species as a vector ["Ele","Pho"] to plot both the electron and photon distributions on the same plot, and set step=1 to plot each time step saved. The keyword argument wide=true makes the figure have an aspect ratio of 8:3 rather than the default 4:3 (i.e. useful as a two column wide figure). We want to plot the "energy" spectrum so we shall set order=2 to plot p^{order}dN/dpdV:

julia
PDisPlot = MomentumDistributionPlot0D(Static(),PhaseSpace,sol,["Ele","Pho"];step=1,wide=true,order=2,plot_limits=(-15,5,6,14))

T2P

We can see that the electron distribution is cooled due to the emission of synchrotron photons. Those synchrotron photons (first bump) then undergo inverse-Compton scattering off the electron population first to X-rays (second bump) with more energy than the synchrotron photons, and then to gamma-rays (third bump) with even more energy. In reality this gamma-ray population would being to annihilate to produce electron-positron pairs but we have not simulated that in this tutorial (It is entirely possible to include this effect in a Diplodocus simulation, all that would be required is to generate the necessary collision matrices and include BinaryInteraction["Pho","Pho","Ele",Pos"] in the setup).

Energy Density ​

Alongside the energy distribution of the particles we can also plot the total energy density of each particle population as a function of time using EnergyDensityPlot0D. We can plot the total energy density of all species by setting the species argument to "All":

julia
EngDenPlot = EnergyDensityPlot0D(Static(),PhaseSpace,sol2,"All";legend_pos=:rc)

T2E

Here it is evident that most of the energy contained within the spherical cell is stored within the photon population, indicating that as electrons are injected there energy is quickly transferred to the photon population via synchrotron emission and inverse-Compton scattering, reaching a near steady state after 10 characteristic times.