Skip to content

Commit

Permalink
Merge pull request #201 from snek5000/simul-movie-README
Browse files Browse the repository at this point in the history
docs/examples/scripts/simul_cbox_movie.py for movie in README
  • Loading branch information
paugier committed Nov 19, 2022
2 parents 1ea79f5 + c6dbac4 commit d80e56e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 77 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ sim.output.phys_fields.animate(
```

For example, this movie has been produced by a `sim.output.phys_fields.animate`
from a snek5000-cbox simulation:
call from a [snek5000-cbox]
[simulation](https://github.com/snek5000/snek5000/blob/main/docs/examples/scripts/simul_cbox_movie.py):

https://user-images.githubusercontent.com/8842662/202872147-4ea3c749-dc63-4a73-98a0-6c787edb9cd3.mp4

Expand Down
54 changes: 54 additions & 0 deletions docs/examples/scripts/simul_cbox_movie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from tuto_cbox import Simul, params

params.output.sub_directory = "examples_snek/movie"

aspect_ratio = 0.7
params.prandtl = 0.71
params.Ra_side = 4e9
nb_elements = 28
order = 10

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

params.oper.ny = ny = nb_elements
nx = params.oper.nx = int(nb_elements / aspect_ratio)

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

params.short_name_type_run = f"Ra{params.Ra_side:.3e}_{nx*order}x{ny*order}"

params.nek.general.write_interval = 0.5
params.nek.general.end_time = 100
params.nek.general.target_cfl = 1.7

params.nek.velocity.residual_tol = 1e-08
params.nek.pressure.residual_tol = 1e-06

sim = Simul(params)

sim.make.exec("run_fg", nproc=4)

print(
f"""You can run:
cd {sim.output.path_run}; snek-ipy-load
Then, from IPython:
from functools import partial
animate = partial(
sim.output.phys_fields.animate, dt_frame_in_sec=0.15, dt_equations=0.5,
tmax=100,
pcolor_kw=dict(cmap="coolwarm"),
quiver_kw=dict(scale=12),
normalize_vectors=False,
fig_kw=dict(figsize=(6, 4), dpi=70),
)
animate(interactive=True)
animate(save_file="movie.mp4")
"""
)
36 changes: 0 additions & 36 deletions docs/examples/scripts/simul_phill_short.py

This file was deleted.

40 changes: 0 additions & 40 deletions docs/examples/scripts/simul_tgv_short.py

This file was deleted.

0 comments on commit d80e56e

Please sign in to comment.