| Type | Intent | Optional | 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 |
subroutine solve_zhao_unknowns(model, p, phi0_v, phi_m_v, n_swe_inf_m3, branch) 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 real(dp) :: x3(3), x2(2) logical :: success character(len=1), dimension(3) :: order integer :: i select case (trim(model)) case ('zhao_a') call solve_zhao_branch_a(p, phi0_v, phi_m_v, n_swe_inf_m3) branch = 'A' return case ('zhao_b') call solve_zhao_branch_b(p, phi0_v, n_swe_inf_m3) phi_m_v = phi0_v branch = 'B' return case ('zhao_c') call solve_zhao_branch_c(p, phi0_v, n_swe_inf_m3) phi_m_v = phi0_v branch = 'C' 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 error stop 'Unknown Zhao sheath model.' 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' 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' 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' return end if end select end do error stop 'Zhao sheath auto branch selection failed.' end subroutine solve_zhao_unknowns