Performs contiguous task decomposition for the radiation solver.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(radiation_mpi_t), | intent(inout) | :: | rad |
The radiation context to update. |
||
| integer, | intent(in) | :: | n_tasks |
Total number of discrete tasks (e.g., rays). |
subroutine radiation_task_bounds(rad, n_tasks) type(radiation_mpi_t), intent(inout) :: rad integer, intent(in) :: n_tasks integer :: base, rem if (n_tasks < 0) call fatal_error('mpi_radiation', 'n_tasks cannot be negative') if (rad%nprocs <= 0) call fatal_error('mpi_radiation', 'radiation communicator is not initialized') base = n_tasks / rad%nprocs rem = mod(n_tasks, rad%nprocs) if (rad%rank < rem) then rad%nlocal_tasks = base + 1 rad%first_task = rad%rank * (base + 1) + 1 else rad%nlocal_tasks = base rad%first_task = rem * (base + 1) + (rad%rank - rem) * base + 1 end if rad%last_task = rad%first_task + rad%nlocal_tasks - 1 rad%first_wavenumber = rad%first_task rad%last_wavenumber = rad%last_task rad%nlocal_wavenumbers = rad%nlocal_tasks end subroutine radiation_task_bounds