cherab / solps

Other
6 stars 5 forks source link

Invert index order of SOLPS data arrays or make all arrays as column-major #37

Closed vsnever closed 3 years ago

vsnever commented 4 years ago

The current index order of SOLPS data arrays: (poloidal, radial, species) make sense only for column-major arrays (Fortran-style or F-style), because the species slice is needed more often than the radial slice and the radial slice is needed more often than the poloidal slice.

In the raw simulation files, the arrays are stored in column-major order, and load_b2f_file() and read_block44() return F-style arrays. But on the MDS server they are stored in row-major order (C-style) and with inverse indexing. When reading from MDS, the index order is inverted but the order is not changed from C-style to F-style.

Thus, to improve the performance we should either change the order from C-style to F-style when reading from MDS and also make sure that all arrays created for operation with the SOLPS data arrays are F-style, or to make all arrays C-style and invert the indexing: (species, radial, poloidal). I like the second option better because C-style arrays are default in numpy.

CnlPepper commented 4 years ago

I would convert everything to row major, i.e. C-style. Unless a mistake has been made everything should be row major in raysect and cherab.

vsnever commented 3 years ago

Fixed in #35.