sample_zhao_state_at_z Subroutine

public subroutine sample_zhao_state_at_z(p, branch, phi0_v, phi_m_v, n_swe_inf_m3, z_m, state)

Arguments

Type IntentOptional Attributes Name
type(zhao_params_type), intent(in) :: p
character(len=1), intent(in) :: branch
real(kind=dp), intent(in) :: phi0_v
real(kind=dp), intent(in) :: phi_m_v
real(kind=dp), intent(in) :: n_swe_inf_m3
real(kind=dp), intent(in) :: z_m
type(zhao_local_state_type), intent(out) :: state

Calls

proc~~sample_zhao_state_at_z~~CallsGraph proc~sample_zhao_state_at_z sample_zhao_state_at_z proc~evaluate_zhao_state_from_phi_hat evaluate_zhao_state_from_phi_hat proc~sample_zhao_state_at_z->proc~evaluate_zhao_state_from_phi_hat proc~sample_monotonic_phi_hat_at_z sample_monotonic_phi_hat_at_z proc~sample_zhao_state_at_z->proc~sample_monotonic_phi_hat_at_z proc~sample_type_a_phi_hat_at_z sample_type_a_phi_hat_at_z proc~sample_zhao_state_at_z->proc~sample_type_a_phi_hat_at_z proc~evaluate_zhao_density_hat evaluate_zhao_density_hat proc~evaluate_zhao_state_from_phi_hat->proc~evaluate_zhao_density_hat proc~evaluate_zhao_rho_hat evaluate_zhao_rho_hat proc~sample_monotonic_phi_hat_at_z->proc~evaluate_zhao_rho_hat proc~interpolate_profile_value interpolate_profile_value proc~sample_monotonic_phi_hat_at_z->proc~interpolate_profile_value proc~build_type_a_branch_from_minimum build_type_a_branch_from_minimum proc~sample_type_a_phi_hat_at_z->proc~build_type_a_branch_from_minimum proc~sample_type_a_phi_hat_at_z->proc~interpolate_profile_value proc~build_type_a_branch_from_minimum->proc~evaluate_zhao_rho_hat proc~evaluate_zhao_rho_hat->proc~evaluate_zhao_density_hat

Called by

proc~~sample_zhao_state_at_z~~CalledByGraph proc~sample_zhao_state_at_z sample_zhao_state_at_z proc~sample_zhao_reservoir_state sample_zhao_reservoir_state proc~sample_zhao_reservoir_state->proc~sample_zhao_state_at_z proc~resolve_sheath_injection_context resolve_sheath_injection_context proc~resolve_sheath_injection_context->proc~sample_zhao_reservoir_state proc~init_particle_batch_from_config init_particle_batch_from_config proc~init_particle_batch_from_config->proc~resolve_sheath_injection_context

Source Code

  subroutine sample_zhao_state_at_z(p, branch, phi0_v, phi_m_v, n_swe_inf_m3, z_m, state)
    type(zhao_params_type), intent(in) :: p
    character(len=1), intent(in) :: branch
    real(dp), intent(in) :: phi0_v, phi_m_v, n_swe_inf_m3, z_m
    type(zhao_local_state_type), intent(out) :: state

    real(dp) :: phi0_hat, phi_m_hat, phi_hat, z_m_hat
    character(len=16) :: side

    phi0_hat = phi0_v/p%t_phe_ev
    phi_m_hat = phi_m_v/p%t_phe_ev
    if (z_m <= 0.0d0) then
      phi_hat = phi0_hat
      if (branch == 'A') then
        side = 'lower'
      else
        side = 'monotonic'
      end if
      z_m_hat = 0.0d0
    else
      select case (branch)
      case ('A')
        call sample_type_a_phi_hat_at_z(p, phi0_hat, phi_m_hat, n_swe_inf_m3/p%n_phe_ref_m3, z_m, phi_hat, side, z_m_hat)
      case ('B', 'C')
        call sample_monotonic_phi_hat_at_z( &
          p, branch, phi0_hat, phi_m_hat, n_swe_inf_m3/p%n_phe_ref_m3, z_m, phi_hat, side, z_m_hat &
          )
      case default
        error stop 'Unknown Zhao branch in local state reconstruction.'
      end select
    end if

    call evaluate_zhao_state_from_phi_hat( &
      p, branch, side, phi_hat, phi0_hat, phi_m_hat, n_swe_inf_m3, z_m_hat*p%lambda_d_phe_ref_m, state &
      )
  end subroutine sample_zhao_state_at_z