openPMD / openPMD-standard

:notebook: Open Standard for Particle-Mesh Data
http://www.openPMD.org
Creative Commons Attribution 4.0 International
78 stars 27 forks source link

Best practice wrt sharing `Mesh` across variables #286

Open pgrete opened 5 months ago

pgrete commented 5 months ago

What's the best practice/recommendation wrt to storing variables that share the same Mesh? Creating one mesh per variable is duplicating information -- especially thinking about deep mesh refinement hierarchies.

This question came up as my (naive) approach was to one mesh record (for each level) and then define record components for the individual variables (like density, energy, pressure, ..., and potentially velocity -- knowing that I'd loose the coordinate property). I made that choice following my understanding of the standard using it as a tensor (by not specifying x, y, z components) but the standard is now that verbose about tensors or non-coordinate vectors. This resulted in problems because openpmd-viewer would only allow for x, y, z as available_coord and not handle other components (which now brought this question up whether I'm not properly following the standard).

In order to obtain a "clean" hierarchy, it'd be nice if the Mesh information could be easily shared across record components so that I'd have to create only one mesh (per level) and then assign variable (components) as components and ideally provide additional metadata, e.g., that record components foo, bar, baz correspond to coordinate components of a compound variable.