bem_simulator_io.f90 Source File


This file depends on

sourcefile~~bem_simulator_io.f90~~EfferentGraph sourcefile~bem_simulator_io.f90 bem_simulator_io.f90 sourcefile~bem_simulator.f90 bem_simulator.f90 sourcefile~bem_simulator_io.f90->sourcefile~bem_simulator.f90 sourcefile~bem_app_config.f90 bem_app_config.f90 sourcefile~bem_simulator.f90->sourcefile~bem_app_config.f90 sourcefile~bem_boundary.f90 bem_boundary.f90 sourcefile~bem_simulator.f90->sourcefile~bem_boundary.f90 sourcefile~bem_collision.f90 bem_collision.f90 sourcefile~bem_simulator.f90->sourcefile~bem_collision.f90 sourcefile~bem_field_solver.f90 bem_field_solver.f90 sourcefile~bem_simulator.f90->sourcefile~bem_field_solver.f90 sourcefile~bem_kinds.f90 bem_kinds.f90 sourcefile~bem_simulator.f90->sourcefile~bem_kinds.f90 sourcefile~bem_mpi.f90 bem_mpi.F90 sourcefile~bem_simulator.f90->sourcefile~bem_mpi.f90 sourcefile~bem_pusher.f90 bem_pusher.f90 sourcefile~bem_simulator.f90->sourcefile~bem_pusher.f90 sourcefile~bem_types.f90 bem_types.f90 sourcefile~bem_simulator.f90->sourcefile~bem_types.f90 sourcefile~bem_app_config_parser.f90 bem_app_config_parser.f90 sourcefile~bem_app_config.f90->sourcefile~bem_app_config_parser.f90 sourcefile~bem_app_config_runtime.f90 bem_app_config_runtime.f90 sourcefile~bem_app_config.f90->sourcefile~bem_app_config_runtime.f90 sourcefile~bem_app_config_types.f90 bem_app_config_types.f90 sourcefile~bem_app_config.f90->sourcefile~bem_app_config_types.f90 sourcefile~bem_string_utils.f90 bem_string_utils.f90 sourcefile~bem_app_config.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_boundary.f90->sourcefile~bem_kinds.f90 sourcefile~bem_boundary.f90->sourcefile~bem_types.f90 sourcefile~bem_collision.f90->sourcefile~bem_kinds.f90 sourcefile~bem_collision.f90->sourcefile~bem_types.f90 sourcefile~bem_collision.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_field_solver.f90->sourcefile~bem_kinds.f90 sourcefile~bem_field_solver.f90->sourcefile~bem_types.f90 sourcefile~bem_constants.f90 bem_constants.f90 sourcefile~bem_field_solver.f90->sourcefile~bem_constants.f90 sourcefile~bem_coulomb_fmm_core.f90 bem_coulomb_fmm_core.f90 sourcefile~bem_field_solver.f90->sourcefile~bem_coulomb_fmm_core.f90 sourcefile~bem_field.f90 bem_field.f90 sourcefile~bem_field_solver.f90->sourcefile~bem_field.f90 sourcefile~bem_field_solver.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_mpi.f90->sourcefile~bem_kinds.f90 sourcefile~bem_pusher.f90->sourcefile~bem_kinds.f90 sourcefile~bem_types.f90->sourcefile~bem_kinds.f90 sourcefile~bem_app_config_parser.f90->sourcefile~bem_kinds.f90 sourcefile~bem_app_config_parser.f90->sourcefile~bem_types.f90 sourcefile~bem_app_config_parser.f90->sourcefile~bem_app_config_types.f90 sourcefile~bem_app_config_parser.f90->sourcefile~bem_constants.f90 sourcefile~bem_app_config_parser.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_kinds.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_mpi.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_types.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_app_config_types.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_field.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_config_helpers.f90 bem_config_helpers.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_config_helpers.f90 sourcefile~bem_importers.f90 bem_importers.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_importers.f90 sourcefile~bem_injection.f90 bem_injection.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_injection.f90 sourcefile~bem_mesh.f90 bem_mesh.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_mesh.f90 sourcefile~bem_particles.f90 bem_particles.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_particles.f90 sourcefile~bem_sheath_injection_model.f90 bem_sheath_injection_model.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_sheath_injection_model.f90 sourcefile~bem_templates.f90 bem_templates.f90 sourcefile~bem_app_config_runtime.f90->sourcefile~bem_templates.f90 sourcefile~bem_app_config_types.f90->sourcefile~bem_kinds.f90 sourcefile~bem_app_config_types.f90->sourcefile~bem_types.f90 sourcefile~bem_constants.f90->sourcefile~bem_kinds.f90 sourcefile~bem_coulomb_fmm_core.f90->sourcefile~bem_kinds.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_field.f90->sourcefile~bem_kinds.f90 sourcefile~bem_field.f90->sourcefile~bem_types.f90 sourcefile~bem_field.f90->sourcefile~bem_constants.f90 sourcefile~bem_config_helpers.f90->sourcefile~bem_kinds.f90 sourcefile~bem_config_helpers.f90->sourcefile~bem_app_config_types.f90 sourcefile~bem_config_helpers.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_coulomb_fmm_types.f90->sourcefile~bem_kinds.f90 sourcefile~bem_importers.f90->sourcefile~bem_kinds.f90 sourcefile~bem_importers.f90->sourcefile~bem_types.f90 sourcefile~bem_importers.f90->sourcefile~bem_mesh.f90 sourcefile~bem_injection.f90->sourcefile~bem_boundary.f90 sourcefile~bem_injection.f90->sourcefile~bem_collision.f90 sourcefile~bem_injection.f90->sourcefile~bem_kinds.f90 sourcefile~bem_injection.f90->sourcefile~bem_types.f90 sourcefile~bem_injection.f90->sourcefile~bem_constants.f90 sourcefile~bem_injection.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_injection.f90->sourcefile~bem_particles.f90 sourcefile~bem_mesh.f90->sourcefile~bem_kinds.f90 sourcefile~bem_mesh.f90->sourcefile~bem_types.f90 sourcefile~bem_mesh.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_particles.f90->sourcefile~bem_kinds.f90 sourcefile~bem_particles.f90->sourcefile~bem_types.f90 sourcefile~bem_sheath_runtime.f90 bem_sheath_runtime.f90 sourcefile~bem_sheath_injection_model.f90->sourcefile~bem_sheath_runtime.f90 sourcefile~bem_templates.f90->sourcefile~bem_kinds.f90 sourcefile~bem_templates.f90->sourcefile~bem_types.f90 sourcefile~bem_templates.f90->sourcefile~bem_mesh.f90 sourcefile~bem_sheath_runtime.f90->sourcefile~bem_kinds.f90 sourcefile~bem_sheath_runtime.f90->sourcefile~bem_types.f90 sourcefile~bem_sheath_runtime.f90->sourcefile~bem_app_config_types.f90 sourcefile~bem_sheath_runtime.f90->sourcefile~bem_constants.f90 sourcefile~bem_sheath_runtime.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_sheath_runtime.f90->sourcefile~bem_config_helpers.f90 sourcefile~bem_sheath_model_core.f90 bem_sheath_model_core.f90 sourcefile~bem_sheath_runtime.f90->sourcefile~bem_sheath_model_core.f90 sourcefile~bem_sheath_model_core.f90->sourcefile~bem_kinds.f90 sourcefile~bem_sheath_model_core.f90->sourcefile~bem_constants.f90 sourcefile~bem_sheath_model_core.f90->sourcefile~bem_string_utils.f90 sourcefile~bem_sheath_model_core.f90->sourcefile~bem_injection.f90

Source Code

!> `bem_simulator` の進捗表示と履歴出力を実装する submodule。
submodule(bem_simulator) bem_simulator_io
  implicit none
contains

  !> 現在バッチ番号と相対変化量を標準出力へ表示する。
  module procedure print_batch_progress
  print '(a,i0,a,i0,a,es12.4,a)', &
    '---------- batch ', batch_idx, '/', final_batch_idx, ' rel_change=', rel_change, ' ----------'
  flush (output_unit)
  end procedure print_batch_progress

  !> 履歴出力条件を満たすバッチだけ電荷スナップショットを書き出す。
  module procedure maybe_write_history_snapshot
  if (.not. history_enabled) return
  if (mod(stats%batches - 1_i32, hist_stride) /= 0_i32) return
  call write_history_snapshot(hist_unit, stats%batches, stats%processed_particles, rel, q_elem)
  end procedure maybe_write_history_snapshot

  !> 全要素電荷を履歴CSV形式で1バッチ分書き出す。
  module procedure write_history_snapshot
  integer(i32) :: elem_idx

  do elem_idx = 1, size(q_elem)
    write (unit_id, '(i0,a,i0,a,es24.16,a,i0,a,es24.16)') batch_idx, ',', processed_particles, ',', &
      rel_change, ',', elem_idx, ',', q_elem(elem_idx)
  end do
  end procedure write_history_snapshot

  !> 電位履歴出力条件を満たすバッチだけ電位スナップショットを書き出す。
  module procedure maybe_write_potential_history_snapshot
  if (.not. potential_history_enabled) return
  if (mod(stats%batches - 1_i32, hist_stride) /= 0_i32) return
  call field_solver%refresh(mesh)
  call field_solver%compute_mesh_potential(mesh, sim, potential_buf)
  call write_potential_history_snapshot(pot_hist_unit, stats%batches, potential_buf)
  end procedure maybe_write_potential_history_snapshot

  !> 全要素電位を電位履歴CSV形式で1バッチ分書き出す。
  module procedure write_potential_history_snapshot
  integer(i32) :: elem_idx

  do elem_idx = 1, size(potential_v)
    write (unit_id, '(i0,a,i0,a,es24.16)') batch_idx, ',', elem_idx, ',', potential_v(elem_idx)
  end do
  end procedure write_potential_history_snapshot

end submodule bem_simulator_io