File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ Welcome to StagPy's documentation!
2525 sources/cookbook/field
2626 sources/cookbook/nura
2727 sources/cookbook/vrmsra
28+ sources/cookbook/tracers
2829
2930.. toctree ::
3031 :maxdepth: 2
Original file line number Diff line number Diff line change 1+ Plotting tracers information
2+ ============================
3+
4+ StagPy gives you access to tracers information through StagyyData. Mind that
5+ tracers information is organized by blocks even if your run only has one
6+ block. The following script offers an example::
7+
8+ from stagpy.stagyydata import StagyyData
9+ import matplotlib.pyplot as plt
10+ import numpy as np
11+
12+ sdat = StagyyData('.')
13+
14+ time = []
15+ energy = []
16+ for snap in sdat.snaps:
17+ time.append(snap.time)
18+ energy.append(np.sum(snap.tracers['Mass'][0] *
19+ snap.tracers['Temperature'][0]))
20+
21+ fig, axes = plt.subplots(nrows=2)
22+
23+ axes[0].plot(time, energy)
24+ axes[0].set_xlabel("Time")
25+ axes[0].set_ylabel("Internal energy")
26+
27+ axes[1].hist(sdat.snaps[-1].tracers['TimeMelted'][0])
28+ axes[1].set_xlabel("Time melted")
29+ axes[1].set_ylabel("Number of tracers")
30+
31+ fig.tight_layout()
32+ plt.savefig('tracers.pdf')
You can’t perform that action at this time.
0 commit comments