solve_no_photo_floating_potential Subroutine

public subroutine solve_no_photo_floating_potential(spec_e, spec_i, inward_normal, phi0_v)

Arguments

Type IntentOptional Attributes Name
type(sheath_model_species), intent(in) :: spec_e
type(sheath_model_species), intent(in) :: spec_i
real(kind=dp), intent(in) :: inward_normal(3)
real(kind=dp), intent(out) :: phi0_v

Calls

proc~~solve_no_photo_floating_potential~~CallsGraph proc~solve_no_photo_floating_potential solve_no_photo_floating_potential proc~compute_inflow_flux_from_drifting_maxwellian compute_inflow_flux_from_drifting_maxwellian proc~solve_no_photo_floating_potential->proc~compute_inflow_flux_from_drifting_maxwellian proc~no_photo_current_balance no_photo_current_balance proc~solve_no_photo_floating_potential->proc~no_photo_current_balance proc~temperature_ev_from_species temperature_ev_from_species proc~solve_no_photo_floating_potential->proc~temperature_ev_from_species proc~no_photo_current_balance->proc~compute_inflow_flux_from_drifting_maxwellian

Called by

proc~~solve_no_photo_floating_potential~~CalledByGraph proc~solve_no_photo_floating_potential solve_no_photo_floating_potential proc~resolve_sheath_injection_context resolve_sheath_injection_context proc~resolve_sheath_injection_context->proc~solve_no_photo_floating_potential 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 solve_no_photo_floating_potential(spec_e, spec_i, inward_normal, phi0_v)
    type(sheath_model_species), intent(in) :: spec_e, spec_i
    real(dp), intent(in) :: inward_normal(3)
    real(dp), intent(out) :: phi0_v

    real(dp) :: n_e_inf_m3, n_i_inf_m3, gamma_i, f_low, f_high, f_mid, phi_low, phi_high, phi_mid
    integer :: iter

    n_e_inf_m3 = spec_e%number_density_m3
    n_i_inf_m3 = spec_i%number_density_m3
    gamma_i = compute_inflow_flux_from_drifting_maxwellian( &
              n_i_inf_m3, spec_i%temperature_k, spec_i%m_particle, spec_i%drift_velocity, inward_normal &
              )
    if (gamma_i <= 0.0d0) error stop 'floating_no_photo requires a positive ion inflow flux.'

    phi_low = -128.0d0*max(1.0d0, temperature_ev_from_species(spec_e))
    phi_high = 0.0d0
    f_low = no_photo_current_balance(phi_low, n_e_inf_m3, spec_e, inward_normal, gamma_i)
    f_high = no_photo_current_balance(phi_high, n_e_inf_m3, spec_e, inward_normal, gamma_i)
    if (f_high < 0.0d0) then
      error stop 'floating_no_photo could not bracket a negative sheath potential.'
    end if
    do while (f_low > 0.0d0)
      phi_low = 2.0d0*phi_low
      f_low = no_photo_current_balance(phi_low, n_e_inf_m3, spec_e, inward_normal, gamma_i)
      if (phi_low < -1.0d6) error stop 'floating_no_photo bracket search failed.'
    end do

    do iter = 1, 80
      phi_mid = 0.5d0*(phi_low + phi_high)
      f_mid = no_photo_current_balance(phi_mid, n_e_inf_m3, spec_e, inward_normal, gamma_i)
      if (abs(f_mid) <= 1.0d-12*max(1.0d0, gamma_i)) exit
      if (f_mid > 0.0d0) then
        phi_high = phi_mid
      else
        phi_low = phi_mid
      end if
    end do
    phi0_v = 0.5d0*(phi_low + phi_high)
  end subroutine solve_no_photo_floating_potential