validate_active_physics_config Subroutine

public subroutine validate_active_physics_config(sim, field, periodic2, panel, status, message)

有限画像、panel reference、cached k!=0 の periodic2 構成を検証する。

Arguments

Type IntentOptional Attributes Name
type(sim_config), intent(in) :: sim
type(field_physics_config), intent(in) :: field
type(periodic2_physics_config), intent(in) :: periodic2
type(panel_kernel_config), intent(in) :: panel
integer(kind=i32), intent(out) :: status
character(len=*), intent(out) :: message

Calls

proc~~validate_active_physics_config~~CallsGraph proc~validate_active_physics_config validate_active_physics_config proc~lower_ascii lower_ascii proc~validate_active_physics_config->proc~lower_ascii proc~validate_phase1_panel_config validate_phase1_panel_config proc~validate_active_physics_config->proc~validate_phase1_panel_config proc~validate_phase1_panel_config->proc~lower_ascii

Source Code

  subroutine validate_active_physics_config(sim, field, periodic2, panel, status, message)
    type(sim_config), intent(in) :: sim
    type(field_physics_config), intent(in) :: field
    type(periodic2_physics_config), intent(in) :: periodic2
    type(panel_kernel_config), intent(in) :: panel
    integer(i32), intent(out) :: status
    character(len=*), intent(out) :: message
    character(len=32) :: nonzero_backend

    status = physics_config_ok
    message = ''
    nonzero_backend = lower_ascii(trim(periodic2%nonzero_mode_backend))

    if (.not. ieee_is_finite(periodic2%max_nonzero_mode_potential_step) .or. &
        periodic2%max_nonzero_mode_potential_step < 0.0_dp) then
      call reject(physics_config_invalid_combination, &
                  'periodic2.max_nonzero_mode_potential_step must be finite and >= 0.', status, message)
      return
    end if

    if (trim(lower_ascii(sim%multiple_box_events_retry_backend)) == 'upper_panel_fourier' .and. &
        trim(nonzero_backend) /= 'cached_kneq0') then
      call reject( &
        physics_config_invalid_combination, &
        'upper_panel_fourier retry requires the cached_kneq0 periodic backend.', status, message &
        )
      return
    end if

    if (trim(nonzero_backend) == 'not_applicable') then
      call validate_phase1_panel_config(sim, panel, status, message)
      return
    end if

    if (trim(lower_ascii(sim%field_bc_mode)) /= 'periodic2' .or. .not. sim%use_box) then
      call reject( &
        physics_config_invalid_combination, &
        'Periodic physics requires periodic2 box geometry.', status, message &
        )
      return
    end if
    if (any(sim%bc_low(1:2) /= bc_periodic) .or. any(sim%bc_high(1:2) /= bc_periodic) .or. &
        sim%bc_low(3) == bc_periodic .or. sim%bc_high(3) == bc_periodic) then
      call reject(physics_config_unavailable, 'Periodic2 requires x/y periodic and z nonperiodic.', status, message)
      return
    end if

    if (trim(nonzero_backend) == 'legacy_finite_images') then
      if (trim(lower_ascii(periodic2%zero_mode_policy)) /= 'legacy_not_decomposed') then
        call reject( &
          physics_config_invalid_combination, &
          'legacy_finite_images requires zero_mode_policy=legacy_not_decomposed.', status, message &
          )
        return
      end if
      call validate_phase1_panel_config(sim, panel, status, message)
      return
    end if

    if (trim(nonzero_backend) == 'panel_spectral_reference') then
      if (trim(lower_ascii(field%backend)) /= 'direct' .or. trim(lower_ascii(sim%field_solver)) /= 'direct') then
        call reject( &
          physics_config_invalid_combination, &
          'panel_spectral_reference requires field backend direct.', status, message &
          )
        return
      end if
      if (trim(lower_ascii(periodic2%zero_mode_policy)) /= 'exclude_k0' .or. &
          .not. supported_lower_boundary(periodic2%lower_boundary_model)) then
        call reject( &
          physics_config_invalid_combination, &
          'panel_spectral_reference requires exclude_k0 and a supported lower boundary model.', &
          status, message &
          )
        return
      end if
      if (trim(lower_ascii(panel%kernel_id)) /= 'triangle_p0_exact_direct') then
        call reject( &
          physics_config_invalid_combination, &
          'panel_spectral_reference requires triangle_p0_exact_direct.', status, message &
          )
        return
      end if
      if (periodic2%reference_mode_layers < 1_i32 .or. periodic2%panel_quadrature_order < 2_i32) then
        call reject( &
          physics_config_invalid_combination, &
          'Periodic reference orders are out of range.', status, message &
          )
        return
      end if
      if (.not. ieee_is_finite(periodic2%max_nonzero_mode_potential_step) .or. &
          periodic2%max_nonzero_mode_potential_step /= 0.0_dp) then
        call reject( &
          physics_config_invalid_combination, &
          'panel_spectral_reference does not support max_nonzero_mode_potential_step.', status, message &
          )
      end if
      return
    end if

    if (trim(nonzero_backend) /= 'cached_kneq0') then
      call reject(physics_config_invalid_combination, 'Unknown periodic nonzero-mode backend.', status, message)
      return
    end if
    if (trim(lower_ascii(field%backend)) /= 'fmm' .or. trim(lower_ascii(sim%field_solver)) /= 'fmm') then
      call reject( &
        physics_config_invalid_combination, &
        'cached_kneq0 requires the periodic2 FMM backend.', status, message &
        )
      return
    end if
    if (trim(lower_ascii(periodic2%zero_mode_policy)) /= 'exclude_k0' .or. &
        .not. supported_lower_boundary(periodic2%lower_boundary_model)) then
      call reject( &
        physics_config_invalid_combination, &
        'cached_kneq0 requires exclude_k0 and a supported lower boundary model.', status, message &
        )
      return
    end if
    if (trim(lower_ascii(panel%kernel_id)) /= 'triangle_p0_exact_p2m_near') then
      call reject( &
        physics_config_invalid_combination, &
        'cached_kneq0 requires the exact FMM panel kernel.', status, message &
        )
      return
    end if
  end subroutine validate_active_physics_config