!> Deterministic radiation wiring test model. !! !! This is not a physical radiation model. It exercises the intended contract: !! each radiation rank loops over its assigned wavenumbers and the full mesh, !! produces a partial qrad field, and leaves spectral reduction to the driver. module mod_radiation_spectral_test use mod_precision, only : rk, zero use mod_mesh, only : mesh_t use mod_radiation_types, only : radiation_context_t, radiation_state_t, radiation_source_t implicit none private public :: radiation_compute_spectral_test contains subroutine radiation_compute_spectral_test(mesh, context, state, source, source_scale) type(mesh_t), intent(in) :: mesh type(radiation_context_t), intent(in) :: context type(radiation_state_t), intent(in) :: state type(radiation_source_t), intent(inout) :: source real(rk), intent(in) :: source_scale integer :: c, j, s real(rk) :: y_weight, spectral_weight source%qrad = zero if (context%n_wavenumbers <= 0) return spectral_weight = source_scale / real(max(1, context%n_wavenumbers), rk) do j = context%wn_first, context%wn_last if (j <= 0) cycle do c = 1, mesh%ncells y_weight = 1.0_rk if (allocated(state%Y) .and. state%n_species > 0) then y_weight = zero do s = 1, state%n_species y_weight = y_weight + max(zero, state%Y(s, c)) end do end if source%qrad(c) = source%qrad(c) + spectral_weight * y_weight end do end do end subroutine radiation_compute_spectral_test end module mod_radiation_spectral_test