Implemented Paul Romano suggestions, changed score and tally names, used associate, and copied all coord to last%coord

This commit is contained in:
guillaume 2017-06-26 22:01:58 -04:00
parent e61a04ee91
commit 345f84b428
9 changed files with 29 additions and 105 deletions

View file

@ -289,7 +289,7 @@ module constants
integer, parameter :: &
TALLY_VOLUME = 1, &
TALLY_SURFACE_CURRENT = 2, &
TALLY_CELL_TO_CELL = 3
TALLY_SURFACE = 3
! Tally estimator types
integer, parameter :: &
@ -305,7 +305,7 @@ module constants
EVENT_ABSORB = 2
! Tally score type
integer, parameter :: N_SCORE_TYPES = 25
integer, parameter :: N_SCORE_TYPES = 24
integer, parameter :: &
SCORE_FLUX = -1, & ! flux
SCORE_TOTAL = -2, & ! total reaction rate
@ -330,8 +330,7 @@ module constants
SCORE_INVERSE_VELOCITY = -21, & ! flux-weighted inverse velocity
SCORE_FISS_Q_PROMPT = -22, & ! prompt fission Q-value
SCORE_FISS_Q_RECOV = -23, & ! recoverable fission Q-value
SCORE_DECAY_RATE = -24, & ! delayed neutron precursor decay rate
SCORE_CELL_TO_CELL = -25 ! cell to cell partial current
SCORE_DECAY_RATE = -24 ! delayed neutron precursor decay rate
! Maximum scattering order supported
integer, parameter :: MAX_ANG_ORDER = 10
@ -370,7 +369,7 @@ module constants
FILTER_AZIMUTHAL = 12, &
FILTER_DELAYEDGROUP = 13, &
FILTER_ENERGYFUNCTION = 14, &
FILTER_CELL_TO_CELL = 15
FILTER_CELLFROM = 15
! Mesh types
integer, parameter :: &

View file

@ -66,8 +66,6 @@ contains
string = "fission-q-prompt"
case (SCORE_FISS_Q_RECOV)
string = "fission-q-recoverable"
case (SCORE_CELL_TO_CELL)
string = "cell-to-cell-partial-current"
! Normal ENDF-based reactions
case (TOTAL_XS)

View file

@ -159,7 +159,7 @@ module global
type(VectorInt) :: active_current_tallies
type(VectorInt) :: active_collision_tallies
type(VectorInt) :: active_tallies
type(VectorInt) :: active_cell_to_cell_tallies
type(VectorInt) :: active_surface_tallies
! Global tallies
! 1) collision estimate of k-eff
@ -518,7 +518,7 @@ contains
call active_tracklength_tallies % clear()
call active_current_tallies % clear()
call active_collision_tallies % clear()
call active_cell_to_cell_tallies % clear()
call active_surface_tallies % clear()
call active_tallies % clear()
! Deallocate track_identifiers

View file

@ -3047,17 +3047,6 @@ contains
call get_node_array(node_filt, "bins", filt % cells)
end select
case ('cellto')
! Allocate and declare the filter type
allocate(CellToFilter :: f % obj)
select type (filt => f % obj)
type is (CellToFilter)
! Allocate and store bins
filt % n_bins = n_words
allocate(filt % cells(n_words))
call get_node_array(node_filt, "bins", filt % cells)
end select
case ('cellborn')
! Allocate and declare the filter type
allocate(CellbornFilter :: f % obj)
@ -3415,9 +3404,7 @@ contains
type is (CellFilter)
t % find_filter(FILTER_CELL) = j
type is (CellFromFilter)
t % find_filter(FILTER_CELL_TO_CELL) = j
type is (CellToFilter)
t % find_filter(FILTER_CELL_TO_CELL) = j
t % find_filter(FILTER_CELLFROM) = j
type is (CellbornFilter)
t % find_filter(FILTER_CELLBORN) = j
type is (MaterialFilter)
@ -3921,8 +3908,8 @@ contains
t % filter(n_filter) = i_filt
case ('partial_current')
t % type = TALLY_CELL_TO_CELL
t % score_bins(j) = SCORE_CELL_TO_CELL
t % type = TALLY_SURFACE
t % score_bins(j) = SCORE_CURRENT
case ('events')
t % score_bins(j) = SCORE_EVENTS
case ('elastic', '(n,elastic)')

View file

@ -733,7 +733,7 @@ contains
score_names(abs(SCORE_INVERSE_VELOCITY)) = "Flux-Weighted Inverse Velocity"
score_names(abs(SCORE_FISS_Q_PROMPT)) = "Prompt fission power"
score_names(abs(SCORE_FISS_Q_RECOV)) = "Recoverable fission power"
score_names(abs(SCORE_CELL_TO_CELL)) = "Partial current"
score_names(abs(SCORE_CURRENT)) = "Partial current"
! Create filename for tally output
filename = trim(path_output) // "tallies.out"

View file

@ -32,7 +32,6 @@ module particle_header
logical :: rotated = .false.
contains
procedure :: reset => reset_coord
procedure :: copy_coord
end type LocalCoord
!===============================================================================
@ -236,11 +235,7 @@ contains
integer :: i
this % last_n_coord = this % n_coord
! copy all information at all coordinate levels
do i = 1, this % n_coord
call this % last_coord(i) % copy_coord(this % coord(i))
end do
this % last_coord = this % coord
! reset the rest of former last_coord
do i = this % n_coord + 1, MAX_COORD
@ -249,24 +244,6 @@ contains
end subroutine set_last_coord
!===============================================================================
! COPY_COORD copies one coordinate levels from coord to last_coord.
!===============================================================================
elemental subroutine copy_coord(this, coord)
class(LocalCoord), intent(inout) :: this
class(LocalCoord), intent(in) :: coord
this % cell = coord % cell
this % universe = coord % universe
this % lattice = coord % lattice
this % lattice_x = coord % lattice_x
this % lattice_y = coord % lattice_y
this % lattice_z = coord % lattice_z
this % rotated = coord % rotated
end subroutine copy_coord
!===============================================================================
! CREATE_SECONDARY stores the current phase space attributes of the particle in
! the secondary bank and increments the number of sites in the secondary bank.

View file

@ -3138,14 +3138,14 @@ contains
end subroutine score_collision_tally
!===============================================================================
! score_partial_current tallies partial currents from cell_to to cell_from
! score_surface_tally is called at every surface crossing and can be used to
! tally partial currents between two cells
!===============================================================================
subroutine score_partial_current(p)
subroutine score_surface_tally(p)
type(Particle), intent(in) :: p
!end if
integer :: i
integer :: i_tally
integer :: i_filt
@ -3160,7 +3160,6 @@ contains
real(8) :: filter_weight ! combined weight of all filters
real(8) :: score ! analog tally score
logical :: finished ! found all valid bin combinations
type(TallyObject), pointer :: t
! Determine collision estimate of flux
if (survival_biasing) then
@ -3170,10 +3169,10 @@ contains
flux = p % last_wgt
end if
TALLY_LOOP: do i = 1, active_cell_to_cell_tallies % size()
TALLY_LOOP: do i = 1, active_surface_tallies % size()
! Get index of tally and pointer to tally
i_tally = active_cell_to_cell_tallies % data(i)
t => tallies(i_tally)
i_tally = active_surface_tallies % data(i)
associate (t => tallies(i_tally))
! Find all valid bins in each filter if they have not already been found
! for a previous tally.
@ -3233,7 +3232,7 @@ contains
! Expand score if necessary and add to tally results.
call expand_and_score(p, t, score_index, filter_index, score_bin, &
score, q)
score, score_index)
end do SCORE_LOOP
! ======================================================================
@ -3260,6 +3259,8 @@ contains
end do FILTER_LOOP
end associate
! If the user has specified that we can assume all tallies are spatially
! separate, this implies that once a tally has been scored to, we needn't
! check the others. This cuts down on overhead when there are many
@ -3275,7 +3276,7 @@ contains
! Reset tally map positioning
position = 0
end subroutine score_partial_current
end subroutine score_surface_tally
!===============================================================================
! SCORE_SURFACE_CURRENT tallies surface crossings in a mesh tally by manually
@ -4568,8 +4569,8 @@ contains
end if
elseif (user_tallies(i) % type == TALLY_SURFACE_CURRENT) then
call active_current_tallies % push_back(i_user_tallies + i)
elseif (user_tallies(i) % type == TALLY_CELL_TO_CELL) then
call active_cell_to_cell_tallies % push_back(i_user_tallies + i)
elseif (user_tallies(i) % type == TALLY_SURFACE) then
call active_surface_tallies % push_back(i_user_tallies + i)
end if
end do
@ -4579,7 +4580,7 @@ contains
call active_tracklength_tallies % shrink_to_fit()
call active_collision_tallies % shrink_to_fit()
call active_current_tallies % shrink_to_fit()
call active_cell_to_cell_tallies % shrink_to_fit()
call active_surface_tallies % shrink_to_fit()
end subroutine setup_active_usertallies
@ -4603,7 +4604,7 @@ contains
else if (active_current_tallies % size() > 0) then
call fatal_error("Active current tallies should not exist before CMFD &
&tallies!")
else if (active_cell_to_cell_tallies % size() > 0) then
else if (active_surface_tallies % size() > 0) then
call fatal_error("Active cell to cell tallies should not exist before &
&CMFD tallies!")
end if

View file

@ -82,16 +82,6 @@ module tally_filter
procedure :: text_label => text_label_cell_from
end type CellFromFilter
!===============================================================================
! CELLTOFILTER specifies which geometric cells particles enter when crossing a
! surface.
!===============================================================================
type, extends(CellFilter) :: CellToFilter
contains
procedure :: to_statepoint => to_statepoint_cell_to
procedure :: text_label => text_label_cell_to
end type CellToFilter
!===============================================================================
! DISTRIBCELLFILTER specifies which distributed geometric cells tally events
! reside in.
@ -802,34 +792,6 @@ contains
label = "Cell from " // to_str(cells(this % cells(bin)) % id)
end function text_label_cell_from
!===============================================================================
! CellToFilter methods
!===============================================================================
subroutine to_statepoint_cell_to(this, filter_group)
class(CellToFilter), intent(in) :: this
integer(HID_T), intent(in) :: filter_group
integer :: i
integer, allocatable :: cell_ids(:)
call write_dataset(filter_group, "type", "cellto")
call write_dataset(filter_group, "n_bins", this % n_bins)
allocate(cell_ids(size(this % cells)))
do i = 1, size(this % cells)
cell_ids(i) = cells(this % cells(i)) % id
end do
call write_dataset(filter_group, "bins", cell_ids)
end subroutine to_statepoint_cell_to
function text_label_cell_to(this, bin) result(label)
class(CellToFilter), intent(in) :: this
integer, intent(in) :: bin
character(MAX_LINE_LEN) :: label
label = "Cell to " // to_str(cells(this % cells(bin)) % id)
end function text_label_cell_to
!===============================================================================
! DistribcellFilter methods
!===============================================================================

View file

@ -15,7 +15,7 @@ module tracking
use string, only: to_str
use tally, only: score_analog_tally, score_tracklength_tally, &
score_collision_tally, score_surface_current, &
score_track_derivative, score_partial_current, &
score_track_derivative, score_surface_tally, &
score_collision_derivative, zero_flux_derivs
use track_output, only: initialize_particle_track, write_particle_track, &
add_particle_track, finalize_particle_track
@ -153,8 +153,8 @@ contains
last_cell = p % coord(p % n_coord) % cell
call p % set_last_coord()
! Update last_ information. This is needed to use the same filters as
! the ones implemented for regular tallies
! Update last_ data. This is needed to use the same filters in
! surface tallies as the ones implemented for regular tallies
p % last_uvw = p % coord(p % n_coord) % uvw
p % last_E = p % E
@ -172,7 +172,7 @@ contains
p % event = EVENT_SURFACE
end if
! Score cell to cell partial currents
if(active_cell_to_cell_tallies%size()>0) call score_partial_current(p)
if(active_surface_tallies % size() > 0) call score_surface_tally(p)
else
! ====================================================================
! PARTICLE HAS COLLISION