Drift kinetic model#228
Conversation
…entation of the base_units system, and added the possibility to modulate the alpha parameter in the toy_drift model method __init__
…lation, modification of the calculation of the growth rate
…rd loading parameter
…mdata directory instead of the general one (params_diocotron.py)
…into drift_kinetic_model
spossann
left a comment
There was a problem hiding this comment.
Looks good! I have some minor comments.
|
|
||
| # fields background | ||
| BackgroundTypes = Literal["LogicalConst", "FluidEquilibrium"] | ||
| DimensionToPlot = Literal["e1", "e2", "e3", "v1", "v2", "v3"] |
There was a problem hiding this comment.
This should maybe be called KineticDimensionsToPlot
| if axe_to_plot - 3 > self.vdim: | ||
| AssertionError("Coordinate " + dim_1 + " does not exist with this background") | ||
| linspace_space = xp.array([0.0]) | ||
| integrate_linspace_vel = xp.linspace(0.0, v_lim, integrate_resol) |
There was a problem hiding this comment.
Is this ok here that the velocity space starts at 0? I would expect xp.linspace(-v_lim, v_lim, integrate_resol), but then this will not work for a mu-coordinate.
| if axe_to_plot < 3: | ||
| plot_linspace = xp.linspace(0.0, 1.0, resol) | ||
| else: | ||
| plot_linspace = xp.linspace(0.0, v_lim, resol) |
There was a problem hiding this comment.
same here, use negative velocities?
| etas = xp.meshgrid(*tabs, indexing="ij") | ||
| total_density = self(*etas) | ||
| if use_mu and axe_to_plot == 4: | ||
| B_tab = equil.b_xyz(etas[0], etas[1], etas[2]) |
There was a problem hiding this comment.
There is also equil.absB0 for the absolute value as a 0-form (regular function).
There was a problem hiding this comment.
The equilibrium here does not always provide a domain, which is mandatory to call equil.absB0 (as it calls internally b_cart).
| for i in range(3): | ||
| tabs[i][0] = logical_coord[i] | ||
| tabs[axe_to_plot] = plot_linspace | ||
| etas = xp.meshgrid(*tabs, indexing="ij") |
There was a problem hiding this comment.
Maybe there should be an upper bound on integrate_resol, otherwise the memory could blow up with meshgrid.
There was a problem hiding this comment.
Please remove the output from all cells!
|
And: don't forget |
| # Testing with GyroMaxwellian2D: | ||
| equil = equils.HomogenSlab(B0x=0.0, B0y=0.0, B0z=1.0) | ||
| background = maxwellians.GyroMaxwellian2D(n=(n_init, None), vth_para=(vth, None), vth_perp=(vth, None), equil=equil) | ||
| background.plot_density_profile("e1") |
There was a problem hiding this comment.
Here I would expect to see the cosine from n_init, but I don't. Maybe sg went wrong with the np.max operation?
Co-authored-by: Stefan Possanner <stefan.possanner@ipp.mpg.de>
Co-authored-by: Stefan Possanner <stefan.possanner@ipp.mpg.de>
Co-authored-by: Stefan Possanner <stefan.possanner@ipp.mpg.de>
Addition of a plotting method for the KineticBackground objects. Possibility to plot a 1D or 2D projection of the phase space background.
Initialization of the example/drift_kinetic_model directory and of the parameter and pproc files.