bem_injection Module

乱数シード設定と粒子位置/速度サンプリングを担う粒子注入モジュール。


Uses

  • module~~bem_injection~~UsesGraph module~bem_injection bem_injection module~bem_boundary bem_boundary module~bem_injection->module~bem_boundary module~bem_collision bem_collision module~bem_injection->module~bem_collision module~bem_constants bem_constants module~bem_injection->module~bem_constants module~bem_kinds bem_kinds module~bem_injection->module~bem_kinds module~bem_particles bem_particles module~bem_injection->module~bem_particles module~bem_string_utils bem_string_utils module~bem_injection->module~bem_string_utils module~bem_types bem_types module~bem_injection->module~bem_types module~bem_boundary->module~bem_kinds module~bem_boundary->module~bem_types module~bem_collision->module~bem_kinds module~bem_collision->module~bem_string_utils module~bem_collision->module~bem_types module~bem_constants->module~bem_kinds iso_fortran_env iso_fortran_env module~bem_kinds->iso_fortran_env module~bem_particles->module~bem_kinds module~bem_particles->module~bem_types module~bem_types->module~bem_kinds

Used by

  • module~~bem_injection~~UsedByGraph module~bem_injection bem_injection module~bem_app_config_runtime bem_app_config_runtime module~bem_app_config_runtime->module~bem_injection module~bem_sheath_injection_model bem_sheath_injection_model module~bem_app_config_runtime->module~bem_sheath_injection_model module~bem_sheath_model_core bem_sheath_model_core module~bem_sheath_model_core->module~bem_injection module~bem_app_config bem_app_config module~bem_app_config->module~bem_app_config_runtime module~bem_sheath_runtime bem_sheath_runtime module~bem_sheath_runtime->module~bem_sheath_model_core module~bem_sheath_injection_model->module~bem_sheath_runtime module~bem_simulator bem_simulator module~bem_simulator->module~bem_app_config program~main main program~main->module~bem_app_config program~main->module~bem_simulator module~bem_simulator_io bem_simulator_io module~bem_simulator_io->module~bem_simulator module~bem_simulator_loop bem_simulator_loop module~bem_simulator_loop->module~bem_simulator module~bem_simulator_stats bem_simulator_stats module~bem_simulator_stats->module~bem_simulator

Functions

public function compute_inflow_flux_from_drifting_maxwellian(number_density_m3, temperature_k, m_particle, drift_velocity, inward_normal, vmin_normal) result(gamma_in)

drifting Maxwellian の片側流入束 [#/m^2/s] を返す。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: number_density_m3

粒子数密度 [1/m^3]。

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

温度 [K]。

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

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

real(kind=dp), intent(in) :: drift_velocity(3)
real(kind=dp), intent(in) :: inward_normal(3)
real(kind=dp), intent(in), optional :: vmin_normal

法線速度の下限 [m/s](省略時は 0)。

Return Value real(kind=dp)

public function compute_face_area_from_bounds(inject_face, pos_low, pos_high) result(area)

注入面上の矩形開口から有効面積[m^2]を返す。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: inject_face

注入面識別子(x_low/x_high/y_low/y_high/z_low/z_high)。

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

Return Value real(kind=dp)


Subroutines

public subroutine seed_rng(seed)

与えたシード列またはシステム時刻からFortran乱数生成器を初期化する。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in), optional :: seed(:)

public subroutine sample_uniform_positions(low, high, x)

直方体領域 [low, high] 内で一様分布の初期位置をサンプリングする。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: low(3)
real(kind=dp), intent(in) :: high(3)
real(kind=dp), intent(out) :: x(:,:)

public subroutine sample_shifted_maxwell_velocities(drift_velocity, m_particle, v, temperature_k, thermal_speed)

ドリフト速度付きMaxwell分布(温度または熱速度指定)から粒子速度を生成する。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: drift_velocity(3)
real(kind=dp), intent(in) :: m_particle

粒子1個あたりの質量 [kg](temperature_k 指定時に使用)。

real(kind=dp), intent(out) :: v(:,:)
real(kind=dp), intent(in), optional :: temperature_k

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

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

熱速度の標準偏差 sigma [m/s](指定時は温度より優先)。

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](指定時は温度より優先)。

public subroutine compute_macro_particles_for_batch(number_density_m3, temperature_k, m_particle, drift_velocity, box_min, box_max, inject_face, pos_low, pos_high, batch_duration, w_particle, residual, n_macro, vmin_normal)

物理流量・重み・残差から今バッチのマクロ粒子数を決める。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: number_density_m3

粒子数密度 [1/m^3]。

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

温度 [K]。

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

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

real(kind=dp), intent(in) :: drift_velocity(3)
real(kind=dp), intent(in) :: box_min(3)
real(kind=dp), intent(in) :: box_max(3)
character(len=*), intent(in) :: inject_face

注入面識別子(x_low/x_high/y_low/y_high/z_low/z_high)。

real(kind=dp), intent(in) :: pos_low(3)
real(kind=dp), intent(in) :: pos_high(3)
real(kind=dp), intent(in) :: batch_duration

1バッチの物理時間長 [s]。

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

マクロ粒子重み。

real(kind=dp), intent(inout) :: residual

前バッチから繰り越すマクロ粒子端数(呼び出し後に更新)。

integer(kind=i32), intent(out) :: n_macro

今バッチで生成するマクロ粒子数。

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

法線速度の下限 [m/s](省略時は 0)。

public subroutine sample_reservoir_face_particles(box_min, box_max, inject_face, pos_low, pos_high, drift_velocity, m_particle, temperature_k, batch_duration, x, v, barrier_normal_energy, vmin_normal, position_jitter_dt, apply_barrier_energy_shift)

上流リザーバ境界から流入する粒子群を面注入としてサンプルする。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: box_min(3)
real(kind=dp), intent(in) :: box_max(3)
character(len=*), intent(in) :: inject_face

注入面識別子(x_low/x_high/y_low/y_high/z_low/z_high)。

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) :: m_particle

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

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

粒子1個あたりの質量 [kg]。 温度 [K]。

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

粒子1個あたりの質量 [kg]。 温度 [K]。 1バッチの物理時間長 [s](現在は妥当性チェックのみ)。

real(kind=dp), intent(out) :: x(:,:)
real(kind=dp), intent(out) :: v(:,:)
real(kind=dp), intent(in), optional :: barrier_normal_energy

法線方向のエネルギー障壁 2 q Δφ / m [m^2/s^2](省略時 0)。

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

法線速度の下限 [m/s](省略時は barrier_normal_energy から自動導出)。

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

初期位置に速度方向で与えるランダムジッタ時間幅[s](省略時は 0)。

logical, intent(in), optional :: apply_barrier_energy_shift

.true. のとき法線速度へ障壁エネルギー変換を適用する。

public subroutine sample_photo_raycast_particles(mesh, sim, inject_face, pos_low, pos_high, ray_direction, m_particle, temperature_k, normal_drift_speed, emit_current_density_a_m2, q_particle, rays_per_batch, x, v, w, n_emit, emit_elem_idx, global_rays_per_batch, vmin_normal)

光線を注入面からレイキャストし、最初の命中要素から光電子を放出する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(in) :: mesh

交差判定に使うメッシュ。

type(sim_config), intent(in) :: sim

ボックス境界条件とバッチ時間を含むシミュレーション設定。

character(len=*), intent(in) :: inject_face

照射面識別子(x_low/x_high/y_low/y_high/z_low/z_high)。

real(kind=dp), intent(in) :: pos_low(3)
real(kind=dp), intent(in) :: pos_high(3)
real(kind=dp), intent(in) :: ray_direction(3)
real(kind=dp), intent(in) :: m_particle

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

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

粒子1個あたりの質量 [kg]。 放出温度 [K]。

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

粒子1個あたりの質量 [kg]。 放出温度 [K]。 放出法線方向のシフト速度 [m/s]。

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

レイ垂直面基準の放出電流面密度 [A/m^2]。

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

レイ垂直面基準の放出電流面密度 [A/m^2]。 粒子1個あたりの電荷 [C]。

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

このrankで発射するレイ本数。

real(kind=dp), intent(out) :: x(:,:)
real(kind=dp), intent(out) :: v(:,:)
real(kind=dp), intent(out) :: w(:)
integer(kind=i32), intent(out) :: n_emit

実際に放出された粒子数(<= rays_per_batch)。

integer(kind=i32), intent(out), optional :: emit_elem_idx(:)
integer(kind=i32), intent(in), optional :: global_rays_per_batch

全rank合計のレイ本数(省略時は rays_per_batch)。

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

放出法線速度の下限 [m/s](省略時は 0)。