| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg | |||
| integer(kind=i32), | intent(out) | :: | electron_idx | |||
| integer(kind=i32), | intent(out) | :: | ion_idx | |||
| integer(kind=i32), | intent(out) | :: | photo_idx |
subroutine detect_sheath_species(cfg, electron_idx, ion_idx, photo_idx) type(app_config), intent(in) :: cfg integer(i32), intent(out) :: electron_idx, ion_idx, photo_idx integer(i32) :: s character(len=16) :: mode electron_idx = 0_i32 ion_idx = 0_i32 photo_idx = 0_i32 do s = 1_i32, cfg%n_particle_species if (.not. cfg%particle_species(s)%enabled) cycle mode = trim(lower_ascii(cfg%particle_species(s)%source_mode)) select case (mode) case ('reservoir_face') if (cfg%particle_species(s)%q_particle < 0.0d0) then if (electron_idx == 0_i32) electron_idx = s else if (cfg%particle_species(s)%q_particle > 0.0d0) then if (ion_idx == 0_i32) ion_idx = s end if case ('photo_raycast') if (cfg%particle_species(s)%q_particle < 0.0d0 .and. photo_idx == 0_i32) photo_idx = s end select end do if (electron_idx <= 0_i32) error stop 'sheath injection requires one enabled negative-q reservoir_face species.' if (ion_idx <= 0_i32) error stop 'sheath injection requires one enabled positive-q reservoir_face species.' if (trim(lower_ascii(cfg%particle_species(electron_idx)%inject_face)) & /= trim(lower_ascii(cfg%particle_species(ion_idx)%inject_face))) then error stop 'sheath electron/ion reservoir species must share the same inject_face.' end if end subroutine detect_sheath_species