Cell metrics for all blocks at once, with the grid index last, exactly like block_grid_t holds the solution. One instance covers every block a rank can own (1:max_blocks), so the arrays are allocated once at startup instead of per block, and device kernels can index them directly by igrid rather than chasing a per-block pointer. The corresponding state components (ps(igrid)%x, %dx, ...) are bounds-remapped views into these arrays, so host code keeps working unchanged.
All of it is device-resident, because the device is what produces it: fill_geometry_device builds every member there. That includes dx, which no kernel reads - it has to live where it is written, and is pulled back only on demand (see sync_geometry_host).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| double precision, | public, | dimension(:,:,:,:,:), allocatable | :: | ds |
Cell sizes in length unit |
||
| double precision, | public, | dimension(:,:,:,:), allocatable | :: | dvolume |
Volumes of a cell |
||
| double precision, | public, | dimension(:,:,:,:,:), allocatable | :: | dx |
Cell sizes in coordinate units. Read on the host alone - by calc_x, by the collapsed output and by set_B0_grid - never by a kernel. |
||
| double precision, | public, | dimension(:,:,:,:,:), allocatable | :: | surfaceC |
Areas of cell-face surfaces |
||
| double precision, | public, | dimension(:,:,:,:,:), allocatable | :: | x |
Cell-center positions |
type geo_t !> Cell-center positions double precision, dimension(:,:,:,:,:), allocatable :: x !> Cell sizes in length unit double precision, dimension(:,:,:,:,:), allocatable :: ds !> Volumes of a cell double precision, dimension(:,:,:,:), allocatable :: dvolume !> Areas of cell-face surfaces double precision, dimension(:,:,:,:,:), allocatable :: surfaceC !> Cell sizes in coordinate units. Read on the host alone - by calc_x, !> by the collapsed output and by set_B0_grid - never by a kernel. double precision, dimension(:,:,:,:,:), allocatable :: dx end type geo_t