Bug in `BasisProjectionOperator` when NOT using compiled kernels
Bug description / feature request:
There is a bug in basis projection operator when not using compiled kernels but rather pure python. This is an out of bounds
error when updating the coefficients.
To reproduce the bug :
Change last lines of test_toy_models.py
to only test VariationalPressurelessFluid
:
if __name__ == '__main__':
test_toy(('Cuboid', 'HomogenSlab'), True, model='VariationalPressurelessFluid')
#test_toy(('HollowTorus', 'AdhocTorus'), True, model=None)
#test_toy(('Tokamak', 'EQDSKequilibrium'), True, model=None)
delete all the kernels (struphy compile --language=python
)
go to the folder and run python3 test_toy_models.py
You should have the a similar error message :
Traceback (most recent call last):
File "/home/vcarlier/struphy/src/struphy/models/tests/test_toy_models.py", line 37, in <module>
test_toy(('Cuboid', 'HomogenSlab'), True, model='VariationalPressurelessFluid')
File "/home/vcarlier/struphy/src/struphy/models/tests/test_toy_models.py", line 33, in test_toy
call_model(model, val, map_and_equil, Tend=Tend)
File "/home/vcarlier/struphy/src/struphy/models/tests/util.py", line 107, in call_model
main(key, parameters, path_out)
File "/home/vcarlier/struphy/src/struphy/main.py", line 135, in main
model.integrate(time_params['dt'], time_params['split_algo'])
File "/home/vcarlier/struphy/src/struphy/models/base.py", line 369, in integrate
propagator(dt)
File "/home/vcarlier/struphy/src/struphy/propagators/propagators_fields.py", line 2595, in __call__
self._update_all_weights()
File "/home/vcarlier/struphy/src/struphy/propagators/propagators_fields.py", line 2733, in _update_all_weights
self.PiuT.update_weights([[uf_values[0], uf_values[1], uf_values[2]]])
File "/home/vcarlier/struphy/src/struphy/feec/basis_projection_ops.py", line 965, in update_weights
self._dof_mat = self._assemble_mat()
File "/home/vcarlier/struphy/src/struphy/feec/basis_projection_ops.py", line 1073, in _assemble_mat
kernel(dofs_mat._data, _starts_in, _ends_in, _pads_in, _starts_out, _ends_out,
File "/home/vcarlier/struphy/src/struphy/feec/basis_projection_kernels.py", line 556, in assemble_dofs_for_weighted_basisfuns_3d
mat[po1 + i, po2 + j, po3 + k,
IndexError: index -8 is out of bounds for axis 4 with size 7
Expected behavior:
Not bugging and giving the right matrix
Proposed solution:
We should check how column indices are computed in the periodic case