Static Space¶
The StaticSpace object is the basis of structured grid management in turboWAVE. It is the root of the space-time mesh inheritance tree.
StaticSpace- basic topology and indexing that stays constant throughout a simulationDynSpace- adds coordinates or parameters that may evolve during a simulationMetricSpace- adds metric information geared toward finite volume methods
Owing to the nature of particle-in-cell, there is a tight coupling between certain concepts associated with particles and the StaticSpace object.
Boundary Conditions¶
-
namespace bc¶
boundary conditions
Grid Axes¶
-
namespace grid¶
Types and maps for working with grid axes.
Particle Primitives¶
-
struct Primitive¶
Abstraction for location on a grid.
-
struct Particle¶
Data describing any kind of particle.
Public Functions
-
struct ParticleRef¶
Used to create sorting map within a thread for subsets of particle lists.
-
struct TransferParticle¶
Used to pack data for message passing of particles The destination information is computed on the source node and packaged with the particle. No floating point operations other than copying should be needed.
Public Members
-
tw::Int dst[4]¶
dst[0]is rank of starting domain upon construction; gets set to destination domain later.dst[1..3]are -1, 0, or 1, giving direction of movement or no movement.
-
float number¶
particles per macroparticle divided by

-
tw::Int ijk[4]¶
topological indices referenced on the source node
-
float x[4]¶
for transfers, the relative cell position can be kept without change
-
tw::vec4 p¶
for tansfers, momentum can be kept unchanged
-
tw::vec4 s¶
for transfers, polarization can be kept unchanged
-
uint64_t tag¶
for transfers, tag can be kept unchanged
-
tw::Int dst[4]¶
-
struct weights_3D¶
This holds the coefficients used to spread the particle cloud across 3x3x3 grid cells. Due to assumptions of separability this only requires storing 3x3 coefficients.
Public Members
-
tw::Float w[3][3]¶
The weights are packed in a 3x3 matrix. The first index (row) selects a cell from a 3-cell strip along a given axis, the second index (column) selects the axis, and the value is the weight factor in the cell.
-
tw::Int cell¶
Encoded representation of the cell in which the particle center resides.
-
tw::Float w[3][3]¶
StaticSpace Object¶
-
struct StaticSpace¶
This object is an indexing and interpolation scheme for a 5D structured grid. The five dimensions are spacetime plus an internal dimension such as vector components. Cells in the space are addressed as (t,x,y,z,c).
StaticSpace should only contain data that can be assumed to be static throughout a simulation. Spaces with evolving properties are reserved for derivative objects.
Consider first the topological indices, defined as follows.
Let
axbe an axis index, numbered from 0 to 3 (leave out 4). Consider a one dimensional strip of cells lined up along axisax. Suppose this axis usesLghost cell layers. Then, for any such strip,Interior cells are labeled
[1,...,dim[ax]]Lower ghost cells are labeled
[1-L,...,0]Upper ghost cells are labeled
[dim[ax]+1,...,dim[ax]+L].
The internal dimension labeled 4 is different. For the internal space ghost cells have no meaning. So this axis has elements labeled
[0,...,dim[4]-1]in all cases.The topological indices are independent of all storage patterns, In other words, no matter what storage pattern is used, toplogical index
(t0,x0,y0,z0,c0)will always refer to the same cell.Storage patterns are dictated by the
packingarray, which in turn provides a cell encoding that maps the topological indices to a memory location.Subclassed by Driver, DynSpace, Field
Public Functions
-
inline StaticSpace()¶
Create an empty
StaticSpace
-
inline StaticSpace(const tw::node5 &dim, const tw::vec4 &size, const tw::node5 &packing, const tw::node4 &ghostCellLayers)¶
Create a
StaticSpacewith purely local coordinates.
-
inline StaticSpace ax0(const tw::Int &n) const¶
Make a copy of this
StaticSpaceand change the number of time levels.
-
inline StaticSpace ax4(const tw::Int &c) const¶
Make a copy of this
StaticSpaceand change the number of components.
-
inline StaticSpace Repack(const tw::node5 &packing) const¶
Make a copy of this
StaticSpaceand change the packing.
-
void Resize(const tw::node5 &domains, const tw::node5 &gdim, const tw::vec4 &gsize, const tw::node5 &packing, const tw::node4 &ghostCellLayers)¶
Resize a
StaticSpacewith the given global parameters.
-
inline tw::Int EncodeCell(tw::Int n, tw::Int i, tw::Int j, tw::Int k) const¶
Encode cell with topological indices
(n,i,j,k,0)
-
inline void EncodeCell(tw::Int cell[tw::max_bundle_size], const tw::Int topo[4][tw::max_bundle_size]) const¶
Bundle version of
EncodeCell
-
inline void DecodeCell(const tw::Int &cell, tw::Int topo[4]) const¶
Decode
cellto produce topological indices(topo[0..4])assuming topo[4]==0.
-
inline void DecodeCell(const tw::Int cell[tw::max_bundle_size], tw::Int topo[4][tw::max_bundle_size]) const¶
Bundle version of
DecodeCell
-
inline void DecodeCell(const Primitive &q, tw::Int topo[4]) const¶
Decode
qto produce topological indices(topo[0..4]).
-
inline void MinimizePrimitive(Primitive &q) const¶
Change the reference cell to the one containing the particle centroid. This leaves x[ax] within the normal range [-.5,.5) except when the particle has left the extended domain. In the latter case the reference cell is pegged to the current extended domain, leaving x[ax] out of normal range.
-
inline void MinimizePrimitive(tw::Int cell[tw::max_bundle_size], tw::Int topo[4][tw::max_bundle_size], float x[4][tw::max_bundle_size], float domainMask[tw::max_bundle_size]) const¶
Bundle version of
MinimizePrimitive. The bundle version also sets thedomainMaskto 0 for particles out of the interior domain, 1 otherwise. Also the topological indices are loaded for further use.
Protected Attributes
-
tw::vec4 spacing¶
center-to-center cell separation along each axis (uniform grids only)
-
tw::vec4 freq¶
inverse of spacing component by component (uniform grids only)
-
tw::node5 dim¶
dim[0..5]are the number of cells along each axis. At this level we have only a static view into an empty spacetime. We will often have dim[0] = 1, i.e., the view being considered is a snapshot.
-
tw::node5 num¶
numis similar todim, except ghost cells are included.
-
tw::node5 encodingStride¶
Parameters of the cell encoding. The
encodingStrideis 0 along an ignorable axis resulting in a many-one mapping, i.e., ghost cells and the one interior cell map to the same cell for the ignorable axis.
-
tw::node5 decodingStride¶
The
decodingStridediffers from theencodingStrideonly in that ignorable axes have unit strides.
-
tw::node5 packing¶
Map of axes in order of large stride to small stride, it is not required, but very desirable, that the internal dimension always be the largest stride. In that case iterators are compatible with any Field object that shares the same spatio-temporal structure.
-
tw::node4 lfg¶
indices of lower far ghost cells, no internal axis
-
tw::node4 ufg¶
indices of upper far ghost cells, no internal axis
-
tw::node4 lng¶
indices of lower near ghost cells, no internal axis
-
tw::node4 ung¶
indices of upper near ghost cells, no internal axis
-
tw::node4 layers¶
number of ghost cell layers, no internal axis
-
tw::node5 ignorable¶
1 if axis is ignorable, 0 otherwise