設定読込・メッシュ構築・再開判定・乱数初期化をまとめて行う。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(out) | :: | app |
読み込み・既定値適用後のアプリ設定。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
構築した三角形メッシュ。 |
||
| type(sim_stats), | intent(out) | :: | initial_stats |
再開時に引き継ぐ初期統計(新規実行時はゼロ)。 |
||
| type(injection_state), | intent(out) | :: | inject_state |
種別ごとの注入残差状態。 |
||
| type(charge_ledger_type), | intent(out) | :: | charge_ledger | |||
| logical, | intent(out) | :: | resumed |
チェックポイントから再開した場合に |
||
| type(mpi_context), | intent(in) | :: | mpi |
subroutine load_or_init_run_state(app, mesh, initial_stats, inject_state, charge_ledger, resumed, mpi) type(app_config), intent(out) :: app type(mesh_type), intent(out) :: mesh type(sim_stats), intent(out) :: initial_stats type(injection_state), intent(out) :: inject_state type(charge_ledger_type), intent(out) :: charge_ledger logical, intent(out) :: resumed type(mpi_context), intent(in) :: mpi character(len=256) :: cfg_path character(len=256) :: restart_dir character(len=512) :: matching_response_message integer(i32) :: matching_response_status logical :: has_config type(matching_plane_response_provider_type) :: matching_response_provider call default_app_config(app) call resolve_config_path(cfg_path, has_config) if (has_config) then call load_app_config(trim(cfg_path), app) end if call matching_response_provider%initialize( & app, mpi, matching_response_status, matching_response_message & ) if (matching_response_status /= matching_plane_provider_ok) then error stop 'matching-plane response preflight failed: '//trim(matching_response_message) end if call build_mesh_from_config(app, mesh) call prepare_periodic2_collision_mesh(mesh, app%sim) call initialize_injection_state(inject_state, app%n_particle_species) initial_stats = sim_stats() resumed = .false. if (app%resume_output) then restart_dir = app%output_dir if (len_trim(app%output_restart_from) > 0) restart_dir = app%output_restart_from call resolve_latest_checkpoint_dir(trim(restart_dir), restart_dir) call load_restart_checkpoint( & trim(restart_dir), mesh, initial_stats, resumed, inject_state, & mpi=mpi, require_checkpoint=.true., app=app, charge_ledger=charge_ledger & ) end if if (resumed) then if (mpi_is_root(mpi)) then print '(a,a)', 'resuming_from_dir=', trim(restart_dir) print '(a,i0)', 'resuming_from_batches=', initial_stats%batches print '(a,i0)', 'resuming_from_processed_particles=', initial_stats%processed_particles end if else call seed_particles_from_config(app, mpi=mpi) end if end subroutine load_or_init_run_state