init_random_beam_particles Subroutine

public subroutine init_random_beam_particles(pcls, n, q_particle, m_particle, w_particle, pos_low, pos_high, drift_velocity, temperature_k, thermal_speed)

指定粒子数ぶんの位置/速度/電荷/質量/重みを生成し particles_soa を初期化する。

Arguments

Type IntentOptional Attributes Name
type(particles_soa), intent(out) :: pcls

生成した粒子群を保持する particles_soa

integer(kind=i32), intent(in) :: n

生成するマクロ粒子数。

real(kind=dp), intent(in) :: q_particle

粒子1個あたりの電荷 [C]。

real(kind=dp), intent(in) :: m_particle

粒子1個あたりの電荷 [C]。 粒子1個あたりの質量 [kg]。

real(kind=dp), intent(in) :: w_particle

粒子1個あたりの電荷 [C]。 粒子1個あたりの質量 [kg]。 粒子1個あたりのマクロ粒子重み。

real(kind=dp), intent(in) :: pos_low(3)
real(kind=dp), intent(in) :: pos_high(3)
real(kind=dp), intent(in) :: drift_velocity(3)
real(kind=dp), intent(in), optional :: temperature_k

熱運動の温度 [K](thermal_speed 未指定時に使用)。

real(kind=dp), intent(in), optional :: thermal_speed

熱運動の温度 [K](thermal_speed 未指定時に使用)。 熱速度の標準偏差 sigma [m/s](指定時は温度より優先)。


Calls

proc~~init_random_beam_particles~~CallsGraph proc~init_random_beam_particles init_random_beam_particles proc~allocate_particles allocate_particles proc~init_random_beam_particles->proc~allocate_particles proc~sample_shifted_maxwell_velocities sample_shifted_maxwell_velocities proc~init_random_beam_particles->proc~sample_shifted_maxwell_velocities proc~sample_uniform_positions sample_uniform_positions proc~init_random_beam_particles->proc~sample_uniform_positions proc~sample_standard_normal sample_standard_normal proc~sample_shifted_maxwell_velocities->proc~sample_standard_normal

Source Code

  subroutine init_random_beam_particles(pcls, n, q_particle, m_particle, w_particle, pos_low, pos_high, drift_velocity, &
                                        temperature_k, thermal_speed)
    type(particles_soa), intent(out) :: pcls
    integer(i32), intent(in) :: n
    real(dp), intent(in) :: q_particle, m_particle, w_particle
    real(dp), intent(in) :: pos_low(3), pos_high(3), drift_velocity(3)
    real(dp), intent(in), optional :: temperature_k, thermal_speed

    call allocate_particles(pcls, n)
    call sample_uniform_positions(pos_low, pos_high, pcls%x)
    call sample_shifted_maxwell_velocities(drift_velocity, m_particle, pcls%v, temperature_k, thermal_speed)
    pcls%q = q_particle
    pcls%m = m_particle
    pcls%w = w_particle
  end subroutine init_random_beam_particles