Merge branch 'develop' into threading-new

Conflicts:
	src/initialize.F90
This commit is contained in:
Paul Romano 2013-09-07 15:06:16 -04:00
commit af43d7ec8c
229 changed files with 230433 additions and 225521 deletions

View file

@ -1,24 +1,32 @@
ace.o: ace_header.o
ace.o: constants.o
ace.o: endf.o
ace.o: error.o
ace.o: fission.o
ace.o: global.o
ace.o: material_header.o
ace.o: output.o
ace.o: set_header.o
ace.o: string.o
set_header.o: constants.o
set_header.o: list_header.o
ace_header.o: constants.o
ace_header.o: endf_header.o
energy_grid.o: constants.o
energy_grid.o: global.o
energy_grid.o: list_header.o
energy_grid.o: output.o
cmfd_data.o: cmfd_header.o
cmfd_data.o: constants.o
cmfd_data.o: error.o
cmfd_data.o: global.o
cmfd_data.o: mesh.o
cmfd_data.o: mesh_header.o
cmfd_data.o: tally_header.o
list_header.o: constants.o
cmfd_slepc_solver.o: cmfd_loss_operator.o
cmfd_slepc_solver.o: cmfd_prod_operator.o
cmfd_slepc_solver.o: constants.o
cmfd_slepc_solver.o: global.o
cmfd_loss_operator.o: constants.o
cmfd_loss_operator.o: global.o
particle_restart.o: bank_header.o
particle_restart.o: constants.o
particle_restart.o: geometry_header.o
particle_restart.o: global.o
particle_restart.o: output.o
particle_restart.o: output_interface.o
particle_restart.o: particle_header.o
particle_restart.o: random_lcg.o
particle_restart.o: tracking.o
doppler.o: constants.o
cmfd_execute.o: cmfd_data.o
cmfd_execute.o: cmfd_message_passing.o
@ -33,108 +41,27 @@ cmfd_execute.o: output.o
cmfd_execute.o: search.o
cmfd_execute.o: tally.o
cmfd_header.o: constants.o
cmfd_input.o: cmfd_message_passing.o
cmfd_input.o: error.o
cmfd_input.o: global.o
cmfd_input.o: mesh_header.o
cmfd_input.o: output.o
cmfd_input.o: string.o
cmfd_input.o: tally.o
cmfd_input.o: tally_header.o
cmfd_input.o: tally_initialize.o
cmfd_input.o: templates/cmfd_t.o
cmfd_jacobian_operator.o: cmfd_loss_operator.o
cmfd_jacobian_operator.o: cmfd_prod_operator.o
cmfd_jacobian_operator.o: constants.o
cmfd_jacobian_operator.o: global.o
cmfd_loss_operator.o: constants.o
cmfd_loss_operator.o: global.o
cmfd_message_passing.o: cmfd_header.o
cmfd_message_passing.o: global.o
cmfd_output.o: cmfd_data.o
cmfd_output.o: cmfd_header.o
cmfd_output.o: constants.o
cmfd_output.o: global.o
cmfd_power_solver.o: cmfd_loss_operator.o
cmfd_power_solver.o: cmfd_prod_operator.o
cmfd_power_solver.o: constants.o
cmfd_power_solver.o: global.o
cmfd_power_solver.o: string.o
cmfd_prod_operator.o: constants.o
cmfd_prod_operator.o: global.o
cmfd_message_passing.o: cmfd_header.o
cmfd_message_passing.o: global.o
cmfd_slepc_solver.o: cmfd_loss_operator.o
cmfd_slepc_solver.o: cmfd_prod_operator.o
cmfd_slepc_solver.o: constants.o
cmfd_slepc_solver.o: global.o
random_lcg.o: global.o
cmfd_snes_solver.o: cmfd_jacobian_operator.o
cmfd_snes_solver.o: cmfd_loss_operator.o
cmfd_snes_solver.o: cmfd_power_solver.o
cmfd_snes_solver.o: cmfd_prod_operator.o
cmfd_snes_solver.o: constants.o
cmfd_snes_solver.o: global.o
cmfd_snes_solver.o: string.o
cross_section.o: ace_header.o
cross_section.o: constants.o
cross_section.o: error.o
cross_section.o: fission.o
cross_section.o: global.o
cross_section.o: material_header.o
cross_section.o: particle_header.o
cross_section.o: random_lcg.o
cross_section.o: search.o
doppler.o: constants.o
eigenvalue.o: cmfd_execute.o
eigenvalue.o: constants.o
eigenvalue.o: error.o
eigenvalue.o: global.o
eigenvalue.o: math.o
eigenvalue.o: mesh.o
eigenvalue.o: mesh_header.o
eigenvalue.o: output.o
eigenvalue.o: particle_header.o
eigenvalue.o: random_lcg.o
eigenvalue.o: search.o
eigenvalue.o: source.o
eigenvalue.o: state_point.o
eigenvalue.o: string.o
eigenvalue.o: tally.o
eigenvalue.o: tracking.o
endf.o: constants.o
endf.o: string.o
energy_grid.o: constants.o
energy_grid.o: global.o
energy_grid.o: list_header.o
energy_grid.o: output.o
error.o: global.o
finalize.o: cmfd_output.o
finalize.o: global.o
finalize.o: hdf5_interface.o
finalize.o: output.o
finalize.o: tally.o
fission.o: ace_header.o
fission.o: constants.o
fission.o: error.o
fission.o: global.o
fission.o: interpolation.o
fission.o: search.o
plot.o: constants.o
plot.o: error.o
plot.o: geometry.o
plot.o: geometry_header.o
plot.o: global.o
plot.o: output.o
plot.o: particle_header.o
plot.o: plot_header.o
plot.o: ppmlib.o
plot.o: string.o
fixed_source.o: constants.o
fixed_source.o: global.o
@ -147,64 +74,53 @@ fixed_source.o: string.o
fixed_source.o: tally.o
fixed_source.o: tracking.o
geometry.o: constants.o
geometry.o: error.o
geometry.o: geometry_header.o
geometry.o: global.o
geometry.o: output.o
geometry.o: particle_header.o
geometry.o: particle_restart_write.o
geometry.o: string.o
geometry.o: tally.o
source.o: bank_header.o
source.o: constants.o
source.o: error.o
source.o: geometry_header.o
source.o: global.o
source.o: math.o
source.o: output.o
source.o: particle_header.o
source.o: random_lcg.o
source.o: string.o
global.o: ace_header.o
global.o: bank_header.o
global.o: cmfd_header.o
global.o: constants.o
global.o: dict_header.o
global.o: geometry_header.o
global.o: hdf5_interface.o
global.o: material_header.o
global.o: mesh_header.o
global.o: particle_header.o
global.o: plot_header.o
global.o: set_header.o
global.o: source_header.o
global.o: tally_header.o
global.o: timer_header.o
cmfd_prod_operator.o: constants.o
cmfd_prod_operator.o: global.o
hdf5_summary.o: ace_header.o
hdf5_summary.o: constants.o
hdf5_summary.o: endf.o
hdf5_summary.o: geometry_header.o
hdf5_summary.o: global.o
hdf5_summary.o: material_header.o
hdf5_summary.o: mesh_header.o
hdf5_summary.o: output_interface.o
hdf5_summary.o: output.o
hdf5_summary.o: string.o
hdf5_summary.o: tally_header.o
ace_header.o: constants.o
ace_header.o: endf_header.o
initialize.o: ace.o
initialize.o: bank_header.o
initialize.o: constants.o
initialize.o: dict_header.o
initialize.o: energy_grid.o
initialize.o: error.o
initialize.o: geometry.o
initialize.o: geometry_header.o
initialize.o: global.o
initialize.o: hdf5_interface.o
initialize.o: hdf5_summary.o
initialize.o: input_xml.o
initialize.o: output_interface.o
initialize.o: output.o
initialize.o: random_lcg.o
initialize.o: source.o
initialize.o: state_point.o
initialize.o: string.o
initialize.o: tally_header.o
initialize.o: tally_initialize.o
fission.o: ace_header.o
fission.o: constants.o
fission.o: error.o
fission.o: global.o
fission.o: interpolation.o
fission.o: search.o
cmfd_jacobian_operator.o: cmfd_loss_operator.o
cmfd_jacobian_operator.o: cmfd_prod_operator.o
cmfd_jacobian_operator.o: constants.o
cmfd_jacobian_operator.o: global.o
cmfd_snes_solver.o: cmfd_jacobian_operator.o
cmfd_snes_solver.o: cmfd_loss_operator.o
cmfd_snes_solver.o: cmfd_power_solver.o
cmfd_snes_solver.o: cmfd_prod_operator.o
cmfd_snes_solver.o: constants.o
cmfd_snes_solver.o: global.o
cmfd_snes_solver.o: string.o
cmfd_input.o: cmfd_message_passing.o
cmfd_input.o: error.o
cmfd_input.o: global.o
cmfd_input.o: mesh_header.o
cmfd_input.o: output.o
cmfd_input.o: string.o
cmfd_input.o: tally.o
cmfd_input.o: tally_header.o
cmfd_input.o: tally_initialize.o
cmfd_input.o: templates/cmfd_t.o
input_xml.o: cmfd_input.o
input_xml.o: constants.o
@ -227,15 +143,6 @@ input_xml.o: templates/plots_t.o
input_xml.o: templates/settings_t.o
input_xml.o: templates/tallies_t.o
interpolation.o: constants.o
interpolation.o: endf_header.o
interpolation.o: error.o
interpolation.o: global.o
interpolation.o: search.o
interpolation.o: string.o
list_header.o: constants.o
main.o: constants.o
main.o: eigenvalue.o
main.o: finalize.o
@ -245,15 +152,211 @@ main.o: initialize.o
main.o: particle_restart.o
main.o: plot.o
particle_restart_write.o: bank_header.o
particle_restart_write.o: global.o
particle_restart_write.o: output_interface.o
particle_restart_write.o: particle_header.o
particle_restart_write.o: string.o
timer_header.o: constants.o
math.o: constants.o
math.o: random_lcg.o
interpolation.o: constants.o
interpolation.o: endf_header.o
interpolation.o: error.o
interpolation.o: global.o
interpolation.o: search.o
interpolation.o: string.o
cmfd_data.o: cmfd_header.o
cmfd_data.o: constants.o
cmfd_data.o: error.o
cmfd_data.o: global.o
cmfd_data.o: mesh.o
cmfd_data.o: mesh_header.o
cmfd_data.o: tally_header.o
cmfd_output.o: cmfd_data.o
cmfd_output.o: cmfd_header.o
cmfd_output.o: constants.o
cmfd_output.o: global.o
global.o: ace_header.o
global.o: bank_header.o
global.o: cmfd_header.o
global.o: constants.o
global.o: dict_header.o
global.o: geometry_header.o
global.o: hdf5_interface.o
global.o: material_header.o
global.o: mesh_header.o
global.o: plot_header.o
global.o: set_header.o
global.o: source_header.o
global.o: tally_header.o
global.o: timer_header.o
string.o: constants.o
string.o: error.o
string.o: global.o
finalize.o: cmfd_output.o
finalize.o: global.o
finalize.o: hdf5_interface.o
finalize.o: output.o
finalize.o: tally.o
tally_initialize.o: constants.o
tally_initialize.o: global.o
tally_initialize.o: tally_header.o
tally.o: ace_header.o
tally.o: constants.o
tally.o: error.o
tally.o: global.o
tally.o: math.o
tally.o: mesh.o
tally.o: mesh_header.o
tally.o: output.o
tally.o: particle_header.o
tally.o: search.o
tally.o: string.o
tally.o: tally_header.o
particle_header.o: constants.o
particle_header.o: geometry_header.o
output_interface.o: constants.o
output_interface.o: error.o
output_interface.o: global.o
output_interface.o: hdf5_interface.o
output_interface.o: mpiio_interface.o
output_interface.o: tally_header.o
mesh.o: constants.o
mesh.o: global.o
mesh.o: mesh_header.o
mesh.o: particle_header.o
mesh.o: search.o
endf.o: constants.o
endf.o: string.o
initialize.o: ace.o
initialize.o: bank_header.o
initialize.o: constants.o
initialize.o: dict_header.o
initialize.o: energy_grid.o
initialize.o: error.o
initialize.o: geometry.o
initialize.o: geometry_header.o
initialize.o: global.o
initialize.o: hdf5_interface.o
initialize.o: hdf5_summary.o
initialize.o: input_xml.o
initialize.o: output.o
initialize.o: output_interface.o
initialize.o: random_lcg.o
initialize.o: source.o
initialize.o: state_point.o
initialize.o: string.o
initialize.o: tally_header.o
initialize.o: tally_initialize.o
cross_section.o: ace_header.o
cross_section.o: constants.o
cross_section.o: error.o
cross_section.o: fission.o
cross_section.o: global.o
cross_section.o: material_header.o
cross_section.o: particle_header.o
cross_section.o: random_lcg.o
cross_section.o: search.o
state_point.o: constants.o
state_point.o: error.o
state_point.o: global.o
state_point.o: output.o
state_point.o: output_interface.o
state_point.o: string.o
state_point.o: tally_header.o
eigenvalue.o: cmfd_execute.o
eigenvalue.o: constants.o
eigenvalue.o: error.o
eigenvalue.o: global.o
eigenvalue.o: math.o
eigenvalue.o: mesh.o
eigenvalue.o: mesh_header.o
eigenvalue.o: output.o
eigenvalue.o: particle_header.o
eigenvalue.o: random_lcg.o
eigenvalue.o: search.o
eigenvalue.o: source.o
eigenvalue.o: state_point.o
eigenvalue.o: string.o
eigenvalue.o: tally.o
eigenvalue.o: tracking.o
search.o: error.o
search.o: global.o
tracking.o: cross_section.o
tracking.o: error.o
tracking.o: geometry.o
tracking.o: geometry_header.o
tracking.o: global.o
tracking.o: output.o
tracking.o: particle_header.o
tracking.o: physics.o
tracking.o: random_lcg.o
tracking.o: string.o
tracking.o: tally.o
ace.o: ace_header.o
ace.o: constants.o
ace.o: endf.o
ace.o: error.o
ace.o: fission.o
ace.o: global.o
ace.o: material_header.o
ace.o: output.o
ace.o: set_header.o
ace.o: string.o
geometry.o: constants.o
geometry.o: error.o
geometry.o: geometry_header.o
geometry.o: global.o
geometry.o: output.o
geometry.o: particle_header.o
geometry.o: particle_restart_write.o
geometry.o: string.o
geometry.o: tally.o
plot_header.o: constants.o
cmfd_header.o: constants.o
tally_header.o: constants.o
hdf5_summary.o: ace_header.o
hdf5_summary.o: constants.o
hdf5_summary.o: endf.o
hdf5_summary.o: geometry_header.o
hdf5_summary.o: global.o
hdf5_summary.o: hdf5_interface.o
hdf5_summary.o: material_header.o
hdf5_summary.o: mesh_header.o
hdf5_summary.o: output.o
hdf5_summary.o: output_interface.o
hdf5_summary.o: string.o
hdf5_summary.o: tally_header.o
error.o: global.o
output.o: ace_header.o
output.o: constants.o
output.o: endf.o
@ -268,35 +371,8 @@ output.o: plot_header.o
output.o: string.o
output.o: tally_header.o
output_interface.o: constants.o
output_interface.o: error.o
output_interface.o: global.o
output_interface.o: hdf5_interface.o
output_interface.o: mpiio_interface.o
output_interface.o: tally_header.o
particle_header.o: constants.o
particle_header.o: geometry_header.o
particle_restart.o: bank_header.o
particle_restart.o: constants.o
particle_restart.o: geometry_header.o
particle_restart.o: global.o
particle_restart.o: hdf5_interface.o
particle_restart.o: output.o
particle_restart.o: particle_header.o
particle_restart.o: random_lcg.o
particle_restart.o: tracking.o
particle_restart_write.o: bank_header.o
particle_restart_write.o: global.o
particle_restart_write.o: hdf5_interface.o
particle_restart_write.o: particle_header.o
particle_restart_write.o: string.o
physics.o: ace_header.o
physics.o: constants.o
physics.o: cross_section.o
physics.o: endf.o
physics.o: error.o
physics.o: fission.o
@ -312,78 +388,3 @@ physics.o: random_lcg.o
physics.o: search.o
physics.o: string.o
plot.o: constants.o
plot.o: error.o
plot.o: geometry.o
plot.o: geometry_header.o
plot.o: global.o
plot.o: output.o
plot.o: particle_header.o
plot.o: plot_header.o
plot.o: ppmlib.o
plot.o: string.o
plot_header.o: constants.o
random_lcg.o: global.o
search.o: error.o
search.o: global.o
set_header.o: constants.o
set_header.o: list_header.o
source.o: bank_header.o
source.o: constants.o
source.o: error.o
source.o: geometry_header.o
source.o: global.o
source.o: math.o
source.o: output.o
source.o: particle_header.o
source.o: random_lcg.o
source.o: string.o
state_point.o: constants.o
state_point.o: error.o
state_point.o: global.o
state_point.o: output.o
state_point.o: output_interface.o
state_point.o: string.o
state_point.o: tally_header.o
string.o: constants.o
string.o: error.o
string.o: global.o
tally.o: ace_header.o
tally.o: constants.o
tally.o: error.o
tally.o: global.o
tally.o: math.o
tally.o: mesh.o
tally.o: mesh_header.o
tally.o: output.o
tally.o: particle_header.o
tally.o: search.o
tally.o: string.o
tally.o: tally_header.o
tally_header.o: constants.o
tally_initialize.o: constants.o
tally_initialize.o: global.o
tally_initialize.o: tally_header.o
timer_header.o: constants.o
tracking.o: cross_section.o
tracking.o: error.o
tracking.o: geometry.o
tracking.o: geometry_header.o
tracking.o: global.o
tracking.o: output.o
tracking.o: particle_header.o
tracking.o: physics.o
tracking.o: string.o
tracking.o: tally.o

View file

@ -28,7 +28,7 @@ PETSC = no
MPI_DIR = /opt/mpich/3.0.4-$(COMPILER)
HDF5_DIR = /opt/hdf5/1.8.11-$(COMPILER)
PHDF5_DIR = /opt/phdf5/1.8.11-$(COMPILER)
PETSC_DIR = /opt/petsc/3.3-p6-$(COMPILER)
PETSC_DIR = /opt/petsc/3.4.2-$(COMPILER)
#===============================================================================
# Add git SHA-1 hash

View file

@ -1180,8 +1180,14 @@ contains
integer :: NMU ! number of outgoing angles
integer :: JXS4 ! location of elastic energy table
! read secondary energy mode for inelastic scattering
! read secondary energy mode for inelastic scattering and check
table % secondary_mode = NXS(7)
if (table % secondary_mode /= SAB_SECONDARY_EQUAL .and. &
table % secondary_mode /= SAB_SECONDARY_SKEWED) then
message = "Unsupported secondary mode on S(a,b) table " // &
trim(adjustl(table % name)) // ": " // to_str(table % secondary_mode)
call fatal_error()
end if
! read number of inelastic energies and allocate arrays
NE_in = int(XSS(JXS(1)))

View file

@ -281,8 +281,7 @@ contains
use constants, only: ZERO, ONE
use error, only: warning, fatal_error
use global, only: n_particles, meshes, source_bank, work, &
n_user_meshes, message, cmfd, master, mpi_err, &
bank_first, bank_last
n_user_meshes, message, cmfd, master, mpi_err
use mesh_header, only: StructuredMesh
use mesh, only: count_bank_sites, get_mesh_indices
use search, only: binary_search
@ -296,7 +295,6 @@ contains
integer :: ijk(3) ! spatial bin location
integer :: e_bin ! energy bin of source particle
integer :: n_groups ! number of energy groups
integer(8) :: size_bank ! size of source bank
logical :: outside ! any source sites outside mesh
logical :: in_mesh ! source site is inside mesh
logical :: new_weights ! calcualte new weights
@ -312,9 +310,6 @@ contains
nz = cmfd%indices(3)
ng = cmfd%indices(4)
! compute size of source bank
size_bank = bank_last - bank_first + 1_8
! allocate arrays in cmfd object (can take out later extend to multigroup)
if (.not.allocated(cmfd%sourcecounts)) then
allocate(cmfd%sourcecounts(ng,nx,ny,nz))
@ -337,7 +332,7 @@ contains
! count bank sites in mesh
call count_bank_sites(m, source_bank, cmfd%sourcecounts, egrid, &
sites_outside=outside, size_bank = size_bank)
sites_outside=outside, size_bank=work)
! check for sites outside of the mesh
if (master .and. outside) then
@ -360,7 +355,7 @@ contains
end if
! begin loop over source bank
do i = 1, int(size_bank, 4)
do i = 1, int(work,4)
! determine spatial bin
call get_mesh_indices(m, source_bank(i)%xyz, ijk, in_mesh)

View file

@ -389,7 +389,7 @@ contains
end if
! the last processor should not be sending sites to right
finish = bank_last
finish = work_index(rank + 1)
end if
call time_bank_sample % stop()
@ -405,11 +405,11 @@ contains
if (start < n_particles) then
! Determine the index of the processor which has the first part of the
! source_bank for the local processor
neighbor = start / maxwork
neighbor = binary_search(work_index, n_procs + 1, start) - 1
SEND_SITES: do while (start < finish)
! Determine the number of sites to send
n = min((neighbor + 1)*maxwork, finish) - start
n = min(work_index(neighbor + 1), finish) - start
! Initiate an asynchronous send of source sites to the neighboring
! process
@ -434,7 +434,7 @@ contains
! ==========================================================================
! RECEIVE BANK SITES FROM NEIGHBORS OR TEMPORARY BANK
start = bank_first - 1
start = work_index(rank)
index_local = 1
! Determine what process has the source sites that will need to be stored at
@ -446,13 +446,12 @@ contains
neighbor = binary_search(bank_position, n_procs, start) - 1
end if
RECV_SITES: do while (start < bank_last)
RECV_SITES: do while (start < work_index(rank + 1))
! Determine how many sites need to be received
if (neighbor == n_procs - 1) then
n = min(n_particles, (rank+1)*maxwork) - start
n = work_index(rank + 1) - start
else
n = min(bank_position(neighbor+2), min(n_particles, &
(rank+1)*maxwork)) - start
n = min(bank_position(neighbor + 2), work_index(rank + 1)) - start
end if
if (neighbor /= rank) then
@ -763,7 +762,7 @@ contains
else
! count number of source sites in each ufs mesh cell
call count_bank_sites(ufs_mesh, source_bank, source_frac, &
sites_outside=sites_outside)
sites_outside=sites_outside, size_bank=work)
! Check for sites outside of the mesh
if (master .and. sites_outside) then

View file

@ -17,7 +17,9 @@ contains
! stream.
!===============================================================================
subroutine warning()
subroutine warning(force)
logical, optional :: force ! force write from proc other than master
integer :: i_start ! starting position
integer :: i_end ! ending position
@ -26,7 +28,7 @@ contains
integer :: indent ! length of indentation
! Only allow master to print to screen
if (.not. master) return
if (.not. master .and. .not. present(force)) return
! Write warning at beginning
write(ERROR_UNIT, fmt='(1X,A)', advance='no') 'WARNING: '

View file

@ -56,12 +56,12 @@ contains
PARTICLE_LOOP: do i = 1, work
! Set unique particle ID
p % id = (current_batch - 1)*n_particles + bank_first + i - 1
p % id = (current_batch - 1)*n_particles + work_index(rank) + i
! set particle trace
trace = .false.
if (current_batch == trace_batch .and. current_gen == trace_gen .and. &
bank_first + i - 1 == trace_particle) trace = .true.
work_index(rank) + i == trace_particle) trace = .true.
! set random number seed
call set_particle_seed(p % id)

View file

@ -1567,7 +1567,7 @@ contains
type(Particle), intent(inout) :: p
! Print warning and write lost particle file
call warning()
call warning(force = .true.)
call write_particle_restart(p)
! Increment number of lost particles

View file

@ -166,10 +166,8 @@ module global
type(Bank), allocatable, target :: master_fission_bank(:)
#endif
integer(8) :: n_bank ! # of sites in fission bank
integer(8) :: bank_first ! index of first particle in bank
integer(8) :: bank_last ! index of last particle in bank
integer(8) :: work ! number of particles per processor
integer(8) :: maxwork ! maximum number of particles per processor
integer(8), allocatable :: work_index(:) ! starting index in source bank for each process
integer(8) :: current_work ! index in source bank of current history simulated
! Temporary k-effective values
@ -462,6 +460,9 @@ contains
if (allocated(source_bank)) deallocate(source_bank)
if (allocated(entropy_p)) deallocate(entropy_p)
! Deallocate array of work indices
if (allocated(work_index)) deallocate(work_index)
! Deallocate cmfd
call deallocate_cmfd(cmfd)

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,10 @@ module hdf5_summary
use string, only: to_str
use tally_header, only: TallyObject
implicit none
type(BinaryOutput) :: su
contains
!===============================================================================
@ -25,7 +29,7 @@ contains
character(MAX_FILE_LEN) :: filename = "summary.h5"
! Create a new file using default properties.
call file_create(filename, "serial")
call su % file_create(filename)
! Write header information
call hdf5_write_header()
@ -34,24 +38,24 @@ contains
if (run_mode == MODE_EIGENVALUE) then
! Write number of particles
call write_data(n_particles, "n_particles")
call su % write_data(n_particles, "n_particles")
! Use H5LT interface to write n_batches, n_inactive, and n_active
call write_data(n_batches, "n_batches")
call write_data(n_inactive, "n_inactive")
call write_data(n_active, "n_active")
call write_data(gen_per_batch, "gen_per_batch")
call su % write_data(n_batches, "n_batches")
call su % write_data(n_inactive, "n_inactive")
call su % write_data(n_active, "n_active")
call su % write_data(gen_per_batch, "gen_per_batch")
! Add description of each variable
call write_attribute_string("n_particles", &
call su % write_attribute_string("n_particles", &
"description", "Number of particles per generation")
call write_attribute_string("n_batches", &
call su % write_attribute_string("n_batches", &
"description", "Total number of batches")
call write_attribute_string("n_inactive", &
call su % write_attribute_string("n_inactive", &
"description", "Number of inactive batches")
call write_attribute_string("n_active", &
call su % write_attribute_string("n_active", &
"description", "Number of active batches")
call write_attribute_string("gen_per_batch", &
call su % write_attribute_string("gen_per_batch", &
"description", "Number of generations per batch")
end if
@ -63,7 +67,7 @@ contains
end if
! Terminate access to the file.
call file_close("serial")
call su % file_close()
end subroutine hdf5_write_summary
@ -74,16 +78,16 @@ contains
subroutine hdf5_write_header()
! Write version information
call write_data(VERSION_MAJOR, "version_major")
call write_data(VERSION_MINOR, "version_minor")
call write_data(VERSION_RELEASE, "version_release")
call su % write_data(VERSION_MAJOR, "version_major")
call su % write_data(VERSION_MINOR, "version_minor")
call su % write_data(VERSION_RELEASE, "version_release")
! Write current date and time
call write_data(time_stamp(), "date_and_time")
call su % write_data(time_stamp(), "date_and_time")
! Write MPI information
call write_data(n_procs, "n_procs")
call write_attribute_string("n_procs", "description", &
call su % write_data(n_procs, "n_procs")
call su % write_attribute_string("n_procs", "description", &
"Number of MPI processes")
end subroutine hdf5_write_header
@ -103,53 +107,53 @@ contains
type(Lattice), pointer :: lat => null()
! Use H5LT interface to write number of geometry objects
call write_data(n_cells, "n_cells", group="geometry")
call write_data(n_surfaces, "n_surfaces", group="geometry")
call write_data(n_universes, "n_universes", group="geometry")
call write_data(n_lattices, "n_lattices", group="geometry")
call su % write_data(n_cells, "n_cells", group="geometry")
call su % write_data(n_surfaces, "n_surfaces", group="geometry")
call su % write_data(n_universes, "n_universes", group="geometry")
call su % write_data(n_lattices, "n_lattices", group="geometry")
! ==========================================================================
! WRITE INFORMATION ON CELLS
! Create a cell group (nothing directly written in this group) then close
call hdf5_open_group("geometry/cells")
call hdf5_close_group()
call su % open_group("geometry/cells")
call su % close_group()
! Write information on each cell
CELL_LOOP: do i = 1, n_cells
c => cells(i)
! Write universe for this cell
call write_data(universes(c % universe) % id, "universe", &
call su % write_data(universes(c % universe) % id, "universe", &
group="geometry/cells/cell " // trim(to_str(c % id)))
! Write information on what fills this cell
select case (c % type)
case (CELL_NORMAL)
call write_data("normal", "fill_type", &
call su % write_data("normal", "fill_type", &
group="geometry/cells/cell " // trim(to_str(c % id)))
if (c % material == MATERIAL_VOID) then
call write_data(-1, "material", &
call su % write_data(-1, "material", &
group="geometry/cells/cell " // trim(to_str(c % id)))
else
call write_data(materials(c % material) % id, "material", &
call su % write_data(materials(c % material) % id, "material", &
group="geometry/cells/cell " // trim(to_str(c % id)))
end if
case (CELL_FILL)
call write_data("universe", "fill_type", &
call su % write_data("universe", "fill_type", &
group="geometry/cells/cell " // trim(to_str(c % id)))
call write_data(universes(c % fill) % id, "material", &
call su % write_data(universes(c % fill) % id, "material", &
group="geometry/cells/cell " // trim(to_str(c % id)))
case (CELL_LATTICE)
call write_data("lattice", "fill_type", &
call su % write_data("lattice", "fill_type", &
group="geometry/cells/cell " // trim(to_str(c % id)))
call write_data(lattices(c % fill) % id, "lattice", &
call su % write_data(lattices(c % fill) % id, "lattice", &
group="geometry/cells/cell " // trim(to_str(c % id)))
end select
! Write list of bounding surfaces
if (c % n_surfaces > 0) then
call write_data(c % surfaces, "surfaces", length= c % n_surfaces, &
call su % write_data(c % surfaces, "surfaces", length= c % n_surfaces, &
group="geometry/cells/cell " // trim(to_str(c % id)))
end if
@ -159,8 +163,8 @@ contains
! WRITE INFORMATION ON SURFACES
! Create surfaces group (nothing directly written here) then close
call hdf5_open_group("geometry/surfaces")
call hdf5_close_group()
call su % open_group("geometry/surfaces")
call su % close_group()
! Write information on each surface
SURFACE_LOOP: do i = 1, n_surfaces
@ -169,54 +173,54 @@ contains
! Write surface type
select case (s % type)
case (SURF_PX)
call write_data("X Plane", "type", &
call su % write_data("X Plane", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_PY)
call write_data("Y Plane", "type", &
call su % write_data("Y Plane", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_PZ)
call write_data("Z Plane", "type", &
call su % write_data("Z Plane", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_PLANE)
call write_data("Plane", "type", &
call su % write_data("Plane", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_CYL_X)
call write_data("X Cylinder", "type", &
call su % write_data("X Cylinder", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_CYL_Y)
call write_data("Y Cylinder", "type", &
call su % write_data("Y Cylinder", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_CYL_Z)
call write_data("Z Cylinder", "type", &
call su % write_data("Z Cylinder", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_SPHERE)
call write_data("Sphere", "type", &
call su % write_data("Sphere", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_CONE_X)
call write_data("X Cone", "type", &
call su % write_data("X Cone", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_CONE_Y)
call write_data("Y Cone", "type", &
call su % write_data("Y Cone", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (SURF_CONE_Z)
call write_data("Z Cone", "type", &
call su % write_data("Z Cone", "type", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
end select
! Write coefficients for surface
call write_data(s % coeffs, "coefficients", length=size(s % coeffs), &
call su % write_data(s % coeffs, "coefficients", length=size(s % coeffs), &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
! Write positive neighbors
if (allocated(s % neighbor_pos)) then
call write_data(s % neighbor_pos, "neighbors_positive", &
call su % write_data(s % neighbor_pos, "neighbors_positive", &
length=size(s % neighbor_pos), &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
end if
! Write negative neighbors
if (allocated(s % neighbor_neg)) then
call write_data(s % neighbor_neg, "neighbors_negative", &
call su % write_data(s % neighbor_neg, "neighbors_negative", &
length=size(s % neighbor_neg), &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
end if
@ -224,16 +228,16 @@ contains
! Write boundary condition
select case (s % bc)
case (BC_TRANSMIT)
call write_data("transmission", "boundary_condition", &
call su % write_data("transmission", "boundary_condition", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (BC_VACUUM)
call write_data("vacuum", "boundary_condition", &
call su % write_data("vacuum", "boundary_condition", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (BC_REFLECT)
call write_data("reflective", "boundary_condition", &
call su % write_data("reflective", "boundary_condition", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
case (BC_PERIODIC)
call write_data("periodic", "boundary_condition", &
call su % write_data("periodic", "boundary_condition", &
group="geometry/surfaces/surface " // trim(to_str(s % id)))
end select
@ -243,8 +247,8 @@ contains
! WRITE INFORMATION ON UNIVERSES
! Create universes group (nothing directly written here) then close
call hdf5_open_group("geometry/universes")
call hdf5_close_group()
call su % open_group("geometry/universes")
call su % close_group()
! Write information on each universe
UNIVERSE_LOOP: do i = 1, n_universes
@ -252,7 +256,7 @@ contains
! Write list of cells in this universe
if (u % n_cells > 0) then
call write_data(u % cells, "cells", length=u % n_cells, &
call su % write_data(u % cells, "cells", length=u % n_cells, &
group="geometry/universes/universe " // trim(to_str(u % id)))
end if
@ -262,8 +266,8 @@ contains
! WRITE INFORMATION ON LATTICES
! Create lattices group (nothing directly written here) then close
call hdf5_open_group("geometry/lattices")
call hdf5_close_group()
call su % open_group("geometry/lattices")
call su % close_group()
! Write information on each lattice
LATTICE_LOOP: do i = 1, n_lattices
@ -272,21 +276,21 @@ contains
! Write lattice type
select case(lat % type)
case (LATTICE_RECT)
call write_data("rectangular", "type", &
call su % write_data("rectangular", "type", &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
case (LATTICE_HEX)
call write_data("hexagonal", "type", &
call su % write_data("hexagonal", "type", &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
end select
! Write lattice dimensions, lower left corner, and width of element
call write_data(lat % dimension, "dimension", &
call su % write_data(lat % dimension, "dimension", &
length=lat % n_dimension, &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
call write_data(lat % lower_left, "lower_left", &
call su % write_data(lat % lower_left, "lower_left", &
length=lat % n_dimension, &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
call write_data(lat % width, "width", &
call su % write_data(lat % width, "width", &
length=lat % n_dimension, &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
@ -308,7 +312,7 @@ contains
end do
end do
end do
call write_data(lattice_universes, "universes", &
call su % write_data(lattice_universes, "universes", &
length=(/n_x, n_y, n_z/), &
group="geometry/lattices/lattice " // trim(to_str(lat % id)))
deallocate(lattice_universes)
@ -329,16 +333,16 @@ contains
type(Material), pointer :: m => null()
! Use H5LT interface to write number of materials
call write_data(n_materials, "n_materials", group="materials")
call su % write_data(n_materials, "n_materials", group="materials")
! Write information on each material
do i = 1, n_materials
m => materials(i)
! Write atom density with units
call write_data(m % density, "atom_density", &
call su % write_data(m % density, "atom_density", &
group="materials/material " // trim(to_str(m % id)))
call write_attribute_string("atom_density", "units", "atom/b-cm", &
call su % write_attribute_string("atom_density", "units", "atom/b-cm", &
group="materials/material " // trim(to_str(m % id)))
! Copy ZAID for each nuclide to temporary array
@ -348,23 +352,23 @@ contains
end do
! Write temporary array to 'nuclides'
call write_data(zaids, "nuclides", length=m % n_nuclides, &
call su % write_data(zaids, "nuclides", length=m % n_nuclides, &
group="materials/material " // trim(to_str(m % id)))
! Deallocate temporary array
deallocate(zaids)
! Write atom densities
call write_data(m % atom_density, "nuclide_densities", &
call su % write_data(m % atom_density, "nuclide_densities", &
length=m % n_nuclides, &
group="materials/material " // trim(to_str(m % id)))
! Write S(a,b) information if present
if (m % n_sab > 0) then
call write_data(m % i_sab_nuclides, "i_sab_nuclides", &
call su % write_data(m % i_sab_nuclides, "i_sab_nuclides", &
length=m % n_sab, &
group="materials/material " // trim(to_str(m % id)))
call write_data(m % i_sab_tables, "i_sab_tables", &
call su % write_data(m % i_sab_tables, "i_sab_tables", &
length=m % n_sab, &
group="materials/material " // trim(to_str(m % id)))
end if
@ -385,72 +389,72 @@ contains
type(TallyObject), pointer :: t => null()
! Write total number of meshes
call write_data(n_meshes, "n_meshes", group="tallies")
call su % write_data(n_meshes, "n_meshes", group="tallies")
! Write information for meshes
MESH_LOOP: do i = 1, n_meshes
m => meshes(i)
! Write type and number of dimensions
call write_data(m % type, "type", &
call su % write_data(m % type, "type", &
group="tallies/mesh " // trim(to_str(m % id)))
call write_data(m % n_dimension, "n_dimension", &
call su % write_data(m % n_dimension, "n_dimension", &
group="tallies/mesh " // trim(to_str(m % id)))
! Write mesh information
call write_data(m % dimension, "dimension", &
call su % write_data(m % dimension, "dimension", &
length=m % n_dimension, &
group="tallies/mesh " // trim(to_str(m % id)))
call write_data(m % lower_left, "lower_left", &
call su % write_data(m % lower_left, "lower_left", &
length=m % n_dimension, &
group="tallies/mesh " // trim(to_str(m % id)))
call write_data(m % upper_right, "upper_right", &
call su % write_data(m % upper_right, "upper_right", &
length=m % n_dimension, &
group="tallies/mesh " // trim(to_str(m % id)))
call write_data(m % width, "width", &
call su % write_data(m % width, "width", &
length=m % n_dimension, &
group="tallies/mesh " // trim(to_str(m % id)))
end do MESH_LOOP
! Write number of tallies
call write_data(n_tallies, "n_tallies", group="tallies")
call su % write_data(n_tallies, "n_tallies", group="tallies")
TALLY_METADATA: do i = 1, n_tallies
! Get pointer to tally
t => tallies(i)
! Write size of each tally
call write_data(t % total_score_bins, "total_score_bins", &
call su % write_data(t % total_score_bins, "total_score_bins", &
group="tallies/tally " // trim(to_str(t % id)))
call write_data(t % total_filter_bins, "total_filter_bins", &
call su % write_data(t % total_filter_bins, "total_filter_bins", &
group="tallies/tally " // trim(to_str(t % id)))
! Write number of filters
call write_data(t % n_filters, "n_filters", &
call su % write_data(t % n_filters, "n_filters", &
group="tallies/tally " // trim(to_str(t % id)))
FILTER_LOOP: do j = 1, t % n_filters
! Write type of filter
call write_data(t % filters(j) % type, "type", &
call su % write_data(t % filters(j) % type, "type", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
! Write number of bins for this filter
call write_data(t % filters(j) % n_bins, "n_bins", &
call su % write_data(t % filters(j) % n_bins, "n_bins", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
! Write filter bins
if (t % filters(j) % type == FILTER_ENERGYIN .or. &
t % filters(j) % type == FILTER_ENERGYOUT) then
call write_data(t % filters(j) % real_bins, "bins", &
call su % write_data(t % filters(j) % real_bins, "bins", &
length=size(t % filters(j) % real_bins), &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
else
call write_data(t % filters(j) % int_bins, "bins", &
call su % write_data(t % filters(j) % int_bins, "bins", &
length=size(t % filters(j) % int_bins), &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
@ -459,35 +463,35 @@ contains
! Write name of type
select case (t % filters(j) % type)
case(FILTER_UNIVERSE)
call write_data("universe", "type_name", &
call su % write_data("universe", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
case(FILTER_MATERIAL)
call write_data("material", "type_name", &
call su % write_data("material", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
case(FILTER_CELL)
call write_data("cell", "type_name", &
call su % write_data("cell", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
case(FILTER_CELLBORN)
call write_data("cellborn", "type_name", &
call su % write_data("cellborn", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
case(FILTER_SURFACE)
call write_data("surface", "type_name", &
call su % write_data("surface", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
case(FILTER_MESH)
call write_data("mesh", "type_name", &
call su % write_data("mesh", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
case(FILTER_ENERGYIN)
call write_data("energy", "type_name", &
call su % write_data("energy", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
case(FILTER_ENERGYOUT)
call write_data("energyout", "type_name", &
call su % write_data("energyout", "type_name", &
group="tallies/tally " // trim(to_str(t % id)) &
// "/filter " // trim(to_str(j)))
end select
@ -495,7 +499,7 @@ contains
end do FILTER_LOOP
! Write number of nuclide bins
call write_data(t % n_nuclide_bins, "n_nuclide_bins", &
call su % write_data(t % n_nuclide_bins, "n_nuclide_bins", &
group="tallies/tally " // trim(to_str(t % id)))
! Create temporary array for nuclide bins
@ -509,14 +513,14 @@ contains
end do NUCLIDE_LOOP
! Write and deallocate nuclide bins
call write_data(temp_array, "nuclide_bins", length=t % n_nuclide_bins, &
call su % write_data(temp_array, "nuclide_bins", length=t % n_nuclide_bins, &
group="tallies/tally " // trim(to_str(t % id)))
deallocate(temp_array)
! Write number of score bins
call write_data(t % n_score_bins, "n_score_bins", &
call su % write_data(t % n_score_bins, "n_score_bins", &
group="tallies/tally " // trim(to_str(t % id)))
call write_data(t % score_bins, "score_bins", length=t % n_score_bins, &
call su % write_data(t % score_bins, "score_bins", length=t % n_score_bins, &
group="tallies/tally " // trim(to_str(t % id)))
end do TALLY_METADATA
@ -539,7 +543,7 @@ contains
type(UrrData), pointer :: urr => null()
! Use H5LT interface to write number of nuclides
call write_data(n_nuclides_total, "n_nuclides", group="nuclides")
call su % write_data(n_nuclides_total, "n_nuclides", group="nuclides")
! Write information on each nuclide
NUCLIDE_LOOP: do i = 1, n_nuclides_total
@ -550,27 +554,27 @@ contains
size_total = size_xs
! Write some basic attributes
call write_data(nuc % zaid, "zaid", &
call su % write_data(nuc % zaid, "zaid", &
group="nuclides/" // trim(nuc % name))
call write_data(nuc % awr, "awr", &
call su % write_data(nuc % awr, "awr", &
group="nuclides/" // trim(nuc % name))
call write_data(nuc % kT, "kT", &
call su % write_data(nuc % kT, "kT", &
group="nuclides/" // trim(nuc % name))
call write_data(nuc % n_grid, "n_grid", &
call su % write_data(nuc % n_grid, "n_grid", &
group="nuclides/" // trim(nuc % name))
call write_data(nuc % n_reaction, "n_reactions", &
call su % write_data(nuc % n_reaction, "n_reactions", &
group="nuclides/" // trim(nuc % name))
call write_data(nuc % n_fission, "n_fission", &
call su % write_data(nuc % n_fission, "n_fission", &
group="nuclides/" // trim(nuc % name))
call write_data(size_xs, "size_xs", &
call su % write_data(size_xs, "size_xs", &
group="nuclides/" // trim(nuc % name))
! =======================================================================
! WRITE INFORMATION ON EACH REACTION
! Create overall group for reactions and close it
call hdf5_open_group("nuclides/" // trim(nuc % name) // "/reactions")
call hdf5_close_group()
call su % open_group("nuclides/" // trim(nuc % name) // "/reactions")
call su % close_group()
RXN_LOOP: do j = 1, nuc % n_reaction
! Information on each reaction
@ -591,19 +595,19 @@ contains
end if
! Write information on reaction
call write_data(rxn % Q_value, "Q_value", &
call su % write_data(rxn % Q_value, "Q_value", &
group="nuclides/" // trim(nuc % name) // "/reactions/" // &
trim(reaction_name(rxn % MT)))
call write_data(rxn % multiplicity, "multiplicity", &
call su % write_data(rxn % multiplicity, "multiplicity", &
group="nuclides/" // trim(nuc % name) // "/reactions/" // &
trim(reaction_name(rxn % MT)))
call write_data(rxn % threshold, "threshold", &
call su % write_data(rxn % threshold, "threshold", &
group="nuclides/" // trim(nuc % name) // "/reactions/" // &
trim(reaction_name(rxn % MT)))
call write_data(size_angle, "size_angle", &
call su % write_data(size_angle, "size_angle", &
group="nuclides/" // trim(nuc % name) // "/reactions/" // &
trim(reaction_name(rxn % MT)))
call write_data(size_energy, "size_energy", &
call su % write_data(size_energy, "size_energy", &
group="nuclides/" // trim(nuc % name) // "/reactions/" // &
trim(reaction_name(rxn % MT)))
@ -616,24 +620,24 @@ contains
if (nuc % urr_present) then
urr => nuc % urr_data
call write_data(urr % n_energy, "urr_n_energy", &
call su % write_data(urr % n_energy, "urr_n_energy", &
group="nuclides/" // trim(nuc % name))
call write_data(urr % n_prob, "urr_n_prob", &
call su % write_data(urr % n_prob, "urr_n_prob", &
group="nuclides/" // trim(nuc % name))
call write_data(urr % interp, "urr_interp", &
call su % write_data(urr % interp, "urr_interp", &
group="nuclides/" // trim(nuc % name))
call write_data(urr % inelastic_flag, "urr_inelastic", &
call su % write_data(urr % inelastic_flag, "urr_inelastic", &
group="nuclides/" // trim(nuc % name))
call write_data(urr % absorption_flag, "urr_absorption", &
call su % write_data(urr % absorption_flag, "urr_absorption", &
group="nuclides/" // trim(nuc % name))
call write_data(urr % energy(1), "urr_min_E", &
call su % write_data(urr % energy(1), "urr_min_E", &
group="nuclides/" // trim(nuc % name))
call write_data(urr % energy(urr % n_energy), "urr_max_E", &
call su % write_data(urr % energy(urr % n_energy), "urr_max_E", &
group="nuclides/" // trim(nuc % name))
end if
! Write total memory used
call write_data(size_total, "size_total", &
call su % write_data(size_total, "size_total", &
group="nuclides/" // trim(nuc % name))
end do NUCLIDE_LOOP
@ -650,63 +654,63 @@ contains
real(8) :: speed
! Write timing data
call write_data(time_initialize % elapsed, "time_initialize", &
call su % write_data(time_initialize % elapsed, "time_initialize", &
group="timing")
call write_data(time_read_xs % elapsed, "time_read_xs", &
call su % write_data(time_read_xs % elapsed, "time_read_xs", &
group="timing")
call write_data(time_unionize % elapsed, "time_unionize", &
call su % write_data(time_unionize % elapsed, "time_unionize", &
group="timing")
call write_data(time_transport % elapsed, "time_transport", &
call su % write_data(time_transport % elapsed, "time_transport", &
group="timing")
call write_data(time_bank % elapsed, "time_bank", &
call su % write_data(time_bank % elapsed, "time_bank", &
group="timing")
call write_data(time_bank_sample % elapsed, "time_bank_sample", &
call su % write_data(time_bank_sample % elapsed, "time_bank_sample", &
group="timing")
call write_data(time_bank_sendrecv % elapsed, "time_bank_sendrecv", &
call su % write_data(time_bank_sendrecv % elapsed, "time_bank_sendrecv", &
group="timing")
call write_data(time_tallies % elapsed, "time_tallies", &
call su % write_data(time_tallies % elapsed, "time_tallies", &
group="timing")
call write_data(time_inactive % elapsed, "time_inactive", &
call su % write_data(time_inactive % elapsed, "time_inactive", &
group="timing")
call write_data(time_active % elapsed, "time_active", &
call su % write_data(time_active % elapsed, "time_active", &
group="timing")
call write_data(time_finalize % elapsed, "time_finalize", &
call su % write_data(time_finalize % elapsed, "time_finalize", &
group="timing")
call write_data(time_total % elapsed, "time_total", &
call su % write_data(time_total % elapsed, "time_total", &
group="timing")
! Add descriptions to timing data
call write_attribute_string("time_initialize", "description", &
call su % write_attribute_string("time_initialize", "description", &
"Total time elapsed for initialization (s)", group="timing")
call write_attribute_string("time_read_xs", "description", &
call su % write_attribute_string("time_read_xs", "description", &
"Time reading cross-section libraries (s)", group="timing")
call write_attribute_string("time_unionize", "description", &
call su % write_attribute_string("time_unionize", "description", &
"Time unionizing energy grid (s)", group="timing")
call write_attribute_string("time_transport", "description", &
call su % write_attribute_string("time_transport", "description", &
"Time in transport only (s)", group="timing")
call write_attribute_string("time_bank", "description", &
call su % write_attribute_string("time_bank", "description", &
"Total time synchronizing fission bank (s)", group="timing")
call write_attribute_string("time_bank_sample", "description", &
call su % write_attribute_string("time_bank_sample", "description", &
"Time between generations sampling source sites (s)", group="timing")
call write_attribute_string("time_bank_sendrecv", "description", &
call su % write_attribute_string("time_bank_sendrecv", "description", &
"Time between generations SEND/RECVing source sites (s)", &
group="timing")
call write_attribute_string("time_tallies", "description", &
call su % write_attribute_string("time_tallies", "description", &
"Time between batches accumulating tallies (s)", group="timing")
call write_attribute_string("time_inactive", "description", &
call su % write_attribute_string("time_inactive", "description", &
"Total time in inactive batches (s)", group="timing")
call write_attribute_string("time_active", "description", &
call su % write_attribute_string("time_active", "description", &
"Total time in active batches (s)", group="timing")
call write_attribute_string("time_finalize", "description", &
call su % write_attribute_string("time_finalize", "description", &
"Total time for finalization (s)", group="timing")
call write_attribute_string("time_total", "description", &
call su % write_attribute_string("time_total", "description", &
"Total time elapsed (s)", group="timing")
! Write calculation rate
total_particles = n_particles * n_batches * gen_per_batch
speed = real(total_particles) / (time_inactive % elapsed + &
time_active % elapsed)
call write_data(speed, "neutrons_per_second", group="timing")
call su % write_data(speed, "neutrons_per_second", group="timing")
end subroutine hdf5_write_timing

View file

@ -14,7 +14,7 @@ module initialize
use output, only: title, header, write_summary, print_version, &
print_usage, write_xs_summary, print_plot, &
write_message
use output_interface, only: file_open, file_close, read_data
use output_interface
use random_lcg, only: initialize_prng
use source, only: initialize_source
use state_point, only: load_state_point
@ -310,6 +310,7 @@ contains
integer :: filetype
character(MAX_FILE_LEN) :: pwd ! present working directory
character(MAX_WORD_LEN), allocatable :: argv(:) ! command line arguments
type(BinaryOutput) :: sp
! Get working directory
call GET_ENVIRONMENT_VARIABLE("PWD", pwd)
@ -350,9 +351,9 @@ contains
i = i + 1
! Check what type of file this is
call file_open(argv(i), 'parallel', 'r')
call read_data(filetype, 'filetype')
call file_close('parallel')
call sp % file_open(argv(i), 'r', serial = .false.)
call sp % read_data(filetype, 'filetype')
call sp % file_close()
! Set path and flag for type of run
select case (filetype)
@ -775,15 +776,37 @@ contains
subroutine calculate_work()
! Determine maximum amount of particles to simulate on each processor
maxwork = ceiling(real(n_particles)/n_procs,8)
integer :: i ! loop index
integer :: remainder ! Number of processors with one extra particle
integer(8) :: i_bank ! Running count of number of particles
integer(8) :: min_work ! Minimum number of particles on each proc
integer(8) :: work_i ! Number of particles on rank i
! ID's of first and last source particles
bank_first = rank*maxwork + 1
bank_last = min((rank+1)*maxwork, n_particles)
allocate(work_index(0:n_procs))
! number of particles for this processor
work = bank_last - bank_first + 1
! Determine minimum amount of particles to simulate on each processor
min_work = n_particles/n_procs
! Determine number of processors that have one extra particle
remainder = int(mod(n_particles, int(n_procs,8)), 4)
i_bank = 0
work_index(0) = 0
do i = 0, n_procs - 1
! Number of particles for rank i
if (i < remainder) then
work_i = min_work + 1
else
work_i = min_work
end if
! Set number of particles
if (rank == i) work = work_i
! Set index into source bank for rank i
i_bank = i_bank + work_i
work_index(i+1) = i_bank
end do
end subroutine calculate_work
@ -796,7 +819,7 @@ contains
integer :: alloc_err ! allocation error code
! Allocate source bank
allocate(source_bank(maxwork), STAT=alloc_err)
allocate(source_bank(work), STAT=alloc_err)
! Check for allocation errors
if (alloc_err /= 0) then
@ -815,14 +838,14 @@ contains
thread_id = omp_get_thread_num()
if (thread_id == 0) then
allocate(fission_bank(3*maxwork))
allocate(fission_bank(3*work))
else
allocate(fission_bank(3*maxwork/n_threads))
allocate(fission_bank(3*work/n_threads))
end if
!$omp end parallel
allocate(master_fission_bank(3*maxwork), STAT=alloc_err)
allocate(master_fission_bank(3*work), STAT=alloc_err)
#else
allocate(fission_bank(3*maxwork), STAT=alloc_err)
allocate(fission_bank(3*work), STAT=alloc_err)
#endif
! Check for allocation errors

View file

@ -5,9 +5,40 @@ module mpiio_interface
implicit none
integer :: mpi_fh ! MPI file handle
integer :: mpiio_err ! MPI error code
! Generic HDF5 write procedure interface
interface mpi_write_data
module procedure mpi_write_double
module procedure mpi_write_double_1Darray
module procedure mpi_write_double_2Darray
module procedure mpi_write_double_3Darray
module procedure mpi_write_double_4Darray
module procedure mpi_write_integer
module procedure mpi_write_integer_1Darray
module procedure mpi_write_integer_2Darray
module procedure mpi_write_integer_3Darray
module procedure mpi_write_integer_4Darray
module procedure mpi_write_long
module procedure mpi_write_string
end interface mpi_write_data
! Generic HDF5 read procedure interface
interface mpi_read_data
module procedure mpi_read_double
module procedure mpi_read_double_1Darray
module procedure mpi_read_double_2Darray
module procedure mpi_read_double_3Darray
module procedure mpi_read_double_4Darray
module procedure mpi_read_integer
module procedure mpi_read_integer_1Darray
module procedure mpi_read_integer_2Darray
module procedure mpi_read_integer_3Darray
module procedure mpi_read_integer_4Darray
module procedure mpi_read_long
module procedure mpi_read_string
end interface mpi_read_data
contains
!===============================================================================
@ -40,7 +71,7 @@ contains
! Determine access mode
open_mode = MPI_MODE_RDONLY
if (mode == 'w') then
open_mode = MPI_MODE_WRONLY
open_mode = ior(MPI_MODE_APPEND, MPI_MODE_WRONLY)
end if
! Create the file
@ -65,173 +96,505 @@ contains
! MPI_WRITE_INTEGER writes integer scalar data using MPI File I/O
!===============================================================================
subroutine mpi_write_integer(fh, buffer)
subroutine mpi_write_integer(fh, buffer, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: buffer ! data to write
integer, intent(in) :: fh ! file handle
integer, intent(in) :: buffer ! data to write
logical, intent(in) :: collect ! collective I/O
call MPI_FILE_WRITE(fh, buffer, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_integer
!===============================================================================
! MPI_WRITE_INTEGER_1DARRAY writes integer 1-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_integer_1Darray(fh, buffer, length)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of array
integer, intent(in) :: buffer(:) ! data to write
call MPI_FILE_WRITE(fh, buffer, length, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end subroutine mpi_write_integer_1Darray
!===============================================================================
! MPI_WRITE_LONG writes long integer scalar data using MPI file I/O
!===============================================================================
subroutine mpi_write_long(fh, buffer)
integer, intent(in) :: fh ! file handle
integer(8), intent(in) :: buffer ! data to write
call MPI_FILE_WRITE(fh, buffer, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpiio_err)
end subroutine mpi_write_long
!===============================================================================
! MPI_WRITE_DOUBLE writes double precision scalar data using MPI file I/O
!===============================================================================
subroutine mpi_write_double(fh, buffer)
integer, intent(in) :: fh ! file handle
real(8), intent(in) :: buffer ! data to write
call MPI_FILE_WRITE(fh, buffer, 1, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end subroutine mpi_write_double
!===============================================================================
! MPI_WRITE_DOUBLE_1DARRAY writes double precision 1-D array using MPI file I/O
!===============================================================================
subroutine mpi_write_double_1Darray(fh, buffer, length)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of array
real(8), intent(in) :: buffer(:) ! data to write
call MPI_FILE_WRITE(fh, buffer, length, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end subroutine mpi_write_double_1Darray
!===============================================================================
! MPI_WRITE_STRING writes string data using MPI file I/O
!===============================================================================
subroutine mpi_write_string(fh, buffer, length)
character(*), intent(in) :: buffer ! data to write
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of data
call MPI_FILE_WRITE(fh, buffer, length, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpiio_err)
end subroutine mpi_write_string
!===============================================================================
! MPI_READ_INTEGER reads integer scalar data using MPI file I/O
!===============================================================================
subroutine mpi_read_integer(fh, buffer)
subroutine mpi_read_integer(fh, buffer, collect)
integer, intent(in) :: fh ! file handle
integer, intent(inout) :: buffer ! read data to here
integer, intent(in) :: fh ! file handle
integer, intent(inout) :: buffer ! read data to here
logical, intent(in) :: collect ! collective I/O
call MPI_FILE_READ(fh, buffer, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, 1, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_integer
!===============================================================================
! MPI_WRITE_INTEGER_1DARRAY writes integer 1-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_integer_1Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of array
integer, intent(in) :: buffer(:) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, length, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, length, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_integer_1Darray
!===============================================================================
! MPI_READ_INTEGER_1DARRAY reads integer 1-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_integer_1Darray(fh, buffer, length)
subroutine mpi_read_integer_1Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of array
integer, intent(inout) :: buffer(:) ! read data to here
logical, intent(in) :: collect ! collective I/O
call MPI_FILE_READ(fh, buffer, length, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, length, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, length, MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_integer_1Darray
!===============================================================================
! MPI_WRITE_INTEGER_2DARRAY writes integer 2-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_integer_2Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(2) ! length of array
integer, intent(in) :: buffer(length(1),length(2)) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_integer_2Darray
!===============================================================================
! MPI_READ_INTEGER_2DARRAY reads integer 2-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_integer_2Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(2) ! length of array
integer, intent(inout) :: buffer(length(1),length(2)) ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_integer_2Darray
!===============================================================================
! MPI_WRITE_INTEGER_3DARRAY writes integer 3-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_integer_3Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(3) ! length of array
integer, intent(in) :: buffer(length(1),length(2),&
length(3)) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_integer_3Darray
!===============================================================================
! MPI_READ_INTEGER_3DARRAY reads integer 3-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_integer_3Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(3) ! length of array
integer, intent(inout) :: buffer(length(1),length(2), &
length(3)) ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_integer_3Darray
!===============================================================================
! MPI_WRITE_INTEGER_4DARRAY writes integer 4-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_integer_4Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(4) ! length of array
integer, intent(in) :: buffer(length(1),length(2),&
length(3),length(4)) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_integer_4Darray
!===============================================================================
! MPI_READ_INTEGER_4DARRAY reads integer 4-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_integer_4Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(4) ! length of array
integer, intent(inout) :: buffer(length(1),length(2), &
length(3),length(4)) ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, product(length), MPI_INTEGER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_integer_4Darray
!===============================================================================
! MPI_WRITE_DOUBLE writes integer scalar data using MPI File I/O
!===============================================================================
subroutine mpi_write_double(fh, buffer, collect)
integer, intent(in) :: fh ! file handle
real(8), intent(in) :: buffer ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, 1, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, 1, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_double
!===============================================================================
! MPI_READ_DOUBLE reads integer scalar data using MPI file I/O
!===============================================================================
subroutine mpi_read_double(fh, buffer, collect)
integer, intent(in) :: fh ! file handle
real(8), intent(inout) :: buffer ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, 1, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, 1, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_double
!===============================================================================
! MPI_WRITE_DOUBLE_1DARRAY writes integer 1-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_double_1Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of array
real(8), intent(in) :: buffer(:) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, length, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, length, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_double_1Darray
!===============================================================================
! MPI_READ_DOUBLE_1DARRAY reads integer 1-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_double_1Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of array
real(8), intent(inout) :: buffer(:) ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, length, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, length, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_double_1Darray
!===============================================================================
! MPI_WRITE_DOUBLE_2DARRAY writes integer 2-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_double_2Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(2) ! length of array
real(8), intent(in) :: buffer(length(1),length(2)) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_double_2Darray
!===============================================================================
! MPI_READ_DOUBLE_2DARRAY reads integer 2-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_double_2Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(2) ! length of array
real(8), intent(inout) :: buffer(length(1),length(2)) ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_double_2Darray
!===============================================================================
! MPI_WRITE_DOUBLE_3DARRAY writes integer 3-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_double_3Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(3) ! length of array
real(8), intent(in) :: buffer(length(1),length(2),&
length(3)) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_double_3Darray
!===============================================================================
! MPI_READ_DOUBLE_3DARRAY reads integer 3-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_double_3Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(3) ! length of array
real(8), intent(inout) :: buffer(length(1),length(2), &
length(3)) ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_double_3Darray
!===============================================================================
! MPI_WRITE_DOUBLE_4DARRAY writes integer 4-D array data using MPI File I/O
!===============================================================================
subroutine mpi_write_double_4Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(4) ! length of array
real(8), intent(in) :: buffer(length(1),length(2),&
length(3),length(4)) ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_double_4Darray
!===============================================================================
! MPI_READ_DOUBLE_4DARRAY reads integer 4-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_double_4Darray(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length(4) ! length of array
real(8), intent(inout) :: buffer(length(1),length(2), &
length(3),length(4)) ! read data to here
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, product(length), MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_double_4Darray
!===============================================================================
! MPI_WRITE_LONG writes long integer scalar data using MPI file I/O
!===============================================================================
subroutine mpi_write_long(fh, buffer, collect)
integer, intent(in) :: fh ! file handle
integer(8), intent(in) :: buffer ! data to write
logical, intent(in) :: collect ! collective I/O
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_write_long
!===============================================================================
! MPI_READ_LONG reads long integer scalar data using MPI file I/O
!===============================================================================
subroutine mpi_read_long(fh, buffer)
subroutine mpi_read_long(fh, buffer, collect)
integer, intent(in) :: fh ! file handle
integer(8), intent(inout) :: buffer ! read data to here
integer, intent(in) :: fh ! file handle
integer(8), intent(inout) :: buffer ! read data to here
logical, intent(in) :: collect ! collective I/O
call MPI_FILE_READ(fh, buffer, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpiio_err)
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_long
!===============================================================================
! MPI_READ_DOUBLE reads double precision scalar data using MPI file I/O
! MPI_WRITE_STRING writes string data using MPI file I/O
!===============================================================================
subroutine mpi_read_double(fh, buffer)
subroutine mpi_write_string(fh, buffer, length, collect)
integer, intent(in) :: fh ! file handle
real(8), intent(inout) :: buffer ! read data to here
character(*), intent(in) :: buffer ! data to write
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of data
logical, intent(in) :: collect ! collective I/O
call MPI_FILE_READ(fh, buffer, 1, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
if (collect) then
call MPI_FILE_WRITE_ALL(fh, buffer, length, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_WRITE(fh, buffer, length, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_double
!===============================================================================
! MPI_READ_DOUBLE_1DARRAY reads double precision 1-D array using MPI file I/O
!===============================================================================
subroutine mpi_read_double_1Darray(fh, buffer, length)
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of array
real(8), intent(inout) :: buffer(:) ! read data to here
call MPI_FILE_READ(fh, buffer, length, MPI_REAL8, &
MPI_STATUS_IGNORE, mpiio_err)
end subroutine mpi_read_double_1Darray
end subroutine mpi_write_string
!===============================================================================
! MPI_READ_STRING reads string data using MPI file I/O
!===============================================================================
subroutine mpi_read_string(fh, buffer, length)
subroutine mpi_read_string(fh, buffer, length, collect)
character(*), intent(inout) :: buffer ! read data to here
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of string
character(*), intent(inout) :: buffer ! read data to here
integer, intent(in) :: fh ! file handle
integer, intent(in) :: length ! length of string
logical, intent(in) :: collect ! collective I/O
call MPI_FILE_READ(fh, buffer, length, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpiio_err)
if (collect) then
call MPI_FILE_READ_ALL(fh, buffer, length, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpiio_err)
else
call MPI_FILE_READ(fh, buffer, length, MPI_CHARACTER, &
MPI_STATUS_IGNORE, mpiio_err)
end if
end subroutine mpi_read_string

File diff suppressed because it is too large Load diff

View file

@ -2,123 +2,27 @@ module particle_restart
use, intrinsic :: ISO_FORTRAN_ENV
use bank_header, only: Bank
use bank_header, only: Bank
use constants
use geometry_header, only: BASE_UNIVERSE
use geometry_header, only: BASE_UNIVERSE
use global
use output, only: write_message, print_particle
use particle_header, only: Particle
use random_lcg, only: set_particle_seed
use tracking, only: transport
#ifdef HDF5
use hdf5_interface
#endif
use output, only: write_message, print_particle
use output_interface, only: BinaryOutput
use particle_header, only: Particle
use random_lcg, only: set_particle_seed
use tracking, only: transport
implicit none
private
public :: run_particle_restart
#ifdef HDF5
integer(HID_T) :: hdf5_particle_file
#endif
! Short names for output and error units
integer :: ou = OUTPUT_UNIT
integer :: eu = ERROR_UNIT
! Binary file
type(BinaryOutput) :: pr
contains
#ifdef HDF5
!===============================================================================
! READ_HDF5_PARTICLE_RESTART
!===============================================================================
subroutine read_hdf5_particle_restart(p)
type(Particle), intent(inout) :: p
! write meessage
message = "Loading particle restart file " // trim(path_particle_restart) &
// "..."
call write_message(1)
! open hdf5 file
call h5fopen_f(path_particle_restart, H5F_ACC_RDONLY_F, hdf5_particle_file,&
hdf5_err)
! read data from file
call hdf5_read_integer(hdf5_particle_file, 'current_batch', current_batch)
call hdf5_read_integer(hdf5_particle_file, 'gen_per_batch', gen_per_batch)
call hdf5_read_integer(hdf5_particle_file, 'current_gen', current_gen)
call hdf5_read_long(hdf5_particle_file, 'n_particles', n_particles, hdf5_integer8_t)
call hdf5_read_long(hdf5_particle_file, 'id', p % id, hdf5_integer8_t)
call hdf5_read_double(hdf5_particle_file, 'weight', p % wgt)
call hdf5_read_double(hdf5_particle_file, 'energy', p % E)
dims1 = (/3/)
call h5ltread_dataset_double_f(hdf5_particle_file, 'xyz', p % coord % xyz, &
dims1, hdf5_err)
call h5ltread_dataset_double_f(hdf5_particle_file, 'uvw', p % coord % uvw, &
dims1, hdf5_err)
! set particle last attributes
p % last_wgt = p % wgt
p % last_xyz = p % coord % xyz
p % last_E = p % E
! close hdf5 file
call h5fclose_f(hdf5_particle_file, hdf5_err)
end subroutine read_hdf5_particle_restart
#endif
!===============================================================================
! READ_BINARY_PARTICLE_RESTART
!===============================================================================
subroutine read_binary_particle_restart(p)
type(Particle), intent(inout) :: p
integer :: filetype
integer :: revision
! write meessage
message = "Loading particle restart file " // trim(path_particle_restart) &
// "..."
call write_message(1)
! open file
open(UNIT=UNIT_PARTICLE, FILE=path_particle_restart, STATUS='old', &
ACCESS='stream')
! read data from file
read(UNIT_PARTICLE) filetype
read(UNIT_PARTICLE) revision
read(UNIT_PARTICLE) current_batch
read(UNIT_PARTICLE) gen_per_batch
read(UNIT_PARTICLE) current_gen
read(UNIT_PARTICLE) n_particles
read(UNIT_PARTICLE) p % id
read(UNIT_PARTICLE) p % wgt
read(UNIT_PARTICLE) p % E
read(UNIT_PARTICLE) p % coord % xyz
read(UNIT_PARTICLE) p % coord % uvw
! set particle last attributes
p % last_wgt = p % wgt
p % last_xyz = p % coord % xyz
p % last_E = p % E
! close hdf5 file
close(UNIT_PARTICLE)
end subroutine read_binary_particle_restart
!===============================================================================
! RUN_PARTICLE_RESTART
! RUN_PARTICLE_RESTART is the main routine that runs the particle restart
!===============================================================================
subroutine run_particle_restart()
@ -126,30 +30,69 @@ contains
integer(8) :: particle_seed
type(Particle) :: p
! initialize the particle to be tracked
! Set verbosity high
verbosity = 10
! Initialize the particle to be tracked
call p % initialize()
! read in the restart information
#ifdef HDF5
call read_hdf5_particle_restart(p)
#else
call read_binary_particle_restart(p)
#endif
! Read in the restart information
call read_particle_restart(p)
! set all tallies to 0 for now (just tracking errors)
! Set all tallies to 0 for now (just tracking errors)
n_tallies = 0
! compute random number seed
! Compute random number seed
particle_seed = ((current_batch - 1)*gen_per_batch + &
current_gen - 1)*n_particles + p % id
call set_particle_seed(particle_seed)
! transport neutron
! Transport neutron
call transport(p)
! write output if particle made it
! Write output if particle made it
call print_particle(p)
end subroutine run_particle_restart
!===============================================================================
! READ_PARTICLE_RESTART reads the particle restart file
!===============================================================================
subroutine read_particle_restart(p)
integer :: int_scalar
type(Particle), intent(inout) :: p
! Write meessage
message = "Loading particle restart file " // trim(path_particle_restart) &
// "..."
call write_message(1)
! Open file
call pr % file_open(path_particle_restart, 'r')
! Read data from file
call pr % read_data(int_scalar, 'filetype')
call pr % read_data(int_scalar, 'revision')
call pr % read_data(current_batch, 'current_batch')
call pr % read_data(gen_per_batch, 'gen_per_batch')
call pr % read_data(current_gen, 'current_gen')
call pr % read_data(n_particles, 'n_particles')
call pr % read_data(p % id, 'id')
call pr % read_data(p % wgt, 'weight')
call pr % read_data(p % E, 'energy')
call pr % read_data(p % coord % xyz, 'xyz', length=3)
call pr % read_data(p % coord % uvw, 'uvw', length=3)
! Set particle last attributes
p % last_wgt = p % wgt
p % last_xyz = p % coord % xyz
p % last_E = p % E
! Close hdf5 file
call pr % file_close()
end subroutine read_particle_restart
end module particle_restart

View file

@ -1,132 +1,65 @@
module particle_restart_write
use, intrinsic :: ISO_FORTRAN_ENV
use bank_header, only: Bank
use bank_header, only: Bank
use global
use particle_header, only: Particle
use string, only: to_str
#ifdef HDF5
use hdf5_interface
#endif
use output_interface, only: BinaryOutput
use particle_header, only: Particle
use string, only: to_str
implicit none
private
public :: write_particle_restart
#ifdef HDF5
integer(HID_T) :: hdf5_particle_file
#endif
! Binary output file
type(BinaryOutput) :: pr
contains
!===============================================================================
! WRITE_PARTICLE_RESTART
! WRITE_PARTICLE_RESTART is the main routine that writes out the particle file
!===============================================================================
subroutine write_particle_restart(p)
type(Particle), intent(in) :: p
character(MAX_FILE_LEN) :: filename
type(Bank), pointer :: src => null()
! Dont write another restart file if in particle restart mode
if (run_mode == MODE_PARTICLE) return
! write out binary or HDF5 file
! Set up file name
filename = trim(path_output) // 'particle_' // trim(to_str(current_batch)) &
// '_' // trim(to_str(p % id))
#ifdef HDF5
call write_particle_restart_hdf5(p)
filename = trim(filename) // '.h5'
#else
call write_particle_restart_binary(p)
filename = trim(filename) // '.binary'
#endif
! Create file
call pr % file_create(filename)
! Get information about source particle
src => source_bank(current_work)
! Write data to file
call pr % write_data(FILETYPE_PARTICLE_RESTART, 'filetype')
call pr % write_data(REVISION_PARTICLE_RESTART, 'revision')
call pr % write_data(current_batch, 'current_batch')
call pr % write_data(gen_per_batch, 'gen_per_batch')
call pr % write_data(current_gen, 'current_gen')
call pr % write_data(n_particles, 'n_particles')
call pr % write_data(p % id, 'id')
call pr % write_data(src % wgt, 'weight')
call pr % write_data(src % E, 'energy')
call pr % write_data(src % xyz, 'xyz', length = 3)
call pr % write_data(src % uvw, 'uvw', length = 3)
! Close file
call pr % file_close()
end subroutine write_particle_restart
#ifdef HDF5
!===============================================================================
! WRITE_PARTICLE_RESTART_HDF5
!===============================================================================
subroutine write_particle_restart_hdf5(p)
type(Particle), intent(in) :: p
character(MAX_FILE_LEN) :: filename
type(Bank), pointer :: src => null()
! set up file name
filename = trim(path_output) // 'particle_' // trim(to_str(current_batch)) &
// '_' // trim(to_str(current_work)) // '.h5'
! create hdf5 file
call h5fcreate_f(filename, H5F_ACC_TRUNC_F, hdf5_particle_file, hdf5_err)
! get information about source particle
src => source_bank(current_work)
! write data to file
call hdf5_write_integer(hdf5_particle_file, 'filetype', &
FILETYPE_PARTICLE_RESTART)
call hdf5_write_integer(hdf5_particle_file, 'revision', &
REVISION_PARTICLE_RESTART)
call hdf5_write_integer(hdf5_particle_file, 'current_batch', current_batch)
call hdf5_write_integer(hdf5_particle_file, 'gen_per_batch', gen_per_batch)
call hdf5_write_integer(hdf5_particle_file, 'current_gen', current_gen)
call hdf5_write_long(hdf5_particle_file, 'n_particles', n_particles, hdf5_integer8_t)
call hdf5_write_long(hdf5_particle_file, 'id', p % id, hdf5_integer8_t)
call hdf5_write_double(hdf5_particle_file, 'weight', src % wgt)
call hdf5_write_double(hdf5_particle_file, 'energy', src % E)
dims1 = (/3/)
call h5ltmake_dataset_double_f(hdf5_particle_file, 'xyz', 1, dims1, &
src % xyz, hdf5_err)
call h5ltmake_dataset_double_f(hdf5_particle_file, 'uvw', 1, dims1, &
src % uvw, hdf5_err)
! close hdf5 file
call h5fclose_f(hdf5_particle_file, hdf5_err)
end subroutine write_particle_restart_hdf5
#endif
!===============================================================================
! WRITE_PARTICLE_RESTART_BINARY
!===============================================================================
subroutine write_particle_restart_binary(p)
type(Particle), intent(in) :: p
character(MAX_FILE_LEN) :: filename
type(Bank), pointer :: src => null()
! set up file name
filename = trim(path_output) // 'particle_' // trim(to_str(current_batch)) &
// '_' // trim(to_str(current_work)) // '.binary'
! create hdf5 file
open(UNIT=UNIT_PARTICLE, FILE=filename, STATUS='replace', &
ACCESS='stream')
! get information about source particle
src => source_bank(current_work)
! write data to file
write(UNIT_PARTICLE) FILETYPE_PARTICLE_RESTART
write(UNIT_PARTICLE) REVISION_PARTICLE_RESTART
write(UNIT_PARTICLE) current_batch
write(UNIT_PARTICLE) gen_per_batch
write(UNIT_PARTICLE) current_gen
write(UNIT_PARTICLE) n_particles
write(UNIT_PARTICLE) p % id
write(UNIT_PARTICLE) src % wgt
write(UNIT_PARTICLE) src % E
write(UNIT_PARTICLE) src % xyz
write(UNIT_PARTICLE) src % uvw
! close hdf5 file
close(UNIT_PARTICLE)
end subroutine write_particle_restart_binary
end module particle_restart_write

View file

@ -47,7 +47,7 @@ contains
src => source_bank(i)
! initialize random number seed
id = bank_first + i - 1
id = work_index(rank) + i
call set_particle_seed(id)
! sample external source distribution
@ -166,7 +166,7 @@ contains
call copy_source_attributes(p, src)
! set identifier for particle
p % id = bank_first + index_source - 1
p % id = work_index(rank) + index_source
! set random number seed
particle_seed = (overall_gen - 1)*n_particles + p % id

View file

@ -22,6 +22,8 @@ module state_point
implicit none
type(BinaryOutput) :: sp ! statepoint/source output file
contains
!===============================================================================
@ -51,78 +53,78 @@ contains
message = "Creating state point " // trim(filename) // "..."
call write_message(1)
! Create statepoint file
call file_create(filename, 'serial')
if (master) then
! Create statepoint file
call sp % file_create(filename)
! Write file type
call write_data(FILETYPE_STATEPOINT, "filetype")
call sp % write_data(FILETYPE_STATEPOINT, "filetype")
! Write revision number for state point file
call write_data(REVISION_STATEPOINT, "revision")
call sp % write_data(REVISION_STATEPOINT, "revision")
! Write OpenMC version
call write_data(VERSION_MAJOR, "version_major")
call write_data(VERSION_MINOR, "version_minor")
call write_data(VERSION_RELEASE, "version_release")
call sp % write_data(VERSION_MAJOR, "version_major")
call sp % write_data(VERSION_MINOR, "version_minor")
call sp % write_data(VERSION_RELEASE, "version_release")
! Write current date and time
call write_data(time_stamp(), "date_and_time")
call sp % write_data(time_stamp(), "date_and_time")
! Write path to input
call write_data(path_input, "path")
call sp % write_data(path_input, "path")
! Write out random number seed
call write_data(seed, "seed")
call sp % write_data(seed, "seed")
! Write run information
call write_data(run_mode, "run_mode")
call write_data(n_particles, "n_particles")
call write_data(n_batches, "n_batches")
call sp % write_data(run_mode, "run_mode")
call sp % write_data(n_particles, "n_particles")
call sp % write_data(n_batches, "n_batches")
! Write out current batch number
call write_data(current_batch, "current_batch")
call sp % write_data(current_batch, "current_batch")
! Write out information for eigenvalue run
if (run_mode == MODE_EIGENVALUE) then
call write_data(n_inactive, "n_inactive")
call write_data(gen_per_batch, "gen_per_batch")
call write_data(k_generation, "k_generation", &
call sp % write_data(n_inactive, "n_inactive")
call sp % write_data(gen_per_batch, "gen_per_batch")
call sp % write_data(k_generation, "k_generation", &
length=current_batch*gen_per_batch)
call write_data(entropy, "entropy", length=current_batch*gen_per_batch)
call write_data(k_col_abs, "k_col_abs")
call write_data(k_col_tra, "k_col_tra")
call write_data(k_abs_tra, "k_abs_tra")
call write_data(k_combined, "k_combined", length=2)
call sp % write_data(entropy, "entropy", length=current_batch*gen_per_batch)
call sp % write_data(k_col_abs, "k_col_abs")
call sp % write_data(k_col_tra, "k_col_tra")
call sp % write_data(k_abs_tra, "k_abs_tra")
call sp % write_data(k_combined, "k_combined", length=2)
end if
! Write number of meshes
call write_data(n_meshes, "n_meshes", group="tallies")
call sp % write_data(n_meshes, "n_meshes", group="tallies")
! Write information for meshes
MESH_LOOP: do i = 1, n_meshes
call write_data(meshes(i) % id, "id", &
call sp % write_data(meshes(i) % id, "id", &
group="tallies/mesh" // to_str(i))
call write_data(meshes(i) % type, "type", &
call sp % write_data(meshes(i) % type, "type", &
group="tallies/mesh" // to_str(i))
call write_data(meshes(i) % n_dimension, "n_dimension", &
call sp % write_data(meshes(i) % n_dimension, "n_dimension", &
group="tallies/mesh" // to_str(i))
call write_data(meshes(i) % dimension, "dimension", &
call sp % write_data(meshes(i) % dimension, "dimension", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension)
call write_data(meshes(i) % lower_left, "lower_left", &
call sp % write_data(meshes(i) % lower_left, "lower_left", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension)
call write_data(meshes(i) % upper_right, "upper_right", &
call sp % write_data(meshes(i) % upper_right, "upper_right", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension)
call write_data(meshes(i) % width, "width", &
call sp % write_data(meshes(i) % width, "width", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension)
end do MESH_LOOP
! Write number of tallies
call write_data(n_tallies, "n_tallies", group="tallies")
call sp % write_data(n_tallies, "n_tallies", group="tallies")
! Write all tally information except results
TALLY_METADATA: do i = 1, n_tallies
@ -130,41 +132,41 @@ contains
t => tallies(i)
! Write id
call write_data(t % id, "id", group="tallies/tally" // to_str(i))
call sp % write_data(t % id, "id", group="tallies/tally" // to_str(i))
! Write number of realizations
call write_data(t % n_realizations, "n_realizations", &
call sp % write_data(t % n_realizations, "n_realizations", &
group="tallies/tally" // to_str(i))
! Write size of each tally
call write_data(t % total_score_bins, "total_score_bins", &
call sp % write_data(t % total_score_bins, "total_score_bins", &
group="tallies/tally" // to_str(i))
call write_data(t % total_filter_bins, "total_filter_bins", &
call sp % write_data(t % total_filter_bins, "total_filter_bins", &
group="tallies/tally" // to_str(i))
! Write number of filters
call write_data(t % n_filters, "n_filters", &
call sp % write_data(t % n_filters, "n_filters", &
group="tallies/tally" // to_str(i))
! Write filter information
FILTER_LOOP: do j = 1, t % n_filters
! Write type of filter
call write_data(t % filters(j) % type, "type", &
call sp % write_data(t % filters(j) % type, "type", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j))
! Write number of bins for this filter
call write_data(t % filters(j) % n_bins, "n_bins", &
call sp % write_data(t % filters(j) % n_bins, "n_bins", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j))
! Write bins
if (t % filters(j) % type == FILTER_ENERGYIN .or. &
t % filters(j) % type == FILTER_ENERGYOUT) then
call write_data(t % filters(j) % real_bins, "bins", &
call sp % write_data(t % filters(j) % real_bins, "bins", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j), &
length=size(t % filters(j) % real_bins))
else
call write_data(t % filters(j) % int_bins, "bins", &
call sp % write_data(t % filters(j) % int_bins, "bins", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j), &
length=size(t % filters(j) % int_bins))
end if
@ -172,7 +174,7 @@ contains
end do FILTER_LOOP
! Write number of nuclide bins
call write_data(t % n_nuclide_bins, "n_nuclide_bins", &
call sp % write_data(t % n_nuclide_bins, "n_nuclide_bins", &
group="tallies/tally" // to_str(i))
! Set up nuclide bin array and then write
@ -184,20 +186,20 @@ contains
temp_array(j) = t % nuclide_bins(j)
end if
end do NUCLIDE_LOOP
call write_data(temp_array, "nuclide_bins", &
call sp % write_data(temp_array, "nuclide_bins", &
group="tallies/tally" // to_str(i), length=t % n_nuclide_bins)
deallocate(temp_array)
! Write number of score bins, score bins, and scatt order
call write_data(t % n_score_bins, "n_score_bins", &
call sp % write_data(t % n_score_bins, "n_score_bins", &
group="tallies/tally" // to_str(i))
call write_data(t % score_bins, "score_bins", &
call sp % write_data(t % score_bins, "score_bins", &
group="tallies/tally" // to_str(i), length=t % n_score_bins)
call write_data(t % scatt_order, "scatt_order", &
call sp % write_data(t % scatt_order, "scatt_order", &
group="tallies/tally" // to_str(i), length=t % n_score_bins)
! Write number of user score bins
call write_data(t % n_user_score_bins, "n_user_score_bins", &
call sp % write_data(t % n_user_score_bins, "n_user_score_bins", &
group="tallies/tally" // to_str(i))
end do TALLY_METADATA
@ -214,18 +216,18 @@ contains
elseif (master) then
! Write number of global realizations
call write_data(n_realizations, "n_realizations")
call sp % write_data(n_realizations, "n_realizations")
! Write global tallies
call write_data(N_GLOBAL_TALLIES, "n_global_tallies")
call write_tally_result(global_tallies, "global_tallies", &
call sp % write_data(N_GLOBAL_TALLIES, "n_global_tallies")
call sp % write_tally_result(global_tallies, "global_tallies", &
n1=N_GLOBAL_TALLIES, n2=1)
! Write tallies
if (tallies_on) then
! Indicate that tallies are on
call write_data(1, "tallies_present", group="tallies")
call sp % write_data(1, "tallies_present", group="tallies")
! Write all tally results
TALLY_RESULTS: do i = 1, n_tallies
@ -234,7 +236,7 @@ contains
t => tallies(i)
! Write sum and sum_sq for each bin
call write_tally_result(t % results, "results", &
call sp % write_tally_result(t % results, "results", &
group="tallies/tally" // to_str(i), &
n1=size(t % results, 1), n2=size(t % results, 2))
@ -243,10 +245,13 @@ contains
else
! Indicate tallies are off
call write_data(0, "tallies_present", group="tallies")
call sp % write_data(0, "tallies_present", group="tallies")
end if
! Close the file for serial writing
call sp % file_close()
end if
! Check for eigenvalue calculation
@ -255,9 +260,6 @@ contains
! Check for writing source out separately
if (source_separate) then
! Close statepoint file
call file_close('serial')
! Set filename for source
filename = trim(path_output) // 'source.' // &
trim(to_str(current_batch))
@ -271,30 +273,21 @@ contains
message = "Creating source file " // trim(filename) // "..."
call write_message(1)
! Create statepoint file
call file_create(filename, 'parallel')
! Create source file
call sp % file_create(filename, serial = .false.)
#ifdef HDF5
# ifdef MPI
else
! Close HDF5 serial file and reopen in parallel
call file_close('serial')
call file_open(filename, 'parallel', 'w')
# endif
#endif
! Reopen state point file in parallel
call sp % file_open(filename, 'w', serial = .false.)
end if
! Write out source
call write_source_bank()
call sp % write_source_bank()
! Close file, all files in parallel mode
call file_close('parallel') ! even if no MPI, this will work for HDF5
else
! Close file if not in eigenvalue mode or no source writing
call file_close('serial')
! Close file
call sp % file_close()
end if
@ -323,10 +316,10 @@ contains
if (master) then
! Write number of realizations
call write_data(n_realizations, "n_realizations")
call sp % write_data(n_realizations, "n_realizations")
! Write number of global tallies
call write_data(N_GLOBAL_TALLIES, "n_global_tallies")
call sp % write_data(N_GLOBAL_TALLIES, "n_global_tallies")
end if
! Copy global tallies into temporary array for reducing
@ -355,7 +348,7 @@ contains
! Write out global tallies sum and sum_sq
call write_tally_result(tallyresult_temp, "global_tallies", &
call sp % write_tally_result(tallyresult_temp, "global_tallies", &
n1=N_GLOBAL_TALLIES, n2=1)
! Deallocate temporary tally result
@ -371,7 +364,7 @@ contains
if (tallies_on) then
! Indicate that tallies are on
if (master) then
call write_data(1, "tallies_present", group="tallies")
call sp % write_data(1, "tallies_present", group="tallies")
end if
! Write all tally results
@ -409,7 +402,7 @@ contains
tallyresult_temp(:,:) % sum_sq = tally_temp(2,:,:)
! Write reduced tally results to file
call write_tally_result(t % results, "results", &
call sp % write_tally_result(t % results, "results", &
group="tallies/tally" // to_str(i), n1=m, n2=n)
! Deallocate temporary tally result
@ -428,7 +421,7 @@ contains
else
if (master) then
! Indicate that tallies are off
call write_data(0, "tallies_present", group="tallies")
call sp % write_data(0, "tallies_present", group="tallies")
end if
end if
@ -455,14 +448,14 @@ contains
call write_message(1)
! Open file for reading
call file_open(path_state_point, 'parallel', 'r')
call sp % file_open(path_state_point, 'r')
! Read filetype
call read_data(int_array(1), "filetype", option="collective")
call sp % read_data(int_array(1), "filetype")
! Read revision number for state point file and make sure it matches with
! current version
call read_data(int_array(1), "revision", option="collective")
call sp % read_data(int_array(1), "revision")
if (int_array(1) /= REVISION_STATEPOINT) then
message = "State point version does not match current version " &
// "in OpenMC."
@ -470,9 +463,9 @@ contains
end if
! Read OpenMC version
call read_data(int_array(1), "version_major", option="collective")
call read_data(int_array(2), "version_minor", option="collective")
call read_data(int_array(3), "version_release", option="collective")
call sp % read_data(int_array(1), "version_major")
call sp % read_data(int_array(2), "version_minor")
call sp % read_data(int_array(3), "version_release")
if (int_array(1) /= VERSION_MAJOR .or. int_array(2) /= VERSION_MINOR &
.or. int_array(3) /= VERSION_RELEASE) then
message = "State point file was created with a different version " &
@ -481,70 +474,68 @@ contains
end if
! Read date and time
call read_data(current_time, "date_and_time", option="collective")
call sp % read_data(current_time, "date_and_time")
! Read path to input
call read_data(path_temp, "path", option="collective")
call sp % read_data(path_temp, "path")
! Read and overwrite random number seed
call read_data(seed, "seed", option="collective")
call sp % read_data(seed, "seed")
! Read and overwrite run information except number of batches
call read_data(run_mode, "run_mode", option="collective")
call read_data(n_particles, "n_particles", option="collective")
call read_data(int_array(1), "n_batches", option="collective")
call sp % read_data(run_mode, "run_mode")
call sp % read_data(n_particles, "n_particles")
call sp % read_data(int_array(1), "n_batches")
! Take maximum of statepoint n_batches and input n_batches
n_batches = max(n_batches, int_array(1))
! Read batch number to restart at
call read_data(restart_batch, "current_batch", option="collective")
call sp % read_data(restart_batch, "current_batch")
! Read information specific to eigenvalue run
if (run_mode == MODE_EIGENVALUE) then
call read_data(int_array(1), "n_inactive", option="collective")
call read_data(gen_per_batch, "gen_per_batch", option="collective")
call read_data(k_generation, "k_generation", &
length=restart_batch*gen_per_batch, option="collective")
call read_data(entropy, "entropy", length=restart_batch*gen_per_batch, &
option="collective")
call read_data(k_col_abs, "k_col_abs", option="collective")
call read_data(k_col_tra, "k_col_tra", option="collective")
call read_data(k_abs_tra, "k_abs_tra", option="collective")
call read_data(real_array(1:2), "k_combined", length=2, &
option="collective")
call sp % read_data(int_array(1), "n_inactive")
call sp % read_data(gen_per_batch, "gen_per_batch")
call sp % read_data(k_generation, "k_generation", &
length=restart_batch*gen_per_batch)
call sp % read_data(entropy, "entropy", length=restart_batch*gen_per_batch)
call sp % read_data(k_col_abs, "k_col_abs")
call sp % read_data(k_col_tra, "k_col_tra")
call sp % read_data(k_abs_tra, "k_abs_tra")
call sp % read_data(real_array(1:2), "k_combined", length=2)
! Take maximum of statepoint n_inactive and input n_inactive
n_inactive = max(n_inactive, int_array(1))
end if
! Read number of meshes
call read_data(n_meshes, "n_meshes", group="tallies", option="collective")
call sp % read_data(n_meshes, "n_meshes", group="tallies")
! Read and overwrite mesh information
MESH_LOOP: do i = 1, n_meshes
call read_data(meshes(i) % id, "id", &
group="tallies/mesh" // to_str(i), option="collective")
call read_data(meshes(i) % type, "type", &
group="tallies/mesh" // to_str(i), option="collective")
call read_data(meshes(i) % n_dimension, "n_dimension", &
group="tallies/mesh" // to_str(i), option="collective")
call read_data(meshes(i) % dimension, "dimension", &
call sp % read_data(meshes(i) % id, "id", &
group="tallies/mesh" // to_str(i))
call sp % read_data(meshes(i) % type, "type", &
group="tallies/mesh" // to_str(i))
call sp % read_data(meshes(i) % n_dimension, "n_dimension", &
group="tallies/mesh" // to_str(i))
call sp % read_data(meshes(i) % dimension, "dimension", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension, option="collective")
call read_data(meshes(i) % lower_left, "lower_left", &
length=meshes(i) % n_dimension)
call sp % read_data(meshes(i) % lower_left, "lower_left", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension, option="collective")
call read_data(meshes(i) % upper_right, "upper_right", &
length=meshes(i) % n_dimension)
call sp % read_data(meshes(i) % upper_right, "upper_right", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension, option="collective")
call read_data(meshes(i) % width, "width", &
length=meshes(i) % n_dimension)
call sp % read_data(meshes(i) % width, "width", &
group="tallies/mesh" // to_str(i), &
length=meshes(i) % n_dimension, option="collective")
length=meshes(i) % n_dimension)
end do MESH_LOOP
! Read and overwrite number of tallies
call read_data(n_tallies, "n_tallies", group="tallies", option="collective")
call sp % read_data(n_tallies, "n_tallies", group="tallies")
! Read in tally metadata
TALLY_METADATA: do i = 1, n_tallies
@ -553,18 +544,17 @@ contains
t => tallies(i)
! Read tally id
call read_data(t % id, "id", group="tallies/tally" // to_str(i), &
option="collective")
call sp % read_data(t % id, "id", group="tallies/tally" // to_str(i))
! Read number of realizations
call read_data(t % n_realizations, "n_realizations", &
group="tallies/tally" // to_str(i), option="collective")
call sp % read_data(t % n_realizations, "n_realizations", &
group="tallies/tally" // to_str(i))
! Read size of tally results
call read_data(int_array(1), "total_score_bins", &
group="tallies/tally" // to_str(i), option="collective")
call read_data(int_array(2), "total_filter_bins", &
group="tallies/tally" // to_str(i), option="collective")
call sp % read_data(int_array(1), "total_score_bins", &
group="tallies/tally" // to_str(i))
call sp % read_data(int_array(2), "total_filter_bins", &
group="tallies/tally" // to_str(i))
! Check size of tally results array
if (int_array(1) /= t % total_score_bins .and. &
@ -574,45 +564,42 @@ contains
end if
! Read number of filters
call read_data(t % n_filters, "n_filters", &
group="tallies/tally" // to_str(i), option="collective")
call sp % read_data(t % n_filters, "n_filters", &
group="tallies/tally" // to_str(i))
! Read filter information
FILTER_LOOP: do j = 1, t % n_filters
! Read type of filter
call read_data(t % filters(j) % type, "type", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j), &
option="collective")
call sp % read_data(t % filters(j) % type, "type", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j))
! Read number of bins for this filter
call read_data(t % filters(j) % n_bins, "n_bins", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j), &
option="collective")
call sp % read_data(t % filters(j) % n_bins, "n_bins", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j))
! Read bins
if (t % filters(j) % type == FILTER_ENERGYIN .or. &
t % filters(j) % type == FILTER_ENERGYOUT) then
call read_data(t % filters(j) % real_bins, "bins", &
call sp % read_data(t % filters(j) % real_bins, "bins", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j), &
length=size(t % filters(j) % real_bins), option="collective")
length=size(t % filters(j) % real_bins))
else
call read_data(t % filters(j) % int_bins, "bins", &
call sp % read_data(t % filters(j) % int_bins, "bins", &
group="tallies/tally" // trim(to_str(i)) // "/filter" // to_str(j), &
length=size(t % filters(j) % int_bins), option="collective")
length=size(t % filters(j) % int_bins))
end if
end do FILTER_LOOP
! Read number of nuclide bins
call read_data(t % n_nuclide_bins, "n_nuclide_bins", &
group="tallies/tally" // to_str(i), option="collective")
call sp % read_data(t % n_nuclide_bins, "n_nuclide_bins", &
group="tallies/tally" // to_str(i))
! Set up nuclide bin array and then write
allocate(temp_array(t % n_nuclide_bins))
call read_data(temp_array, "nuclide_bins", &
group="tallies/tally" // to_str(i), length=t % n_nuclide_bins, &
option="collective")
call sp % read_data(temp_array, "nuclide_bins", &
group="tallies/tally" // to_str(i), length=t % n_nuclide_bins)
NUCLIDE_LOOP: do j = 1, t % n_nuclide_bins
if (temp_array(j) > 0) then
nuclides(t % nuclide_bins(j)) % zaid = temp_array(j)
@ -623,18 +610,16 @@ contains
deallocate(temp_array)
! Write number of score bins, score bins, and scatt order
call read_data(t % n_score_bins, "n_score_bins", &
group="tallies/tally" // to_str(i), option="collective")
call read_data(t % score_bins, "score_bins", &
group="tallies/tally" // to_str(i), length=t % n_score_bins, &
option="collective")
call read_data(t % scatt_order, "scatt_order", &
group="tallies/tally" // to_str(i), length=t % n_score_bins, &
option="collective")
call sp % read_data(t % n_score_bins, "n_score_bins", &
group="tallies/tally" // to_str(i))
call sp % read_data(t % score_bins, "score_bins", &
group="tallies/tally" // to_str(i), length=t % n_score_bins)
call sp % read_data(t % scatt_order, "scatt_order", &
group="tallies/tally" // to_str(i), length=t % n_score_bins)
! Write number of user score bins
call read_data(t % n_user_score_bins, "n_user_score_bins", &
group="tallies/tally" // to_str(i), option="collective")
call sp % read_data(t % n_user_score_bins, "n_user_score_bins", &
group="tallies/tally" // to_str(i))
end do TALLY_METADATA
@ -642,21 +627,21 @@ contains
if (master) then
! Read number of realizations for global tallies
call read_data(n_realizations, "n_realizations")
call sp % read_data(n_realizations, "n_realizations", collect=.false.)
! Read number of global tallies
call read_data(int_array(1), "n_global_tallies")
call sp % read_data(int_array(1), "n_global_tallies", collect=.false.)
if (int_array(1) /= N_GLOBAL_TALLIES) then
message = "Number of global tallies does not match in state point."
call fatal_error()
end if
! Read global tally data
call read_tally_result(global_tallies, "global_tallies", &
call sp % read_tally_result(global_tallies, "global_tallies", &
n1=N_GLOBAL_TALLIES, n2=1)
! Check if tally results are present
call read_data(int_array(1), "tallies_present", group="tallies")
call sp % read_data(int_array(1), "tallies_present", group="tallies", collect=.false.)
! Read in sum and sum squared
if (int_array(1) == 1) then
@ -666,12 +651,19 @@ contains
t => tallies(i)
! Read sum and sum_sq for each bin
call read_tally_result(t % results, "results", &
call sp % read_tally_result(t % results, "results", &
group="tallies/tally" // to_str(i), &
n1=size(t % results, 1), n2=size(t % results, 2))
end do TALLY_RESULTS
end if
#ifdef MPI
! If using MPI, file needs to be closed and reopened in parallel
! If serial, we cannot close the file or we will lose our file position
call sp % file_close()
# endif
end if
! Read source if in eigenvalue mode
@ -681,7 +673,7 @@ contains
if (source_separate) then
! Close statepoint file
call file_close('parallel')
call sp % file_close()
! Set filename for source
filename = trim(path_output) // 'source.' // &
@ -696,28 +688,27 @@ contains
message = "Loading source file " // trim(filename) // "..."
call write_message(1)
! Create statepoint file
call file_open(filename, 'parallel', 'r')
! Open source file
call sp % file_open(filename, 'r', serial = .false.)
else
#ifdef MPI
! Reopen statepoint file in parallel, but only if MPI
! We will compute the position where the source begins
call sp % file_open(path_state_point, 'r', serial = .false.)
#endif
end if
! Write out source
call read_source_bank()
! Close file
if (source_separate) then
call file_close('parallel')
else
call file_close('parallel')
end if
else
! Close file if not in eigenvalue mode
call file_close('parallel')
call sp % read_source_bank()
end if
! Close file
call sp % file_close()
end subroutine load_state_point
subroutine read_source

23
tests/convert_precision.py Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env python
import os
import glob
dirs = glob.glob('test_*')
for adir in dirs:
os.chdir(adir)
files = glob.glob('results.py')
if len(files) > 0:
files = files[0]
with open(files, 'r') as fh:
intxt = fh.read()
intxt = intxt.replace('14.8E', '12.6E')
with open(files, 'w') as fh:
fh.write(intxt)
os.chdir('..')

41
tests/nose_mpi.py Normal file
View file

@ -0,0 +1,41 @@
import os
import logging
from nose.plugins import Plugin
log = logging.getLogger('nose.plugins.nose_mpi')
class NoseMPI(Plugin):
mpi_np = "0"
mpi_exec = "/opt/mpich/3.0.4-gnu/bin/mpiexec"
def options(self, parser, env=os.environ):
"""Define the command line options for plugin."""
super(NoseMPI, self).options(parser, env)
parser.add_option(
"--mpi-np", dest="mpi_np", default=0,
help="Number of MPI processors to execute OpenMC executable.")
parser.add_option(
"--mpi-exec", dest="mpi_exec",
default="/opt/mpich/3.0.4-gnu/bin/mpiexec",
help="Absolute path to mpiexec file.")
def configure(self, options, conf):
"""Configure plugin based on command line options"""
super(NoseMPI, self).configure(options, conf)
try:
mpi_np = int(options.mpi_np)
self.enabled = True
NoseMPI.mpi_np = options.mpi_np
except:
self.enabled = False
return
if not os.path.exists(options.mpi_exec):
print 'Need to specify valid mpiexec path.'
exit()
NoseMPI.mpi_exec = options.mpi_exec

101
tests/run_tests.py Executable file
View file

@ -0,0 +1,101 @@
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import nose
import glob
from subprocess import call
from nose_mpi import NoseMPI
def run_compile():
print('-'*17)
print('Compilation tests')
print('-'*17)
# clean up all previous executables
openmc_exe = glob.glob(pwd + '/../src/openmc*')
for exe in openmc_exe:
os.remove(exe)
# run compile test
result = nose.run(argv=['run_tests.py', 'test_compile'] + flags)
if not result:
print('Did not pass compile tests.')
results.append(('compile', result))
def run_suite(name=None, mpi=False):
print('-'*(len(name) + 6))
print(name + ' tests')
print('-'*(len(name) + 6))
# Set arguments list. Note that the first argument is a dummy argument (the
# script name). It's not actually recursively calling run_tests.py
argv = ['run_tests.py', '--exclude', 'test_compile'] + flags
# Add MPI plugin if set
if mpi:
plugins = [NoseMPI()]
argv += ['--mpi-np', '3', '--mpi-exec', mpiexec]
else:
plugins = None
try:
os.chdir(pwd)
os.rename(pwd + '/../src/openmc-' + name, pwd + '/../src/openmc')
result = nose.run(argv=argv, addplugins=plugins)
finally:
os.rename(pwd + '/../src/openmc', pwd + '/../src/openmc-' + name)
if not result:
print('Did not pass ' + name + ' tests')
results.append((name, result))
# set mpiexec path
if os.environ.has_key('COMPILER'):
compiler = os.environ['COMPILER']
else:
compiler = 'gnu'
mpiexec = '/opt/mpich/3.0.4-{0}/bin/mpiexec'.format(compiler)
# get current working directory
pwd = os.getcwd()
sys.path.append(pwd)
# Set list of tests, either default or from command line
flags = []
tests = ['compile', 'normal', 'debug', 'optimize', 'hdf5', 'mpi', 'phdf5',
'petsc', 'phdf5-petsc', 'phdf5-petsc-optimize']
if len(sys.argv) > 1:
flags = [i for i in sys.argv[1:] if i.startswith('-')]
tests_ = [i for i in sys.argv[1:] if not i.startswith('-')]
tests = tests_ if tests_ else tests
# Run tests
results = []
for name in tests:
if name == 'compile':
run_compile()
elif name in ['normal', 'debug', 'optimize', 'hdf5']:
run_suite(name=name)
elif name in ['mpi', 'phdf5', 'petsc', 'phdf5-petsc',
'phdf5-petsc-optimize']:
run_suite(name=name, mpi=True)
# print out summary of results
print('\n' + '='*54)
print('Summary of Compilation Option Testing:\n')
OK = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
for name, result in results:
print(name + '.'*(50 - len(name)), end='')
if result:
print(BOLD + OK + '[OK]' + ENDC)
else:
print(BOLD + FAIL + '[FAILED]' + ENDC)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
0.30113528 0.00285456
3.011353E-01 2.854556E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<cmfd>
<mesh>
<lower_left> -10 -1 -1 </lower_left>
<upper_right> 10 1 1 </upper_right>
<dimension> 10 1 1 </dimension>
<albedo> 0.0 0.0 1.0 1.0 1.0 1.0 </albedo>
</mesh>
<begin> 5 </begin>
<display> dominance </display>
<solver> power </solver>
<feedback> true </feedback>
</cmfd>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<geometry>
<!-- Definition of Cells -->
<cell id="1">
<universe>0</universe>
<surfaces>-1 2 -3 4 -5 6</surfaces>
<material>1</material>
</cell>
<!-- Defition of Surfaces -->
<surface id="1">
<type>x-plane</type>
<coeffs>10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="2">
<type>x-plane</type>
<coeffs>-10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="3">
<type>y-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="4">
<type>y-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="5">
<type>z-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="6">
<type>z-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
</geometry>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<materials>
<!-- Definition of materials -->
<material id="1">
<density value="19" units="g/cc" />
<nuclide name="U-235" xs="70c" wo="0.21" />
<nuclide name="U-238" xs="70c" wo="0.68" />
<nuclide name="O-16" xs="70c" wo="0.11" />
</material>
</materials>

View file

@ -0,0 +1,58 @@
#!/usr/bin/env python
import sys
import numpy as np
# import statepoint
sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.20.binary')
sp.read_results()
# extract tally results and convert to vector
results1 = sp.tallies[0].results
shape1 = results1.shape
size1 = (np.product(shape1))
results1 = np.reshape(results1, size1)
results2 = sp.tallies[1].results
shape2 = results2.shape
size2 = (np.product(shape2))
results2 = np.reshape(results2, size2)
results3 = sp.tallies[2].results
shape3 = results3.shape
size3 = (np.product(shape3))
results3 = np.reshape(results3, size3)
results4 = sp.tallies[3].results
shape4 = results4.shape
size4 = (np.product(shape4))
results4 = np.reshape(results4, size4)
# set up output string
outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tally 1:\n'
for item in results1:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 2:\n'
for item in results2:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 3:\n'
for item in results3:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 4:\n'
for item in results4:
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:
fh.write(outstr)

View file

@ -0,0 +1,654 @@
k-combined:
1.167124E+00 1.217343E-02
tally 1:
1.126891E+01
1.275755E+01
2.086556E+01
4.369501E+01
2.853629E+01
8.169559E+01
3.404506E+01
1.165019E+02
3.723908E+01
1.389881E+02
3.760048E+01
1.416691E+02
3.455469E+01
1.197186E+02
2.837503E+01
8.086291E+01
2.151789E+01
4.648315E+01
1.194541E+01
1.432331E+01
tally 2:
2.292173E+01
2.650792E+01
1.598183E+01
1.288692E+01
2.194143E+00
2.510557E-01
4.217816E+01
8.938583E+01
2.974466E+01
4.447038E+01
3.939269E+00
7.882413E-01
5.742289E+01
1.654599E+02
4.067581E+01
8.308454E+01
5.566955E+00
1.570072E+00
6.810586E+01
2.331019E+02
4.831543E+01
1.174673E+02
6.244999E+00
1.967938E+00
7.258131E+01
2.646756E+02
5.185146E+01
1.351425E+02
6.622488E+00
2.231695E+00
7.246115E+01
2.641295E+02
5.159542E+01
1.339441E+02
6.702239E+00
2.277825E+00
6.716397E+01
2.266815E+02
4.765063E+01
1.141627E+02
6.384098E+00
2.063760E+00
5.549542E+01
1.545361E+02
3.940819E+01
7.794880E+01
5.183375E+00
1.369483E+00
4.155685E+01
8.679439E+01
2.926744E+01
4.307145E+01
3.938852E+00
7.877949E-01
2.335180E+01
2.758241E+01
1.622683E+01
1.331996E+01
2.248921E+00
2.594934E-01
tally 3:
1.537807E+01
1.193746E+01
1.044189E+00
5.627797E-02
2.861614E+01
4.118322E+01
1.846208E+00
1.729007E-01
3.921462E+01
7.723576E+01
2.427723E+00
2.983153E-01
4.653207E+01
1.089818E+02
3.128394E+00
4.945409E-01
4.989896E+01
1.251503E+02
3.242191E+00
5.330743E-01
4.967378E+01
1.241657E+02
3.184751E+00
5.164524E-01
4.592989E+01
1.061019E+02
2.936424E+00
4.356307E-01
3.783939E+01
7.188489E+01
2.485680E+00
3.117618E-01
2.819358E+01
3.997588E+01
1.875908E+00
1.772000E-01
1.562421E+01
1.236020E+01
1.013140E+00
5.260420E-02
tally 4:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.126365E+00
4.930682E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
5.456410E+00
1.499416E+00
2.727755E+00
3.788867E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.453480E+00
2.790159E+00
5.240103E+00
1.386895E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.741563E+00
3.830225E+00
7.137968E+00
2.555042E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.221731E+00
4.266573E+00
8.474116E+00
3.604647E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.054937E+00
4.124537E+00
9.066119E+00
4.133833E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.362253E+00
3.517245E+00
9.086548E+00
4.156118E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
6.871573E+00
2.369190E+00
8.399584E+00
3.549784E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.998103E+00
1.258194E+00
7.145296E+00
2.568115E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.716076E+00
3.753568E-01
5.427593E+00
1.484154E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.056645E+00
4.702349E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<!-- Parameters for criticality calculation -->
<eigenvalue>
<batches>20</batches>
<inactive>10</inactive>
<particles>1000</particles>
</eigenvalue>
<!-- How verbose output should be -->
<verbosity value="7" />
<!-- Starting source -->
<source>
<space>
<type>box</type>
<parameters>-10 -1 -1 10 1 1</parameters>
</space>
</source>
<!-- Shannon Entropy -->
<entropy>
<dimension> 10 1 1 </dimension>
<lower_left> -10.0 -1.0 -1.0 </lower_left>
<upper_right> 10.0 1.0 1.0 </upper_right>
</entropy>
<!-- Run CMFD -->
<run_cmfd> true </run_cmfd>
</settings>

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<tallies>
<mesh id="1">
<type>rectangular</type>
<lower_left>-10 -1 -1 </lower_left>
<upper_right>10 1 1</upper_right>
<dimension>10 1 1</dimension>
</mesh>
<tally id="1">
<filter type="mesh" bins="1" />
<scores>flux</scores>
</tally>
</tallies>

View file

@ -0,0 +1,68 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
import glob
from nose.plugins.skip import SkipTest
from nose_mpi import NoseMPI
pwd = os.path.dirname(__file__)
skipAll = False
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
global skipAll
skipAll = False
def test_run():
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
output = proc.communicate()[0]
print(output)
if 'CMFD is not available' in output:
global skipAll
skipAll = True
raise SkipTest
assert returncode == 0
def test_created_statepoint():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
if skipAll:
raise SkipTest
assert os.path.exists(pwd + '/tallies.out')
def test_results():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = glob.glob(pwd + '/statepoint.20.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<cmfd>
<mesh>
<lower_left> -10 -1 -1 </lower_left>
<upper_right> 10 1 1 </upper_right>
<dimension> 10 1 1 </dimension>
<albedo> 0.0 0.0 1.0 1.0 1.0 1.0 </albedo>
</mesh>
<begin> 5 </begin>
<display> dominance </display>
<solver> power </solver>
<feedback> false </feedback>
</cmfd>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<geometry>
<!-- Definition of Cells -->
<cell id="1">
<universe>0</universe>
<surfaces>-1 2 -3 4 -5 6</surfaces>
<material>1</material>
</cell>
<!-- Defition of Surfaces -->
<surface id="1">
<type>x-plane</type>
<coeffs>10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="2">
<type>x-plane</type>
<coeffs>-10</coeffs>
<boundary> vacuum </boundary>
</surface>
<surface id="3">
<type>y-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="4">
<type>y-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="5">
<type>z-plane</type>
<coeffs>1</coeffs>
<boundary>reflective</boundary>
</surface>
<surface id="6">
<type>z-plane</type>
<coeffs>-1</coeffs>
<boundary>reflective</boundary>
</surface>
</geometry>

View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<materials>
<!-- Definition of materials -->
<material id="1">
<density value="19" units="g/cc" />
<nuclide name="U-235" xs="70c" wo="0.21" />
<nuclide name="U-238" xs="70c" wo="0.68" />
<nuclide name="O-16" xs="70c" wo="0.11" />
</material>
</materials>

View file

@ -0,0 +1,58 @@
#!/usr/bin/env python
import sys
import numpy as np
# import statepoint
sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.20.binary')
sp.read_results()
# extract tally results and convert to vector
results1 = sp.tallies[0].results
shape1 = results1.shape
size1 = (np.product(shape1))
results1 = np.reshape(results1, size1)
results2 = sp.tallies[1].results
shape2 = results2.shape
size2 = (np.product(shape2))
results2 = np.reshape(results2, size2)
results3 = sp.tallies[2].results
shape3 = results3.shape
size3 = (np.product(shape3))
results3 = np.reshape(results3, size3)
results4 = sp.tallies[3].results
shape4 = results4.shape
size4 = (np.product(shape4))
results4 = np.reshape(results4, size4)
# set up output string
outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tally 1:\n'
for item in results1:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 2:\n'
for item in results2:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 3:\n'
for item in results3:
outstr += "{0:12.6E}\n".format(item)
outstr += 'tally 4:\n'
for item in results4:
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:
fh.write(outstr)

View file

@ -0,0 +1,654 @@
k-combined:
1.137460E+00 1.215114E-02
tally 1:
1.168490E+01
1.400522E+01
2.192157E+01
4.824543E+01
2.936949E+01
8.648246E+01
3.435607E+01
1.185184E+02
3.612841E+01
1.309721E+02
3.552232E+01
1.266988E+02
3.314322E+01
1.107274E+02
2.765588E+01
7.705156E+01
2.044445E+01
4.210167E+01
1.125932E+01
1.276689E+01
tally 2:
2.372613E+01
2.862691E+01
1.660400E+01
1.404387E+01
2.237703E+00
2.562122E-01
4.397041E+01
9.722086E+01
3.107800E+01
4.859826E+01
4.052018E+00
8.364586E-01
5.850026E+01
1.715533E+02
4.157400E+01
8.666187E+01
5.420325E+00
1.492090E+00
6.875182E+01
2.377104E+02
4.875600E+01
1.196878E+02
6.167355E+00
1.922001E+00
7.240156E+01
2.639189E+02
5.161800E+01
1.342800E+02
6.657325E+00
2.248300E+00
7.074222E+01
2.516854E+02
5.016500E+01
1.266005E+02
6.598272E+00
2.224189E+00
6.625191E+01
2.209754E+02
4.694400E+01
1.110192E+02
6.197674E+00
1.947375E+00
5.574790E+01
1.561211E+02
3.963100E+01
7.893339E+01
5.104628E+00
1.314367E+00
4.068463E+01
8.316576E+01
2.878400E+01
4.165629E+01
4.000895E+00
8.100229E-01
2.238335E+01
2.532998E+01
1.555300E+01
1.221694E+01
2.312206E+00
2.751529E-01
tally 3:
1.599200E+01
1.304060E+01
1.075546E+00
5.989825E-02
2.991600E+01
4.504778E+01
2.016558E+00
2.060921E-01
4.008500E+01
8.057644E+01
2.465241E+00
3.073562E-01
4.690900E+01
1.108192E+02
3.050094E+00
4.696181E-01
4.972600E+01
1.246434E+02
3.127136E+00
4.939882E-01
4.836400E+01
1.176964E+02
3.102574E+00
4.868820E-01
4.524800E+01
1.031819E+02
2.966738E+00
4.482948E-01
3.809700E+01
7.295318E+01
2.526411E+00
3.226394E-01
2.772600E+01
3.866039E+01
1.852304E+00
1.725388E-01
1.494500E+01
1.129101E+01
9.995136E-01
5.115569E-02
tally 4:
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.251000E+00
5.355770E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
5.759000E+00
1.676451E+00
2.883000E+00
4.269210E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.633000E+00
2.922951E+00
5.354000E+00
1.442474E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.787000E+00
3.871605E+00
7.137000E+00
2.553987E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.343000E+00
4.385923E+00
8.470000E+00
3.603838E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
9.076000E+00
4.142704E+00
8.977000E+00
4.056459E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
8.252000E+00
3.428360E+00
8.957000E+00
4.041545E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
6.868000E+00
2.375736E+00
8.404000E+00
3.562144E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.914000E+00
1.211724E+00
7.074000E+00
2.511368E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.634000E+00
3.523220E-01
5.349000E+00
1.437693E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.050000E+00
4.687600E-01
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<!-- Parameters for criticality calculation -->
<eigenvalue>
<batches>20</batches>
<inactive>10</inactive>
<particles>1000</particles>
</eigenvalue>
<!-- How verbose output should be -->
<verbosity value="7" />
<!-- Starting source -->
<source>
<space>
<type>box</type>
<parameters>-10 -1 -1 10 1 1</parameters>
</space>
</source>
<!-- Shannon Entropy -->
<entropy>
<dimension> 10 1 1 </dimension>
<lower_left> -10.0 -1.0 -1.0 </lower_left>
<upper_right> 10.0 1.0 1.0 </upper_right>
</entropy>
<!-- Run CMFD -->
<run_cmfd> true </run_cmfd>
</settings>

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<tallies>
<mesh id="1">
<type>rectangular</type>
<lower_left>-10 -1 -1 </lower_left>
<upper_right>10 1 1</upper_right>
<dimension>10 1 1</dimension>
</mesh>
<tally id="1">
<filter type="mesh" bins="1" />
<scores>flux</scores>
</tally>
</tallies>

View file

@ -0,0 +1,67 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
import glob
from nose.plugins.skip import SkipTest
from nose_mpi import NoseMPI
pwd = os.path.dirname(__file__)
skipAll = False
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
global skipAll
skipAll = False
def test_run():
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
output = proc.communicate()[0]
print(output)
if 'CMFD is not available' in output:
global skipAll
skipAll = True
raise SkipTest
assert returncode == 0
def test_created_statepoint():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
if skipAll:
raise SkipTest
assert os.path.exists(pwd + '/tallies.out')
def test_results():
if skipAll:
raise SkipTest
statepoint = glob.glob(pwd + '/statepoint.20.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = glob.glob(pwd + '/statepoint.20.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -15,100 +15,73 @@ import shutil
pwd = os.path.dirname(__file__)
if os.environ.has_key('COMPILER'):
compiler = 'COMPILER=' + os.environ['COMPILER']
else:
compiler = 'COMPILER=gnu'
def setup():
# Change to source directory
os.chdir(pwd + '/../../src')
def test_gfortran():
def test_normal():
returncode = run(['make','distclean'])
returncode = run(['make'])
returncode = run(['make', compiler])
assert returncode == 0
shutil.move('openmc', 'openmc-gfortran')
shutil.move('openmc', 'openmc-normal')
def test_gfortran_debug():
def test_debug():
returncode = run(['make','distclean'])
returncode = run(['make', 'DEBUG=yes'])
returncode = run(['make', compiler, 'DEBUG=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-debug')
def test_profile():
returncode = run(['make','distclean'])
returncode = run(['make', compiler, 'PROFILE=yes'])
assert returncode == 0
def test_gfortran_profile():
def test_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'PROFILE=yes'])
returncode = run(['make', compiler, 'OPTIMIZE=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-optimize')
def test_gfortran_optimize():
def test_mpi():
returncode = run(['make','distclean'])
returncode = run(['make', 'OPTIMIZE=yes'])
returncode = run(['make', compiler, 'MPI=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-mpi')
def test_gfortran_mpi():
def test_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes'])
returncode = run(['make', compiler, 'HDF5=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-hdf5')
def test_gfortran_hdf5():
def test_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'HDF5=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'PETSC=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-petsc')
def test_gfortran_petsc():
def test_mpi_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'PETSC=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-phdf5')
def test_gfortran_mpi_hdf5():
def test_mpi_hdf5_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-phdf5-petsc')
def test_gfortran_mpi_hdf5_petsc():
def test_mpi_hdf5_petsc_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
assert returncode == 0
def test_intel():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel'])
assert returncode == 0
def test_intel_debug():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'DEBUG=yes'])
assert returncode == 0
def test_intel_profile():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'PROFILE=yes'])
assert returncode == 0
def test_intel_optimize():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'OPTIMIZE=yes'])
assert returncode == 0
def test_intel_mpi():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes'])
assert returncode == 0
def test_intel_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'HDF5=yes'])
assert returncode == 0
def test_intel_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes', 'PETSC=yes'])
assert returncode == 0
def test_intel_mpi_hdf5():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes', 'HDF5=yes'])
assert returncode == 0
def test_intel_mpi_hdf5_petsc():
returncode = run(['make','distclean'])
returncode = run(['make', 'COMPILER=intel', 'MPI=yes', 'HDF5=yes', 'PETSC=yes'])
returncode = run(['make', compiler, 'MPI=yes', 'HDF5=yes', 'PETSC=yes', 'OPTIMIZE=yes'])
assert returncode == 0
shutil.move('openmc', 'openmc-phdf5-petsc-optimize')
def run(commands):
proc = Popen(commands, stderr=STDOUT, stdout=PIPE)
@ -118,4 +91,4 @@ def run(commands):
def teardown(commands):
returncode = run(['make','distclean'])
shutil.copy('openmc-gfortran','openmc')
shutil.copy('openmc-normal','openmc')

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,5 +1,5 @@
k-combined:
0.29371031 0.00739160
2.937103E-01 7.391597E-03
tallies:
62.67770579
492.80295648
6.267771E+01
4.928030E+02

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,27 +13,36 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_created_output():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
output.append(pwd + '/tallies.out')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
1.73961429 0.01281892
1.739614E+00 1.281892E-02

View file

@ -1,33 +1,44 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
1.08146351 0.02283652
1.081464E+00 2.283652E-02

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob('statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
0.80588796 0.00512148
8.058880E-01 5.121476E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
0.31665691 0.00636741
3.166569E-01 6.367411E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob('statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.7.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.7.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
0.30043746 0.00230870
3.004375E-01 2.308696E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.7.binary')
statepoint = glob.glob(pwd + '/statepoint.7.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.7.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.7.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.7.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
0.31185079 0.00676453
3.118508E-01 6.764530E-03

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
0.32430182 0.00096736
3.243018E-01 9.673636E-04

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -16,12 +19,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'entropy:\n'
for item in sp.entropy:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,13 +1,13 @@
k-combined:
0.30113528 0.00285456
3.011353E-01 2.854556E-03
entropy:
7.11451332
8.05560155
8.23397277
8.23557155
8.28448354
8.28984841
8.42007985
8.27943150
8.29999736
8.36396839
7.114513E+00
8.055602E+00
8.233973E+00
8.235572E+00
8.284484E+00
8.289848E+00
8.420080E+00
8.279431E+00
8.299997E+00
8.363968E+00

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
@ -11,23 +13,32 @@ def setup():
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_statepoint():
assert os.path.exists(pwd + '/statepoint.10.binary')
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
0.00000000
0.00000000
18.82286226
72.03127513
4.03592017
3.30960729
56.15335982
641.42946960
0.000000E+00
0.000000E+00
1.882286E+01
7.203128E+01
4.035920E+00
3.309607E+00
5.615336E+01
6.414295E+02

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
0.00000000
0.00000000
91.12132788
1691.91742599
0.00000000
0.00000000
0.00000000
0.00000000
0.000000E+00
0.000000E+00
9.112133E+01
1.691917E+03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
32.64739927
215.66831301
43.90484994
388.17393630
50.74294368
516.93670081
10.05233017
20.30524675
3.264740E+01
2.156683E+02
4.390485E+01
3.881739E+02
5.074294E+01
5.169367E+02
1.005233E+01
2.030525E+01

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
32.68000000
216.39020000
43.50000000
380.24020000
51.33000000
528.74330000
6.62000000
8.82700000
3.268000E+01
2.163902E+02
4.350000E+01
3.802402E+02
5.133000E+01
5.287433E+02
6.620000E+00
8.827000E+00

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,67 +1,67 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
30.03000000
183.35510000
0.00000000
0.00000000
0.04000000
0.00040000
0.00000000
0.00000000
0.00000000
0.00000000
0.77446136
0.12571254
0.00000000
0.00000000
2.15557882
0.96830054
2.65000000
1.41390000
0.00000000
0.00000000
38.97000000
305.38850000
0.00000000
0.00000000
0.00000000
0.00000000
0.27919994
0.01768291
0.00000000
0.00000000
0.67147652
0.09169556
0.00000000
0.00000000
0.00000000
0.00000000
4.49000000
4.03650000
0.00000000
0.00000000
47.94000000
461.47120000
0.01733787
0.00030060
0.00000000
0.00000000
0.08687216
0.00220468
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
0.00000000
3.39000000
2.31650000
0.12897774
0.00405715
6.62000000
8.82700000
0.31877323
0.02168587
3.003000E+01
1.833551E+02
0.000000E+00
0.000000E+00
4.000000E-02
4.000000E-04
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
7.744614E-01
1.257125E-01
0.000000E+00
0.000000E+00
2.155579E+00
9.683005E-01
2.650000E+00
1.413900E+00
0.000000E+00
0.000000E+00
3.897000E+01
3.053885E+02
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
2.791999E-01
1.768291E-02
0.000000E+00
0.000000E+00
6.714765E-01
9.169556E-02
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
4.490000E+00
4.036500E+00
0.000000E+00
0.000000E+00
4.794000E+01
4.614712E+02
1.733787E-02
3.006016E-04
0.000000E+00
0.000000E+00
8.687216E-02
2.204684E-03
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
0.000000E+00
3.390000E+00
2.316500E+00
1.289777E-01
4.057153E-03
6.620000E+00
8.827000E+00
3.187732E-01
2.168587E-02

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
27.75440762
154.83131712
6.47809111
8.42933435
66.33549411
889.14780763
28.94858797
172.85306981
2.775441E+01
1.548313E+02
6.478091E+00
8.429334E+00
6.633549E+01
8.891478E+02
2.894859E+01
1.728531E+02

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

File diff suppressed because it is too large Load diff

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

File diff suppressed because it is too large Load diff

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -22,12 +25,12 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,11 +1,11 @@
k-combined:
0.93773827 0.06215432
9.377383E-01 6.215432E-02
tallies:
76.34206724
1184.75098610
9.28488884
17.65553583
33.12780146
225.26612084
3.62384871
2.75301569
7.634207E+01
1.184751E+03
9.284889E+00
1.765554E+01
3.312780E+01
2.252661E+02
3.623849E+00
2.753016E+00

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -8,7 +8,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally results and convert to vector
@ -23,7 +26,7 @@ outstr = ''
# write out tally results
outstr += 'tallies:\n'
for item in results:
outstr += "{0:10.8f}\n".format(item)
outstr += "{0:12.6E}\n".format(item)
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,3 +1,3 @@
tallies:
453.85329674
20667.76024307
4.538533E+02
2.066776E+04

View file

@ -1,37 +1,48 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
from nose_mpi import NoseMPI
import glob
pwd = os.path.dirname(__file__)
def setup():
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_statepoint_exists():
assert os.path.exists(pwd + '/statepoint.10.binary')
def test_created_statepoint():
statepoint = glob.glob(pwd + '/statepoint.10.*')
assert len(statepoint) == 1
assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5')
def test_output_exists():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
statepoint = glob.glob(pwd + '/statepoint.10.*')
call(['python', 'results.py', statepoint[0]])
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
if not compare:
os.rename('results_test.dat', 'results_error.dat')
assert compare
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
pwd + '/results_test.dat']
output = glob.glob(pwd + '/statepoint.10.*')
output.append(pwd + '/tallies.out')
output.append(pwd + '/results_test.dat')
for f in output:
if os.path.exists(f):
os.remove(f)

View file

@ -7,7 +7,10 @@ sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
sp = statepoint.StatePoint('statepoint.10.binary')
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# set up output string
@ -15,7 +18,7 @@ outstr = ''
# write out k-combined
outstr += 'k-combined:\n'
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
outstr += "{0:12.6E} {1:12.6E}\n".format(sp.k_combined[0], sp.k_combined[1])
# write results to file
with open('results_test.dat','w') as fh:

View file

@ -1,2 +1,2 @@
k-combined:
1.09426709 0.07838238
1.094267E+00 7.838238E-02

Some files were not shown because too many files have changed in this diff Show more