Closed vsnever closed 1 year ago
The Raysect-0.8-compat
branch should be merged into the development
branch to pass the tests.
Thanks for this Vlad. I'm a bit snowed under at the moment, but will take a look at this (and also merging raysect-0.8 into development) when I get time in a couple of weeks.
Hi @vsnever,
thanks for the review, I will find some time next week to look at this.
With the last commit, I fixed the plasma neutrality issue for core profiles. The charge state distributions are now calculated using the ionisation balance tools. Also, manual adjustment of the LCFS values is no longer required, the core profiles match the profiles in the edge plasma quite well. However, the core profiles now depend on the atomic data that we have no control over. I think, this is not a big issue, because almost all Cherab demos use atomic data anyway.
However, the core profiles now depend on the atomic data that we have no control over. I think, this is not a big issue, because almost all Cherab demos use atomic data anyway.
You could avoid this by pre-computing the profiles using ionisation balance but then storing the computed values rather than computing them at instantiation time. The data then effectively depends on the atomic data at generation time but end users don't need to have it available when using Generomak.
You could avoid this by pre-computing the profiles using ionisation balance but then storing the computed values rather than computing them at instantiation time. The data then effectively depends on the atomic data at generation time but end users don't need to have it available when using Generomak.
I added json files with precalculated core profiles as well as two functions to handle them: load_core_profiles()
and get_core_interpolators()
. All other functions and demo scripts now use get_core_interpolators()
instead of get_core_profiles_description()
by default.
The density profiles are very sharp functions near Ψnorm=1, so to take this into account I changed how Ψnorm is sampled for ionisation balance solver:
psin_1d = np.append(1. - np.geomspace(1.e-4, 1, 1023)[::-1], [1.])
.
In json files Ψnorm is sampled in the same way:
psin_norm = np.append(1. - np.geomspace(1.e-4, 1, 255)[::-1], [1.])
.
This PR solves #372 and contains the following changes in
generomak/plasma/plasma.py
:get_full_profiles()
, which blends core and edge profiles to form the full 2D profiles using the linear mask function, F(ψnorm), as a modulator.get_plasma()
, which creates Generomak plasma from specified equilibrium and distributions. By default this function returns the plasma built from the full plasma profiles.get_core_plasma()
andget_edge_plasma()
as both functions now call the newget_plasma()
function.distributions
argument fromget_core_plasma()
, because for non-default distributions the generalget_plasma()
function can be used directly.get_core_profiles_description()
to better match the edge profiles.get_core_profiles_description()
. @Mateasek, could you please check if this fix is correct?get_edge_distributions()
toget_2d_distributions()
and adds an optionalprofiles_2d
argument, since this function can now be used with both edge and full 2D profiles. By default, the function returns distributions built with edge profiles.get_2d_distributions()
to match the structure of the dictionary returned byget_core_distributions()
. Since both dictionaries now have the same structure, they can be used with theget_plasma()
function.Some outliers in the temperature profiles in
hydrogen0.json
andcarbon0.json
are replaced with reasonable values.Two demos are added, both plotting the core, edge and blended Generomak 2D plasma profiles. The first demo uses the interpolators directly, while the second one samples the profiles from the
Plasma
objects.