Skip to content

Commit

Permalink
Modif Kolmolaw aniso
Browse files Browse the repository at this point in the history
  • Loading branch information
agoua committed Aug 27, 2024
1 parent e7f2e4a commit 5d86a31
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doc/examples/internal_waves_coriolis/simul_idempotent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doc/examples/simul_ns3d_forced_isotropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down Expand Up @@ -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()
5 changes: 5 additions & 0 deletions fluidsim/base/output/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion fluidsim/solvers/ns3d/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 4 additions & 2 deletions fluidsim/solvers/ns3d/output/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 5d86a31

Please sign in to comment.