cherab / core

The core source repository for the Cherab project.
https://www.cherab.info
Other
44 stars 24 forks source link

Add full profiles for Generomak plasma #373

Closed vsnever closed 1 year ago

vsnever commented 2 years ago

This PR solves #372 and contains the following changes in generomak/plasma/plasma.py:

Some outliers in the temperature profiles in hydrogen0.json and carbon0.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.

vsnever commented 2 years ago

The Raysect-0.8-compat branch should be merged into the development branch to pass the tests.

jacklovell commented 2 years ago

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.

Mateasek commented 2 years ago

Hi @vsnever,

thanks for the review, I will find some time next week to look at this.

vsnever commented 1 year ago

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.

jacklovell commented 1 year ago

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.

vsnever commented 1 year ago

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.]).