Discrete Space¶
The DiscreteSpace object is the basis of structured grid management in turboWAVE. While DiscreteSpace provides topology and indexing, MetricSpace adds edge lengths, wall areas, and cell volumes, which define a specific grid geometry.
There is a tight coupling between certain concepts associated with particles and the DiscreteSpace object. As a result some of the lowest level particle objects appear in this scope.
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
-
Particle(const tw::vec3 &p, const Primitive &q, const float number, const float aux1, const float aux2) noexcept¶
Constructor, parameters shadow the member variables.
-
inline void Assert(tw::Int beg, tw::Int end)¶
Assertions verifying that the primitive is minimized and in bounds.
-
Particle(const tw::vec3 &p, const Primitive &q, const float number, const float aux1, const float aux2) noexcept¶
-
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 To avoid inconsistencies arising from FP comparisons on different nodes the destination information is computed on the source domain and packaged with the particle The position is kept as a double precision global coordinate until final call to
AddParticlePublic 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.
-
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]¶
DiscreteSpace Object¶
-
struct DiscreteSpace : public Testable¶
This object is an indexing and interpolation scheme for a structured grid. Consider first the topological indices, defined as follows.
Let
axbe an axis index, numbered from 1 to 3. 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 topological indices are independent of all storage patterns, In other words, no matter what storage pattern is used, toplogical index
(i0,j0,k0)will always refer to the same cell.Storage patterns are dictated by a cell encoding. This associates the topological indices with a single integer that maps to ascending memory addresses. The default encoding is used to sort particles. Superclasses can add a secondary encoding to resolve higher dimensional storage patterns. For example,
Fieldadds another encoding to define how its components are packed.Subclassed by Field, MetricSpace, Module
Public Functions
-
DiscreteSpace()¶
Create an empty
DiscreteSpace
-
DiscreteSpace(tw::Int xDim, tw::Int yDim, tw::Int zDim, const tw::vec3 &corner, const tw::vec3 &size, tw::Int ghostCellLayers = 2)¶
Create a
DiscreteSpacewith purely local coordinates.
-
void Resize(const tw::Int dim[4], const tw::Int gdim[4], const tw::Int dom[4], const tw::vec3 &gcorner, const tw::vec3 &gsize, tw::Int ghostCellLayers = 2)¶
Change the topology and coordinates.
-
void Resize(Task &task, const tw::vec3 &gcorner, const tw::vec3 &gsize, tw::Int ghostCellLayers = 2)¶
Change the coordinates, inheriting the
Tasktopology.
-
inline void SetupTimeInfo(tw::Float dt0)¶
Change the time step. Use
Simulation::UpdateTimestepto do this for all modules.
-
inline tw::Int EncodeCell(tw::Int i, tw::Int j, tw::Int k) const¶
Encode the cell with topological indices
(i,j,k)
-
inline void DecodeCell(const tw::Int &cell, tw::Int ijk[4]) const¶
Decode
cellto produce topological indices(ijk[1],ijk[2],ijk[3]). This assumes z-packed encoding, i.e.,decodingStride[3]=1.
-
inline void DecodeCell(const tw::Int &cell, tw::Int *i, tw::Int *j, tw::Int *k) const¶
Decode
cellto produce topological indices(i,j,k). This assumes z-packed encoding, i.e.,decodingStride[3]=1.
-
inline void DecodeCell(const Primitive &q, tw::Int ijk[4]) const¶
Decode
qto produce topological indices(ijk[1],ijk[2],ijk[3]). This assumes z-packed encoding, i.e.,decodingStride[3]=1.
-
inline void DecodeCell(const Primitive &q, tw::Int *i, tw::Int *j, tw::Int *k) const¶
Decode
qto produce topological indices(i,j,k). This assumes z-packed encoding, i.e.,decodingStride[3]=1.
-
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.
Protected Attributes
-
tw::Float dt¶
timestep
-
tw::Float dth¶
half timestep
-
tw::Float dti¶
inverse timestep
-
tw::vec3 corner¶
position where all coordinates are minimized on the local domain
-
tw::vec3 size¶
length of the local domain along each axis
-
tw::vec3 globalCorner¶
position where all coordinates are minimized on the global domain
-
tw::vec3 globalSize¶
length of the global domain along each axis
-
tw::vec3 spacing¶
center-to-center cell separation along each axis (uniform grids only)
-
tw::vec3 freq¶
inverse of spacing component by component (uniform grids only)
-
tw::Int dim[4]¶
dim[1..3]are the number of cells along each axis. When aFieldis derived,dim[0]becomes the number of components.
-
tw::Int num[4]¶
numis similar todim, except ghost cells are included.
-
tw::Int encodingStride[4]¶
Parameters of the default cell encoding. For the encoding see
EncodeCell. TheencodingStrideis 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::Int decodingStride[4]¶
The
decodingStridediffers from theencodingStrideonly in that ignorable axes have unit strides. SeeDecodeCellfor the decoding.
-
tw::Int lfg[4]¶
indices of lower far ghost cells
-
tw::Int ufg[4]¶
indices of upper far ghost cells
-
tw::Int lng[4]¶
indices of lower near ghost cells
-
tw::Int ung[4]¶
indices of upper near ghost cells
-
tw::Int layers[4]¶
number of ghost cell layers,
layers[0]holds maximum layers
-
tw::Int ignorable[4]¶
1 if axis is ignorable, 0 otherwise
