Skip to content

Refactor Kinetic Params

Dominik Bell requested to merge refactor-kinetic-params into devel

Solves the following issue(s):

Closes #259 (closed)

Core changes:

Initialization of distribution function in the params.yml file is now done using the keywords background and perturbation for each particles species. A minimal example reads

    background:
        type: Maxwellian6D

which will initialize a uniform 6D Maxwellian. More parameters can be changed as was common before, e.g. via

    background:
        type: Maxwellian6D
        pforms: ['vol', '0']
        Maxwellian6D:
            n  : 2.
            u1 : 0.1
            u2 : 0.1
            u3 : 0.2
            vth1 : 0.5
            vth2 : 0.5
            vth3 : 1.5

To add a perturbation, simply add the specification using the perturbation keyword below. In order to initialize a uniform 6D Maxwellian with a cosine perturbation in the density function, simply do:

    background:
        type: Maxwellian6D
    perturbation:
        type: ModesCos
        ModesCos:
            comps:
                n: '0'
            ls:
                n: [3]
            amps:
                n: [0.001]

which will give a cosine with 3 mode numbers and an amplitude of 0.001 added to n_0=1 (from the uniform background Maxwellian). All functions that were possible in the fluid and em_fields initialization (can be found under struphy.initial.perturbations) are available here.

struphy.diagnostics.console_diagn.py now grabs the default values if they are not provided in the parameters.yml file which is created during simulation. This is done by the following two additions:

  • struphy.pic.base now has the method default_bckgr_params which is an abstractmethod and classmethod. This should indicate at least the default type of background function.
  • struphy.kinetic_background.maxwellians.Maxwellian6D now has the classmethod default_bckgr_params which gives the default parameters for the background (a uniform and isotropic Maxwellian). This should also be implemented for the other functions in that file (and later on other background functions).

Also formats some files.

Model-specific changes:

Small adaptation to the new conventions listed above.

Documentation changes:

Update sections/subsections/parameters to include new conventions for initializing particles.

Edited by Dominik Bell

Merge request reports