bem_coulomb_fmm_core.f90 Source File


This file depends on

sourcefile~~bem_coulomb_fmm_core.f90~~EfferentGraph sourcefile~bem_coulomb_fmm_core.f90 bem_coulomb_fmm_core.f90 sourcefile~bem_coulomb_fmm_types.f90 bem_coulomb_fmm_types.f90 sourcefile~bem_coulomb_fmm_core.f90->sourcefile~bem_coulomb_fmm_types.f90 sourcefile~bem_kinds.f90 bem_kinds.f90 sourcefile~bem_coulomb_fmm_core.f90->sourcefile~bem_kinds.f90 sourcefile~bem_mpi.f90 bem_mpi.F90 sourcefile~bem_coulomb_fmm_core.f90->sourcefile~bem_mpi.f90 sourcefile~bem_coulomb_fmm_types.f90->sourcefile~bem_kinds.f90 sourcefile~bem_coulomb_fmm_types.f90->sourcefile~bem_mpi.f90 sourcefile~bem_panel_geometry.f90 bem_panel_geometry.f90 sourcefile~bem_coulomb_fmm_types.f90->sourcefile~bem_panel_geometry.f90 sourcefile~bem_periodic_shell_mean.f90 bem_periodic_shell_mean.f90 sourcefile~bem_coulomb_fmm_types.f90->sourcefile~bem_periodic_shell_mean.f90 sourcefile~bem_periodic_zero_mode_plan.f90 bem_periodic_zero_mode_plan.f90 sourcefile~bem_coulomb_fmm_types.f90->sourcefile~bem_periodic_zero_mode_plan.f90 sourcefile~bem_mpi.f90->sourcefile~bem_kinds.f90 sourcefile~bem_panel_geometry.f90->sourcefile~bem_kinds.f90 sourcefile~bem_periodic_shell_mean.f90->sourcefile~bem_kinds.f90 sourcefile~bem_periodic_zero_mode_plan.f90->sourcefile~bem_kinds.f90 sourcefile~bem_constants.f90 bem_constants.f90 sourcefile~bem_periodic_zero_mode_plan.f90->sourcefile~bem_constants.f90 sourcefile~bem_sorting.f90 bem_sorting.f90 sourcefile~bem_periodic_zero_mode_plan.f90->sourcefile~bem_sorting.f90 sourcefile~bem_types.f90 bem_types.f90 sourcefile~bem_periodic_zero_mode_plan.f90->sourcefile~bem_types.f90 sourcefile~bem_constants.f90->sourcefile~bem_kinds.f90 sourcefile~bem_sorting.f90->sourcefile~bem_kinds.f90 sourcefile~bem_types.f90->sourcefile~bem_kinds.f90 sourcefile~bem_outflow_spectrum.f90 bem_outflow_spectrum.f90 sourcefile~bem_types.f90->sourcefile~bem_outflow_spectrum.f90 sourcefile~bem_outflow_spectrum.f90->sourcefile~bem_kinds.f90

Files dependent on this one

sourcefile~~bem_coulomb_fmm_core.f90~~AfferentGraph sourcefile~bem_coulomb_fmm_core.f90 bem_coulomb_fmm_core.f90 sourcefile~bem_coulomb_fmm_core_build.f90 bem_coulomb_fmm_core_build.f90 sourcefile~bem_coulomb_fmm_core_build.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_coulomb_fmm_core_eval.f90 bem_coulomb_fmm_core_eval.f90 sourcefile~bem_coulomb_fmm_core_eval.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_coulomb_fmm_core_state.f90 bem_coulomb_fmm_core_state.f90 sourcefile~bem_coulomb_fmm_core_state.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_field_kernel_c.f90 bem_field_kernel_c.f90 sourcefile~bem_field_kernel_c.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_field_solver.f90 bem_field_solver.f90 sourcefile~bem_field_solver.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_field_solver_config.f90 bem_field_solver_config.f90 sourcefile~bem_field_solver_config.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_field_solver_config.f90->sourcefile~bem_field_solver.f90 sourcefile~bem_field_solver_eval.f90 bem_field_solver_eval.f90 sourcefile~bem_field_solver_eval.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_field_solver_eval.f90->sourcefile~bem_field_solver.f90 sourcefile~bem_field_solver_fmm.f90 bem_field_solver_fmm.f90 sourcefile~bem_field_solver_fmm.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_field_solver_fmm.f90->sourcefile~bem_field_solver.f90 sourcefile~bem_electrostatic_snapshot.f90 bem_electrostatic_snapshot.f90 sourcefile~bem_electrostatic_snapshot.f90->sourcefile~bem_field_solver.f90 sourcefile~bem_field_solver_tree.f90 bem_field_solver_tree.f90 sourcefile~bem_field_solver_tree.f90->sourcefile~bem_field_solver.f90 sourcefile~bem_output_writer_summary.f90 bem_output_writer_summary.f90 sourcefile~bem_output_writer_summary.f90->sourcefile~bem_field_solver.f90 sourcefile~bem_output_writer.f90 bem_output_writer.f90 sourcefile~bem_output_writer_summary.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_app_config_particle_runtime.f90 bem_app_config_particle_runtime.f90 sourcefile~bem_app_config_particle_runtime.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~bem_app_config_potential_runtime.f90 bem_app_config_potential_runtime.f90 sourcefile~bem_app_config_particle_runtime.f90->sourcefile~bem_app_config_potential_runtime.f90 sourcefile~bem_app_config_potential_runtime.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~bem_electrostatic_snapshot_eval.f90 bem_electrostatic_snapshot_eval.f90 sourcefile~bem_electrostatic_snapshot_eval.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~bem_electrostatic_snapshot_upper_fourier.f90 bem_electrostatic_snapshot_upper_fourier.f90 sourcefile~bem_electrostatic_snapshot_upper_fourier.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~bem_output_writer.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~bem_particle_stepper.f90 bem_particle_stepper.f90 sourcefile~bem_particle_stepper.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~bem_simulator.f90 bem_simulator.f90 sourcefile~bem_simulator.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~bem_simulator.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_simulator.f90->sourcefile~bem_particle_stepper.f90 sourcefile~bem_surface_models.f90 bem_surface_models.f90 sourcefile~bem_simulator.f90->sourcefile~bem_surface_models.f90 sourcefile~bem_app_config_runtime.f90 bem_app_config_runtime.f90 sourcefile~bem_simulator.f90->sourcefile~bem_app_config_runtime.f90 sourcefile~bem_run_outputs.f90 bem_run_outputs.f90 sourcefile~bem_simulator.f90->sourcefile~bem_run_outputs.f90 sourcefile~bem_app_config.f90 bem_app_config.f90 sourcefile~bem_simulator.f90->sourcefile~bem_app_config.f90 sourcefile~bem_surface_models.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~main.f90 main.f90 sourcefile~main.f90->sourcefile~bem_electrostatic_snapshot.f90 sourcefile~main.f90->sourcefile~bem_output_writer.f90 sourcefile~main.f90->sourcefile~bem_simulator.f90 sourcefile~bem_periodic_checkpoint.f90 bem_periodic_checkpoint.f90 sourcefile~main.f90->sourcefile~bem_periodic_checkpoint.f90 sourcefile~main.f90->sourcefile~bem_run_outputs.f90 sourcefile~main.f90->sourcefile~bem_app_config.f90 sourcefile~bem_app_config_particle_runtime_batch.f90 bem_app_config_particle_runtime_batch.f90 sourcefile~bem_app_config_particle_runtime_batch.f90->sourcefile~bem_app_config_particle_runtime.f90 sourcefile~bem_app_config_particle_runtime_sampling.f90 bem_app_config_particle_runtime_sampling.f90 sourcefile~bem_app_config_particle_runtime_sampling.f90->sourcefile~bem_app_config_particle_runtime.f90 sourcefile~bem_app_config_particle_runtime_slots.f90 bem_app_config_particle_runtime_slots.f90 sourcefile~bem_app_config_particle_runtime_slots.f90->sourcefile~bem_app_config_particle_runtime.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_app_config_particle_runtime.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_app_config_potential_runtime.f90 sourcefile~bem_output_writer_files.f90 bem_output_writer_files.f90 sourcefile~bem_output_writer_files.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_output_writer_history.f90 bem_output_writer_history.f90 sourcefile~bem_output_writer_history.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_periodic_checkpoint.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_run_outputs.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_run_outputs.f90->sourcefile~bem_periodic_checkpoint.f90 sourcefile~bem_simulator_charge.f90 bem_simulator_charge.f90 sourcefile~bem_simulator_charge.f90->sourcefile~bem_simulator.f90 sourcefile~bem_simulator_io.f90 bem_simulator_io.f90 sourcefile~bem_simulator_io.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_simulator_io.f90->sourcefile~bem_simulator.f90 sourcefile~bem_simulator_io.f90->sourcefile~bem_app_config_runtime.f90 sourcefile~bem_simulator_loop.f90 bem_simulator_loop.f90 sourcefile~bem_simulator_loop.f90->sourcefile~bem_output_writer.f90 sourcefile~bem_simulator_loop.f90->sourcefile~bem_simulator.f90 sourcefile~bem_simulator_loop.f90->sourcefile~bem_app_config_runtime.f90 sourcefile~bem_simulator_loop.f90->sourcefile~bem_periodic_checkpoint.f90 sourcefile~bem_simulator_loop.f90->sourcefile~bem_run_outputs.f90 sourcefile~bem_zhao_outflow_refresh.f90 bem_zhao_outflow_refresh.f90 sourcefile~bem_simulator_loop.f90->sourcefile~bem_zhao_outflow_refresh.f90 sourcefile~bem_simulator_particles.f90 bem_simulator_particles.f90 sourcefile~bem_simulator_particles.f90->sourcefile~bem_particle_stepper.f90 sourcefile~bem_simulator_particles.f90->sourcefile~bem_simulator.f90 sourcefile~bem_simulator_stats.f90 bem_simulator_stats.f90 sourcefile~bem_simulator_stats.f90->sourcefile~bem_simulator.f90 sourcefile~bem_surface_models_conductor.f90 bem_surface_models_conductor.f90 sourcefile~bem_surface_models_conductor.f90->sourcefile~bem_surface_models.f90 sourcefile~bem_app_config.f90->sourcefile~bem_app_config_runtime.f90 sourcefile~bem_zhao_outflow_refresh.f90->sourcefile~bem_app_config.f90

Source Code

!> `mesh_type` や `sim_config` に依存しない Coulomb FMM コア API。
module bem_coulomb_fmm_core
  use bem_kinds, only: dp
  use bem_coulomb_fmm_types, only: fmm_options_type, fmm_plan_type, fmm_state_type
  use bem_mpi, only: mpi_context
  implicit none
  private

  public :: fmm_options_type
  public :: fmm_plan_type
  public :: fmm_state_type
  public :: build_plan
  public :: build_panel_plan
  public :: prepare_panel_sources
  public :: complete_plan
  public :: update_state
  public :: eval_points
  public :: eval_direct_points
  public :: eval_point
  public :: eval_potential_points
  public :: eval_direct_potential_points
  public :: eval_potential_point
  public :: destroy_plan
  public :: destroy_state

  interface
    !> FMM 計画を構築する。
    !! @param[out] plan 構築先の計画。
    !! @param[in] src_pos ソース位置 `(3,n)` [m]。
    !! @param[in] options FMM 設定。
    module subroutine build_plan(plan, src_pos, options)
      type(fmm_plan_type), intent(inout) :: plan
      real(dp), intent(in) :: src_pos(:, :)
      type(fmm_options_type), intent(in) :: options
    end subroutine build_plan

    module subroutine build_panel_plan(plan, v0, v1, v2, options)
      type(fmm_plan_type), intent(inout) :: plan
      real(dp), intent(in) :: v0(:, :), v1(:, :), v2(:, :)
      type(fmm_options_type), intent(in) :: options
    end subroutine build_panel_plan

    !> パネルソースの幾何だけを準備する(`build_panel_plan` の前半)。exact-direct 評価はこれで足りる。
    module subroutine prepare_panel_sources(plan, v0, v1, v2, options)
      type(fmm_plan_type), intent(inout) :: plan
      real(dp), intent(in) :: v0(:, :), v1(:, :), v2(:, :)
      type(fmm_options_type), intent(in) :: options
    end subroutine prepare_panel_sources

    !> `prepare_panel_sources` 済みの計画に木・相互作用・演算子を加え、`build_panel_plan` と同じ計画にする。
    module subroutine complete_plan(plan)
      type(fmm_plan_type), intent(inout) :: plan
    end subroutine complete_plan

    !> ソース電荷から FMM state を更新する。
    !! @param[in] plan 構築済みの FMM 計画。
    !! @param[inout] state 更新対象の state。
    !! @param[in] src_q ソース電荷量。
    !! @param[in] mpi 与えると M2L を target node のブロックごとに rank で分担し、局所展開を全 rank で揃える。
    !!            全 rank が同じ plan と src_q で呼ぶこと。結果は分担しない場合と bit 単位で同じ。
    module subroutine update_state(plan, state, src_q, mpi)
      type(fmm_plan_type), intent(in) :: plan
      type(fmm_state_type), intent(inout) :: state
      real(dp), intent(in) :: src_q(:)
      type(mpi_context), intent(in), optional :: mpi
    end subroutine update_state

    !> 複数の評価点で電場を計算する。
    !! @param[in] plan 構築済みの FMM 計画。
    !! @param[inout] state 評価に使う FMM state。
    !! @param[in] target_pos 評価点位置 `(3,m)` [m]。
    !! @param[out] e 電場ベクトル `(3,m)` [V/m]。
    module subroutine eval_points(plan, state, target_pos, e)
      type(fmm_plan_type), intent(in) :: plan
      type(fmm_state_type), intent(inout) :: state
      real(dp), intent(in) :: target_pos(:, :)
      real(dp), intent(out) :: e(:, :)
    end subroutine eval_points

    !> 複数の評価点で全ソースの直接和による電場を計算する(非周期のみ)。
    !! ソース幾何(`prepare_panel_sources` 以降)と電荷 `src_q(nsrc)` だけを使う。Coulomb 係数は含まない。
    module subroutine eval_direct_points(plan, src_q, target_pos, e)
      type(fmm_plan_type), intent(in) :: plan
      real(dp), intent(in) :: src_q(:)
      real(dp), intent(in) :: target_pos(:, :)
      real(dp), intent(out) :: e(:, :)
    end subroutine eval_direct_points

    !> 1 点で電場を計算する。
    !! @param[in] plan 構築済みの FMM 計画。
    !! @param[inout] state 評価に使う FMM state。
    !! @param[in] r 評価点位置 `(x,y,z)` [m]。
    !! @param[out] e 電場ベクトル `(x,y,z)` [V/m]。
    module subroutine eval_point(plan, state, r, e)
      type(fmm_plan_type), intent(in) :: plan
      type(fmm_state_type), intent(inout) :: state
      real(dp), intent(in) :: r(3)
      real(dp), intent(out) :: e(3)
    end subroutine eval_point

    !> 複数の評価点で電位を計算する。
    !! @param[in] plan 構築済みの FMM 計画。
    !! @param[inout] state 評価に使う FMM state。
    !! @param[in] target_pos 評価点位置 `(3,m)` [m]。
    !! @param[out] phi 電位 `(m)` [V](`k_coulomb` は含まない)。
    module subroutine eval_potential_points(plan, state, target_pos, phi)
      type(fmm_plan_type), intent(in) :: plan
      type(fmm_state_type), intent(inout) :: state
      real(dp), intent(in) :: target_pos(:, :)
      real(dp), intent(out) :: phi(:)
    end subroutine eval_potential_points

    !> 複数の評価点で全ソースの直接和による電位を計算する(非周期のみ)。
    !! ソース幾何(`prepare_panel_sources` 以降)と電荷 `src_q(nsrc)` だけを使う。Coulomb 係数は含まない。
    module subroutine eval_direct_potential_points(plan, src_q, target_pos, phi)
      type(fmm_plan_type), intent(in) :: plan
      real(dp), intent(in) :: src_q(:)
      real(dp), intent(in) :: target_pos(:, :)
      real(dp), intent(out) :: phi(:)
    end subroutine eval_direct_potential_points

    !> 1 点で電位を計算する。
    !! @param[in] plan 構築済みの FMM 計画。
    !! @param[inout] state 評価に使う FMM state。
    !! @param[in] r 評価点位置 `(x,y,z)` [m]。
    !! @param[out] phi 電位 [V](`k_coulomb` は含まない)。
    module subroutine eval_potential_point(plan, state, r, phi)
      type(fmm_plan_type), intent(in) :: plan
      type(fmm_state_type), intent(inout) :: state
      real(dp), intent(in) :: r(3)
      real(dp), intent(out) :: phi
    end subroutine eval_potential_point

    !> FMM 計画を解放する。
    !! @param[inout] plan 解放対象の計画。
    module subroutine destroy_plan(plan)
      type(fmm_plan_type), intent(inout) :: plan
    end subroutine destroy_plan

    !> FMM state を解放する。
    !! @param[inout] state 解放対象の state。
    module subroutine destroy_state(state)
      type(fmm_state_type), intent(inout) :: state
    end subroutine destroy_state
  end interface

end module bem_coulomb_fmm_core