ITADN

DiagPlotfile OpenPMD path ignores field_names filter

#1969OpenBenWibking 创建于 2026-06-20
bug: wrong answer/failure/crashI/Ocode-audit
B
BenWibkingcommented
# DiagPlotfile OpenPMD path ignores `field_names` filter **Severity:** Medium **File:** `src/io/DiagPlotfile.H:127` **Function:** `DiagPlotfile::processDiag` ## Explanation When `m_varNames` (the `field_names` filter) is non-empty, the code builds `varnames_out` and `mf_cc_filtered`/`mf_cc_out_ptr` containing only the selected fields (lines 100-123). The non-OpenPMD path (line 136) correctly uses `varnames_out` and `mf_cc_out_ptr`. But the `#ifdef QUOKKA_USE_OPENPMD` branch (line 127) calls `quokka::OpenPMDOutput::WriteFile` with the **unfiltered** `varnames` and `mf_cc_ptr`: ```cpp #ifdef QUOKKA_USE_OPENPMD // Write using OpenPMD format quokka::OpenPMDOutput::WriteFile(varnames, finest_level + 1, mf_cc_ptr, geoms, m_diagfile, a_time, sim->istep[0]); #else ... amrex::WriteMultiLevelPlotfile(plotfilename, finest_level + 1, mf_cc_out_ptr, varnames_out, geoms, a_time, sim->istep, refRatio); ``` So the user's `field_names` selection is silently ignored and all fields are written when OpenPMD is enabled. ## Proposed patch ```cpp quokka::OpenPMDOutput::WriteFile(varnames_out, finest_level + 1, mf_cc_out_ptr, geoms, m_diagfile, a_time, sim->istep[0]); ```
0 条评论