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")

Setup parameters

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

Deduced quantities

58 # grid int coords to [0,1]^3
59 scale_fact = 1 / (sz * base * multx)
60
61 u_1 = P_1 / ((gamma - 1) * rho_1)
62 u_2 = P_2 / ((gamma - 1) * rho_2)
63
64 print("Mach number 1 :", vslip / np.sqrt(gamma * P_1 / rho_1))
65 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

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