diff --git a/examples/wave/wave-eager-mpi.py b/examples/wave/wave-eager-mpi.py index fc09cbd5f2718c39449fdfbaf4deaef6bbadc8ae..a6ca4381c9c84345d5d7eec64e470c43e05a20e1 100644 --- a/examples/wave/wave-eager-mpi.py +++ b/examples/wave/wave-eager-mpi.py @@ -180,8 +180,6 @@ def main(): def rhs(t, w): return wave_operator(discr, c=1, w=w) - rank = comm.Get_rank() - t = 0 t_final = 3 istep = 0 @@ -190,7 +188,9 @@ def main(): if istep % 10 == 0: print(istep, t, discr.norm(fields[0])) - vis.write_vtk_file("fld-wave-eager-mpi-%03d-%04d.vtu" % (rank, istep), + vis.write_parallel_vtk_file( + comm, + f"fld-wave-eager-mpi-{{rank:03d}}-{istep:04d}.vtu", [ ("u", fields[0]), ("v", fields[1:]), diff --git a/examples/wave/wave-min-mpi.py b/examples/wave/wave-min-mpi.py index bca2610199ed1cf50ae0c178d28caf1579730e3c..95bcab7034cc1adc6a3feb30f700aa49d804ae55 100644 --- a/examples/wave/wave-min-mpi.py +++ b/examples/wave/wave-min-mpi.py @@ -124,8 +124,6 @@ def main(write_output=True, order=4): from time import time t_last_step = time() - rank = comm.Get_rank() - for event in dt_stepper.run(t_end=final_t): if isinstance(event, dt_stepper.StateComputed): assert event.component_id == "w" @@ -135,11 +133,9 @@ def main(write_output=True, order=4): print(step, event.t, norm(u=event.state_component[0]), time()-t_last_step) if step % 10 == 0: - vis.write_vtk_file( - "fld-wave-min-mpi-%03d-%04d.vtu" % ( - rank, - step, - ), + vis.write_parallel_vtk_file( + comm, + f"fld-wave-min-mpi-{{rank:03d}}-{step:04d}.vtu", [ ("u", event.state_component[0]), ("v", event.state_component[1:]),