try_solve_zhao_unknowns Subroutine

public subroutine try_solve_zhao_unknowns(model, p, phi0_v, phi_m_v, n_swe_inf_m3, branch, success)

Zhao の零電流定常根を fail-closed な status 付きで探索する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: model
type(zhao_params_type), intent(in) :: p
real(kind=dp), intent(out) :: phi0_v
real(kind=dp), intent(out) :: phi_m_v
real(kind=dp), intent(out) :: n_swe_inf_m3
character(len=1), intent(out) :: branch
logical, intent(out) :: success

Calls

proc~~try_solve_zhao_unknowns~~CallsGraph proc~try_solve_zhao_unknowns try_solve_zhao_unknowns proc~try_solve_zhao_branch_a try_solve_zhao_branch_a proc~try_solve_zhao_unknowns->proc~try_solve_zhao_branch_a proc~try_solve_zhao_branch_b try_solve_zhao_branch_b proc~try_solve_zhao_unknowns->proc~try_solve_zhao_branch_b proc~try_solve_zhao_branch_c try_solve_zhao_branch_c proc~try_solve_zhao_unknowns->proc~try_solve_zhao_branch_c proc~solve_nonlinear_system solve_nonlinear_system proc~try_solve_zhao_branch_a->proc~solve_nonlinear_system proc~try_solve_zhao_branch_b->proc~solve_nonlinear_system proc~try_solve_zhao_monotonic_scalar try_solve_zhao_monotonic_scalar proc~try_solve_zhao_branch_b->proc~try_solve_zhao_monotonic_scalar proc~try_solve_zhao_branch_c->proc~solve_nonlinear_system proc~try_solve_zhao_branch_c->proc~try_solve_zhao_monotonic_scalar proc~try_newton_solve try_newton_solve proc~solve_nonlinear_system->proc~try_newton_solve proc~evaluate_monotonic_stationary_phi evaluate_monotonic_stationary_phi proc~try_solve_zhao_monotonic_scalar->proc~evaluate_monotonic_stationary_phi proc~residual_norm residual_norm proc~try_solve_zhao_monotonic_scalar->proc~residual_norm proc~zhao_residuals_type_b zhao_residuals_type_b proc~try_solve_zhao_monotonic_scalar->proc~zhao_residuals_type_b proc~zhao_residuals_type_c zhao_residuals_type_c proc~try_solve_zhao_monotonic_scalar->proc~zhao_residuals_type_c proc~evaluate_monotonic_stationary_phi->proc~zhao_residuals_type_b proc~evaluate_monotonic_stationary_phi->proc~zhao_residuals_type_c proc~swe_free_current_term swe_free_current_term proc~evaluate_monotonic_stationary_phi->proc~swe_free_current_term proc~try_newton_solve->proc~residual_norm proc~numerical_jacobian numerical_jacobian proc~try_newton_solve->proc~numerical_jacobian proc~solve_small_linear_system solve_small_linear_system proc~try_newton_solve->proc~solve_small_linear_system proc~zhao_residuals_type_b->proc~swe_free_current_term proc~zhao_residuals_type_c->proc~swe_free_current_term

Called by

proc~~try_solve_zhao_unknowns~~CalledByGraph proc~try_solve_zhao_unknowns try_solve_zhao_unknowns proc~evaluate_surface_current_model evaluate_surface_current_model proc~evaluate_surface_current_model->proc~try_solve_zhao_unknowns proc~solve_zhao_unknowns solve_zhao_unknowns proc~solve_zhao_unknowns->proc~try_solve_zhao_unknowns proc~evaluate_surface_closure evaluate_surface_closure proc~evaluate_surface_closure->proc~evaluate_surface_current_model

Source Code

  subroutine try_solve_zhao_unknowns(model, p, phi0_v, phi_m_v, n_swe_inf_m3, branch, success)
    character(len=*), intent(in) :: model
    type(zhao_params_type), intent(in) :: p
    real(dp), intent(out) :: phi0_v, phi_m_v, n_swe_inf_m3
    character(len=1), intent(out) :: branch
    logical, intent(out) :: success

    real(dp) :: x3(3), x2(2)
    character(len=1), dimension(3) :: order
    integer :: i

    phi0_v = 0.0_dp
    phi_m_v = 0.0_dp
    n_swe_inf_m3 = 0.0_dp
    branch = ' '
    success = .false.

    select case (trim(model))
    case ('zhao_a')
      call try_solve_zhao_branch_a(p, x3, success)
      if (success) then
        phi0_v = x3(1)
        phi_m_v = x3(2)
        n_swe_inf_m3 = x3(3)
        branch = 'A'
      end if
      return
    case ('zhao_b')
      call try_solve_zhao_branch_b(p, x2, success)
      if (success) then
        phi0_v = x2(1)
        phi_m_v = x2(1)
        n_swe_inf_m3 = x2(2)
        branch = 'B'
      end if
      return
    case ('zhao_c')
      call try_solve_zhao_branch_c(p, x2, success)
      if (success) then
        phi0_v = x2(1)
        phi_m_v = x2(1)
        n_swe_inf_m3 = x2(2)
        branch = 'C'
      end if
      return
    case ('zhao_auto')
      if (p%alpha_rad*180.0d0/pi < 20.0d0) then
        order = ['C', 'A', 'B']
      else
        order = ['A', 'B', 'C']
      end if
    case default
      return
    end select

    do i = 1, size(order)
      select case (order(i))
      case ('A')
        call try_solve_zhao_branch_a(p, x3, success)
        if (success) then
          phi0_v = x3(1)
          phi_m_v = x3(2)
          n_swe_inf_m3 = x3(3)
          branch = 'A'
          success = .true.
          return
        end if
      case ('B')
        call try_solve_zhao_branch_b(p, x2, success)
        if (success) then
          phi0_v = x2(1)
          phi_m_v = x2(1)
          n_swe_inf_m3 = x2(2)
          branch = 'B'
          success = .true.
          return
        end if
      case ('C')
        call try_solve_zhao_branch_c(p, x2, success)
        if (success) then
          phi0_v = x2(1)
          phi_m_v = x2(1)
          n_swe_inf_m3 = x2(2)
          branch = 'C'
          success = .true.
          return
        end if
      end select
    end do

  end subroutine try_solve_zhao_unknowns