PlasmaCalcs.hookups.copapic.copapic_input_deck.CopapicInputDeck

class PlasmaCalcs.hookups.copapic.copapic_input_deck.CopapicInputDeck(params, distributions, *, filename=None, **kw_super)

Bases: DictlikeFromKeysAndGetitem

info from copapic.json file, in a class.
Use CopapicInputDeck.from_file() to create an instance from a file.
Units are “SI”.
params: dict
values of params
distributions: dict or CopapicDistList
dict of {distribution number: CopapicDist}, or an already-created CopapicDistList.
if dict, will be internally stored as CopapicDistList.from_dict(distributions), instead.
filename: str
path to copapic.json file
str will be internally stored as os.path.abspath(filename), instead.
Examples:
cpid = CopapicInputDeck.from_file(‘copapic.json’)
cpid[1] # CopapicDist for distribution 1
cpid[‘nz’] # number of grid points in z direction
cpid.params # dict of all global params
cpid.dists # CopapicDistList of all the distributions
cpid.dists.get(‘e’) # get CopapicDist with name ‘e’
cpid.dists.get(0) # get CopapicDist number 0 from this list
cpid[2][‘m’] # mass parameter for distribution 2
cpid[0][‘coll_rate’] # collision rate parameter for distribution 0
cpid.keys() # available keys
cpid.items() # available (key, value) pairs
cpid[0].keys() # available keys for distribution 0
cpid.get(‘k’, 7) # eid[‘k’] if it exists, else 7.
__init__(params, distributions, *, filename=None, **kw_super)

Methods

__init__(params, distributions, *[, filename])

from_file(filename, *[, dist_names])

get(key[, default])

get_coord(xstr)

get_dspace(xstr)

get_dspace_max()

get_dspace_min()

get_nspace(xstr)

get_space_coords()

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

is_quasineutral()

items()

keys()

maindims()

values()

Attributes

Dx

Dy

Dz

Nx

Ny

Nz

dirname

dists

output_dir

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 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.
property dirname
os.path.dirname(self.filename).
if self.filename is None, raise FileNotFoundError.
dist_type

alias of CopapicDist

property dists
alias to distributions
dlist_type

alias of CopapicDistList

classmethod from_file(filename, *, dist_names=None, **kw__init)
return CopapicInputDeck from copapic.json file.
filename: str
path to copapic.json 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.
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
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 CopapicNeutral

nlist_type

alias of CopapicNeutralList

property output_dir
return directory where output files are stored.
values()
return tuple of values corresponding to self.keys().