|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 |
|
| 3 | +import numpy as np |
3 | 4 | from pathlib import Path
|
| 5 | +import matplotlib as mpl |
4 | 6 |
|
5 | 7 | import pyphare.pharein as ph
|
| 8 | +from pyphare.cpp import cpp_lib |
6 | 9 | from pyphare.simulator.simulator import Simulator, startMPI
|
7 | 10 | from pyphare.pharesee.run import Run
|
8 |
| - |
9 |
| -import numpy as np |
10 |
| - |
11 |
| -import matplotlib as mpl |
12 |
| - |
13 |
| -mpl.use("Agg") |
14 |
| - |
15 |
| -from pyphare.cpp import cpp_lib |
16 | 11 | from tests.simulator import SimulatorTest
|
17 | 12 |
|
| 13 | +mpl.use("Agg") |
18 | 14 |
|
19 | 15 | cpp = cpp_lib()
|
20 | 16 | startMPI()
|
21 | 17 |
|
22 | 18 | time_step = 0.005
|
23 |
| -final_time = 0.1 |
| 19 | +final_time = 0.05 |
24 | 20 | time_step_nbr = int(final_time / time_step)
|
25 | 21 | timestamps = np.arange(0, final_time + 0.01, 0.05)
|
26 | 22 | diag_dir = "phare_outputs/test_run"
|
@@ -224,15 +220,25 @@ def test_run(self):
|
224 | 220 | sim = config()
|
225 | 221 | self.register_diag_dir_for_cleanup(diag_dir)
|
226 | 222 | Simulator(sim).run().reset()
|
| 223 | + |
| 224 | + run = Run(diag_dir) |
| 225 | + B = run.GetB(timestamps[-1], all_primal=False) |
| 226 | + self.assertTrue(B.levels()[0].patches[0].attrs) |
| 227 | + |
| 228 | + B = run.GetB(timestamps[-1]) |
| 229 | + self.assertTrue(B.levels()[0].patches[0].attrs) |
| 230 | + |
227 | 231 | if cpp.mpi_rank() == 0:
|
228 | 232 | plot(diag_dir)
|
229 | 233 |
|
230 | 234 | for time in timestamps:
|
231 | 235 | for q in ["divb", "Ranks", "N", "jz"]:
|
232 | 236 | assert_file_exists_with_size_at_least(plot_file_for_qty(q, time))
|
233 |
| - |
| 237 | + |
234 | 238 | for c in ["x", "y", "z"]:
|
235 |
| - assert_file_exists_with_size_at_least(plot_file_for_qty(f"b{c}", time)) |
| 239 | + assert_file_exists_with_size_at_least( |
| 240 | + plot_file_for_qty(f"b{c}", time) |
| 241 | + ) |
236 | 242 |
|
237 | 243 | cpp.mpi_barrier()
|
238 | 244 |
|
|
0 commit comments