app_config からメッシュ・粒子群を構築する実行時変換モジュール。
粒子種設定から実効密度[m^-3]を返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(particle_species_spec), | intent(in) | :: | spec |
粒子種設定。 |
粒子種設定から実効温度[K]を返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(particle_species_spec), | intent(in) | :: | spec |
粒子種設定。 |
mesh_mode と OBJ ファイル有無に応じてメッシュ生成方法を選ぶ。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg |
メッシュ入力設定を含むアプリ設定。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
構築した三角形メッシュ。 |
OBJ メッシュの全頂点にスケール→回転→平行移動を適用し再初期化する。 変換順序: v_new = R(rotation) * (v_old * scale) + offset 回転は度単位で x→y→z の順に外因性 (extrinsic) 回転を適用する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(inout) | :: | mesh |
変換対象の三角形メッシュ。 |
||
| real(kind=dp), | intent(in) | :: | scale |
一様スケーリング係数。 |
||
| real(kind=dp), | intent(in) | :: | rotation_deg(3) | |||
| real(kind=dp), | intent(in) | :: | offset(3) |
設定全体ぶんの粒子群を生成し、SoA へ詰める。 粒子種ごとに乱数サンプルした後、種ごとに rank を揃えて interleave する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg |
粒子種設定を含むアプリ設定。 |
||
| type(particles_soa), | intent(out) | :: | pcls |
生成した全粒子群。 |
バッチ生成前に乱数シードだけを初期化する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg |
乱数シード値 |
||
| integer(kind=i32), | intent(in), | optional | :: | mpi_rank | ||
| integer(kind=i32), | intent(in), | optional | :: | mpi_size | ||
| type(mpi_context), | intent(in), | optional | :: | mpi |
指定バッチ番号に対応する粒子バッチを生成する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg |
粒子種とシミュレーション条件を含むアプリ設定。 |
||
| integer(kind=i32), | intent(in) | :: | batch_idx |
生成対象のバッチ番号(1始まり)。 |
||
| type(particles_soa), | intent(out) | :: | pcls |
生成したバッチ粒子群。 |
||
| type(injection_state), | intent(inout), | optional | :: | state |
reservoir_face 注入の残差状態(必要時のみ)。 |
|
| type(mesh_type), | intent(in), | optional | :: | mesh |
現在バッチ開始時点の電荷分布メッシュ(電位補正時に必要)。 |
|
| real(kind=dp), | intent(out), | optional | :: | photo_emission_dq(:) | ||
| integer(kind=i32), | intent(in), | optional | :: | mpi_rank | ||
| integer(kind=i32), | intent(in), | optional | :: | mpi_size | ||
| type(mpi_context), | intent(in), | optional | :: | mpi |
1粒子種ぶんの位置・速度サンプルをまとめて生成する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sim_config), | intent(in) | :: | sim |
ボックス境界・バッチ時間などのシミュレーション設定。 |
||
| type(particle_species_spec), | intent(in) | :: | spec |
1粒子種の注入設定。 |
||
| integer(kind=i32), | intent(in) | :: | n |
生成粒子数。 |
||
| real(kind=dp), | intent(out) | :: | x(:,:) | |||
| real(kind=dp), | intent(out) | :: | v(:,:) | |||
| real(kind=dp), | intent(in), | optional | :: | barrier_normal_energy |
reservoir_face 法線方向のエネルギー障壁 |
|
| real(kind=dp), | intent(in), | optional | :: | vmin_normal |
reservoir_face 法線速度の下限 [m/s]。 |
|
| logical, | intent(in), | optional | :: | apply_barrier_energy_shift |
reservoir_face 法線速度へ障壁エネルギー変換を適用するか。 |
|
| real(kind=dp), | intent(in), | optional | :: | temperature_k_override | ||
| real(kind=dp), | intent(in), | optional | :: | drift_velocity_override(3) |
photo_raycast 粒子種のレイキャスト放出を実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sim_config), | intent(in) | :: | sim |
シミュレーション設定。 |
||
| type(particle_species_spec), | intent(in) | :: | spec |
photo_raycast 粒子種設定。 |
||
| type(mesh_type), | intent(in) | :: | mesh |
交差判定に使う現在メッシュ。 |
||
| integer(kind=i32), | intent(in) | :: | n_rays |
バッチで発射するレイ本数。 |
||
| 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 |
実際に放出された粒子数。 |
||
| integer(kind=i32), | intent(out), | optional | :: | emit_elem_idx(:) | ||
| integer(kind=i32), | intent(in), | optional | :: | global_rays_per_batch | ||
| real(kind=dp), | intent(in), | optional | :: | emit_current_density_override |
放出電流密度の上書き値 [A/m^2]。 |
|
| real(kind=dp), | intent(in), | optional | :: | normal_drift_speed_override |
放出法線ドリフトの上書き値 [m/s]。 |
|
| real(kind=dp), | intent(in), | optional | :: | vmin_normal |
放出法線速度の下限 [m/s]。 |
reservoir_face 用に、物理流量と残差から今バッチのマクロ粒子数を決める。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sim_config), | intent(in) | :: | sim |
ボックス境界・バッチ時間などのシミュレーション設定。 |
||
| type(particle_species_spec), | intent(in) | :: | spec |
reservoir_face 粒子種設定。 |
||
| real(kind=dp), | intent(inout) | :: | residual |
前バッチから繰り越した端数。 |
||
| integer(kind=i32), | intent(out) | :: | count |
今バッチで生成するマクロ粒子数。 |
||
| real(kind=dp), | intent(in), | optional | :: | vmin_normal |
法線速度の下限 [m/s](省略時は 0)。 |
|
| real(kind=dp), | intent(in), | optional | :: | batch_duration_scale | ||
| real(kind=dp), | intent(in), | optional | :: | number_density_override |
数密度の上書き値 [1/m^3]。 |
|
| real(kind=dp), | intent(in), | optional | :: | w_particle_override |
マクロ粒子重みの上書き値。 |
|
| real(kind=dp), | intent(in), | optional | :: | temperature_k_override |
温度の上書き値 [K]。 |
|
| real(kind=dp), | intent(in), | optional | :: | drift_velocity_override(3) |
reservoir_face の target 個数からシース補正込み重みを解決する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sim_config), | intent(in) | :: | sim |
シミュレーション設定。 |
||
| type(particle_species_spec), | intent(in) | :: | spec |
reservoir_face 粒子種設定。 |
||
| real(kind=dp), | intent(in) | :: | number_density_m3 |
実効数密度 [1/m^3]。 |
||
| real(kind=dp), | intent(in) | :: | vmin_normal |
実効数密度 [1/m^3]。 法線速度の下限 [m/s]。 |
||
| real(kind=dp), | intent(in) | :: | temperature_k |
実効数密度 [1/m^3]。 法線速度の下限 [m/s]。 実効温度 [K]。 |
||
| real(kind=dp), | intent(in) | :: | drift_velocity(3) |
実効数密度 [1/m^3]。 法線速度の下限 [m/s]。 実効温度 [K]。 |
||
| integer(kind=i32), | intent(in) | :: | target_macro_particles_per_batch |
目標マクロ粒子数。 |
||
| real(kind=dp), | intent(out) | :: | w_particle |
解決したマクロ粒子重み。 |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | drift_velocity(3) | |||
| real(kind=dp), | intent(in) | :: | inward_normal(3) | |||
| real(kind=dp), | intent(in) | :: | normal_speed | |||
| real(kind=dp), | intent(out) | :: | drift_velocity_out(3) |
reservoir_face 注入に対する法線速度補正パラメータを計算する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(sim_config), | intent(in) | :: | sim |
シミュレーション設定。 |
||
| type(particle_species_spec), | intent(in) | :: | spec |
reservoir_face 粒子種設定。 |
||
| real(kind=dp), | intent(out) | :: | vmin_normal |
無限遠法線速度の下限 [m/s]。 |
||
| real(kind=dp), | intent(out) | :: | barrier_normal |
法線エネルギー障壁 |
||
| type(mesh_type), | intent(in), | optional | :: | mesh |
現在バッチ開始時点の電荷分布メッシュ(補正時に必要)。 |
reservoir_face 開口面の平均電位を N x N 格子平均で評価する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(in) | :: | mesh |
現在バッチ開始時点の電荷分布メッシュ。 |
||
| type(sim_config), | intent(in) | :: | sim |
シミュレーション設定。 |
||
| type(particle_species_spec), | intent(in) | :: | spec |
reservoir_face 粒子種設定。 |
||
| real(kind=dp), | intent(out) | :: | phi_face |
注入開口面の平均電位 [V]。 |
注入面名から法線軸・接線軸・境界値・内向き法線を返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | box_min(3) | |||
| real(kind=dp), | intent(in) | :: | box_max(3) | |||
| character(len=*), | intent(in) | :: | inject_face |
注入面識別子。 |
||
| integer, | intent(out) | :: | axis_n |
法線軸インデックス(1:x, 2:y, 3:z)。 |
||
| integer, | intent(out) | :: | axis_t1 |
法線軸インデックス(1:x, 2:y, 3:z)。 第1接線軸インデックス。 |
||
| integer, | intent(out) | :: | axis_t2 |
法線軸インデックス(1:x, 2:y, 3:z)。 第1接線軸インデックス。 第2接線軸インデックス。 |
||
| real(kind=dp), | intent(out) | :: | boundary_value |
注入面の境界座標値 [m]。 |
||
| real(kind=dp), | intent(out) | :: | inward_normal(3) |
併存対応のため mpi_context と rank/size の両方を受け、最終的なrank/sizeを解決する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i32), | intent(out) | :: | local_rank | |||
| integer(kind=i32), | intent(out) | :: | n_ranks | |||
| integer(kind=i32), | intent(in), | optional | :: | mpi_rank | ||
| integer(kind=i32), | intent(in), | optional | :: | mpi_size | ||
| type(mpi_context), | intent(in), | optional | :: | mpi | ||
| character(len=*), | intent(in) | :: | caller_name |
有効なテンプレートを連結し、1つのメッシュへまとめる。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg |
テンプレート設定を含むアプリ設定。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
連結後の三角形メッシュ。 |
テンプレート種別に応じて形状生成ルーチンへディスパッチする。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(template_spec), | intent(in) | :: | spec |
1テンプレート分の形状設定。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
生成したテンプレートメッシュ。 |
既存三角形配列へ追加分を連結し、再確保後の配列へ差し替える。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout), | allocatable | :: | v0(:,:) | ||
| real(kind=dp), | intent(inout), | allocatable | :: | v1(:,:) | ||
| real(kind=dp), | intent(inout), | allocatable | :: | v2(:,:) | ||
| real(kind=dp), | intent(in) | :: | add_v0(:,:) | |||
| real(kind=dp), | intent(in) | :: | add_v1(:,:) | |||
| real(kind=dp), | intent(in) | :: | add_v2(:,:) |
既存の要素メッシュID配列へ追加分を連結する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i32), | intent(inout), | allocatable | :: | mesh_ids(:) | ||
| integer(kind=i32), | intent(in) | :: | add_ids(:) |