scotty.beam_me_up module
Contents
scotty.beam_me_up module#
Created on Fri Jun 8 10:44:34 2018
@author: VH Hall-Chen Valerian Hongjie Hall-Chen valerian.chen@gmail.com
Run in Python 3, does not work in Python 2
Version history v1 - Renaming of variables, cleaning up
Plan#
Output everything to a file, and then do the analysis on that file.
Check that gradK_xi and such are done correctly, check that K_mag is calculated correctly when K_zeta is nonzero
Check that the calculation of Psi makes sense (and the rotation angle)
Check that K initial’s calculation makes sense
Notes
The loading of the input files was taken from integral_5 and modified.
I should launch the beam inside the last closed flux surface
K**2 = K_R**2 + K_z**2 + (K_zeta/r_R)**2, and K_zeta is constant (mode number). See 14 Sep 2018 notes.
Coordinates#
X, Y, Z- Lab Cartesian coordinatesR, zeta, Z- Lab cylindrical coordinatesx, y, g- Beam coordinatesu1, u2, u_parallel- Field-aligned coordinates
Abbreviations#
bs- backscatteredloc- localisationcum_loc- cumulative_localisationne- equilibrium electron density
Angles#
theta- angle between g and u1, small when mismatch is smalltheta_m- mismatch angle, angle between u1 and K
Units#
SI units
Distance in m
Angles in rad
electron cyclotron frequency positive
K normalised such that K = 1 in vacuum. (Not implemented yet)
Distance not normalised yet, should give it thought
Start in vacuum, otherwise Psi_3D_beam_initial_cartersian does not get done properly
- scotty.beam_me_up.beam_me_up(poloidal_launch_angle_Torbeam, toroidal_launch_angle_Torbeam, launch_freq_GHz, mode_flag, launch_beam_width, launch_beam_curvature, launch_position, vacuumLaunch_flag=True, find_B_method='torbeam', shot=None, equil_time=None, vacuum_propagation_flag=False, Psi_BC_flag=False, poloidal_flux_enter=None, delta_R=- 0.0001, delta_Z=0.0001, delta_K_R=0.1, delta_K_zeta=0.1, delta_K_Z=0.1, interp_order=5, len_tau=102, rtol=0.001, atol=1e-06, interp_smoothing=0, ne_data_path=PosixPath('.'), magnetic_data_path=PosixPath('.'), output_path=PosixPath('.'), input_filename_suffix='', output_filename_suffix='', figure_flag=True, detailed_analysis_flag=True, verbose_output_flag=True, quick_run=False, plasmaLaunch_K=array([0., 0., 0.]), plasmaLaunch_Psi_3D_lab_Cartesian=array([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]), density_fit_parameters=None, density_fit_method=None, B_T_axis=None, B_p_a=None, R_axis=None, minor_radius_a=None)#
- Initialise density fit parameters. One of:
spline with data from file
Stefanikova
O(3) polynomial
tanh
quadratic
- Initialise magnetic field method. One of:
TORBEAM
OMFIT
analytical
EFIT++
UDA
curvy slab
test/test_notime
Initialise beam launch parameters (vacuum/plasma)
Initialise event functions for IVP solver
Propagate single ray with IVP solver (?)
Handle events
Possible early exit if
quick_run(?)Propagate beam with IVP solver
Dump raw output (?)
Analysis
Dump analysis
- Parameters
find_B_method –
‘efitpp’ finds B from efitpp files directly
’torbeam’ finds B from topfile
UDA_saved
density_fit_parameters (Optional[Sequence]) –
A list of parameters to be passed to the
density_fit_methodconstructor. See the docs for the individual methods for the meaning of their parametersNote
These parameters should not include
poloidal_flux_enterdensity_fit_method (Optional[Union[str, DensityFitLike]]) –
Parameterisation of the density profile. Either a callable (see
DensityFit), or one of the following options:"smoothing-spline": 1D smoothing spline (SmoothingSplineFit)"smoothing-spline-file": 1D smoothing spline constructed from file (SmoothingSplineFit.from_dat_file)"stefanikova": combination of modified hyperbolic \(\tan\) and a Gaussian (StefanikovaFit)"poly3"or"polynomial": \(n\)-th order polynomial (PolynomialFit)"tanh": hyperbolic \(\tan\) (TanhFit)"quadratic": constrained quadratic (QuadraticFit)
If
density_fit_methodis a string, then the correspondingDensityFitobject is constructed usingpoloidal_flux_enteranddensity_fit_parameters."smoothing-spline-file"looks for a file calledne<input_filename_suffix>.datinne_data_path. It also usesinterp_orderandinterp_smoothinginstead ofdensity_fit_parameters.Deprecated since version 2.4.0: If
None(the default) is passed, the method will be guessed from the length ofdensity_fit_parameters. In this case,quadraticandtanhparameters _should_ includepoloidal_flux_enteras the last value.
- scotty.beam_me_up.make_density_fit(method, poloidal_flux_enter, parameters, filename)#
Either construct a
DensityFitinstance, or returnmethodif it’s already suitable. Suitable methods are callables that take an array of poloidal fluxes and return an array of densities.