ドリフト速度付きMaxwell分布(温度または熱速度指定)から粒子速度を生成する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | drift_velocity(3) | |||
| real(kind=dp), | intent(in) | :: | m_particle |
粒子1個あたりの質量 [kg]( |
||
| real(kind=dp), | intent(out) | :: | v(:,:) | |||
| real(kind=dp), | intent(in), | optional | :: | temperature_k |
熱運動の温度 [K]( |
|
| real(kind=dp), | intent(in), | optional | :: | thermal_speed |
熱速度の標準偏差 |
subroutine sample_shifted_maxwell_velocities(drift_velocity, m_particle, v, temperature_k, thermal_speed) real(dp), intent(in) :: drift_velocity(3) real(dp), intent(in) :: m_particle real(dp), intent(out) :: v(:, :) real(dp), intent(in), optional :: temperature_k real(dp), intent(in), optional :: thermal_speed integer :: n real(dp) :: sigma real(dp), allocatable :: z(:, :) if (size(v, 1) /= 3) error stop "v first dimension must be 3" if (m_particle <= 0.0_dp) error stop "m_particle must be > 0" if (.not. present(temperature_k) .and. .not. present(thermal_speed)) then error stop "either temperature_k or thermal_speed must be provided" end if if (present(thermal_speed)) then if (thermal_speed < 0.0_dp) error stop "thermal_speed must be >= 0" sigma = thermal_speed else if (temperature_k < 0.0_dp) error stop "temperature_k must be >= 0" sigma = sqrt(k_boltzmann*temperature_k/m_particle) end if n = size(v, 2) allocate (z(3, n)) call sample_standard_normal(z) v = sigma*z + spread(drift_velocity, dim=2, ncopies=n) end subroutine sample_shifted_maxwell_velocities