15
15
from tests .diagnostic import dump_all_diags
16
16
17
17
timestep = 0.001
18
- first_mpi_size = 4
18
+ time_step_nbr = 1
19
+ first_mpi_size = 1
19
20
ppc = 100
20
21
cells = 200
21
22
first_out = "phare_outputs/reinit/first"
22
23
secnd_out = "phare_outputs/reinit/secnd"
23
- timestamps = np .array ([timestep * 4 ])
24
+ timestamps = [0 ] # np.array([timestep * 2, timestep * 4])
25
+ restart_idx = Z = 0
24
26
simInitArgs = dict (
25
- largest_patch_size = 100 ,
26
- time_step_nbr = 5 ,
27
+ # largest_patch_size=100,
28
+ time_step_nbr = time_step_nbr ,
27
29
time_step = timestep ,
28
30
cells = cells ,
29
31
dl = 0.3 ,
30
- init_options = dict (dir = f"{ first_out } /00000.00400 " , mpi_size = first_mpi_size ),
32
+ init_options = dict (dir = f"{ first_out } /00000.00 { Z } 00 " , mpi_size = first_mpi_size ),
31
33
diag_options = dict (format = "phareh5" , options = dict (dir = secnd_out , mode = "overwrite" )),
32
34
)
33
35
@@ -38,7 +40,7 @@ def setup_model(sim):
38
40
alpha = {"mass" : 4.0 , "charge" : 1 , "nbr_part_per_cell" : ppc },
39
41
)
40
42
ph .ElectronModel (closure = "isothermal" , Te = 0.12 )
41
- dump_all_diags (model .populations , timestamps )
43
+ dump_all_diags (model .populations , timestamps = timestamps )
42
44
return model
43
45
44
46
@@ -68,7 +70,7 @@ def test_reinit(self):
68
70
phut .assert_fp_any_all_close (a , b )
69
71
70
72
def get_merged (hier ):
71
- return single_patch_per_level_per_pop_from (datahier0 )
73
+ return single_patch_per_level_per_pop_from (hier )
72
74
73
75
ds = [get_merged (datahier0 ), get_merged (datahier1 )]
74
76
for key in ["alpha" , "protons" ]:
@@ -78,6 +80,7 @@ def get_merged(hier):
78
80
79
81
80
82
def run_first_sim ():
83
+ """uses params from tests_restarts.py"""
81
84
simput = copy .deepcopy (test_restarts .simArgs )
82
85
simput ["restart_options" ]["dir" ] = first_out
83
86
simput ["restart_options" ]["timestamps" ] = timestamps
@@ -88,6 +91,7 @@ def run_first_sim():
88
91
89
92
90
93
def launch ():
94
+ """Launch secondary process to run first simulation to avoid initalizing MPI now"""
91
95
cmd = f"mpirun -n { first_mpi_size } python3 -O tests/simulator/test_init_from_restart.py lol"
92
96
proc = subprocess .run (cmd .split (" " ), check = True , capture_output = True )
93
97
return (proc .stdout + proc .stderr ).decode ().strip ()
0 commit comments