bem_app_config_particle_runtime Module

app_config から粒子源計画と粒子バッチを構築する実行時変換。


Uses

  • module~~bem_app_config_particle_runtime~~UsesGraph module~bem_app_config_particle_runtime bem_app_config_particle_runtime ieee_arithmetic ieee_arithmetic module~bem_app_config_particle_runtime->ieee_arithmetic iso_fortran_env iso_fortran_env module~bem_app_config_particle_runtime->iso_fortran_env module~bem_app_config_potential_runtime bem_app_config_potential_runtime module~bem_app_config_particle_runtime->module~bem_app_config_potential_runtime module~bem_app_config_types bem_app_config_types module~bem_app_config_particle_runtime->module~bem_app_config_types module~bem_collision bem_collision module~bem_app_config_particle_runtime->module~bem_collision module~bem_config_helpers bem_config_helpers module~bem_app_config_particle_runtime->module~bem_config_helpers module~bem_constants bem_constants module~bem_app_config_particle_runtime->module~bem_constants module~bem_electrostatic_snapshot bem_electrostatic_snapshot module~bem_app_config_particle_runtime->module~bem_electrostatic_snapshot module~bem_external_boundary_contract bem_external_boundary_contract module~bem_app_config_particle_runtime->module~bem_external_boundary_contract module~bem_injection bem_injection module~bem_app_config_particle_runtime->module~bem_injection module~bem_kinds bem_kinds module~bem_app_config_particle_runtime->module~bem_kinds module~bem_mpi bem_mpi module~bem_app_config_particle_runtime->module~bem_mpi module~bem_string_utils bem_string_utils module~bem_app_config_particle_runtime->module~bem_string_utils module~bem_types bem_types module~bem_app_config_particle_runtime->module~bem_types module~bem_app_config_potential_runtime->ieee_arithmetic module~bem_app_config_potential_runtime->iso_fortran_env module~bem_app_config_potential_runtime->module~bem_app_config_types module~bem_app_config_potential_runtime->module~bem_config_helpers module~bem_app_config_potential_runtime->module~bem_constants module~bem_app_config_potential_runtime->module~bem_electrostatic_snapshot module~bem_app_config_potential_runtime->module~bem_kinds module~bem_app_config_potential_runtime->module~bem_string_utils module~bem_app_config_potential_runtime->module~bem_types module~bem_app_config_types->module~bem_kinds module~bem_app_config_types->module~bem_types module~bem_physics_config_types bem_physics_config_types module~bem_app_config_types->module~bem_physics_config_types module~bem_collision->ieee_arithmetic module~bem_collision->iso_fortran_env module~bem_collision->module~bem_kinds module~bem_collision->module~bem_string_utils module~bem_collision->module~bem_types module~bem_config_helpers->module~bem_app_config_types module~bem_config_helpers->module~bem_kinds module~bem_config_helpers->module~bem_string_utils module~bem_config_helpers->module~bem_types module~bem_constants->module~bem_kinds module~bem_electrostatic_snapshot->ieee_arithmetic module~bem_electrostatic_snapshot->module~bem_constants module~bem_electrostatic_snapshot->module~bem_kinds module~bem_electrostatic_snapshot->module~bem_string_utils module~bem_electrostatic_snapshot->module~bem_types module~bem_coulomb_fmm_periodic_nonzero_reference bem_coulomb_fmm_periodic_nonzero_reference module~bem_electrostatic_snapshot->module~bem_coulomb_fmm_periodic_nonzero_reference module~bem_coulomb_fmm_periodic_nonzero_upper_vacuum bem_coulomb_fmm_periodic_nonzero_upper_vacuum module~bem_electrostatic_snapshot->module~bem_coulomb_fmm_periodic_nonzero_upper_vacuum module~bem_field_solver bem_field_solver module~bem_electrostatic_snapshot->module~bem_field_solver module~bem_panel_geometry bem_panel_geometry module~bem_electrostatic_snapshot->module~bem_panel_geometry module~bem_panel_kernel bem_panel_kernel module~bem_electrostatic_snapshot->module~bem_panel_kernel module~bem_periodic_zero_mode_eval bem_periodic_zero_mode_eval module~bem_electrostatic_snapshot->module~bem_periodic_zero_mode_eval module~bem_periodic_zero_mode_plan bem_periodic_zero_mode_plan module~bem_electrostatic_snapshot->module~bem_periodic_zero_mode_plan module~bem_electrostatic_snapshot->module~bem_physics_config_types module~bem_external_boundary_contract->module~bem_kinds module~bem_external_boundary_contract->module~bem_string_utils module~bem_injection_flux bem_injection_flux module~bem_injection->module~bem_injection_flux module~bem_injection_geometry bem_injection_geometry module~bem_injection->module~bem_injection_geometry module~bem_injection_random bem_injection_random module~bem_injection->module~bem_injection_random module~bem_injection_velocity_grid bem_injection_velocity_grid module~bem_injection->module~bem_injection_velocity_grid module~bem_photoelectron_injection bem_photoelectron_injection module~bem_injection->module~bem_photoelectron_injection module~bem_kinds->iso_fortran_env module~bem_mpi->module~bem_kinds module~bem_types->module~bem_kinds module~bem_coulomb_fmm_periodic_nonzero_reference->ieee_arithmetic module~bem_coulomb_fmm_periodic_nonzero_reference->module~bem_constants module~bem_coulomb_fmm_periodic_nonzero_reference->module~bem_kinds module~bem_coulomb_fmm_periodic_nonzero_reference->module~bem_types module~bem_coulomb_fmm_periodic_nonzero_reference->module~bem_panel_geometry module~bem_triangle_quadrature bem_triangle_quadrature module~bem_coulomb_fmm_periodic_nonzero_reference->module~bem_triangle_quadrature module~bem_coulomb_fmm_periodic_nonzero_upper_vacuum->ieee_arithmetic module~bem_coulomb_fmm_periodic_nonzero_upper_vacuum->module~bem_constants module~bem_coulomb_fmm_periodic_nonzero_upper_vacuum->module~bem_kinds module~bem_coulomb_fmm_periodic_nonzero_upper_vacuum->module~bem_types module~bem_field_solver->ieee_arithmetic module~bem_field_solver->module~bem_constants module~bem_field_solver->module~bem_kinds module~bem_field_solver->module~bem_string_utils module~bem_field_solver->module~bem_types module~bem_field_solver->module~bem_physics_config_types module~bem_coulomb_fmm_core bem_coulomb_fmm_core module~bem_field_solver->module~bem_coulomb_fmm_core module~bem_injection_flux->ieee_arithmetic module~bem_injection_flux->module~bem_constants module~bem_injection_flux->module~bem_kinds module~bem_injection_flux->module~bem_injection_geometry module~bem_injection_flux->module~bem_injection_random module~bem_injection_geometry->module~bem_kinds module~bem_injection_geometry->module~bem_string_utils module~bem_injection_random->module~bem_constants module~bem_injection_random->module~bem_kinds module~bem_injection_random->module~bem_types module~bem_particles bem_particles module~bem_injection_random->module~bem_particles module~bem_injection_velocity_grid->ieee_arithmetic module~bem_injection_velocity_grid->module~bem_kinds module~bem_injection_velocity_grid->module~bem_string_utils module~bem_injection_velocity_grid->module~bem_injection_geometry module~bem_panel_geometry->ieee_arithmetic module~bem_panel_geometry->module~bem_kinds module~bem_panel_kernel->module~bem_constants module~bem_panel_kernel->module~bem_kinds module~bem_panel_kernel->module~bem_panel_geometry module~bem_panel_self_terms bem_panel_self_terms module~bem_panel_kernel->module~bem_panel_self_terms module~bem_periodic_zero_mode_eval->module~bem_constants module~bem_periodic_zero_mode_eval->module~bem_kinds module~bem_periodic_zero_mode_eval->module~bem_periodic_zero_mode_plan module~bem_periodic_zero_mode_plan->ieee_arithmetic module~bem_periodic_zero_mode_plan->module~bem_constants module~bem_periodic_zero_mode_plan->module~bem_kinds module~bem_periodic_zero_mode_plan->module~bem_types module~bem_photoelectron_injection->iso_fortran_env module~bem_photoelectron_injection->module~bem_collision module~bem_photoelectron_injection->module~bem_constants module~bem_photoelectron_injection->module~bem_kinds module~bem_photoelectron_injection->module~bem_string_utils module~bem_photoelectron_injection->module~bem_types module~bem_photoelectron_injection->module~bem_injection_flux module~bem_photoelectron_injection->module~bem_injection_geometry module~bem_photoelectron_injection->module~bem_injection_random module~bem_boundary bem_boundary module~bem_photoelectron_injection->module~bem_boundary module~bem_physics_config_types->ieee_arithmetic module~bem_physics_config_types->module~bem_kinds module~bem_physics_config_types->module~bem_string_utils module~bem_physics_config_types->module~bem_types module~bem_boundary->ieee_arithmetic module~bem_boundary->module~bem_kinds module~bem_boundary->module~bem_types module~bem_coulomb_fmm_core->module~bem_kinds module~bem_coulomb_fmm_types bem_coulomb_fmm_types module~bem_coulomb_fmm_core->module~bem_coulomb_fmm_types module~bem_panel_self_terms->module~bem_kinds module~bem_panel_self_terms->module~bem_panel_geometry module~bem_particles->module~bem_kinds module~bem_particles->module~bem_types module~bem_triangle_quadrature->module~bem_constants module~bem_triangle_quadrature->module~bem_kinds module~bem_triangle_quadrature->module~bem_panel_geometry module~bem_coulomb_fmm_types->module~bem_kinds module~bem_coulomb_fmm_types->module~bem_panel_geometry module~bem_coulomb_fmm_types->module~bem_periodic_zero_mode_plan

Used by

  • module~~bem_app_config_particle_runtime~~UsedByGraph module~bem_app_config_particle_runtime bem_app_config_particle_runtime module~bem_app_config_particle_runtime_batch bem_app_config_particle_runtime_batch module~bem_app_config_particle_runtime_batch->module~bem_app_config_particle_runtime module~bem_app_config_particle_runtime_sampling bem_app_config_particle_runtime_sampling module~bem_app_config_particle_runtime_sampling->module~bem_app_config_particle_runtime module~bem_app_config_runtime bem_app_config_runtime module~bem_app_config_runtime->module~bem_app_config_particle_runtime module~bem_app_config bem_app_config module~bem_app_config->module~bem_app_config_runtime module~bem_simulator bem_simulator module~bem_simulator->module~bem_app_config_runtime module~bem_simulator->module~bem_app_config module~bem_simulator_io bem_simulator_io module~bem_simulator_io->module~bem_app_config_runtime module~bem_simulator_io->module~bem_simulator module~bem_simulator_loop bem_simulator_loop module~bem_simulator_loop->module~bem_app_config_runtime module~bem_simulator_loop->module~bem_simulator module~bem_matching_plane_coupling bem_matching_plane_coupling module~bem_simulator_loop->module~bem_matching_plane_coupling module~bem_matching_plane_coupling->module~bem_app_config module~bem_simulator_charge bem_simulator_charge module~bem_simulator_charge->module~bem_simulator module~bem_simulator_particles bem_simulator_particles module~bem_simulator_particles->module~bem_simulator module~bem_simulator_stats bem_simulator_stats module~bem_simulator_stats->module~bem_simulator program~main main program~main->module~bem_app_config program~main->module~bem_simulator program~zhao_atlas_main zhao_atlas_main program~zhao_atlas_main->module~bem_app_config program~zhao_response_main zhao_response_main program~zhao_response_main->module~bem_app_config

Interfaces

interface

  • public module subroutine init_particle_batch_from_config(cfg, batch_idx, pcls, state, mesh, photo_emission_dq, mpi_rank, mpi_size, mpi, collision_failure_status, collision_failure_species, collision_failure_ray, collision_failure_bounce, snapshot, source_plan, photo_emission_dq_by_species)

    Arguments

    Type IntentOptional Attributes Name
    type(app_config), intent(in) :: cfg
    integer(kind=i32), intent(in) :: batch_idx
    type(particles_soa), intent(out) :: pcls
    type(injection_state), intent(inout), optional :: state
    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
    integer(kind=i32), intent(out), optional :: collision_failure_status
    integer(kind=i32), intent(out), optional :: collision_failure_species
    integer(kind=i32), intent(out), optional :: collision_failure_ray
    integer(kind=i32), intent(out), optional :: collision_failure_bounce
    type(electrostatic_snapshot_type), intent(inout), optional :: snapshot
    type(particle_source_plan_type), intent(in), optional, target :: source_plan
    real(kind=dp), intent(out), optional :: photo_emission_dq_by_species(:,:)

interface

  • public module subroutine sample_species_state(sim, spec, n, x, v, barrier_normal_energy, vmin_normal, apply_barrier_energy_shift, temperature_k_override, drift_velocity_override)

    Arguments

    Type IntentOptional Attributes Name
    type(sim_config), intent(in) :: sim
    type(particle_species_spec), intent(in) :: spec
    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
    real(kind=dp), intent(in), optional :: vmin_normal
    logical, intent(in), optional :: apply_barrier_energy_shift
    real(kind=dp), intent(in), optional :: temperature_k_override
    real(kind=dp), intent(in), optional :: drift_velocity_override(3)

interface

  • public module subroutine sample_photo_species_state(sim, spec, mesh, n_rays, x, v, w, n_emit, emit_elem_idx, global_rays_per_batch, emit_current_density_override, normal_drift_speed_override, vmin_normal, collision_failure_status, collision_failure_ray, collision_failure_bounce)

    Arguments

    Type IntentOptional Attributes Name
    type(sim_config), intent(in) :: sim
    type(particle_species_spec), intent(in) :: spec
    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
    real(kind=dp), intent(in), optional :: normal_drift_speed_override
    real(kind=dp), intent(in), optional :: vmin_normal
    integer(kind=i32), intent(out), optional :: collision_failure_status
    integer(kind=i32), intent(out), optional :: collision_failure_ray
    integer(kind=i32), intent(out), optional :: collision_failure_bounce

interface

  • public module subroutine reservoir_face_velocity_correction(cfg, spec, vmin_normal, barrier_normal, mesh, snapshot, warn_face_variation, boundary_contract)

    Arguments

    Type IntentOptional Attributes Name
    type(app_config), intent(in) :: cfg
    type(particle_species_spec), intent(in) :: spec
    real(kind=dp), intent(out) :: vmin_normal
    real(kind=dp), intent(out) :: barrier_normal
    type(mesh_type), intent(in), optional :: mesh
    type(electrostatic_snapshot_type), intent(inout), optional :: snapshot
    logical, intent(in), optional :: warn_face_variation
    type(external_boundary_contract_type), intent(in), optional :: boundary_contract

interface

  • public module subroutine external_kinetic_face_velocity_correction(cfg, spec, reservoir_potential_v, access_potential_v, vmin_normal, barrier_normal, mesh, snapshot, warn_face_variation)

    Arguments

    Type IntentOptional Attributes Name
    type(app_config), intent(in) :: cfg
    type(particle_species_spec), intent(in) :: spec
    real(kind=dp), intent(in) :: reservoir_potential_v
    real(kind=dp), intent(in) :: access_potential_v
    real(kind=dp), intent(out) :: vmin_normal
    real(kind=dp), intent(out) :: barrier_normal
    type(mesh_type), intent(in), optional :: mesh
    type(electrostatic_snapshot_type), intent(inout), optional :: snapshot
    logical, intent(in), optional :: warn_face_variation

Derived Types

type, public ::  particle_source_plan_type


Functions

public pure function has_boundary_inflow(spec) result(has_inflow)

speciesに外部 reservoir 流入を指定したbox面があるかを返す。

Arguments

Type IntentOptional Attributes Name
type(particle_species_spec), intent(in) :: spec

Return Value logical

public pure function boundary_inflow_face_enabled(spec, face) result(enabled)

face bit順の面に reservoir 流入が有効かを返す。

Arguments

Type IntentOptional Attributes Name
type(particle_species_spec), intent(in) :: spec
integer(kind=i32), intent(in) :: face

Return Value logical

public pure function injection_face_index(face_name) result(face)

面名をboundary bit順のindexへ変換する。

Arguments

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

Return Value integer(kind=i32)

public pure function species_number_density_m3(spec) result(number_density_m3)

粒子種設定から実効密度[m^-3]を返す。

Arguments

Type IntentOptional Attributes Name
type(particle_species_spec), intent(in) :: spec

粒子種設定。

Return Value real(kind=dp)

public pure function species_temperature_k(spec) result(temperature_k)

粒子種設定から実効温度[K]を返す。

Arguments

Type IntentOptional Attributes Name
type(particle_species_spec), intent(in) :: spec

粒子種設定。

Return Value real(kind=dp)


Subroutines

public subroutine seed_particles_from_config(cfg, mpi_rank, mpi_size, mpi)

バッチ生成前に乱数シードだけを初期化する。

Arguments

Type IntentOptional Attributes Name
type(app_config), intent(in) :: cfg

乱数シード値 sim.rng_seed を含むアプリ設定。

integer(kind=i32), intent(in), optional :: mpi_rank
integer(kind=i32), intent(in), optional :: mpi_size
type(mpi_context), intent(in), optional :: mpi

public subroutine build_particle_source_plan(cfg, plan, mpi_rank, mpi_size, mpi, kinetic_inflow_active, kinetic_reservoir_potential_v, kinetic_access_potential_v, kinetic_inflow_face, number_flux_override_active, number_flux_override_m2_s)

設定とMPI配置だけに依存する粒子 source の導出値を構築する。 乱数、残差、mesh/snapshot依存の障壁は扱わず、run中に不変な値だけを保持する。

Arguments

Type IntentOptional Attributes Name
type(app_config), intent(in) :: cfg
type(particle_source_plan_type), intent(out) :: plan
integer(kind=i32), intent(in), optional :: mpi_rank
integer(kind=i32), intent(in), optional :: mpi_size
type(mpi_context), intent(in), optional :: mpi
logical, intent(in), optional :: kinetic_inflow_active(:)
real(kind=dp), intent(in), optional :: kinetic_reservoir_potential_v(:)
real(kind=dp), intent(in), optional :: kinetic_access_potential_v(:)
integer(kind=i32), intent(in), optional :: kinetic_inflow_face(:)
logical, intent(in), optional :: number_flux_override_active(:)
real(kind=dp), intent(in), optional :: number_flux_override_m2_s(:)

public pure subroutine normalize_reservoir_positions(sim, x)

reservoir/plane sourceの初期位置を、設定されたbox境界条件に従って有効領域へ正規化する。

Arguments

Type IntentOptional Attributes Name
type(sim_config), intent(in) :: sim
real(kind=dp), intent(inout) :: x(:,:)

public pure subroutine make_boundary_inflow_spec(sim, source_spec, face, inflow_spec)

box全面を開口とする一時的な legacy reservoir spec を構築する。

Arguments

Type IntentOptional Attributes Name
type(sim_config), intent(in) :: sim
type(particle_species_spec), intent(in) :: source_spec
integer(kind=i32), intent(in) :: face
type(particle_species_spec), intent(out) :: inflow_spec

public pure subroutine configure_plane_source_box(spec, box_min, box_max)

plane_sourceの内部面をlegacy face samplerの仮想box境界へ写像する。

Arguments

Type IntentOptional Attributes Name
type(particle_species_spec), intent(in) :: spec
real(kind=dp), intent(inout) :: box_min(3)
real(kind=dp), intent(inout) :: box_max(3)

public pure subroutine boundary_face_name(face, name)

face bit順の面名を返す。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: face
character(len=*), intent(out) :: name

public subroutine compute_macro_particles_for_species(sim, spec, residual, count, vmin_normal, number_density_override, w_particle_override, temperature_k_override, drift_velocity_override, particle_flux_override, use_particle_flux_override)

reservoir_face 用に、物理流量と残差から今バッチのマクロ粒子数を決める。

Arguments

Type IntentOptional 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 :: 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)
real(kind=dp), intent(in), optional :: particle_flux_override

粒子数 flux の上書き値 [1/m^2/s]。

logical, intent(in), optional :: use_particle_flux_override

public subroutine resolve_parallel_rank_size(local_rank, n_ranks, mpi_rank, mpi_size, mpi, caller_name)

併存対応のため mpi_context と rank/size の両方を受け、最終的なrank/sizeを解決する。

Arguments

Type IntentOptional 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