beam-tracing / Scotty

Beam tracing code for diagnostics
https://scotty.readthedocs.io/en/latest/
GNU General Public License v3.0
7 stars 4 forks source link

Implementation of Temperature Fit for relativistic corrections #102

Closed fongkenrui closed 1 year ago

fongkenrui commented 1 year ago

I was assigned to implement relativistic corrections for electron mass, which only affects cyclotron freq and plasma freq, and flows to the rest of the code via the DielectricTensor class. Current plan for implementation is as follows:

  1. Create a new module temp_fit that is structured similarly to density_fit (with the corresponding fit and spline interpolation methods) and returns the fitted function.
  2. Define a function in fun_general that takes in an optional temperature array and returns an array of corrected electron masses; if no temperature is provided returns standard electron mass as a scalar.
  3. Introduce a temp_data path, and make_temp_fit function in beam_me_up that works similarly to its density counterpart. Furthermore, introduce a relativistic flag as a parameter for the main function. If True, then the temp_fit module is called to create a find_temp_1D function, else None is assigned and passed to the Hamiltonian class as an optional argument.
  4. The Hamiltonian class checks and generates the temperature array and passes it optionally to the DielectricTensor instance. The DielectricTensor class calls the electron mass function and sends the output to the modified gyro freq and plasma freq functions.

Would appreciate any suggestions on how this might be better implemented.

ZedThree commented 1 year ago

That sounds sensible to me at least, although I would definitely use temperature rather than temp in names. temp_data_path reads too much like "path for temporary data" to me!

If you want to use exactly the same functional forms as the density_fit forms, we might think about how to reuse the code, for example we could rename density_fit to profile_fit. Then you could skip the first step, and make_temperature_fit and make_density_fit can make use of the existing code.

valerian-chen commented 1 year ago

This has been resolved as of the relativistic Scotty commit.