Skip to content

Commit

Permalink
Workaround attribute issue with BP5
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
franzpoeschel committed Dec 15, 2022
1 parent ddde0a8 commit 25eb278
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions include/picongpu/plugins/radiation/Radiation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,13 @@ namespace picongpu
::openPMD::Series& openPMDdataFile = series.value();
::openPMD::Iteration openPMDdataFileIteration = openPMDdataFile.writeIterations()[currentStep];

/* begin required openPMD global attributes */
openPMDdataFileIteration.setDt<float_X>(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)];

Expand Down Expand Up @@ -905,15 +912,6 @@ namespace picongpu
omega_mrc.storeChunk(detectorFrequencies, offset_omega, extent_omega);
// end: write frequencies

/* begin openPMD attributes */
/* begin required openPMD global attributes */

openPMDdataFileIteration.setDt<float_X>(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();
}
Expand Down

0 comments on commit 25eb278

Please sign in to comment.