Files
FemLite/tests/module/test_particle_config_run.f90
T
2026-06-26 00:48:57 +08:00

607 lines
23 KiB
Fortran

program test_particle_config_run
use fem_precision
use fem_error
use fem_particle_state
use fem_particle_config
use fem_particle_config_run
use fem_particle_config_report
implicit none
real(rk), parameter :: TOL = 1.0e-10_rk
call check_control_defaults()
call check_parse_control_keywords()
call check_parse_control_data()
call check_cloud_only_zero_steps()
call check_multi_step_history()
call check_output_interval()
call check_overlap_stop()
call check_energy_stop()
call check_load_case_and_execute()
call check_report_lines_and_csv()
call check_existing_particle_run()
call check_error_paths()
call check_capacity_stop()
call check_stop_names()
contains
subroutine check_control_defaults()
type(particle_config_run_control) :: control
integer :: ierr
call pcrun_control_reset(control)
if (control%nsteps .ne. 1) call fail(10)
if (control%output_interval .ne. 1) call fail(11)
if (.not. control%reset_particles) call fail(12)
if (control%stop_on_overlap) call fail(13)
if (control%stop_on_energy) call fail(14)
call pcrun_control_validate(control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(15)
call pcrun_control_init(4, 2, .false., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(16)
if (control%nsteps .ne. 4) call fail(17)
if (control%output_interval .ne. 2) call fail(18)
if (control%reset_particles) call fail(19)
if (.not. pcrun_should_record(1, control)) call fail(20)
if (.not. pcrun_should_record(2, control)) call fail(21)
if (pcrun_should_record(3, control)) call fail(22)
if (.not. pcrun_should_record(4, control)) call fail(23)
end subroutine check_control_defaults
subroutine check_parse_control_keywords()
type(particle_config_run_control) :: control
integer :: ierr
call pcrun_control_reset(control)
call pcrun_parse_control_line('*PARTICLE RUN, STEPS=5, ' // &
'OUTPUT=2, RESET=NO, ' // &
'MAX_OVERLAP=0.3, MAX_ENERGY=10', &
control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(40)
if (control%nsteps .ne. 5) call fail(41)
if (control%output_interval .ne. 2) call fail(42)
if (control%reset_particles) call fail(43)
if (.not. control%stop_on_overlap) call fail(44)
if (.not. control%stop_on_energy) call fail(45)
call check_close(control%max_overlap_limit, 0.3_rk, 46)
call check_close(control%max_energy_limit, 10.0_rk, 47)
call pcrun_parse_control_line('*PARTICLE RUN, NSTEP=3, ' // &
'OUTPUT_INTERVAL=1, RESET=YES', &
control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(48)
if (control%nsteps .ne. 3) call fail(49)
if (control%output_interval .ne. 1) call fail(50)
if (.not. control%reset_particles) call fail(51)
end subroutine check_parse_control_keywords
subroutine check_parse_control_data()
type(particle_config_run_control) :: control
integer :: ierr
call pcrun_control_reset(control)
call pcrun_parse_control_line('RUN, 6, 3, 0, 0.25, 100.0', &
control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(70)
if (control%nsteps .ne. 6) call fail(71)
if (control%output_interval .ne. 3) call fail(72)
if (control%reset_particles) call fail(73)
if (.not. control%stop_on_overlap) call fail(74)
if (.not. control%stop_on_energy) call fail(75)
call check_close(control%max_overlap_limit, 0.25_rk, 76)
call check_close(control%max_energy_limit, 100.0_rk, 77)
end subroutine check_parse_control_data
subroutine check_cloud_only_zero_steps()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: final_step
integer :: records
integer :: reason
integer :: contacts
real(rk) :: max_overlap
real(rk) :: max_energy
call build_cloud_only(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(100)
call pcrun_control_init(0, 1, .true., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(101)
call pcrun_execute(config, control, history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(102)
if (particle_count() .ne. 8) call fail(103)
if (history%record_count .ne. 1) call fail(104)
if (history%generated_count .ne. 8) call fail(105)
if (history%active_count .ne. 8) call fail(106)
call pcrun_summary(history, final_step, records, reason, contacts, &
max_overlap, max_energy, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(107)
if (final_step .ne. 0 .or. records .ne. 1) call fail(108)
if (reason .ne. PCRUN_STOP_NONE) call fail(109)
if (contacts .ne. 0) call fail(110)
call check_close(max_overlap, ZERO, 111)
call check_close(max_energy, ZERO, 112)
end subroutine check_cloud_only_zero_steps
subroutine check_multi_step_history()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: step
integer :: active
integer :: contacts
integer :: raw_pairs
integer :: filtered_pairs
real(rk) :: max_overlap
real(rk) :: total_energy
real(rk) :: kinetic
call build_wall_run_config(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(140)
call pcrun_control_init(3, 1, .true., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(141)
call pcrun_execute(config, control, history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(142)
if (history%final_step .ne. 3) call fail(143)
if (history%record_count .ne. 3) call fail(144)
if (history%generated_count .ne. 8) call fail(145)
if (history%active_count .ne. 8) call fail(146)
if (history%total_contacts .lt. 4) call fail(147)
if (history%max_contacts .lt. 4) call fail(148)
if (history%max_overlap .le. ZERO) call fail(149)
if (history%max_total_energy .lt. ZERO) call fail(150)
call pcrun_history_values(history, 1, step, active, contacts, raw_pairs, &
filtered_pairs, max_overlap, total_energy, &
kinetic, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(151)
if (step .ne. 1 .or. active .ne. 8) call fail(152)
if (contacts .ne. 4) call fail(153)
if (raw_pairs .lt. filtered_pairs) call fail(154)
call check_close(max_overlap, 0.20_rk, 155)
if (total_energy .lt. ZERO) call fail(156)
if (kinetic .lt. ZERO) call fail(157)
call pcrun_history_values(history, 3, step, active, contacts, raw_pairs, &
filtered_pairs, max_overlap, total_energy, &
kinetic, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(158)
if (step .ne. 3 .or. active .ne. 8) call fail(159)
end subroutine check_multi_step_history
subroutine check_output_interval()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: step
integer :: active
integer :: contacts
integer :: raw_pairs
integer :: filtered_pairs
real(rk) :: max_overlap
real(rk) :: total_energy
real(rk) :: kinetic
call build_wall_run_config(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(190)
call pcrun_control_init(5, 2, .true., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(191)
call pcrun_execute(config, control, history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(192)
if (history%record_count .ne. 4) call fail(193)
call expect_history_step(history, 1, 1, 194)
call expect_history_step(history, 2, 2, 195)
call expect_history_step(history, 3, 4, 196)
call expect_history_step(history, 4, 5, 197)
call pcrun_history_values(history, 4, step, active, contacts, raw_pairs, &
filtered_pairs, max_overlap, total_energy, &
kinetic, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(198)
if (step .ne. 5 .or. active .ne. 8) call fail(199)
end subroutine check_output_interval
subroutine check_overlap_stop()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: final_step
integer :: records
integer :: reason
integer :: contacts
real(rk) :: max_overlap
real(rk) :: max_energy
call build_wall_run_config(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(230)
call pcrun_control_init(10, 5, .true., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(231)
control%stop_on_overlap = .true.
control%max_overlap_limit = 0.10_rk
call pcrun_execute(config, control, history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(232)
call pcrun_summary(history, final_step, records, reason, contacts, &
max_overlap, max_energy, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(233)
if (final_step .ne. 1) call fail(234)
if (reason .ne. PCRUN_STOP_OVERLAP) call fail(235)
if (records .ne. 1) call fail(236)
if (contacts .ne. 4) call fail(237)
call check_close(max_overlap, 0.20_rk, 238)
end subroutine check_overlap_stop
subroutine check_energy_stop()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
call build_wall_run_config(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(260)
call pcrun_control_init(10, 4, .true., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(261)
control%stop_on_energy = .true.
control%max_energy_limit = ONE
call pcrun_execute(config, control, history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(262)
if (history%final_step .ne. 1) call fail(263)
if (history%stop_reason .ne. PCRUN_STOP_ENERGY) call fail(264)
if (history%max_total_energy .lt. ONE) call fail(265)
end subroutine check_energy_stop
subroutine check_load_case_and_execute()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: final_step
integer :: records
integer :: reason
integer :: contacts
real(rk) :: max_overlap
real(rk) :: max_energy
call write_run_case(ierr)
if (ierr .ne. FEM_SUCCESS) call fail(290)
call pcrun_load_and_execute('particle_config_run.tmp', config, control, &
history, ierr)
call delete_run_case()
if (ierr .ne. FEM_SUCCESS) call fail(291)
if (control%nsteps .ne. 3) call fail(292)
if (control%output_interval .ne. 2) call fail(293)
if (.not. control%reset_particles) call fail(294)
if (history%generated_count .ne. 8) call fail(295)
call pcrun_summary(history, final_step, records, reason, contacts, &
max_overlap, max_energy, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(296)
if (final_step .ne. 3) call fail(297)
if (records .ne. 3) call fail(298)
if (reason .ne. PCRUN_STOP_NONE) call fail(299)
if (contacts .lt. 4) call fail(300)
if (max_overlap .le. ZERO) call fail(301)
end subroutine check_load_case_and_execute
subroutine check_report_lines_and_csv()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
character(len=192) :: line
character(len=32) :: label
integer :: ierr
integer :: unit
integer :: ios
integer :: count
integer :: peak_step
integer :: peak_contacts
logical :: monotonic
real(rk) :: min_energy
real(rk) :: max_energy
call build_wall_run_config(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(310)
call pcrun_control_init(3, 2, .true., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(311)
call pcrun_execute(config, control, history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(312)
call pcreport_header(line, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(313)
if (index(line, 'step,active,contacts') .ne. 1) call fail(314)
call pcreport_history_line(history, 1, line, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(315)
if (index(line, '1,8,4') .ne. 1) call fail(316)
call pcreport_summary_line(history, line, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(317)
if (index(line, 'final_step=3') .ne. 1) call fail(318)
if (index(line, 'stop=none') .le. 0) call fail(319)
call pcreport_metric_line('max_overlap', history%max_overlap, line, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(320)
if (index(line, 'max_overlap,') .ne. 1) call fail(321)
call pcreport_stop_label(PCRUN_STOP_OVERLAP, label, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(322)
if (trim(label) .ne. 'max_overlap') call fail(323)
call pcreport_record_count(history, count, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(324)
if (count .ne. history%record_count) call fail(325)
call pcreport_peak_contact(history, peak_step, peak_contacts, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(326)
if (peak_step .le. 0 .or. peak_contacts .lt. 4) call fail(327)
call pcreport_energy_range(history, min_energy, max_energy, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(328)
if (min_energy .lt. ZERO .or. max_energy .lt. min_energy) call fail(329)
call pcreport_steps_monotonic(history, monotonic, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(330)
if (.not. monotonic) call fail(331)
call pcreport_write_csv('particle_config_report.tmp', history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(332)
unit = 75
open(unit=unit, file='particle_config_report.tmp', status='old', &
action='read', iostat=ios)
if (ios .ne. 0) call fail(333)
count = 0
do
read(unit, '(A)', iostat=ios) line
if (ios .lt. 0) exit
if (ios .gt. 0) call fail(334)
count = count + 1
end do
close(unit, status='delete')
if (count .ne. history%record_count + 2) call fail(335)
call pcreport_history_line(history, history%record_count + 1, line, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(336)
call pcreport_metric_line('', ONE, line, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(337)
end subroutine check_report_lines_and_csv
subroutine check_existing_particle_run()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: slot
call particle_reset()
call particle_add(900, (/ ZERO, ZERO, 0.40_rk /), &
(/ ZERO, ZERO, ZERO /), 0.50_rk, ONE, slot, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(330)
call build_no_cloud_config(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(331)
call pcrun_control_init(2, 1, .false., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(332)
call pcrun_execute(config, control, history, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(333)
if (history%generated_count .ne. 0) call fail(334)
if (history%active_count .ne. 1) call fail(335)
if (history%max_contacts .lt. 1) call fail(336)
if (history%record_count .ne. 2) call fail(337)
end subroutine check_existing_particle_run
subroutine check_error_paths()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: step
integer :: active
integer :: contacts
integer :: raw_pairs
integer :: filtered_pairs
real(rk) :: max_overlap
real(rk) :: total_energy
real(rk) :: kinetic
call pcrun_control_init(-1, 1, .true., control, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(370)
call pcrun_control_init(1, 0, .true., control, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(371)
call pcrun_control_reset(control)
control%stop_on_overlap = .true.
control%max_overlap_limit = ZERO
call pcrun_control_validate(control, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(372)
call pcrun_parse_control_line('RUN, 1', control, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(373)
call pcrun_parse_control_line('*PARTICLE RUN, STEPS=-1', control, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(374)
call build_cloud_only(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(375)
call pcrun_control_init(1, 1, .true., control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(376)
call pcrun_execute(config, control, history, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(377)
call pcrun_history_reset(history)
call pcrun_history_values(history, 1, step, active, contacts, raw_pairs, &
filtered_pairs, max_overlap, total_energy, &
kinetic, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(378)
call pcrun_load_case('missing_particle_run_case.tmp', config, control, &
ierr)
if (ierr .eq. FEM_SUCCESS) call fail(379)
end subroutine check_error_paths
subroutine check_capacity_stop()
type(particle_config_state) :: config
type(particle_config_run_control) :: control
type(particle_config_run_history) :: history
integer :: ierr
integer :: slot
call particle_reset()
call particle_add(901, (/ ZERO, ZERO, 0.40_rk /), &
(/ ZERO, ZERO, ZERO /), 0.50_rk, ONE, slot, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(410)
call build_no_cloud_config(config, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(411)
call pcrun_control_init(PCONFIG_RUN_MAX_RECORDS + 1, 1, .false., &
control, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(412)
call pcrun_execute(config, control, history, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(413)
if (history%stop_reason .ne. PCRUN_STOP_CAPACITY) call fail(414)
if (history%record_count .ne. PCONFIG_RUN_MAX_RECORDS) call fail(415)
end subroutine check_capacity_stop
subroutine check_stop_names()
character(len=32) :: name
integer :: ierr
call pcrun_stop_name(PCRUN_STOP_NONE, name, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(440)
if (trim(name) .ne. 'none') call fail(441)
call pcrun_stop_name(PCRUN_STOP_OVERLAP, name, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(442)
if (trim(name) .ne. 'max_overlap') call fail(443)
call pcrun_stop_name(PCRUN_STOP_ENERGY, name, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(444)
if (trim(name) .ne. 'max_energy') call fail(445)
call pcrun_stop_name(PCRUN_STOP_CAPACITY, name, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(446)
if (trim(name) .ne. 'record_capacity') call fail(447)
call pcrun_stop_name(999, name, ierr)
if (ierr .eq. FEM_SUCCESS) call fail(448)
end subroutine check_stop_names
subroutine build_cloud_only(config, ierr)
type(particle_config_state), intent(out) :: config
integer, intent(out) :: ierr
call pconfig_reset(config)
call pconfig_parse_line('*PARTICLE CLOUD, ID=1, XMIN=0, YMIN=0, ' // &
'ZMIN=0, XMAX=2, YMAX=2, ZMAX=2, ' // &
'RADIUS=0.5, DENSITY=1, SPACING=1, ' // &
'STAGGER=NO', config, ierr)
end subroutine build_cloud_only
subroutine build_wall_run_config(config, ierr)
type(particle_config_state), intent(out) :: config
integer, intent(out) :: ierr
call build_cloud_only(config, ierr)
if (ierr .ne. FEM_SUCCESS) return
call append_contact_step_wall(config, ierr)
end subroutine build_wall_run_config
subroutine build_no_cloud_config(config, ierr)
type(particle_config_state), intent(out) :: config
integer, intent(out) :: ierr
call pconfig_reset(config)
call append_contact_step_wall(config, ierr)
end subroutine build_no_cloud_config
subroutine append_contact_step_wall(config, ierr)
type(particle_config_state), intent(inout) :: config
integer, intent(out) :: ierr
call pconfig_parse_line('*PARTICLE CONTACT, KN=1000, CN=0, KT=0, ' // &
'MU=0, KWALL=1000, CWALL=0', config, ierr)
if (ierr .ne. FEM_SUCCESS) return
call pconfig_parse_line('*PARTICLE STEP, DT=0.001, DAMPING=0, ' // &
'SEARCH=0, GX=0, GY=0, GZ=0, CELL=1', &
config, ierr)
if (ierr .ne. FEM_SUCCESS) return
call pconfig_parse_line('*PARTICLE WALL, PX=0, PY=0, PZ=0.2, ' // &
'NX=0, NY=0, NZ=1', config, ierr)
end subroutine append_contact_step_wall
subroutine expect_history_step(history, index, expected_step, code)
type(particle_config_run_history), intent(in) :: history
integer, intent(in) :: index
integer, intent(in) :: expected_step
integer, intent(in) :: code
integer :: ierr
integer :: step
integer :: active
integer :: contacts
integer :: raw_pairs
integer :: filtered_pairs
real(rk) :: max_overlap
real(rk) :: total_energy
real(rk) :: kinetic
call pcrun_history_values(history, index, step, active, contacts, &
raw_pairs, filtered_pairs, max_overlap, &
total_energy, kinetic, ierr)
if (ierr .ne. FEM_SUCCESS) call fail(code)
if (step .ne. expected_step) call fail(code + 1000)
end subroutine expect_history_step
subroutine write_run_case(ierr)
integer, intent(out) :: ierr
integer :: unit
integer :: ios
unit = 76
open(unit=unit, file='particle_config_run.tmp', status='unknown', &
action='write', iostat=ios)
if (ios .ne. 0) then
call error_set(FEM_ERR_OUTPUT, 'failed to write particle run tmp', ierr)
return
end if
write(unit, '(A)') '# temporary particle run case'
write(unit, '(A)') '*PARTICLE RUN, STEPS=3, OUTPUT=2, RESET=YES, ' // &
'MAX_OVERLAP=0.25'
write(unit, '(A)') '*PARTICLE CLOUD, ID=1, XMIN=0, YMIN=0, ' // &
'ZMIN=0, XMAX=2, YMAX=2, ZMAX=2, ' // &
'RADIUS=0.5, DENSITY=1, SPACING=1, STAGGER=NO'
write(unit, '(A)') '*PARTICLE CONTACT, KN=1000, CN=0, KT=0, ' // &
'MU=0, KWALL=1000, CWALL=0'
write(unit, '(A)') '*PARTICLE STEP, DT=0.001, DAMPING=0, ' // &
'SEARCH=0, GX=0, GY=0, GZ=0, CELL=1'
write(unit, '(A)') '*PARTICLE WALL, PX=0, PY=0, PZ=0.2, ' // &
'NX=0, NY=0, NZ=1'
close(unit)
call error_clear(ierr)
end subroutine write_run_case
subroutine delete_run_case()
integer :: unit
integer :: ios
unit = 76
open(unit=unit, file='particle_config_run.tmp', status='old', iostat=ios)
if (ios .eq. 0) close(unit, status='delete')
end subroutine delete_run_case
subroutine delete_report_file()
integer :: unit
integer :: ios
unit = 75
open(unit=unit, file='particle_config_report.tmp', status='old', &
iostat=ios)
if (ios .eq. 0) close(unit, status='delete')
end subroutine delete_report_file
subroutine check_close(actual, expected, code)
real(rk), intent(in) :: actual
real(rk), intent(in) :: expected
integer, intent(in) :: code
if (abs(actual - expected) .gt. TOL * max(ONE, abs(expected))) then
call fail(code)
end if
end subroutine check_close
subroutine fail(code)
integer, intent(in) :: code
call delete_run_case()
call delete_report_file()
write(*,*) 'test_particle_config_run failed:', code
stop 1
end subroutine fail
end program test_particle_config_run