core icon indicating copy to clipboard operation
core copied to clipboard

Add the N-D laplacian operator to admt_utils and rename the module

Open jacklovell opened this issue 6 years ago • 0 comments

Currently, cherab.tools.inversions.admt_utils.generate_derivative_operators provides a simple way to produce first and second partial derivative operators for a 2D rectilinear grid. These operators are used in the calculation of the ADMT regularisation operator.

At the same time, in multiple machine packages we have almost identical code which calculates the laplacian operator for a grid:

  • https://github.com/cherab/mastu/blob/master/examples/bolometry/grid_generation/make_sxdl_rectilinear_grid.py (and core grids)
  • https://github.com/cherab/jet/blob/master/demos/diagnostic/kl11/grid_generation.py
  • https://github.com/cherab/aug/blob/master/cherab/aug/bolometry/grid_construction/make_grid_laplacian.py

...and probably more.

I think it makes sense to consolidate this calculation of the laplacian operator in cherab-core, and then users can just call the calculation with their own grid. This should be as simple as adding another operator to generate_derivative_operators and returning it in the dictionary.

With this change, the module is no longer ADMT-specific: it contains a set of tools used to derive regularisation operators for 2D grids. So it should perhaps be renamed from admt_utils to regularisation or similar.

jacklovell avatar Dec 12 '19 17:12 jacklovell