Pure Fortran, no MPI dependency. Each rank calls decomp_init with its process-grid coordinates to learn its local subdomain size and offsets.
Domain decomposition descriptor
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | has_east | = | .true. |
True if this rank is on the east domain boundary |
|
| logical, | public | :: | has_north | = | .true. |
True if this rank is on the north domain boundary |
|
| logical, | public | :: | has_south | = | .true. |
True if this rank is on the south domain boundary |
|
| logical, | public | :: | has_west | = | .true. |
True if this rank is on the west domain boundary |
|
| integer, | public | :: | i_start | = | 1 |
Global i-index of this rank’s first physical cell (1-based) |
|
| integer, | public | :: | j_start | = | 1 |
Global j-index of this rank’s first physical cell (1-based) |
|
| integer, | public | :: | nx_global | = | 0 |
Global physical cells in x |
|
| integer, | public | :: | nx_local | = | 0 |
Local physical cells in x for this rank |
|
| integer, | public | :: | ny_global | = | 0 |
Global physical cells in y |
|
| integer, | public | :: | ny_local | = | 0 |
Local physical cells in y for this rank |
|
| integer, | public | :: | px | = | 1 |
Number of processes in x-direction |
|
| integer, | public | :: | py | = | 1 |
Number of processes in y-direction |
|
| integer, | public | :: | rx | = | 0 |
This rank’s x-coordinate in the process grid (0-based) |
|
| integer, | public | :: | ry | = | 0 |
This rank’s y-coordinate in the process grid (0-based) |
Compute rank from process grid coordinates (row-major)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | px |
Process grid size in x |
||
| integer, | intent(in) | :: | rx |
x-coordinate (0-based) |
||
| integer, | intent(in) | :: | ry |
y-coordinate (0-based) |
Choose px, py to minimise halo communication cost
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nprocs |
Total number of MPI ranks |
||
| integer, | intent(in) | :: | nx |
Global physical cells in x |
||
| integer, | intent(in) | :: | ny |
Global physical cells in y |
||
| integer, | intent(out) | :: | px |
Chosen process grid size in x |
||
| integer, | intent(out) | :: | py |
Chosen process grid size in y |
Public only for the unit-test suite (no production module imports it); ignore when developing production code in other modules. Convert global physical indices to local physical indices
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(decomp_t), | intent(in) | :: | d | |||
| integer, | intent(in) | :: | ig |
Global i-index (1-based, physical cells) |
||
| integer, | intent(in) | :: | jg |
Global j-index (1-based, physical cells) |
||
| integer, | intent(out) | :: | il |
Local i-index (1-based, physical cells) |
||
| integer, | intent(out) | :: | jl |
Local j-index (1-based, physical cells) |
Initialise decomposition for a given rank
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(decomp_t), | intent(out) | :: | d |
Decomposition descriptor to populate |
||
| integer, | intent(in) | :: | nx_global |
Total physical cells in x |
||
| integer, | intent(in) | :: | ny_global |
Total physical cells in y |
||
| integer, | intent(in) | :: | px |
Process grid size in x |
||
| integer, | intent(in) | :: | py |
Process grid size in y |
||
| integer, | intent(in) | :: | rank |
MPI rank (0-based) |
Initialise decomposition from config, with optional auto-factoring
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(decomp_t), | intent(out) | :: | d |
Decomposition descriptor to populate |
||
| type(config_t), | intent(inout) | :: | cfg |
Configuration (px, py may be updated) |
||
| integer, | intent(in) | :: | nprocs |
Total number of MPI ranks |
||
| integer, | intent(in) | :: | rank |
This MPI rank (0-based) |
Public only for the unit-test suite (no production module imports it); ignore when developing production code in other modules. Convert local physical indices to global physical indices
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(decomp_t), | intent(in) | :: | d | |||
| integer, | intent(in) | :: | il |
Local i-index (1-based, physical cells) |
||
| integer, | intent(in) | :: | jl |
Local j-index (1-based, physical cells) |
||
| integer, | intent(out) | :: | ig |
Global i-index (1-based, physical cells) |
||
| integer, | intent(out) | :: | jg |
Global j-index (1-based, physical cells) |
Log the process grid + this rank’s subdomain shape. Call from rank 0 after decomp_init_from_config so a run’s decomposition is visible at startup (the halo perimeter is what auto_factor minimises, printed here as the per-rank interior:ghost ratio cue).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(decomp_t), | intent(in) | :: | d | |||
| integer, | intent(in) | :: | nprocs |
Total compute ranks (px*py) |