denisbertini / mpi-sdf2opmd

SDF to openPMD compliant format via openpmd-api interface
GNU General Public License v3.0
7 stars 0 forks source link

Wrong grid "properties" and units of field #8

Open jhornung-gh opened 11 months ago

jhornung-gh commented 11 months ago

It seems like there is a bug with the properties of the fields like e_x, e_y, e_z, which don't match the expected values, specifically the grid_global_offset, grid_spacing, grid_unit_SI and unit_dimension. Same occurs for scalar fields such as the density, etc.

Here is an example of the electric field (Currently e_x which should be changed to E with the corresponding dimension according to issue #7):

Converted properties:

grid_global_offset: [0.0] (depending on the dimension [x_offset, y_offset, z_offset])
grid_spacing: [1.0] (depending on the dimension [dx, dy, dz])
grid_unit_SI: 1.0
unit_dimension: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Expected properties (rounded):
grid_global_offset: [-10000]
grid_spacing: [5.0]
grid_unit_SI: 1.0e-9
unit_dimension: [1.0, 1.0, -3.0, -1.0, 0.0, 0.0, 0.0]

However, I have to admit that I am not sure how the grid_unit_SI is determined since this can also have an "odd" number like 8.5164e-9.

denisbertini commented 11 months ago

i understood the expected value properties besides of :

jhornung-gh commented 11 months ago

basically -10000 nanometers (unit SI conversion), e.g. -10 µm offset of the first pixel. My simulation box starts at x= -10 µm.

denisbertini commented 11 months ago

But are you sure that this is what is meant by global offset ?

jhornung-gh commented 11 months ago

not 100%, but there is no other property which corresponds to the grid offset, or is there any?

Maybe I missed something here, I will have another look at it.

denisbertini commented 11 months ago

No idea for now, one will have to look carefully at ALL the attributes that goes to the converted files and eventually add those which are missing ... this is a work in progress as you see ...

jhornung-gh commented 11 months ago

One issue from my side: The grid_unit_SI has to be 1.0 since EPOCH already handles everything in SI units and the corresponding grid_spacing should then be 5e-9. This only has to differ from 1.0 if non-SI units are used. Regarding the grid_global_offset I am still not sure but I don't see any other attribute defining where the x- and y-axis starts.

denisbertini commented 11 months ago

i will look at the definition of these attribute more in details, i have to confess that i did not really check these up to now

denisbertini commented 11 months ago

This should be now solved with the commit 0ea8b0672bf0b17a4998f27ffe9428688eb82c82