Kelvin-Helmholtz instability in RAMSES solver#

 8 import os
 9
10 import matplotlib
11 import matplotlib.animation as animation
12 import matplotlib.pyplot as plt
13 import numpy as np
14
15 import shamrock
16
17 # If we use the shamrock executable to run this script instead of the python interpreter,
18 # we should not initialize the system as the shamrock executable needs to handle specific MPI logic
19 if not shamrock.sys.is_initialized():
20     shamrock.change_loglevel(1)
21     shamrock.sys.init("0:0")
-> modified loglevel to 0 enabled log types :
log status :
 - Loglevel: 1, enabled log types :
[xxx] Info: xxx ( logger::info )
[xxx] : xxx ( logger::normal )
[xxx] Warning: xxx ( logger::warn )
[xxx] Error: xxx ( logger::err )

Use shamrock documentation style for matplotlib

26 shamrock.matplotlib.set_shamrock_mpl_style()

Setup parameters

31 # plot
32 nx, ny = 512, 512
33
34 # Physical parameters
35 vslip = 1  # slip speed between the two layers
36
37 rho_1 = 1
38 fact = 2 / 3
39 rho_2 = rho_1 / (fact**3)
40
41 y_interface = 0.5
42 xs = 1
43
44 P_1 = 3.5
45 P_2 = 3.5
46
47 gamma = 5.0 / 3.0
48
49 # resolution
50 multx = 1
51 multy = 1
52 multz = 1
53
54 sz = 1 << 1
55 base = 32
56
57 sim_folder = "_to_trash/ramses_kh/"

Deduced quantities

62 # grid int coords to [0,1]^3
63 scale_fact = 1 / (sz * base * multx)
64
65 u_1 = P_1 / ((gamma - 1) * rho_1)
66 u_2 = P_2 / ((gamma - 1) * rho_2)
67
68 print("Mach number 1 :", vslip / np.sqrt(gamma * P_1 / rho_1))
69 print("Mach number 2 :", vslip / np.sqrt(gamma * P_2 / rho_2))
Mach number 1 : 0.4140393356054125
Mach number 2 : 0.760638829255665

Create the dump directory if it does not exist

74 if shamrock.sys.world_rank() == 0:
75     os.makedirs(sim_folder, exist_ok=True)