pencil.read.pvarfile
Classes
ParticleData -- holds Pencil Code PVAR file data. |
Functions
|
pvar(pvarfile='', datadir='data', proc=-1, ipvar=-1, quiet=True, |
Module Contents
- pencil.read.pvarfile.pvar(*args, **kwargs)
- pvar(pvarfile=’’, datadir=’data’, proc=-1, ipvar=-1, quiet=True,
ID=False, pflist=None, sim=None, precision=’f’, dtype=np.float64)
Read PVAR files from Pencil Code. If proc < 0, then load all data and assemble, otherwise load VAR file from specified processor.
The file format written by output() (and used, e.g. in pvar.dat) consists of the followinig Fortran records: 1. [npar] 2. indices(npar) 3. pdata(npvar, npar) Here npvar denotes the number of slots, i.e. 1 for one scalar field, 3 for one vector field, 6 for pvar.dat in the case of npar particles with 3 coordinates and 3 velocity components.
- Parameters:
pvarfile (string) – Name of the VAR file. If not specified, use var.dat (which is the latest snapshot of the fields)
datadir (string) – Directory where the data is stored.
proc (int) – Processor to be read. If -1 read all and assemble to one array.
ipvar (int) – Index of the VAR file, if var_file is not specified.
quiet (bool) – Flag for switching off output.
ID (bool) – Flag for including the particle IDs in the object.
pflist (bool) – If present list of exclusive basic pfarrays to include
sim (pencil code simulation object) – Contains information about the local simulation.
precision (string) – Float ‘f’, double ‘d’ or half ‘half’.
lpersist (bool) – Read the persistent variables if they exist
- Returns:
Instance of the pencil.read.var.DataCube class. All of the computed fields are imported as class members.
- Return type:
Examples
Read the latest var.dat file and print the shape of the uu array: >>> pvar = pc.read.pvar() >>> print(pvar.px.shape)
Read the PVAR2 file, and include only the x coordinates and velocity e.g., for instance to reduce memory load for large arrays. >>> pvar = pc.read.pvar(pvar_file=’PVAR2’, pflist=[‘px’,’pvx’]) >>> print(pvar.pvx.shape)
- class pencil.read.pvarfile.ParticleData
Bases:
objectParticleData – holds Pencil Code PVAR file data.
Fill members with default values.
- keys()
- read(pvarfile='', datadir='data', proc=-1, proclist=None, ipvar=-1, quiet=True, pflist=None, ID=False, sim=None, precision='f', dtype=np.float64)
- pvar(pvar_file=’’, datadir=’data’, proc=-1, ipvar=-1, quiet=True,
pflist=None, sim=None, precision=’f’, dtype=np.float64)
Read PVAR files from Pencil Code. If proc < 0, then load all data and assemble, otherwise load VAR file from specified processor.
The file format written by output() (and used, e.g. in pvar.dat) consists of the followinig Fortran records: 1. [npar] 2. indices(npar) 3. pdata(npvar, npar) Here npvar denotes the number of slots, i.e. 1 for one scalar field, 3 for one vector field, 6 for pvar.dat in the case of npar particles with 3 coordinates and 3 velocity components.
- Parameters:
pvarfile (string) – Name of the VAR file. If not specified, use var.dat (which is the latest snapshot of the fields)
datadir (string) – Directory where the data is stored.
proc (int) – Processor to be read. If -1 read all and assemble to one array.
ipvar (int) – Index of the VAR file, if var_file is not specified.
quiet (bool) – Flag for switching off output.
ID (bool) – Flag for including the particle IDs in the object.
pflist (bool) – If present list of exclusive basic pfarrays to include
sim (pencil code simulation object) – Contains information about the local simulation.
precision (string) – Float ‘f’, double ‘d’ or half ‘half’.
lpersist (bool) – Read the persistent variables if they exist
- Returns:
Instance of the pencil.read.var.DataCube class. All of the computed fields are imported as class members.
- Return type:
Examples
Read the latest var.dat file and print the shape of the uu array: >>> pvar = pc.read.pvar() >>> print(pvar.px.shape)
Read the PVAR2 file, and include only the x coordinates and velocity e.g., for instance to reduce memory load for large arrays. >>> pvar = pc.read.pvar(pvar_file=’PVAR2’, pflist=[‘px’,’pvx’]) >>> print(pvar.pvx.shape)