You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/2-howto/1-problem_generators.md
+15-16Lines changed: 15 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,7 +154,7 @@ Fields must be returned in the local tetrad (orthonormal) basis, while the passe
154
154
155
155
Similar to initializing the fields, one can also initialize particles with a given energy or spatial distribution. This is done by providing a custom method of the `PGen` class called `InitPrtls(Domain<S, M>&)` which takes a reference to the local subdomain as a parameter. In principle, one can manually initialize the particles in any way they want, but it is recommended to use the built-in routines from the `arch::` (archetypes) namespace.
156
156
157
-
For instance, to initialize a uniform Maxwellian of a given temperature, one can use the `arch::Maxwellian` and `arch::UniformInjector` classes together with the `InjectUniform` method:
157
+
For instance, to initialize a uniform Maxwellian of a given temperature, one can use the `arch::Maxwellian` class together with the `InjectUniform` method:
Or you may also manually access the fields and particles through the `domain.fields` and `domain.species[...]` objects, respectively, and perform any operations you need. Be mindful, however, that all the raw quantities stored within the `domain` object are in the code units (for more details, see the [fields and particles](./4-fields_particles.md) section; for ways to convert from one system/basis to another, see the [metric](./5-metrics.md) section).
560
+
Or you may also manually access the fields and particles through the `domain.fields` and `domain.species[...]` objects, respectively, and perform any operations you need. Be mindful, however, that all the raw quantities stored within the `domain` object are in the code units (for more details, see the [fields and particles](../3-code/4-fields_particles.md) section; for ways to convert from one system/basis to another, see the [metric](../3-code/5-metrics.md) section).
|`RNK` <ahref="https://github.com/entity-toolkit/entity/pull/144"> <spanclass="since-version">1.3.0</span> </a> | Meshblock rank the particle was created (if MPI is ON) | -- |
96
+
|`IDX` <ahref="https://github.com/entity-toolkit/entity/pull/144"> <spanclass="since-version">1.3.0</span> </a> | Index of the particle on the given rank | -- |
90
97
91
98
<ahref="https://github.com/entity-toolkit/entity/pull/69"> <spanclass="since-version">1.2.0</span> </a> The code also has an output of box-averaged stats into a `.csv` file, which are simply scalars per each output timestep. The following quantities can be computed
92
99
@@ -110,11 +117,11 @@ and particle quantities
110
117
111
118
All of the vector fields are interpolated to cell centers before the output, and converted to orthonormal basis. The particle-based moments are smoothed with a stencil (specified in the input file; `mom_smooth`) for each particle.
112
119
113
-
In addition, one can write custom user-defined field quantities to the output with the fields or stats. Refer to [the following section](../2-code/6-problem_generators.md#custom-field-output) for more details.
120
+
In addition, one can write custom user-defined field quantities to the output with the fields or stats. Refer to [the following section](../2-howto/1-problem_generators.md#custom-field-output) for more details.
114
121
115
-
!!! warning "Can one track particles at different times?"
122
+
!!! success "Can one track particles at different times?"
116
123
117
-
Particle tracking (outputting the same batch of particles at every timestep) is unfortunately not yet implemented, and will unlikely be available due to limitations imposed by the nature of GPU computations.
124
+
Yes! Simply enable particle tracking for a particular species. Then each particle is uniquely identified by a combination of `IDX` and `RNK` (if no MPI is used, then only `IDX` is sufficient). `nt2py` already automatically combines the variables producing a unique `id` for each particle (for the species where tracking is enabled). However, keep in mind, that the simulations are not reproducible and will unfortunately never be due to limitations imposed by the nature of GPU computations.
118
125
119
126
## [`nt2py`](https://pypi.org/project/nt2py/)
120
127
@@ -220,31 +227,32 @@ Particles and spectra can, in turn, be accessed via `data.particles[s]`, where `
220
227
221
228
### Accessing particles
222
229
223
-
Particles are stored in the same `data` object and are lazily preloaded when one calls `nt2.Data(...)`, as we did above. To access the particle data, use `data.particles`, which returns a python dictionary where the key is particles species index, and the value is an `xarray` Dataset with the particle data. For example, to access the `x` and `y` coordinates of the first species, one can do:
230
+
Particles are stored in the same `data` object and are lazily preloaded when one calls `nt2.Data(...)`, as we did above. To access the particle data, use `data.particles`, which returns a custom object which can then be converted into an explicitly populated dataframe using the `load()` method. Selection of particles can be done in a similar way to the fields:
The shape of the returned dataset is number of particles times the number of time steps. To select the data at a specific time step, one can use the same `sel` or `isel` methods mentioned above. For example, to access the 10-th output timestep of the 3-rd species, one can do:
236
+
which selects all times before $t<10$, selects species 1 and 3, and picks specific particle id-s (traced along all preselected times). There are two built-in plotting methods: `.spectrum_plot`, and `.phase_plot`, for plotting a 1D energy distribution function of each species, and a 2D phase-space plot (or any 2D binned plot).
Distribution functions for all particle species in the box are also written with the data at specified timesteps. These can be accessed via `data.spectra`, which has several different fields. As in particles & fields, you can access the data at different times using `data.spectra.isel(t=...)` or `data.spectra.sel(t=...)`. The energy bins are written into `data.spectra.e`; by default, the binning is done logarithmically in $\gamma - 1$ for massive particles and energy, $E$, for the photons. Below is an example script to build a distribution function of electron-positron pairs at output step `t=450`:
Copy file name to clipboardExpand all lines: docs/content/2-howto/4-checkpoints.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Oftentimes, large simulations cannot be run on a single go. For these cases, Ent
13
13
14
14
## Writing checkpoints
15
15
16
-
Since the checkpoint writing relies on the `ADIOS2` library, to be able to use checkpointing, the code has to be compiled with the `-D output=ON` flag (enabled by default). Configurations for the checkpoint writing are done via the `.toml` input file under the block named `[checkpoint]` (also see the [input file documentation](3-inputfile.md)). The following parameters control how often the checkpoint is written, as well as how many snapshots are preserved as the simulation runs.
16
+
Since the checkpoint writing relies on the `ADIOS2` library, to be able to use checkpointing, the code has to be compiled with the `-D output=ON` flag (enabled by default). Configurations for the checkpoint writing are done via the `.toml` input file under the block named `[checkpoint]` (also see the [input file documentation](../1-getting-started/3-inputfile.md)). The following parameters control how often the checkpoint is written, as well as how many snapshots are preserved as the simulation runs.
Copy file name to clipboardExpand all lines: docs/content/2-howto/7-faq.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ hide:
13
13
14
14
!!! faq "I want to have a custom boundary/injection/driving/distribution function/output."
15
15
16
-
All of that *can* be done via the tools provided by the problem generator. Please inspect carefully the [section dedicated to that](../2-code/6-problem_generators.md). Also have a look at the set of officially supported problem generators some of which might implement a variation of what your original intent is.
16
+
All of that *can* be done via the tools provided by the problem generator. Please inspect carefully the [section dedicated to that](../2-howto/1-problem_generators.md). Also have a look at the set of officially supported problem generators some of which might implement a variation of what your original intent is.
17
17
18
18
## Technical
19
19
@@ -29,7 +29,7 @@ hide:
29
29
30
30
- CUDA @ NVIDIA GPUs: make sure you have a version of `gcc` which is supported by the version of CUDA you are using; check out [this unofficial compatibility matrix](https://gist.github.com/ax3l/9489132#nvcc). In particular, Intel compilers are not very compatible with CUDA, and it is recommended to use `gcc` instead (you won't gain much by using Intel anyway, since CUDA will be doing the heavy-lifting).
31
31
32
-
- HIP/ROCm @ AMD GPUs: ROCm library is a headache. The documentation is even more so. We have a [dedicated section](./1-compile-run.md#hiprocm-amd-gpus) specifically discussing compilation with HIP. Make sure to check it before opening an issue.
32
+
- HIP/ROCm @ AMD GPUs: ROCm library is a headache. The documentation is even more so. We have a [dedicated section](../1-getting-started/1-compile-run.md#hiprocm-amd-gpus) specifically discussing compilation with HIP. Make sure to check it before opening an issue.
33
33
34
34
35
35
!!! faq "If the code gives an error, how do I know whether the problem is with the Entity itself or with the other libraries it depends on (e.g., `Kokkos`, `ADIOS2`, `MPI`)?"
0 commit comments