From 587829721a6410b14de073e656cf0abb033960ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Thu, 15 Dec 2022 11:11:09 +0100 Subject: [PATCH] Workaround attribute issue with BP5 The Radiation plugin sets some attributes quite late. This is normally supported by the openPMD-api, but can become a bit tricky, when the attribute is a default attribute with a default value. The Radiation plugin uncovers a bug in (depending on your point of view) either openPMD-api or in ADIOS2 with this procedure in the BP5 engine. Realistically the best fix for this would be to set defaults in the openPMD-api as late as possible, and not as early as possible. For now, defining these attributes as early as possible in the Radiation plugin is a sensible workaround. --- include/picongpu/plugins/radiation/Radiation.hpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/include/picongpu/plugins/radiation/Radiation.hpp b/include/picongpu/plugins/radiation/Radiation.hpp index 966cba0e8db..34e0f39dcde 100644 --- a/include/picongpu/plugins/radiation/Radiation.hpp +++ b/include/picongpu/plugins/radiation/Radiation.hpp @@ -744,6 +744,13 @@ namespace picongpu ::openPMD::Series& openPMDdataFile = series.value(); ::openPMD::Iteration openPMDdataFileIteration = openPMDdataFile.writeIterations()[currentStep]; + /* begin required openPMD global attributes */ + openPMDdataFileIteration.setDt(DELTA_T); + const float_X time = float_X(currentStep) * DELTA_T; + openPMDdataFileIteration.setTime(time); + openPMDdataFileIteration.setTimeUnitSI(UNIT_TIME); + /* end required openPMD global attributes */ + // begin: write amplitude data ::openPMD::Mesh mesh_amp = openPMDdataFileIteration.meshes[dataLabels(-1)]; @@ -909,15 +916,6 @@ namespace picongpu omega_mrc.storeChunk(detectorFrequencies, offset_omega, extent_omega); // end: write frequencies - /* begin openPMD attributes */ - /* begin required openPMD global attributes */ - - openPMDdataFileIteration.setDt(DELTA_T); - const float_X time = float_X(currentStep) * DELTA_T; - openPMDdataFileIteration.setTime(time); - openPMDdataFileIteration.setTimeUnitSI(UNIT_TIME); - /* end required openPMD global attributes */ - openPMDdataFileIteration.close(); openPMDdataFile.flush(); }