Skip to content

Commit

Permalink
Merge pull request #199 from snek5000/doc/tuto_cbox
Browse files Browse the repository at this point in the history
Improve tuto cbox
  • Loading branch information
paugier committed Nov 15, 2022
2 parents 5b04211 + 384fd75 commit dc1ce52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 6 additions & 7 deletions docs/examples/scripts/tuto_cbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
params.prandtl = 0.71

# The onset of oscillatory flow for aspect ratio 1.0 is at Ra_c = 1.825e8
params.Ra_side = 1.86e8
params.Ra_side = 1.94e8

params.output.sub_directory = "examples_snek/tuto"

Expand All @@ -17,11 +17,9 @@
nb_elements = ny = 8
params.oper.ny = nb_elements
nx = params.oper.nx = int(nb_elements / aspect_ratio)
params.oper.nz = int(nb_elements / aspect_ratio)

Ly = params.oper.Ly
Lx = params.oper.Lx = Ly / aspect_ratio
Lz = params.oper.Lz = Ly / aspect_ratio

order = params.oper.elem.order = params.oper.elem.order_out = 8

Expand Down Expand Up @@ -49,7 +47,7 @@
params.nek.velocity.residual_tol = 1e-08
params.nek.pressure.residual_tol = 1e-05

params.nek.general.end_time = 800
params.nek.general.end_time = 600
params.nek.general.stop_at = "endTime"
params.nek.general.target_cfl = 2.0
params.nek.general.time_stepper = "BDF3"
Expand All @@ -58,7 +56,8 @@
params.nek.general.write_control = "runTime"
params.nek.general.write_interval = 50

params.output.history_points.write_interval = 30
params.output.history_points.write_interval = 10

sim = Simul(params)
sim.make.exec("run_fg", nproc=2)
if __name__ == "__main__":
sim = Simul(params)
sim.make.exec("run_fg", nproc=2)
9 changes: 6 additions & 3 deletions docs/tuto_cbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ or just one history point:

```{code-cell} ipython3
sim.output.history_points.plot_1point(
index_point=0, key='temperature', tmin=600, tmax=800
index_point=0, key='temperature', tmin=400, tmax=800
);
```

Expand All @@ -119,11 +119,14 @@ from scipy import stats
from scipy.signal import argrelmax
coords, df = sim.output.history_points.load()
```

```{code-cell} ipython3
df_point = df[df.index_points == 12]
time = df_point["time"].to_numpy()
ux = df_point["ux"].to_numpy()
indx = np.where(time > 700)[0][0]
indx = np.where(time > 450)[0][0]
time = time[indx:]
ux = ux[indx:]
signal = ux
Expand All @@ -137,7 +140,7 @@ slope, intercept, r_value, p_value, std_err = stats.linregress(
)
growth_rate = slope
print(f"the growth rate is {growth_rate:.2f}")
print(f"The growth rate is {growth_rate:.2e}")
```

There is also the possibility to load to whole field file in
Expand Down

0 comments on commit dc1ce52

Please sign in to comment.