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
> If using Jupyter notebook, you can quickly preview the loaded metadata by simply running a cell with just `data` in it (or in regular python, by doing `print(data)`).
31
+
30
32
#### Examples
31
33
32
34
Plot a field (in cartesian space) at a specific time (or output step):
@@ -96,7 +98,42 @@ def plot(t, data):
96
98
data.makeMovie(plot)
97
99
```
98
100
99
-
> If using Jupyter notebook, you can quickly preview the loaded metadata by simply running a cell with just `data` in it (or in regular python, by doing `print(data)`).
101
+
You may also access the movie-making functionality directly in case you want to use it for other things:
102
+
103
+
```python
104
+
import nt2.export as nt2e
105
+
106
+
defplot(t):
107
+
...
108
+
109
+
# this will be the array of `t`-s passed to `plot`
If the simulation also outputs the ghost cells, `nt2py` will interpret the fields differently, and instead of reading the physical coordinates, will build the coordinates based on the number of cells (including ghost cells). In particular, instead of, e.g., `data.fields.x` it will contain `data.fields.i1`. The data will also contain information about the meshblock decomposition. For instance, if you have `Nx` meshblocks in the `x` direction, each having `nx` cells, the coordinates `data.fields.i1` will go from `0` to `nx * NX + 2 * NGHOSTS * Nx`.
126
+
127
+
You can overplot both the coordinate grid as well as the active zones of the meshblocks using the following:
128
+
129
+
```python
130
+
ax = plt.gca()
131
+
data.fields.Ex.isel(t=ti).plot(ax=ax)
132
+
data.plotGrid(ax=ax)
133
+
data.plotDomains(ax=ax)
134
+
```
135
+
136
+
> Keep in mind, that by default `Entity` converts all quantities to tetrad basis (or contravariant in GR) and interpolates to cell centers before outputting (except for the ghost cells). So when doing plots for debugging, make sure to also set `as_is = true` (together with `ghosts = true`) in the `[output.debug]` section of the `toml` input file. This will ensure the fields are being output as is, with no conversion or interpolation. This does not apply to particle moments, which are never stored in the code and are computed only during the output.
100
137
101
138
### Dashboard
102
139
@@ -119,4 +156,7 @@ This will output the port where the dashboard server is running, e.g., `Dashboar
0 commit comments