Commit db516c77 authored by Jason Reneuve's avatar Jason Reneuve
Browse files

poloidal energy

parent d5dcd49205fa
......@@ -198,7 +198,7 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra):
vmax=None,
):
"""plot the spatiotemporal spectra, with a cylindrical average in k-space"""
keys_plot = self.keys_fields + ["Khd", "Khr"]
keys_plot = self.keys_fields + ["Khd", "Khr", "Kp"]
if key_field is None:
key_field = keys_plot[0]
if key_field not in keys_plot:
......@@ -207,7 +207,7 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra):
tmax = self.sim.params.time_stepping.t_end
key_spect = "spectrum_" + key_field
if key_spect.startswith("spectrum_Kh"):
if key_field.startswith("Kh") or key_field.startswith("Kp"):
save_urud = True
else:
save_urud = False
......@@ -227,7 +227,10 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra):
# load spectrum
with h5py.File(path_file, "r") as file:
spectrum = file[key_spect][...]
if key_spect.startswith("spectrum_Kp"):
spectrum = file["spectrum_Khd"][:] + 0.5 * file["spectrum_vz"][:]
else:
spectrum = file[key_spect][...]
if dtype == "complex64":
float_dtype = "float32"
elif dtype == "complex128":
......@@ -348,6 +351,9 @@ class SpatioTemporalSpectraNS3D(SpatioTemporalSpectra):
if vmax is None:
vmax = np.log10(spect[np.isfinite(spect)].max())
# no log(0)
spect += 1e-15
im = ax.pcolormesh(
xaxis,
yaxis,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment