species_closure_mode Function

public pure function species_closure_mode(contract, species_idx, configured_fixed_current) result(mode)

種 species_idx の固定電流 closure 方式(bem_runtime_modes の closure_mode_*)。 設定が fixed_current でも外部根の目標もなければ none。方式は contract のフラグから導くので、 方式とフラグが食い違うことはない。

Arguments

Type IntentOptional Attributes Name
class(surface_closure_contract_type), intent(in) :: contract
integer(kind=i32), intent(in) :: species_idx
logical, intent(in) :: configured_fixed_current

Return Value integer(kind=i32)


Source Code

  pure integer(i32) function species_closure_mode(contract, species_idx, configured_fixed_current) result(mode)
    class(surface_closure_contract_type), intent(in) :: contract
    integer(i32), intent(in) :: species_idx
    logical, intent(in) :: configured_fixed_current

    mode = closure_mode_none
    if (.not. (configured_fixed_current .or. contract%has_absorbed_target(species_idx) .or. &
               contract%has_emission_target(species_idx) .or. contract%has_escape_target(species_idx))) return
    mode = closure_mode_target
    if (allocated(contract%emission_target_from_tracked_source)) then
      if (contract%emission_target_from_tracked_source(species_idx)) then
        mode = closure_mode_tracked_source
        return
      end if
    end if
    if (allocated(contract%escape_partner_species)) then
      if (contract%escape_partner_species(species_idx) > 0_i32) mode = closure_mode_escape_partner
    end if
    if (allocated(contract%reflected_electron_species)) then
      if (contract%reflected_electron_species(species_idx) > 0_i32) mode = closure_mode_escape_partner
    end if
  end function species_closure_mode