sample_zhao_reservoir_state Subroutine

public subroutine sample_zhao_reservoir_state(sim, spec_e, ctx, p, branch, phi0_v, phi_m_v, n_swe_inf_m3, state)

Arguments

Type IntentOptional Attributes Name
type(sim_config), intent(in) :: sim
type(particle_species_spec), intent(in) :: spec_e
type(sheath_injection_context), intent(inout) :: ctx
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
type(zhao_local_state_type), intent(out) :: state

Calls

proc~~sample_zhao_reservoir_state~~CallsGraph proc~sample_zhao_reservoir_state sample_zhao_reservoir_state proc~resolve_inject_face resolve_inject_face proc~sample_zhao_reservoir_state->proc~resolve_inject_face proc~sample_zhao_state_at_z sample_zhao_state_at_z proc~sample_zhao_reservoir_state->proc~sample_zhao_state_at_z proc~lower_ascii lower_ascii proc~resolve_inject_face->proc~lower_ascii 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_reservoir_state~~CalledByGraph proc~sample_zhao_reservoir_state sample_zhao_reservoir_state 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_reservoir_state(sim, spec_e, ctx, p, branch, phi0_v, phi_m_v, n_swe_inf_m3, state)
    type(sim_config), intent(in) :: sim
    type(particle_species_spec), intent(in) :: spec_e
    type(sheath_injection_context), intent(inout) :: ctx
    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
    type(zhao_local_state_type), intent(out) :: state

    integer :: axis
    real(dp) :: boundary_value, distance_m, axis_sign

    call resolve_inject_face(sim%box_min, sim%box_max, spec_e%inject_face, axis, boundary_value)
    axis_sign = -ctx%reference_inward_normal(axis)
    distance_m = (boundary_value - ctx%reference_coordinate)*axis_sign
    if (distance_m < -1.0d-12) then
      error stop 'sheath_reference_coordinate must lie on or inside the shared reservoir_face boundary.'
    end if
    ctx%reservoir_plane_distance_m = max(0.0d0, distance_m)
    call sample_zhao_state_at_z(p, branch, phi0_v, phi_m_v, n_swe_inf_m3, ctx%reservoir_plane_distance_m, state)
  end subroutine sample_zhao_reservoir_state