apply_kinetic_map_arguments Subroutine

public subroutine apply_kinetic_map_arguments(plan, nspecies, kinetic_inflow_active, kinetic_reservoir_potential_v, kinetic_access_potential_v, kinetic_inflow_face, kinetic_reservoir_density_m3)

外部 closure の kinetic 写像(有効フラグ・貯留部/access 電位・面・貯留部密度)を検査して plan へ写す。

Arguments

Type IntentOptional Attributes Name
type(particle_source_plan_type), intent(inout) :: plan
integer(kind=i32), intent(in) :: nspecies
logical, intent(in), optional :: kinetic_inflow_active(:)
real(kind=dp), intent(in), optional :: kinetic_reservoir_potential_v(:)
real(kind=dp), intent(in), optional :: kinetic_access_potential_v(:)
integer(kind=i32), intent(in), optional :: kinetic_inflow_face(:)
real(kind=dp), intent(in), optional :: kinetic_reservoir_density_m3(:)

Called by

proc~~apply_kinetic_map_arguments~~CalledByGraph proc~apply_kinetic_map_arguments apply_kinetic_map_arguments proc~build_particle_source_plan build_particle_source_plan proc~build_particle_source_plan->proc~apply_kinetic_map_arguments

Source Code

  subroutine apply_kinetic_map_arguments( &
    plan, nspecies, kinetic_inflow_active, kinetic_reservoir_potential_v, kinetic_access_potential_v, &
    kinetic_inflow_face, kinetic_reservoir_density_m3 &
    )
    type(particle_source_plan_type), intent(inout) :: plan
    integer(i32), intent(in) :: nspecies
    logical, intent(in), optional :: kinetic_inflow_active(:)
    real(dp), intent(in), optional :: kinetic_reservoir_potential_v(:), kinetic_access_potential_v(:)
    integer(i32), intent(in), optional :: kinetic_inflow_face(:)
    real(dp), intent(in), optional :: kinetic_reservoir_density_m3(:)

    if (present(kinetic_inflow_active) .or. present(kinetic_reservoir_potential_v) .or. &
        present(kinetic_access_potential_v) .or. present(kinetic_inflow_face)) then
      if (.not. present(kinetic_inflow_active) .or. .not. present(kinetic_reservoir_potential_v) .or. &
          .not. present(kinetic_access_potential_v) .or. .not. present(kinetic_inflow_face)) then
        error stop 'particle source kinetic map requires active, reservoir, access, and face arrays together.'
      end if
      if (size(kinetic_inflow_active) /= nspecies .or. &
          size(kinetic_reservoir_potential_v) /= nspecies .or. &
          size(kinetic_access_potential_v) /= nspecies .or. &
          size(kinetic_inflow_face) /= nspecies) then
        error stop 'particle source kinetic map species count mismatch.'
      end if
      if (.not. all(ieee_is_finite(kinetic_reservoir_potential_v)) .or. &
          .not. all(ieee_is_finite(kinetic_access_potential_v))) then
        error stop 'particle source kinetic map potentials must be finite.'
      end if
      plan%kinetic_inflow_active = kinetic_inflow_active
      plan%kinetic_reservoir_potential_v = kinetic_reservoir_potential_v
      plan%kinetic_access_potential_v = kinetic_access_potential_v
      plan%kinetic_inflow_face = kinetic_inflow_face
      if (any(plan%kinetic_inflow_active .and. &
              (plan%kinetic_inflow_face < 1_i32 .or. plan%kinetic_inflow_face > 6_i32))) then
        error stop 'active particle source kinetic map face must be in [1, 6].'
      end if
    end if

    if (present(kinetic_reservoir_density_m3)) then
      if (size(kinetic_reservoir_density_m3) /= nspecies) then
        error stop 'particle source kinetic reservoir density species count mismatch.'
      end if
      if (.not. all(ieee_is_finite(kinetic_reservoir_density_m3))) then
        error stop 'particle source kinetic reservoir densities must be finite.'
      end if
      plan%kinetic_reservoir_density_m3 = max(0.0_dp, kinetic_reservoir_density_m3)
    end if
  end subroutine apply_kinetic_map_arguments