fixed issue in tally.F90 and updated mdgxs-part-ii.ipynb

This commit is contained in:
Sam Shaner 2016-08-16 16:47:50 -04:00
parent 2636be6779
commit e122535ddc
3 changed files with 63 additions and 79 deletions

File diff suppressed because one or more lines are too long

View file

@ -98,16 +98,16 @@ contains
integer, intent(in) :: ijk(:)
integer :: bin
integer :: n_x ! number of mesh cells in x direction
integer :: n_y ! number of mesh cells in y direction
integer :: n_z ! number of mesh cells in z direction
n_x = m % dimension(1)
n_y = m % dimension(2)
if (m % n_dimension == 2) then
bin = (ijk(1) - 1)*n_y + ijk(2)
bin = (ijk(2) - 1)*n_x + ijk(1)
elseif (m % n_dimension == 3) then
n_z = m % dimension(3)
bin = (ijk(1) - 1)*n_y*n_z + (ijk(2) - 1)*n_z + ijk(3)
bin = (ijk(3) - 1)*n_y*n_x + (ijk(2) - 1)*n_x + ijk(1)
end if
end function mesh_indices_to_bin
@ -122,19 +122,19 @@ contains
integer, intent(in) :: bin
integer, intent(out) :: ijk(:)
integer :: n_x ! number of mesh cells in x direction
integer :: n_y ! number of mesh cells in y direction
integer :: n_z ! number of mesh cells in z direction
n_x = m % dimension(1)
n_y = m % dimension(2)
if (m % n_dimension == 2) then
ijk(1) = (bin - 1)/n_y + 1
ijk(2) = mod(bin - 1, n_y) + 1
ijk(1) = mod(bin - 1, n_x) + 1
ijk(2) = (bin - 1)/n_x + 1
else if (m % n_dimension == 3) then
n_z = m % dimension(3)
ijk(1) = (bin - 1)/(n_y*n_z) + 1
ijk(2) = mod(bin - 1, n_y*n_z)/n_z + 1
ijk(3) = mod(bin - 1, n_z) + 1
ijk(1) = mod(bin - 1, n_x) + 1
ijk(2) = mod(bin - 1, n_x*n_y)/n_x + 1
ijk(3) = (bin - 1)/(n_x*n_y) + 1
end if
end subroutine bin_to_mesh_indices

View file

@ -2327,6 +2327,7 @@ contains
integer :: filter_index ! index of scoring bin
integer :: i_filter_mesh ! index of mesh filter in filters array
integer :: i_filter_surf ! index of surface filter in filters
integer :: i_filter_energy ! index of energy filter in filters
real(8) :: uvw(3) ! cosine of angle of particle
real(8) :: xyz0(3) ! starting/intermediate coordinates
real(8) :: xyz1(3) ! ending coordinates of particle
@ -2351,9 +2352,10 @@ contains
i_tally = active_current_tallies % get_item(i)
t => tallies(i_tally)
! Get index for mesh and surface filters
! Get index for mesh, surface, and energy filters
i_filter_mesh = t % find_filter(FILTER_MESH)
i_filter_surf = t % find_filter(FILTER_SURFACE)
i_filter_energy = t % find_filter(FILTER_ENERGYIN)
! Get pointer to mesh
select type(filt => t % filters(i_filter_mesh) % obj)
@ -2386,11 +2388,11 @@ contains
! Determine incoming energy bin. We need to tell the energy filter this
! is a tracklength tally so it uses the pre-collision energy.
j = t % find_filter(FILTER_ENERGYIN)
if (j > 0) then
call t % filters(i) % obj % get_next_bin(p, ESTIMATOR_TRACKLENGTH, &
& NO_BIN_FOUND, matching_bins(j), filt_score)
if (matching_bins(j) == NO_BIN_FOUND) cycle
if (i_filter_energy > 0) then
call t % filters(i_filter_energy) % obj % get_next_bin(p, &
ESTIMATOR_TRACKLENGTH, NO_BIN_FOUND, &
matching_bins(i_filter_energy), filt_score)
if (matching_bins(i_filter_energy) == NO_BIN_FOUND) cycle
end if
! =======================================================================