# writeGrid

Write grid and PML properties to a k-Wave HDF5 file.

## Syntax

    writeGrid(filename, grid_size, grid_spacing, pml_size, pml_alpha, Nt, dt, c_ref)

## Description

`writeGrid` creates and writes the wavenumber grids and PML variables required by the k-Wave C++ code to the HDF5 file specified by the user.

List of parameters that are written:

- `Nx`
- `Nx`
- `Ny`
- `Nz`
- `Nt`
- `dt`
- `dx`
- `dy`
- `dz`
- `c_ref`
- `ddx_k_shift_pos_r`
- `ddx_k_shift_neg_r`
- `ddy_k_shift_pos`
- `ddy_k_shift_neg`
- `ddz_k_shift_pos`
- `ddz_k_shift_neg`
- `x_shift_neg_r`
- `y_shift_neg_r`
- `z_shift_neg_r`
- `pml_x_sgx`
- `pml_y_sgy`
- `pml_z_sgz`
- `pml_x`
- `pml_y`
- `pml_z`
- `pml_x_alpha`
- `pml_y_alpha`
- `pml_z_alpha`
- `pml_x_size`
- `pml_y_size`
- `pml_z_size`

## Inputs

`filename` | name of HDF5 file to write matrix to
`grid_size` | `[Nx, Ny, Nz]`
`grid_spacing` | `[dx, dy, dz]`
`pml_size` | `[pml_x_size, pml_y_size, pml_z_size]`
`pml_alpha` | `[pml_x_alpha, pml_y_alpha, pml_z_alpha]`
`Nt` | number of time points
`dt` | time step
`c_ref` | scalar sound speed used in the k-space operator and to define the pml variables

## See Also

`h5write`, `writeAttributes`, `writeFlags`, `writeMatrix`