EppicInputDeck

class PlasmaCalcs.hookups.eppic.eppic_input_deck.EppicInputDeck(params, distributions, *, filename=None, **kw_super)

Bases: DictlikeFromKeysAndGetitem

info from eppic.i file, in a class.

Use EppicInputDeck.from_file() to create an instance from a file.
units are “raw”. Numerical values equal those from the eppic.i file.
params: dict
values of params
distributions: dict or EppicDistList
dict of {distribution number: EppicDist}, or an already-created EppicDistList.
if dict, will be internally stored as EppicDistList.from_dict(distributions), instead.
filename: None or str
path to eppic.i file this came from. E.g. ‘path/to/eppic.i’
str will be internally stored as os.path.abspath(filename), instead.
Examples:
eid = EppicInputDeck.from_file(‘eppic.i’)
eid[1] # EppicDist for distribution 1
eid[‘nz’] # number of grid points in z direction
eid.params # dict of all global params
eid.dists # EppicDistList of all the distributions
eid.dists.get(‘e’) # get EppicDist with name ‘e’
eid.dists.get(0) # get EppicDist number 0 from this list
eid[2][‘m’] # mass parameter for distribution 2
eid[0][‘coll_rate’] # collision rate parameter for distribution 0
eid.keys() # available keys
eid.items() # available (key, value) pairs
eid[0].keys() # available keys for distribution 0
eid.get(‘k’, 7) # eid[‘k’] if it exists, else 7.

Methods

__getitem__(key)

return self.params[key] if key in self.params, else self.dists[key].

__iter__()

raises TypeError; use .keys(), .values(), or .items() instead.

from_file([filename, dist_names])

return EppicInputDeck from eppic.i file.

get(key[, default])

return self[key].

get_coord(xstr)

get coordinate array [raw units] for this dimension.

get_dspace(xstr)

get d{x} [raw units] between output cells.

get_dspace_max()

return max of self.Dx, self.Dy, self.Dz.

get_dspace_min()

return min of self.Dx, self.Dy, self.Dz.

get_nspace(xstr)

get number of cells in {x} dimension, accounting for nout_avg and nsubdomains.

get_space_coords()

return dict of {x: xcoord array} for x in self.maindims(), a subset of ('x', 'y', 'z').

get_units_manager(*[, u_l, u_t, u_n, ne_si])

return UnitsManagerPIC for this input deck.

get_velocity_nspace(xstr, N)

get number of cells in {vx} dimension.

is_quasineutral()

return whether this input deck is in quasineutral mode.

items()

return tuple of (key, value) pairs corresponding to self.keys() and self.values().

keys()

return tuple of keys to access self.dists or self.params

maindims()

returns tuple of main dimensions in this input deck.

registry_params()

returns flat dict of all input params relevant to registry for calculator with this input deck.

values()

return tuple of values corresponding to self.keys().

_get_nspace_simple(xstr)

get "simple" number of cells in {x} dimension.

_get_velocity_extents(xstr, N)

get (p{vx}min{N}, p{vx}max{N}) [raw units].

_get_velocity_nspace_simple(xstr, N)

get "simple" number of cells in {vx} dimension.

_init_neutral_fluid()

sets self.neutral and self.neutrals based on params of self.

Attributes

Dx

dx between adjacent output cells [raw units]

Dy

dy between adjacent output cells [raw units]

Dz

dz between adjacent output cells [raw units]

Nvx

list of actual total numbers of grid cells in the vx dimension (ordered by distribution).

Nvy

list of actual total numbers of grid cells in the vy dimension (ordered by distribution).

Nvz

list of actual total numbers of grid cells in the vz dimension (ordered by distribution).

Nx

actual total number of grid cells in the x dimension.

Ny

actual total number of grid cells in the y dimension.

Nz

actual total number of grid cells in the z dimension.

dirname

os.path.dirname(self.filename).

dists

alias to distributions

property Dx

dx between adjacent output cells [raw units]

property Dy

dy between adjacent output cells [raw units]

property Dz

dz between adjacent output cells [raw units]

property Nvx

list of actual total numbers of grid cells in the vx dimension (ordered by distribution).

property Nvy

list of actual total numbers of grid cells in the vy dimension (ordered by distribution).

property Nvz

list of actual total numbers of grid cells in the vz dimension (ordered by distribution).

property Nx

actual total number of grid cells in the x dimension.

property Ny

actual total number of grid cells in the y dimension.

property Nz

actual total number of grid cells in the z dimension.

__getitem__(key)

return self.params[key] if key in self.params, else self.dists[key].

__iter__()

raises TypeError; use .keys(), .values(), or .items() instead.

_get_nspace_simple(xstr)

get “simple” number of cells in {x} dimension. == n{x} // nout_avg

xstr should be ‘x’, ‘y’, or ‘z’.
Note that for x=’x’, actual number of cells may be affected by nsubdomains.
See also: self._get_nspace.
_get_velocity_extents(xstr, N)

get (p{vx}min{N}, p{vx}max{N}) [raw units].

N is the distribution number.
See also: Dvx, Dvy, Dvz.
_get_velocity_nspace_simple(xstr, N)

get “simple” number of cells in {vx} dimension. == pn{vx}{N}

xstr should be ‘vx’, ‘vy’, or ‘vz’.
N is the distribution number.
Note that for x=’x’, actual number of cells may be affected by nsubdomains.
See also: self.get_nspace.
_init_neutral_fluid()

sets self.neutral and self.neutrals based on params of self.

Particularly, uses params[‘m_neutral’].
property dirname

os.path.dirname(self.filename).

if self.filename is None, raise FileNotFoundError.
dist_type

alias of EppicDist

property dists

alias to distributions

dlist_type

alias of EppicDistList

classmethod from_file(filename='eppic.i', *, dist_names=None, **kw__init)

return EppicInputDeck from eppic.i file.

filename: str
path to eppic.i file.
abspath(filename) will be saved to result, for easier bookkeeping.
dist_names: None or dict
{N: name for distribution N} for any number of distributions in filename.
None –> infer from file.
get(key, default=UNSET)

return self[key]. if default is provided and self[key] doesn’t exist, return default.

get_coord(xstr)

get coordinate array [raw units] for this dimension.

xstr: str
dimension name. ‘x’, ‘y’, or ‘z’.
get_dspace(xstr)

get d{x} [raw units] between output cells.

accounts for nout_avg; see also: Dx, Dy, Dz.
if {x} not provided in self (e.g. 2D in x & y, xstr=’z’), returns 1 * nout_avg.
get_dspace_max()

return max of self.Dx, self.Dy, self.Dz.

get_dspace_min()

return min of self.Dx, self.Dy, self.Dz.

get_nspace(xstr)

get number of cells in {x} dimension, accounting for nout_avg and nsubdomains.

See also: Nx, Ny, Nz.
get_space_coords()

return dict of {x: xcoord array} for x in self.maindims(), a subset of (‘x’, ‘y’, ‘z’).

get_units_manager(*, u_l=None, u_t=None, u_n=None, ne_si=None, **kw_u_from_pic)

return UnitsManagerPIC for this input deck. Assumes distribution 0 is electrons.

Must provide u_l, u_t, u_n, or ne_si.
Will read ne, qe, me, and eps0 from the input deck, unless they are provided in kw_u_from_pic.
See help(UnitsManagerPIC.pic_ambiguous_unit) for details.
get_velocity_nspace(xstr, N)

get number of cells in {vx} dimension.

N is the distribution number.
See also: Nvx, Nvy, Nvz.
is_quasineutral()

return whether this input deck is in quasineutral mode.

as a proxy, guessing quasineutral iff any dist.is_hybrid() for dist in self.dists.
items()

return tuple of (key, value) pairs corresponding to self.keys() and self.values().

keys()

return tuple of keys to access self.dists or self.params

maindims()

returns tuple of main dimensions in this input deck.

inferred from self[‘nx’], ‘ny’, ‘nz’, and ‘ndim_space’
neutral_type

alias of EppicNeutral

nlist_type

alias of EppicNeutralList

registry_params()

returns flat dict of all input params relevant to registry for calculator with this input deck.

includes all values from self.params.

Also all values from self.dists,
though, values from self.dists have N appended, e.g. ‘md’ becomes ‘md1’,
similarly to eppic.i file (but not necessarily exactly the same as original file;
eppic itself has some tolerance for params without N appended, but here always has N.
values()

return tuple of values corresponding to self.keys().