From 5938579516961b5e31a4930d5269c60034d95c33 Mon Sep 17 00:00:00 2001 From: nmannall Date: Tue, 2 Jul 2024 15:08:41 +0100 Subject: [PATCH] Fix receivers not always output in the same order This happened when receivers were recombined on rank 0 when using MPI. Need to ensure consistancy in the regression tests when comparing serial and MPI implementations. --- gprMax/fields_outputs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gprMax/fields_outputs.py b/gprMax/fields_outputs.py index 58bd5c84..f4c69613 100644 --- a/gprMax/fields_outputs.py +++ b/gprMax/fields_outputs.py @@ -136,6 +136,10 @@ def write_hd5_data(basegrp, grid, is_subgrid=False): basegrp["tls/tl" + str(tlindex + 1) + "/Vtotal"] = tl.Vtotal basegrp["tls/tl" + str(tlindex + 1) + "/Itotal"] = tl.Itotal + # Ensure the order of receivers is always consistent (Needed for + # consistancy when using MPI with multiple receivers) + grid.rxs.sort(key=lambda rx: rx.ID) + # Create group, add positional data and write field component arrays for receivers for rxindex, rx in enumerate(grid.rxs): grp = basegrp.create_group("rxs/rx" + str(rxindex + 1))