Metric Space

The MetricSpace object inherits from DynSpace, adding edge lengths, wall areas, and cell volumes, which define a specific grid geometry. Curvilinear grids are largely handled by forumating a finite volume equation that works for any coordinate system given these metrics.

MetricSpace Object

struct MetricSpace : public DynSpace

Public Functions

void Resize(Task *task, const tw::node5 &gdim, const tw::vec4 &gcorner, const tw::vec4 &gsize, const tw::node5 &packing, const tw::node4 &ghostCellLayers, tw::grid::geometry geo = tw::grid::cartesian)

Fully initialize object, may involve message passing. If there are warps they should be attached before calling. The task passed as the first argument must itself be initialized. The gsize should be the size of the hull assuming uniform spacing. It will be adjusted automatically to account for warps.

void AttachWarp(std::shared_ptr<warp_base> w)

Argument will typically point to a ComputeTool. Do not update refCount since ultimately the Simulation object, which is derived from this object, owns the tool.

inline tw::Int kdelta(const tw::Int &ax1, const tw::Int &ax2) const

3x3 Kronecker delta function

inline tw::Float X(const tw::Int &i, const tw::Int &ax) const

position at cell center in parameter space, except time nodes that are at cell walls

inline tw::Float dX(const tw::Int &i, const tw::Int &ax) const

cell size in parameter space (not an arc length)

inline tw::Float &X(const tw::Int &i, const tw::Int &ax)

position at cell center in parameter space, except time nodes that are at cell walls

inline tw::Float &dX(const tw::Int &i, const tw::Int &ax)

cell size in parameter space (not an arc length)

inline tw::vec4 Pos4(const tw::Int &n, const tw::Int &i, const tw::Int &j, const tw::Int &k) const

space nodes are at cell centers, time node is at cell wall

inline tw::Float dS(const tw::Int &i, const tw::Int &j, const tw::Int &k, const tw::Int &ax) const

returns wall area for ax = axis normal to wall. ax = 0 returns cell volume.

inline tw::Float dl(const tw::Int &i, const tw::Int &j, const tw::Int &k, const tw::Int &ax) const

returns arc length from cell center to cell center, along axis=ax, from low side

inline tw::Float dSh(const tw::Int &i, const tw::Int &j, const tw::Int &k, const tw::Int &ax) const

returns midplane area for ax = axis normal to area. ax = 0 returns cell volume.

inline tw::Float dlh(const tw::Int &i, const tw::Int &j, const tw::Int &k, const tw::Int &ax) const

returns arc length from cell wall to cell wall, along axis=ax, along low side edge

inline tw::Float dL(const tw::Int &i, const tw::Int &j, const tw::Int &k, const tw::Int &ax) const

returns arc length between 2 cell centers adjacent to this cell center, along axis=ax

Public Members

tw::UnitConverter unitConverter

z-dependent factor for any arc