diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 078b00bc76..e05edd524a 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -142,6 +142,30 @@ contains trace_particle = trace_(2) end if + ! Entropy box + if (associated(entropy_box_)) then + ! Check to make sure enough values were supplied + if (size(entropy_box_) /= 6) then + message = "Need to supply lower-left and upper-right coordinates " & + // "for Shannon entropy box." + call fatal_error() + end if + + ! Copy values + entropy_lower_left = entropy_box_(1:3) + entropy_upper_right = entropy_box_(4:6) + + ! Check on values provided + if (.not. all(entropy_upper_right > entropy_lower_left)) then + message = "Upper-right coordinate must be greater than lower-left " & + // "coordinate for Shannon entropy box." + call fatal_error() + end if + + ! Turn on Shannon entropy calculation + entropy_on = .true. + end if + end subroutine read_settings_xml !=============================================================================== diff --git a/src/intercycle.F90 b/src/intercycle.F90 index 9b8cf25a66..74b728768e 100644 --- a/src/intercycle.F90 +++ b/src/intercycle.F90 @@ -16,13 +16,14 @@ contains subroutine shannon_entropy() - integer :: i_bank ! index for bank sites + integer :: m ! index for bank sites integer :: i ! x-index for entropy mesh integer :: j ! y-index for entropy mesh integer :: k ! z-index for entropy mesh integer, save :: n_box ! total # of boxes on mesh integer, save :: n ! # of boxes in each dimension real(8), save :: width(3) ! width of box in each dimension + logical :: outside_box ! were there sites outside entropy box? ! On the first pass through this subroutine, we need to determine how big ! the entropy mesh should be in each direction and then allocate a @@ -43,19 +44,19 @@ contains ! initialize p entropy_p = ZERO + outside_box = .false. ! loop over fission sites and count how many are in each mesh box - FISSION_SITES: do i_bank = 1, n_bank + FISSION_SITES: do m = 1, n_bank ! determine indices for entropy mesh box - i = (fission_bank(i_bank) % xyz(1) - entropy_lower_left(1))/n - j = (fission_bank(i_bank) % xyz(2) - entropy_lower_left(2))/n - k = (fission_bank(i_bank) % xyz(3) - entropy_lower_left(3))/n + i = (fission_bank(m) % xyz(1) - entropy_lower_left(1))/width(1) + 1 + j = (fission_bank(m) % xyz(2) - entropy_lower_left(2))/width(2) + 1 + k = (fission_bank(m) % xyz(3) - entropy_lower_left(3))/width(3) + 1 ! if outside mesh, skip particle if (i < 1 .or. i > n .or. j < 1 .or. & j > n .or. k < 1 .or. k > n) then - message = "Fission source site outside of entropy box." - call warning() + outside_box = .true. cycle end if @@ -63,6 +64,12 @@ contains entropy_p(i,j,k) = entropy_p(i,j,k) + 1 end do FISSION_SITES + ! display warning message if there were sites outside entropy box + if (outside_box) then + message = "Fission source site(s) outside of entropy box." + call warning() + end if + ! normalize to number of fission sites entropy_p = entropy_p/n diff --git a/src/xml-fortran/templates/settings_t.xml b/src/xml-fortran/templates/settings_t.xml index 71ae91bd27..c69439612e 100644 --- a/src/xml-fortran/templates/settings_t.xml +++ b/src/xml-fortran/templates/settings_t.xml @@ -26,5 +26,6 @@ +