grids.mac

This macro file can be imported to an input file with

$ import grids

It is imported at the top of all simulation runs.

This macro file is available to all packages.

This macro file defines the variable for the grids. The grid is written at time of finalize.

Public Macros

setGridData(nDim, coordSystem)

Set the grid variables,

VPM_BGN0: The start of the grid in the first coordinate,

VPM_BGN1: The start of the grid in the second coordinate,

VPM_BGN2: The start of the grid in the third coordinate,

VPM_L0: The extent of the grid in the first coordinate,

VPM_L1: The extent of the grid in the second coordinate,

VPM_L2: The extent of the grid in the third coordinate,

VPM_N0: The number of cells in the first direction,

VPM_N1: The number of cells in the second direction,

VPM_N2: The number of cells in the third direction,

VPM_PERIODIC_DIRS: An array listing the coordinate directions in which one has periodic boundary conditions,

then calls setGridData(4 args) to set the coordinate-system dependent variables.

Parameters
  • nDim – The dimensionality of the simulation.

  • coordSystem – The coordinate system. One of “UniformCartesian” or “Cylindrical”.

setGridData(nDim, coordSystem, numCells, lengths, startPositions)

Sets the coordinate-system dependent grid variables, VPM_NDIM and VPM_GRID_TYPE, and sets the periodic directions.

For UniformCartesian, computes and sets: VPM_NX, VPM_NY, VPM_NZ, VPM_LX, VPM_LY, VPM_LZ, VPM_BGNX, VPM_BGNY, VPM_BGNZ, VPM_ENDX, VPM_ENDY, VPM_ENDZ, VPM_DX, VPM_DY, VPM_DZ, VPM_NXP1, VPM_NYP1, VPM_NZP1, VPM_NXM1, VPM_NYM1, VPM_NZM1, VPM_DXI, VPM_DYI, VPM_DZI, VPM_DL, VPM_DLI, depending on the dimensionality.

For Cylindrical, computes and sets: VPM_NZ, VPM_NR, VPM_NPHI, VPM_LZ, VPM_LR, VPM_LPHI, VPM_BGNZ, VPM_BGNR, VPM_BGNPHI, VPM_ENDZ, VPM_ENDR, VPM_ENDPHI, VPM_DZ, VPM_DR, VPM_DPHI, VPM_NZP1, VPM_NRP1, VPM_NPHIP1, VPM_NZM1, VPM_NRM1, VPM_NPHIM1, VPM_DZI, VPM_DRI, VPM_DPHII, VPM_DL, VPM_DLI, depending on the dimensionality.

Parameters
  • nDim – The dimensionality of the simulation.

  • coordSystem – The coordinate system. One of “UniformCartesian” or “Cylindrical”.

  • numCells – An integer array of length nDim indicating the number of cells in each direction.

  • lengths – A real-valued array of length nDim indicating the lengths of the simulation domain in each direction.

  • startPositions – A real-valued array of length nDim indicating the start position of each direction. I.e. the coordinate of the node with indices [0,0,0].