cherab / core

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

Utility to create a plasma with species populations in thermal equilibrium #104

Open mattngc opened 5 years ago

mattngc commented 5 years ago

Now that we will imminently have fractional abundance calculations available (https://github.com/cherab/openadas/issues/16), it would be good to have a utility function that can create a plasma in thermal equilibrium. By this, we mean that each charge state has an abundance defined by the balance of ionisation, recombination and charge exchange at that temperature. Perhaps the electron species could serve as the master species from which the others are calculated.

Mateasek commented 5 years ago

To get this issue evolving I added a set of functions doing some basic calculations with steady-state ionization balance.

An initial example is here

The function match_bulk_ion_density does more or less what @mattngc proposed. It calculates density of bulk plasma element ion stages following plasma neutrality by matching it to provided densities of impurities and ne and Te.

The function from_element_density calculates density of ion charge state based on input ne, Te and ni

from_stage_density calculates density of ion charge states based on a in input of ne, te and density of a single charge state.

Next step could be to add functions using interpolators and equilibrium to generate plasma species. At the end there could be functions generating plasma species from 1D or 2D profiles of densities and information about ne and Te.

Mateasek commented 5 years ago

To update this a bit, the basic set of function calculating ionization balance for 0D, 1D, 2D profiles is now done. Also functions connecting it to equilibrium and map3d function. i will now add functions using equilibrium.map2d and then I will add functions taking equilibrium, plasma object and ion/ion charge temperature, density and rotation and returning plasma species which can be added to plasma.

Also I have a question, is it favorable to do examples in ipyhton notebook or pure python? From my experience ipython nothebooks can make nice tutorials because they allow markdown and text cells which can provide nice explanations. However, I understand if cherab wants to be in python scripts only.