mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Merge pull request #776 from paulromano/sourcefile-fix
Fix use of source files for fixed source simulations
This commit is contained in:
commit
5afd4c369f
3 changed files with 19 additions and 8 deletions
|
|
@ -411,8 +411,8 @@ contains
|
|||
! Check if source file exists
|
||||
inquire(FILE=path_source, EXIST=file_exists)
|
||||
if (.not. file_exists) then
|
||||
call fatal_error("Binary source file '" // trim(path_source) &
|
||||
&// "' does not exist!")
|
||||
call fatal_error("Source file '" // trim(path_source) &
|
||||
// "' does not exist!")
|
||||
end if
|
||||
|
||||
else
|
||||
|
|
|
|||
|
|
@ -278,10 +278,12 @@ contains
|
|||
if (master .and. current_gen /= gen_per_batch) call print_generation()
|
||||
elseif (run_mode == MODE_FIXEDSOURCE) then
|
||||
! For fixed-source mode, we need to sample the external source
|
||||
do i = 1, work
|
||||
call set_particle_seed(overall_gen*n_particles + work_index(rank) + i)
|
||||
call sample_external_source(source_bank(i))
|
||||
end do
|
||||
if (path_source == '') then
|
||||
do i = 1, work
|
||||
call set_particle_seed(overall_gen*n_particles + work_index(rank) + i)
|
||||
call sample_external_source(source_bank(i))
|
||||
end do
|
||||
end if
|
||||
end if
|
||||
|
||||
end subroutine finalize_generation
|
||||
|
|
|
|||
|
|
@ -990,7 +990,9 @@ contains
|
|||
integer(HID_T) :: dset ! data set handle
|
||||
integer(HID_T) :: dspace ! data space handle
|
||||
integer(HID_T) :: memspace ! memory space handle
|
||||
integer(HSIZE_T) :: dims(1)
|
||||
integer(HSIZE_T) :: dims(1) ! dimensions on one processor
|
||||
integer(HSIZE_T) :: dims_all(1) ! overall dimensions
|
||||
integer(HSIZE_T) :: maxdims(1) ! maximum dimensions
|
||||
integer(HSIZE_T) :: offset(1) ! offset of data
|
||||
type(c_ptr) :: f_ptr
|
||||
#ifdef PHDF5
|
||||
|
|
@ -1004,8 +1006,15 @@ contains
|
|||
dims(1) = work
|
||||
call h5screate_simple_f(1, dims, memspace, hdf5_err)
|
||||
|
||||
! Select hyperslab for each process
|
||||
! Make sure source bank is big enough
|
||||
call h5dget_space_f(dset, dspace, hdf5_err)
|
||||
call h5sget_simple_extent_dims_f(dspace, dims_all, maxdims, hdf5_err)
|
||||
if (size(source_bank, KIND=HSIZE_T) > dims_all(1)) then
|
||||
call fatal_error("Number of source sites in source file is less than &
|
||||
&number of source particles per generation.")
|
||||
end if
|
||||
|
||||
! Select hyperslab for each process
|
||||
offset(1) = work_index(rank)
|
||||
call h5sselect_hyperslab_f(dspace, H5S_SELECT_SET_F, offset, dims, hdf5_err)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue