Skip to content

Grid Parameters

GridParameters holds the discretisation of the simulation domain: the number of grid points along each axis, the grid spacing dx, the number of boundary (halo) cells, the interface width (in grid points), and — in MPI builds — the cartesian decomposition layout. Users do not construct GridParameters directly; it is read as part of the @GridParameters block owned by Settings, and all consumer modules reach its state through Settings.Grid.

Key Classes and Concepts

  • GridParameters: member of Settings. Fields include Nx, Ny, Nz, dx, Bcells, iWidth, Resolution, and — with MPI — the cartesian-grid sizes.

Usage

Input

Defined in the @GridParameters block of the input file. Appears in every OpenPhase .opi input.

text
@GridParameters

$Nx               System size in X (grid points)      : 128
$Ny               System size in Y (grid points)      : 128
$Nz               System size in Z (grid points)      : 1

$dx               Grid spacing (physical length)      : 1.0e-6
$Bcells           Number of boundary (halo) cells     : 1
$IWidth           Interface width (grid points)       : 5.0
$Resolution       Grid resolution mode                : SINGLE

# MPI-only (optional; ignored in serial builds) {#mpi-only-optional-ignored-in-serial-builds}
$MPI3D            Use 3D cartesian domain decomposition : No
$Ncx              Processes along X                   : 1
$Ncy              Processes along Y                   : 1
$Ncz              Processes along Z                   : 1
TokenVariableTypeDefault
$Nx / $Ny / $NzNx / Ny / Nzint
$dxdxdouble
$BcellsBcellsint1
$IWidth / $InterfaceWidthiWidthdouble
$ResolutionResolutionstringSINGLE
$MPI3DMPI_3D_DECOMPOSITIONboolfalse
$Ncx / $Ncy / $NczMPI_CART_SIZE[0..2]int1

Output

GridParameters does not write output files. Downstream VTK and raw output embeds the grid metadata automatically through the VTK pipeline.

Example

GridParameters is always read through Settings:

cpp
Settings OPSettings;
OPSettings.ReadInput(InputFile);   // also reads @GridParameters

// OPSettings.Grid.Nx, OPSettings.Grid.dx, OPSettings.Grid.iWidth, …

Dependencies

  • Settings — owner of the block.
  • BoundaryConditions — uses the grid dimensions when wrapping halo cells.
  • Every storage-backed module (PhaseField, Composition, Temperature, …) allocates according to GridParameters.

Released under the GNU GPLv3 License.