diff --git a/doc/examples/internal_waves_coriolis/simul_idempotent.py b/doc/examples/internal_waves_coriolis/simul_idempotent.py index 8d48202c8..1ebe9dd8a 100644 --- a/doc/examples/internal_waves_coriolis/simul_idempotent.py +++ b/doc/examples/internal_waves_coriolis/simul_idempotent.py @@ -112,7 +112,7 @@ where $C$ is a constant of order 1. """ - n = 2 + n = 4 C = 1.0 dx = lx / nx U = amplitude * omega_f diff --git a/doc/examples/simul_ns3d_forced_isotropic.py b/doc/examples/simul_ns3d_forced_isotropic.py index 8ff4b4cf1..da541c2f0 100644 --- a/doc/examples/simul_ns3d_forced_isotropic.py +++ b/doc/examples/simul_ns3d_forced_isotropic.py @@ -14,7 +14,7 @@ help="Number of grid points in the x direction.", ) parser.add_argument( - "--t_end", type=float, default=8.0, help="End time of the simulation" + "--t_end", type=float, default=80.0, help="End time of the simulation" ) parser.add_argument( "--order", @@ -34,7 +34,7 @@ params = Simul.create_default_params() -params.output.sub_directory = "examples" +params.output.sub_directory = "examples/test_iso3d" ny = nz = nx Lx = 3 @@ -77,8 +77,8 @@ params.output.periods_save.spatial_means = 0.1 params.output.periods_save.spectra = 0.1 params.output.periods_save.spect_energy_budg = 0.1 +params.output.periods_save.kolmo_law = 0.1 params.output.spectra.kzkh_periodicity = 1 - sim = Simul(params) sim.time_stepping.start() diff --git a/fluidsim/base/output/spectra.py b/fluidsim/base/output/spectra.py index ab1bc9447..6687caca3 100644 --- a/fluidsim/base/output/spectra.py +++ b/fluidsim/base/output/spectra.py @@ -165,6 +165,7 @@ def _plot_ndim( coef_compensate=0, coef_plot_k3=None, coef_plot_k53=None, + coef_plot_k43=None, coef_plot_k2=None, xlim=None, ylim=None, @@ -261,6 +262,10 @@ def _plot_ndim( to_plot = coef_plot_k2 * ks_no0 ** (-2) * coef_norm ax.plot(ks, to_plot, "k:", label=r"$\propto k^{-2}$") + if coef_plot_k43 is not None: + to_plot = coef_plot_k43 * ks_no0 ** (-4.0/3) * coef_norm + ax.plot(ks, to_plot, "k:", label=r"$\propto k^{-4/3}$") + if xlim is not None: ax.set_xlim(xlim) diff --git a/fluidsim/solvers/ns3d/output/__init__.py b/fluidsim/solvers/ns3d/output/__init__.py index 460bc576e..8c1a92645 100644 --- a/fluidsim/solvers/ns3d/output/__init__.py +++ b/fluidsim/solvers/ns3d/output/__init__.py @@ -96,7 +96,7 @@ def _complete_info_solver(info_solver): "module_name": "fluidsim.base.output.kolmo_law3d", "class_name": "KolmoLaw", }, - ) + ) @staticmethod def _complete_params_with_default(params, info_solver): diff --git a/fluidsim/solvers/ns3d/output/spectra.py b/fluidsim/solvers/ns3d/output/spectra.py index 6b864a9ab..fa5d20155 100644 --- a/fluidsim/solvers/ns3d/output/spectra.py +++ b/fluidsim/solvers/ns3d/output/spectra.py @@ -267,8 +267,8 @@ def _plot_times( to_plot = coef_plot_k53 * ks_no0 ** (-5.0 / 3) * coef_norm ax.plot(ks[1:], to_plot[1:], "k-.") - if coef_plot_k2 is not None: - to_plot = coef_plot_k2 * ks_no0 ** (-2) * coef_norm + if coef_plot_k1 is not None: + to_plot = coef_plot_k1 * ks_no0 ** (-2) * coef_norm ax.plot(ks[1:], to_plot[1:], "k--") if xlim is not None: @@ -287,6 +287,7 @@ def plot1d( coef_plot_k3=None, coef_plot_k53=None, coef_plot_k2=None, + coef_plot_k43 = None, xlim=None, ylim=None, directions=None, @@ -302,6 +303,7 @@ def plot1d( coef_plot_k3=coef_plot_k3, coef_plot_k53=coef_plot_k53, coef_plot_k2=coef_plot_k2, + coef_plot_k43=coef_plot_k43, xlim=xlim, ylim=ylim, ndim=1,