7. Grid file

If you are using the GUI, grid file is written when the ‘Write Grid’ button is pressed.

7.1. Scalar parameters

Grid size and topology

nx

Number of radial grid points in the global grid, including boundary cells.

ny

Number of poloidal grid points in the global grid, not including boundary cells.

y_boundary_guards

Number of poloidal boundary cells included in the grid at each divertor target.

ixseps1, ixseps2

Radial grid indices of the separatrices. These give the index of the first grid point radially outside the separatrix. A single null grid has ixseps2 = nx. A connected double null grid has ixseps1 = ixseps2. For a disconnected double null, the primary X-point is the lower one if ixseps1 < ixseps2, or the upper one if ixseps2 < ixseps1.

jyseps1_1, jyseps2_1, jyseps1_2, jyseps2_2

Poloidal grid indices of the X-points. These give the index of the last grid point poloidally before the poloidal position of the X-point is reached. For single null grids jyseps2_1 = jyseps1_2.

ny_inner

For double null grids, gives the number of poloidal grid points before the upper target is reached, not including boundary cells.

Equilibrium parameters

Other options

7.2. 1D arrays

Poloidal coordinates

BoutMesh writes three poloidal coordinates to the grid file:

Note

These coordinates are defined/created in BoutMesh because they require a global mesh, which is not required in Mesh where everything is defined only in terms of MeshRegions.

y-coord

Increments by dy between points and starts from zero at the beginning of the global grid. y includes boundary cells and is single-valued (at a given radial position) everywhere on the global grid. y has branch cuts adjacent to both X-points in the core, and adjacent to the X-point in the PFRs.

theta

Increments by dy between points and goes from 0 to 2pi in the core region. The lower inner divertor leg has negative values. The lower outer divertor leg has values >2pi. The upper inner leg (if it exists) has values increasing continuously from those in the inner SOL (these will overlap values in the outer core region). The outer upper leg (if it exists) has values continuous with those in the outer SOL (these will overlap values in the inner core region).

chi

Is a straight-field line poloidal coordinate proportional to the toroidal angle (i.e. to zShift). It goes from 0 to 2pi in the core, and is undefined on open field lines.

1D integral quantities

total_poloidal_distance

The total poloidal distance around a closed flux surface in the core. Not calculated on open flux surfaces.

ShiftAngle

The total toroidal angular displacement when following a field line one full poloidal turn around a closed flux surface. Not calculated on open flux surfaces.

7.3. 2D arrays

All 2D arrays are saved at the cell centre position, named with no suffix, e.g. Rxy. For use with staggered grid codes, they are also saved at the ‘lower’ cell face locations, with suffix _xlow, e.g. Rxy_xlow for the \(x\)-direction cell faces and with suffix _ylow, e.g. Rxy_ylow, for the \(y\)-direction cell faces.

Spatial positions

Rxy

Major radius.

Zxy

Height.

Rxy_corners, Zxy_corners

Major radius and height of the lower-left corner of each grid cell. Not needed by BOUT++, but may be useful for post-processing.

Rxy_lower_right_corners, Zxy_lower_right_corners, Rxy_upper_right_corners, Zxy_upper_right_corners, Rxy_upper_left_corners, Zxy_upper_left_corners

Major radius and height of the other three corners of each grid cell. Mostly redundant information with Rxy_corners and Zxy_corners, but may make handling branch cuts and upper/outer boundaries more convenient. Not needed by BOUT++, but may be useful for post-processing.

Grid spacings

dx

Coordinate spacing in the radial \(x\) direction.

dy

Coordinate spacing in the poloidal \(y\) direction.

Magnetic field quantities

psixy

Poloidal magnetic flux function, which is the poloidal magnetic flux divided by \(2\pi\).

Brxy, Bzxy

Components of the magnetic field in the major-radial and vertical directions.

Bpxy, Btxy

Components of the magnetic field in the poloidal and toroidal directions.

Bxy

Total magnetic field.

Integral quantities

poloidal_distance

Poloidal distance (in metres) from the lower divertor target of each flux surface to the grid point (on open field lines), or from the poloidal location of the lower X-point (on closed field lines).

zShift

Toroidal displacement of a field line followed from some reference position to the poloidal location of the grid point.

ShiftTorsion

\(d^2\zeta/dxdy\), where \(zeta\) is the toroidal angle. Only used in BOUT++ for the Curl() operator, which is rarely used. Note the calculation of this quantity has not been checked carefully, and should be verified if it is ever needed.

Metric coefficients

Jacobian

J

The Jacobian of the locally field aligned BOUT++ coordinate system.

Curvature

curl_bOverB_x, curl_bOverB_y, curl_bOverB_z

Contravariant components (despite the slightly misleading variable names) of \(\nabla\times(\mathbf{b}/B)\), i.e. \(\nabla\times(\mathbf{b}/B)^x\), \(\nabla\times(\mathbf{b}/B)^y\), and \(\nabla\times(\mathbf{b}/B)^z\).

bxcvx, bxcvy, bxcvz

Contravariant components of the vector \(\frac{B}{2}\nabla\times\left(\frac{\mathbf{b}}{B}\right)\). Other forms (e.g. \(\mathbf{b}\times\mathbf{\kappa}\)) could be implemented, for different settings of curvature_type, but have not been implemented yet.

Equilibrium plama parameters

pressure

Pressure profile read from the geqdsk input file (if there was one).

7.4. Provenance tracking

See Provenance tracking.