mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
merged pauls latest commits
This commit is contained in:
commit
123d2840dd
7 changed files with 426 additions and 152 deletions
|
|
@ -92,7 +92,10 @@ global.o: tally_header.o
|
|||
global.o: timing.o
|
||||
|
||||
hdf5_interface.o: constants.o
|
||||
hdf5_interface.o: geometry_header.o
|
||||
hdf5_interface.o: global.o
|
||||
hdf5_interface.o: material_header.o
|
||||
hdf5_interface.o: string.o
|
||||
|
||||
initialize.o: ace.o
|
||||
initialize.o: bank_header.o
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ contains
|
|||
|
||||
! Create new level of coordinates
|
||||
allocate(p % coord % next)
|
||||
p % coord % next % xyz = p % coord % xyz
|
||||
p % coord % next % uvw = p % coord % uvw
|
||||
|
||||
! Move particle to next level and set universe
|
||||
p % coord => p % coord % next
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ module geometry_header
|
|||
type Universe
|
||||
integer :: id ! Unique ID
|
||||
integer :: type ! Type
|
||||
integer :: level ! Level of universe (0=base)
|
||||
integer :: n_cells ! # of cells within
|
||||
integer, allocatable :: cells(:) ! List of cells within
|
||||
real(8) :: x0 ! Translation in x-coordinate
|
||||
|
|
@ -59,7 +58,6 @@ module geometry_header
|
|||
integer :: type ! Type of cell (normal, universe, lattice)
|
||||
integer :: universe ! universe # this cell is in
|
||||
integer :: fill ! universe # filling this cell
|
||||
integer :: parent ! cell within which this cell resides
|
||||
integer :: material ! Material within cell (0 for universe)
|
||||
integer :: n_surfaces ! Number of surfaces within
|
||||
integer, allocatable :: &
|
||||
|
|
|
|||
|
|
@ -172,7 +172,8 @@ module global
|
|||
! HDF5 VARIABLES
|
||||
|
||||
#ifdef HDF5
|
||||
integer(HID_T) :: hdf5_output_file
|
||||
integer(HID_T) :: hdf5_output_file ! identifier for output file
|
||||
integer :: hdf5_err ! error flag
|
||||
#endif
|
||||
|
||||
! ============================================================================
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
module hdf5_interface
|
||||
|
||||
use constants
|
||||
use geometry_header, only: Cell, Surface, Universe, Lattice
|
||||
use global
|
||||
use material_header, only: Material
|
||||
use string, only: to_str
|
||||
|
||||
#ifdef HDF5
|
||||
use hdf5
|
||||
|
|
@ -10,10 +13,10 @@ module hdf5_interface
|
|||
|
||||
implicit none
|
||||
|
||||
contains
|
||||
|
||||
#ifdef HDF5
|
||||
|
||||
contains
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_CREATE_OUTPUT
|
||||
!===============================================================================
|
||||
|
|
@ -38,10 +41,9 @@ contains
|
|||
subroutine hdf5_open_output()
|
||||
|
||||
character(9), parameter :: filename = "output.h5" ! File name
|
||||
integer :: error ! Error flag
|
||||
|
||||
! Initialize FORTRAN interface.
|
||||
call h5open_f (error)
|
||||
call h5open_f(hdf5_err)
|
||||
|
||||
! Create a new file using default properties.
|
||||
call h5fopen_f(filename, H5F_ACC_RDWR_F, hdf5_output_file, error)
|
||||
|
|
@ -49,143 +51,436 @@ contains
|
|||
end subroutine hdf5_open_output
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_SUMMARY
|
||||
! HDF5_WRITE_HEADER
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_write_summary()
|
||||
subroutine hdf5_write_header()
|
||||
|
||||
integer :: error
|
||||
integer :: rank = 1
|
||||
integer(HSIZE_T) :: dims(1) = (/1/)
|
||||
character(8) :: date_
|
||||
character(10) :: time_
|
||||
character(19) :: current_time
|
||||
character(8) :: date_
|
||||
character(10) :: time_
|
||||
character(19) :: current_time
|
||||
|
||||
! Write version information
|
||||
call h5ltmake_dataset_int_f(hdf5_output_file, "version_major", &
|
||||
rank, dims, (/ VERSION_MAJOR /), error)
|
||||
call h5ltmake_dataset_int_f(hdf5_output_file, "version_minor", &
|
||||
rank, dims, (/ VERSION_MINOR /), error)
|
||||
call h5ltmake_dataset_int_f(hdf5_output_file, "version_release", &
|
||||
rank, dims, (/ VERSION_RELEASE /), error)
|
||||
call hdf5_make_integer(hdf5_output_file, "version_major", VERSION_MAJOR)
|
||||
call hdf5_make_integer(hdf5_output_file, "version_minor", VERSION_MINOR)
|
||||
call hdf5_make_integer(hdf5_output_file, "version_release", VERSION_RELEASE)
|
||||
|
||||
! Write current date and time
|
||||
call date_and_time(DATE=date_, TIME=time_)
|
||||
current_time = date_(1:4) // "-" // date_(5:6) // "-" // date_(7:8) // &
|
||||
" " // time_(1:2) // ":" // time_(3:4) // ":" // time_(5:6)
|
||||
call h5ltmake_dataset_string_f(hdf5_output_file, "/date_and_time", &
|
||||
current_time, error)
|
||||
call h5ltmake_dataset_string_f(hdf5_output_file, "date_and_time", &
|
||||
current_time, hdf5_err)
|
||||
|
||||
! Write MPI information
|
||||
call h5ltmake_dataset_int_f(hdf5_output_file, "n_procs", &
|
||||
rank, dims, (/ n_procs /), error)
|
||||
call hdf5_make_integer(hdf5_output_file, "n_procs", n_procs)
|
||||
call h5ltset_attribute_string_f(hdf5_output_file, "n_procs", &
|
||||
"description", "Number of MPI processes", error)
|
||||
"description", "Number of MPI processes", hdf5_err)
|
||||
|
||||
end subroutine hdf5_write_header
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_SUMMARY
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_write_summary()
|
||||
|
||||
! Write criticality information
|
||||
if (problem_type == PROB_CRITICALITY) then
|
||||
! Need to write integer(8)'s using double instead since there is no H5LT
|
||||
! call for making a dataset of type long
|
||||
call h5ltmake_dataset_double_f(hdf5_output_file, "n_particles", &
|
||||
rank, dims, (/ real(n_particles,8) /), error)
|
||||
call hdf5_make_double(hdf5_output_file, "n_particles", real(n_particles,8))
|
||||
|
||||
! Use H5LT interface to write n_cycles, n_inactive, and n_active
|
||||
call h5ltmake_dataset_int_f(hdf5_output_file, "n_cycles", &
|
||||
rank, dims, (/ n_cycles /), error)
|
||||
call h5ltmake_dataset_int_f(hdf5_output_file, "n_inactive", &
|
||||
rank, dims, (/ n_inactive /), error)
|
||||
call h5ltmake_dataset_int_f(hdf5_output_file, "n_active", &
|
||||
rank, dims, (/ n_cycles - n_inactive /), error)
|
||||
call hdf5_make_integer(hdf5_output_file, "n_cycles", n_cycles)
|
||||
call hdf5_make_integer(hdf5_output_file, "n_inactive", n_inactive)
|
||||
call hdf5_make_integer(hdf5_output_file, "n_active", n_cycles - n_inactive)
|
||||
|
||||
! Add description of each variable
|
||||
call h5ltset_attribute_string_f(hdf5_output_file, "n_particles", &
|
||||
"description", "Number of particles per cycle", error)
|
||||
"description", "Number of particles per cycle", hdf5_err)
|
||||
call h5ltset_attribute_string_f(hdf5_output_file, "n_cycles", &
|
||||
"description", "Total number of cycles", error)
|
||||
"description", "Total number of cycles", hdf5_err)
|
||||
call h5ltset_attribute_string_f(hdf5_output_file, "n_inactive", &
|
||||
"description", "Number of inactive cycles", error)
|
||||
"description", "Number of inactive cycles", hdf5_err)
|
||||
call h5ltset_attribute_string_f(hdf5_output_file, "n_active", &
|
||||
"description", "Number of active cycles", error)
|
||||
"description", "Number of active cycles", hdf5_err)
|
||||
end if
|
||||
|
||||
call hdf5_write_geometry()
|
||||
call hdf5_write_materials()
|
||||
|
||||
end subroutine hdf5_write_summary
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_GEOMETRY
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_write_geometry()
|
||||
|
||||
integer :: i, j, k
|
||||
integer(HSIZE_T) :: dims(1)
|
||||
integer(HSIZE_T) :: dims2(2)
|
||||
integer(HID_T) :: geometry_group
|
||||
integer(HID_T) :: cell_group
|
||||
integer(HID_T) :: surface_group
|
||||
integer(HID_T) :: universe_group
|
||||
integer(HID_T) :: lattice_group
|
||||
integer(HID_T) :: temp_group
|
||||
integer, allocatable :: lattice_universes(:,:)
|
||||
type(Cell), pointer :: c => null()
|
||||
type(Surface), pointer :: s => null()
|
||||
type(Universe), pointer :: u => null()
|
||||
type(Lattice), pointer :: l => null()
|
||||
|
||||
! Create group for geometry
|
||||
call h5gcreate_f(hdf5_output_file, "/geometry", geometry_group, hdf5_err)
|
||||
|
||||
! Use H5LT interface to write number of geometry objects
|
||||
call hdf5_make_integer(geometry_group, "n_cells", n_cells)
|
||||
call hdf5_make_integer(geometry_group, "n_surfaces", n_surfaces)
|
||||
call hdf5_make_integer(geometry_group, "n_universes", n_universes)
|
||||
call hdf5_make_integer(geometry_group, "n_lattices", n_lattices)
|
||||
|
||||
! ==========================================================================
|
||||
! WRITE INFORMATION ON CELLS
|
||||
|
||||
call h5gcreate_f(geometry_group, "cells", cell_group, hdf5_err)
|
||||
|
||||
! Write information on each cell
|
||||
do i = 1, n_cells
|
||||
c => cells(i)
|
||||
|
||||
! Create group for i-th cell
|
||||
call h5gcreate_f(cell_group, "cell " // trim(to_str(c % id)), &
|
||||
temp_group, hdf5_err)
|
||||
|
||||
! Write universe for this cell
|
||||
call hdf5_make_integer(temp_group, "universe", &
|
||||
universes(c % universe) % id)
|
||||
|
||||
! Write information on what fills this cell
|
||||
select case (c % type)
|
||||
case (CELL_NORMAL)
|
||||
call h5ltmake_dataset_string_f(temp_group, "fill_type", "normal", &
|
||||
hdf5_err)
|
||||
call hdf5_make_integer(temp_group, "material", &
|
||||
materials(c % material) % id)
|
||||
case (CELL_FILL)
|
||||
call h5ltmake_dataset_string_f(temp_group, "fill_type", "universe", &
|
||||
hdf5_err)
|
||||
call hdf5_make_integer(temp_group, "material", &
|
||||
universes(c % fill) % id)
|
||||
case (CELL_LATTICE)
|
||||
call h5ltmake_dataset_string_f(temp_group, "fill_type", "lattice", &
|
||||
hdf5_err)
|
||||
call hdf5_make_integer(temp_group, "lattice", &
|
||||
lattices(c % fill) % id)
|
||||
end select
|
||||
|
||||
! Write list of bounding surfaces
|
||||
if (c % n_surfaces > 0) then
|
||||
dims(1) = c % n_surfaces
|
||||
call h5ltmake_dataset_int_f(temp_group, "surfaces", 1, &
|
||||
dims, c % surfaces, hdf5_err)
|
||||
end if
|
||||
|
||||
! Close group for i-th cell
|
||||
call h5gclose_f(temp_group, hdf5_err)
|
||||
end do
|
||||
|
||||
call h5gclose_f(cell_group, hdf5_err)
|
||||
|
||||
! ==========================================================================
|
||||
! WRITE INFORMATION ON SURFACES
|
||||
|
||||
call h5gcreate_f(geometry_group, "surfaces", surface_group, hdf5_err)
|
||||
|
||||
! Write information on each surface
|
||||
do i = 1, n_surfaces
|
||||
s => surfaces(i)
|
||||
|
||||
! Create group for i-th surface
|
||||
call h5gcreate_f(surface_group, "surface " // trim(to_str(s % id)), &
|
||||
temp_group, hdf5_err)
|
||||
|
||||
! Write surface type
|
||||
select case (s % type)
|
||||
case (SURF_PX)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "X Plane", hdf5_err)
|
||||
case (SURF_PY)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "Y Plane", hdf5_err)
|
||||
case (SURF_PZ)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "Z Plane", hdf5_err)
|
||||
case (SURF_PLANE)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "Plane", hdf5_err)
|
||||
case (SURF_CYL_X)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "X Cylinder", hdf5_err)
|
||||
case (SURF_CYL_Y)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "Y Cylinder", hdf5_err)
|
||||
case (SURF_CYL_Z)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "Z Cylinder", hdf5_err)
|
||||
case (SURF_SPHERE)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "Sphere", hdf5_err)
|
||||
case (SURF_BOX_X)
|
||||
case (SURF_BOX_Y)
|
||||
case (SURF_BOX_Z)
|
||||
case (SURF_BOX)
|
||||
case (SURF_GQ)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "General Quadratic", hdf5_err)
|
||||
end select
|
||||
|
||||
! Write coefficients for surface
|
||||
dims(1) = size(s % coeffs)
|
||||
call h5ltmake_dataset_double_f(temp_group, "coefficients", 1, dims, &
|
||||
s % coeffs, hdf5_err)
|
||||
|
||||
! Write positive neighbors
|
||||
if (allocated(s % neighbor_pos)) then
|
||||
dims(1) = size(s % neighbor_pos)
|
||||
call h5ltmake_dataset_int_f(temp_group, "neighbors_positive", 1, dims, &
|
||||
s % neighbor_pos, hdf5_err)
|
||||
end if
|
||||
|
||||
! Write negative neighbors
|
||||
if (allocated(s % neighbor_neg)) then
|
||||
dims(1) = size(s % neighbor_neg)
|
||||
call h5ltmake_dataset_int_f(temp_group, "neighbors_negative", 1, dims, &
|
||||
s % neighbor_neg, hdf5_err)
|
||||
end if
|
||||
|
||||
! Write boundary condition
|
||||
select case (s % bc)
|
||||
case (BC_TRANSMIT)
|
||||
call h5ltmake_dataset_string_f(temp_group, "boundary_condition", &
|
||||
"transmission", hdf5_err)
|
||||
case (BC_VACUUM)
|
||||
call h5ltmake_dataset_string_f(temp_group, "boundary_condition", &
|
||||
"vacuum", hdf5_err)
|
||||
case (BC_REFLECT)
|
||||
call h5ltmake_dataset_string_f(temp_group, "boundary_condition", &
|
||||
"reflective", hdf5_err)
|
||||
case (BC_PERIODIC)
|
||||
call h5ltmake_dataset_string_f(temp_group, "boundary_condition", &
|
||||
"periodic", hdf5_err)
|
||||
end select
|
||||
|
||||
! Close group for i-th surface
|
||||
call h5gclose_f(temp_group, hdf5_err)
|
||||
end do
|
||||
|
||||
call h5gclose_f(surface_group, hdf5_err)
|
||||
|
||||
! ==========================================================================
|
||||
! WRITE INFORMATION ON UNIVERSES
|
||||
|
||||
call h5gcreate_f(geometry_group, "universes", universe_group, hdf5_err)
|
||||
|
||||
! Write information on each universe
|
||||
do i = 1, n_universes
|
||||
u => universes(i)
|
||||
|
||||
! Create group for i-th universe
|
||||
call h5gcreate_f(universe_group, "universe " // trim(to_str(u % id)), &
|
||||
temp_group, hdf5_err)
|
||||
|
||||
! Write list of cells in this universe
|
||||
if (u % n_cells > 0) then
|
||||
dims(1) = u % n_cells
|
||||
call h5ltmake_dataset_int_f(temp_group, "cells", 1, dims, &
|
||||
u % cells, hdf5_err)
|
||||
end if
|
||||
|
||||
! Close group for i-th universe
|
||||
call h5gclose_f(temp_group, hdf5_err)
|
||||
end do
|
||||
|
||||
call h5gclose_f(universe_group, hdf5_err)
|
||||
|
||||
! ==========================================================================
|
||||
! WRITE INFORMATION ON LATTICES
|
||||
|
||||
call h5gcreate_f(geometry_group, "lattices", lattice_group, hdf5_err)
|
||||
|
||||
! Write information on each lattice
|
||||
do i = 1, n_lattices
|
||||
l => lattices(i)
|
||||
|
||||
! Create group for i-th lattice
|
||||
call h5gcreate_f(lattice_group, "lattice " // trim(to_str(l % id)), &
|
||||
temp_group, hdf5_err)
|
||||
|
||||
! Write lattice type
|
||||
select case(l % type)
|
||||
case (LATTICE_RECT)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "rectangular", hdf5_err)
|
||||
case (LATTICE_HEX)
|
||||
call h5ltmake_dataset_string_f(temp_group, "type", "hexagonal", hdf5_err)
|
||||
end select
|
||||
|
||||
! Write lattice dimensions, lower left corner, and width of element
|
||||
dims(1) = 2
|
||||
call h5ltmake_dataset_int_f(temp_group, "n_elements", 1, dims, &
|
||||
(/ l % n_x, l % n_y /), hdf5_err)
|
||||
call h5ltmake_dataset_double_f(temp_group, "lower_left", 1, dims, &
|
||||
(/ l % x0, l % y0 /), hdf5_err)
|
||||
call h5ltmake_dataset_double_f(temp_group, "element_width", 1, dims, &
|
||||
(/ l % width_x, l % width_y /), hdf5_err)
|
||||
|
||||
! Write lattice elements
|
||||
allocate(lattice_universes(l % n_x, l % n_y))
|
||||
do j = 1, l % n_x
|
||||
do k = 1, l % n_y
|
||||
lattice_universes(j,k) = universes(l % element(j,k)) % id
|
||||
end do
|
||||
end do
|
||||
dims2 = (/ l % n_x, l % n_y /)
|
||||
call h5ltmake_dataset_int_f(temp_group, "elements", 2, dims2, &
|
||||
lattice_universes, hdf5_err)
|
||||
deallocate(lattice_universes)
|
||||
|
||||
! Close group for i-th lattice
|
||||
call h5gclose_f(temp_group, hdf5_err)
|
||||
end do
|
||||
|
||||
call h5gclose_f(lattice_group, hdf5_err)
|
||||
|
||||
! Close geometry group
|
||||
call h5gclose_f(geometry_group, hdf5_err)
|
||||
|
||||
end subroutine hdf5_write_geometry
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_MATERIALS
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_write_materials()
|
||||
|
||||
integer :: i
|
||||
integer(HSIZE_T) :: dims(1)
|
||||
integer(HSIZE_T) :: size_string = 12
|
||||
integer(HID_T) :: materials_group
|
||||
integer(HID_T) :: temp_group
|
||||
integer(HID_T) :: string_type
|
||||
integer(HID_T) :: dspace_id
|
||||
integer(HID_T) :: dset_id
|
||||
type(Material), pointer :: m => null()
|
||||
|
||||
! Create group for materials
|
||||
call h5gcreate_f(hdf5_output_file, "/materials", materials_group, hdf5_err)
|
||||
|
||||
! Use H5LT interface to write number of materials
|
||||
call hdf5_make_integer(materials_group, "n_materials", n_materials)
|
||||
|
||||
! Write information on each material
|
||||
do i = 1, n_materials
|
||||
m => materials(i)
|
||||
|
||||
! Create group for i-th universe
|
||||
call h5gcreate_f(materials_group, "material " // trim(to_str(m % id)), &
|
||||
temp_group, hdf5_err)
|
||||
|
||||
! Write atom density with units
|
||||
call hdf5_make_double(temp_group, "atom_density", m % density)
|
||||
call h5ltset_attribute_string_f(temp_group, "atom_density", &
|
||||
"units", "atom/barn-cm", hdf5_err)
|
||||
|
||||
! Create string type of length 12
|
||||
call h5tcopy_f(H5T_C_S1, string_type, hdf5_err)
|
||||
call h5tset_size_f(string_type, size_string, hdf5_err)
|
||||
|
||||
! Create dataspace and dataset for writing nuclides
|
||||
dims(1) = m % n_nuclides
|
||||
call h5screate_simple_f(1, dims, dspace_id, hdf5_err)
|
||||
call h5dcreate_f(temp_group, "nuclides", string_type, dspace_id, &
|
||||
dset_id, hdf5_err)
|
||||
|
||||
! Write list of nuclides
|
||||
call h5dwrite_f(dset_id, string_type, m % names, dims, hdf5_err)
|
||||
|
||||
! Close dataspace and dataset for nuclides
|
||||
call h5dclose_f(dset_id, hdf5_err)
|
||||
call h5sclose_f(dspace_id, hdf5_err)
|
||||
|
||||
! Write atom densities
|
||||
call h5ltmake_dataset_double_f(temp_group, "nuclide_densities", 1, &
|
||||
dims, m % atom_density, hdf5_err)
|
||||
|
||||
! Write S(a,b) information if present
|
||||
if (m % has_sab_table) then
|
||||
call h5ltmake_dataset_string_f(temp_group, "sab_table", &
|
||||
m % sab_name, hdf5_err)
|
||||
end if
|
||||
|
||||
! Close group for i-th material
|
||||
call h5gclose_f(temp_group, hdf5_err)
|
||||
end do
|
||||
|
||||
! Close materials group
|
||||
call h5gclose_f(materials_group, hdf5_err)
|
||||
|
||||
end subroutine hdf5_write_materials
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_WRITE_TIMING
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_write_timing()
|
||||
|
||||
integer :: error
|
||||
integer :: rank = 1
|
||||
integer(HSIZE_T) :: dims(1) = (/1/)
|
||||
integer(HID_T) :: timing_group
|
||||
integer(8) :: total_particles
|
||||
real(8) :: speed
|
||||
|
||||
! Create group for timing
|
||||
call h5gcreate_f(hdf5_output_file, "/timing", timing_group, error)
|
||||
call h5gcreate_f(hdf5_output_file, "/timing", timing_group, hdf5_err)
|
||||
|
||||
! Write timing data
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_initialize", &
|
||||
rank, dims, (/ time_initialize % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_read_xs", &
|
||||
rank, dims, (/ time_read_xs % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_unionize", &
|
||||
rank, dims, (/ time_unionize % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_compute", &
|
||||
rank, dims, (/ time_compute % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_intercycle", &
|
||||
rank, dims, (/ time_intercycle % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_tallies", &
|
||||
rank, dims, (/ time_ic_tallies % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_sample", &
|
||||
rank, dims, (/ time_ic_sample % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_sendrecv", &
|
||||
rank, dims, (/ time_ic_sendrecv % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_rebuild", &
|
||||
rank, dims, (/ time_ic_rebuild % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_inactive", &
|
||||
rank, dims, (/ time_inactive % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_active", &
|
||||
rank, dims, (/ time_active % elapsed /), error)
|
||||
call h5ltmake_dataset_double_f(timing_group, "time_total", &
|
||||
rank, dims, (/ time_total % elapsed /), error)
|
||||
call hdf5_make_double(timing_group, "time_initialize", time_initialize % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_read_xs", time_read_xs % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_unionize", time_unionize % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_compute", time_compute % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_intercycle", time_intercycle % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_tallies", time_ic_tallies % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_sample", time_ic_sample % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_sendrecv", time_ic_sendrecv % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_rebuild", time_ic_rebuild % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_inactive", time_inactive % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_active", time_active % elapsed)
|
||||
call hdf5_make_double(timing_group, "time_total", time_total % elapsed)
|
||||
|
||||
! Add descriptions to timing data
|
||||
call h5ltset_attribute_string_f(timing_group, "time_initialize", &
|
||||
"description", "Total time elapsed for initialization (s)", error)
|
||||
"description", "Total time elapsed for initialization (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_read_xs", &
|
||||
"description", "Time reading cross-section libraries (s)", error)
|
||||
"description", "Time reading cross-section libraries (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_unionize", &
|
||||
"description", "Time unionizing energy grid (s)", error)
|
||||
"description", "Time unionizing energy grid (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_compute", &
|
||||
"description", "Total time in computation (s)", error)
|
||||
"description", "Total time in computation (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_intercycle", &
|
||||
"description", "Total time between cycles (s)", error)
|
||||
"description", "Total time between cycles (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_tallies", &
|
||||
"description", "Time between cycles accumulating tallies (s)", error)
|
||||
"description", "Time between cycles accumulating tallies (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_sample", &
|
||||
"description", "Time between cycles sampling source sites (s)", error)
|
||||
"description", "Time between cycles sampling source sites (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_sendrecv", &
|
||||
"description", "Time between cycles SEND/RECVing source sites (s)", error)
|
||||
"description", "Time between cycles SEND/RECVing source sites (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_rebuild", &
|
||||
"description", "Time between cycles reconstructing source bank (s)", error)
|
||||
"description", "Time between cycles reconstructing source bank (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_inactive", &
|
||||
"description", "Total time in inactive cycles (s)", error)
|
||||
"description", "Total time in inactive cycles (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_active", &
|
||||
"description", "Total time in active cycles (s)", error)
|
||||
"description", "Total time in active cycles (s)", hdf5_err)
|
||||
call h5ltset_attribute_string_f(timing_group, "time_total", &
|
||||
"description", "Total time elapsed (s)", error)
|
||||
"description", "Total time elapsed (s)", hdf5_err)
|
||||
|
||||
! Write calculation rate
|
||||
total_particles = n_particles * n_cycles
|
||||
speed = real(total_particles) / time_compute % elapsed
|
||||
call h5ltmake_dataset_double_f(timing_group, "neutrons_per_second", &
|
||||
rank, dims, (/ speed /), error)
|
||||
call hdf5_make_double(timing_group, "neutrons_per_second", speed)
|
||||
|
||||
! Close timing group
|
||||
call h5gclose_f(timing_group, error)
|
||||
call h5gclose_f(timing_group, hdf5_err)
|
||||
|
||||
end subroutine hdf5_write_timing
|
||||
|
||||
|
|
@ -195,16 +490,50 @@ contains
|
|||
|
||||
subroutine hdf5_close_output()
|
||||
|
||||
integer :: error ! Error flag
|
||||
|
||||
! Terminate access to the file.
|
||||
call h5fclose_f(hdf5_output_file, error)
|
||||
call h5fclose_f(hdf5_output_file, hdf5_err)
|
||||
|
||||
! Close FORTRAN interface.
|
||||
call h5close_f(error)
|
||||
call h5close_f(hdf5_err)
|
||||
|
||||
end subroutine hdf5_close_output
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_MAKE_INTEGER
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_make_integer(group, name, buffer)
|
||||
|
||||
integer(HID_T), intent(in) :: group
|
||||
character(*), intent(in) :: name
|
||||
integer, intent(in) :: buffer
|
||||
|
||||
integer :: rank = 1
|
||||
integer(HSIZE_T) :: dims(1) = (/1/)
|
||||
|
||||
call h5ltmake_dataset_int_f(group, name, rank, dims, &
|
||||
(/ buffer /), hdf5_err)
|
||||
|
||||
end subroutine hdf5_make_integer
|
||||
|
||||
!===============================================================================
|
||||
! HDF5_MAKE_DOUBLE
|
||||
!===============================================================================
|
||||
|
||||
subroutine hdf5_make_double(group, name, buffer)
|
||||
|
||||
integer(HID_T), intent(in) :: group
|
||||
character(*), intent(in) :: name
|
||||
real(8), intent(in) :: buffer
|
||||
|
||||
integer :: rank = 1
|
||||
integer(HSIZE_T) :: dims(1) = (/1/)
|
||||
|
||||
call h5ltmake_dataset_double_f(group, name, rank, dims, &
|
||||
(/ buffer /), hdf5_err)
|
||||
|
||||
end subroutine hdf5_make_double
|
||||
|
||||
#endif
|
||||
|
||||
end module hdf5_interface
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ module initialize
|
|||
#endif
|
||||
|
||||
#ifdef HDF5
|
||||
use hdf5_interface, only: hdf5_create_output, hdf5_write_summary
|
||||
use hdf5_interface, only: hdf5_create_output, hdf5_write_header, &
|
||||
hdf5_write_summary
|
||||
#endif
|
||||
|
||||
implicit none
|
||||
|
|
@ -44,8 +45,6 @@ contains
|
|||
|
||||
subroutine initialize_run()
|
||||
|
||||
type(Universe), pointer :: univ
|
||||
|
||||
! Start total and initialization timer
|
||||
call timer_start(time_total)
|
||||
call timer_start(time_initialize)
|
||||
|
|
@ -61,9 +60,9 @@ contains
|
|||
call create_summary_file()
|
||||
|
||||
#ifdef HDF5
|
||||
! Create HDF5 output file for writing
|
||||
! Open HDF5 output file for writing and write header information
|
||||
call hdf5_create_output()
|
||||
call hdf5_write_summary()
|
||||
call hdf5_write_header()
|
||||
#endif
|
||||
|
||||
! Display title and initialization header
|
||||
|
|
@ -86,10 +85,6 @@ contains
|
|||
! Use dictionaries to redefine index pointers
|
||||
call adjust_indices()
|
||||
|
||||
! determine at which level universes are and link cells to parenting cells
|
||||
univ => universes(BASE_UNIVERSE)
|
||||
call build_universe(univ, 0, 0)
|
||||
|
||||
! After reading input and basic geometry setup is complete, build lists of
|
||||
! neighboring cells for efficient tracking
|
||||
call neighbor_lists()
|
||||
|
|
@ -128,6 +123,9 @@ contains
|
|||
call print_plot()
|
||||
else
|
||||
call print_summary()
|
||||
#ifdef HDF5
|
||||
call hdf5_write_summary()
|
||||
#endif
|
||||
end if
|
||||
end if
|
||||
|
||||
|
|
@ -555,61 +553,6 @@ contains
|
|||
|
||||
end subroutine adjust_indices
|
||||
|
||||
!===============================================================================
|
||||
! BUILD_UNIVERSE determines what level each universe is at and determines what
|
||||
! the parent cell of each cell in a subuniverse is.
|
||||
!===============================================================================
|
||||
|
||||
recursive subroutine build_universe(univ, parent, level)
|
||||
|
||||
type(Universe), pointer :: univ ! univese pointer
|
||||
integer, intent(in) :: parent ! cell containing universe
|
||||
integer, intent(in) :: level ! level of universe
|
||||
|
||||
integer :: i ! index for cells in universe
|
||||
integer :: x,y ! indices for lattice positions
|
||||
integer :: i_cell ! index in cells array
|
||||
integer :: universe_num
|
||||
type(Cell), pointer :: c => null()
|
||||
type(Universe), pointer :: subuniverse => null()
|
||||
type(Lattice), pointer :: lat => null()
|
||||
|
||||
! set level of the universe
|
||||
univ % level = level
|
||||
|
||||
! loop over all cells in the universe
|
||||
do i = 1, univ % n_cells
|
||||
i_cell = univ % cells(i)
|
||||
c => cells(i_cell)
|
||||
c % parent = parent
|
||||
|
||||
! if this cell is filled with another universe, recursively
|
||||
! call this subroutine
|
||||
if (c % type == CELL_FILL) then
|
||||
subuniverse => universes(c % fill)
|
||||
call build_universe(subuniverse, i_cell, level + 1)
|
||||
end if
|
||||
|
||||
! if this cell is filled by a lattice, need to build the
|
||||
! universe for each unique lattice element
|
||||
if (c % type == CELL_LATTICE) then
|
||||
lat => lattices(c % fill)
|
||||
do x = 1, lat % n_x
|
||||
do y = 1, lat % n_y
|
||||
universe_num = lat % element(x,y)
|
||||
if (.not. dict_has_key(build_dict, universe_num)) then
|
||||
call dict_add_key(build_dict, universe_num, 0)
|
||||
subuniverse => universes(universe_num)
|
||||
call build_universe(subuniverse, i_cell, level + 1)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
end if
|
||||
|
||||
end do
|
||||
|
||||
end subroutine build_universe
|
||||
|
||||
!===============================================================================
|
||||
! NORMALIZE_AO normalizes the atom or weight percentages for each material
|
||||
!===============================================================================
|
||||
|
|
|
|||
|
|
@ -336,7 +336,6 @@ contains
|
|||
m => materials(c % material)
|
||||
write(unit_,*) ' Material = ' // to_str(m % id)
|
||||
end if
|
||||
write(unit_,*) ' Parent Cell = ' // to_str(c % parent)
|
||||
string = ""
|
||||
do i = 1, c % n_surfaces
|
||||
select case (c % surfaces(i))
|
||||
|
|
@ -382,9 +381,8 @@ contains
|
|||
|
||||
write(unit_,*) 'Universe ' // to_str(univ % id)
|
||||
if (associated(univ, base_u)) then
|
||||
write(unit_,*) ' Base Universe'
|
||||
write(unit_,*) ' Base Universe'
|
||||
end if
|
||||
write(unit_,*) ' Level = ' // to_str(univ % level)
|
||||
string = ""
|
||||
do i = 1, univ % n_cells
|
||||
c => cells(univ % cells(i))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue