added cmfd inactive tallies

This commit is contained in:
Bryan Herman 2012-10-04 09:55:17 -07:00
parent 797b5d063e
commit d1d88d184a
8 changed files with 131 additions and 21 deletions

View file

@ -30,7 +30,7 @@ contains
if (.not. cmfd_run_2grp) call compute_xs()
! check neutron balance
! call neutron_balance(670)
call neutron_balance(670)
! fix 2 grp cross sections
if (cmfd_run_2grp) call fix_2_grp()
@ -153,7 +153,7 @@ contains
! get total rr and convert to total xs
cmfd % totalxs(h,i,j,k) = t % scores(2,score_index) % sum / flux
write(200,*) cmfd % totalxs(h,i,j,k)
! get p1 scatter rr and convert to p1 scatter xs
cmfd % p1scattxs(h,i,j,k) = t % scores(3,score_index) % sum / flux

View file

@ -176,12 +176,13 @@ contains
subroutine create_cmfd_tally()
use datatypes, only: dict_add_key, dict_get_key
use error, only: fatal_error, warning
use datatypes, only: dict_add_key, dict_get_key
use error, only: fatal_error, warning
use global
use mesh_header, only: StructuredMesh
use mesh_header, only: StructuredMesh
use string
use tally_header, only: TallyObject, TallyScore
use tally, only: setup_active_cmfdtallies
use tally_header, only: TallyObject, TallyScore
use xml_data_cmfd_t
integer :: i ! loop counter
@ -209,9 +210,9 @@ contains
n_current_tallies = n_user_current_tallies + n_cmfd_current_tallies
! Allocate list of pointers for tallies by type
if (.not. allocated(analog_tallies)) allocate(analog_tallies(n_analog_tallies))
if (.not. allocated(tracklength_tallies)) allocate(tracklength_tallies(n_tracklength_tallies))
if (.not. allocated(current_tallies)) allocate(current_tallies(n_current_tallies))
if (.not. allocated(analog_tallies) .and. n_analog_tallies > 0) allocate(analog_tallies(n_analog_tallies))
if (.not. allocated(tracklength_tallies) .and. n_tracklength_tallies > 0) allocate(tracklength_tallies(n_tracklength_tallies))
if (.not. allocated(current_tallies) .and. n_current_tallies > 0) allocate(current_tallies(n_current_tallies))
! allocate mesh
if (.not. allocated(meshes)) allocate(meshes(n_meshes))
@ -286,6 +287,11 @@ contains
t % n_filter_bins = 0
t % stride = 0
! set number of nucilde bins
allocate(t % nuclide_bins(1))
t % nuclide_bins(1) = -1
t % n_nuclide_bins = 1
! record tally id which is equivalent to loop number
t % id = i
@ -412,6 +418,9 @@ contains
end do
call setup_active_cmfdtallies()
tallies_on = .true.
end subroutine create_cmfd_tally
!===============================================================================

View file

@ -11,7 +11,7 @@ module criticality
use source, only: get_source_particle
use state_point, only: write_state_point, replay_batch_history
use string, only: to_str
use tally, only: synchronize_tallies, setup_active_tallies
use tally, only: synchronize_tallies, setup_active_usertallies
use timing, only: timer_start, timer_stop
#ifdef HDF5
@ -181,7 +181,7 @@ contains
tallies_on = .true.
call timer_stop(time_inactive)
call timer_start(time_active)
call setup_active_tallies()
call setup_active_usertallies()
end if
end subroutine finalize_batch

View file

@ -9,7 +9,7 @@ module fixed_source
copy_source_attributes
use state_point, only: write_state_point
use string, only: to_str
use tally, only: synchronize_tallies, setup_active_tallies
use tally, only: synchronize_tallies, setup_active_usertallies
use timing, only: timer_start, timer_stop
#ifdef HDF5
@ -32,7 +32,7 @@ contains
! Turn timer and tallies on
tallies_on = .true.
call setup_active_tallies()
call setup_active_usertallies()
call timer_start(time_active)
! ==========================================================================

View file

@ -336,7 +336,7 @@ module global
integer :: cmfd_begin = 1
! when and how long to flush cmfd tallies during inactive batches
integer :: cmfd_inact_flush(2) = (/10,1/)
integer :: cmfd_inact_flush(2) = (/9999,1/)
! batch to last flush before active batches
integer :: cmfd_act_flush = 0

View file

@ -1188,8 +1188,13 @@ contains
entropy(current_batch)
! write out accumulated k-effective if after first active batch
if (current_batch > n_inactive + 1) write(UNIT=OUTPUT_UNIT, &
FMT='(3X, F8.5," +/-",F8.5)', ADVANCE='NO') keff, keff_std
if (current_batch > n_inactive + 1) then
write(UNIT=OUTPUT_UNIT, FMT='(3X, F8.5," +/-",F8.5)', ADVANCE='NO') &
keff, keff_std
else
write(UNIT=OUTPUT_UNIT, FMT='(23X)', ADVANCE='NO')
end if
! write out cmfd keff if it is active
if (cmfd_on) write(UNIT=OUTPUT_UNIT, FMT='(3X, F8.5)', ADVANCE='NO') &
@ -1200,7 +1205,7 @@ contains
FMT='(3X, F8.5)', ADVANCE='NO') cmfd % entropy
! next line
write(UNIT=OUTPUT_UNIT,FMT=*)
write(UNIT=OUTPUT_UNIT, FMT=*)
end subroutine print_batch_keff

View file

@ -57,6 +57,7 @@ contains
position = 0
do i = 1, n_tallies
t => tallies(i)
! initialize number of filter bins
@ -264,6 +265,7 @@ contains
! determine different filter bins for the same tally in order to score to it
TALLY_LOOP: do while (associated(curr_ptr))
t => tallies(analog_tallies(curr_ptr % data))
! =======================================================================
@ -2374,9 +2376,9 @@ contains
! SETUP_ACTIVE_USERTALLIES
!===============================================================================
subroutine setup_active_tallies()
subroutine setup_active_usertallies()
integer :: i ! loop counter
integer :: i ! loop counter
type(ListInt), pointer :: curr_ptr ! pointer to current list node
type(ListInt), pointer :: tall_ptr ! pointer to active tallies only
@ -2495,6 +2497,100 @@ contains
! nullify the temporary pointer
if (associated(curr_ptr)) nullify(curr_ptr)
end subroutine setup_active_tallies
end subroutine setup_active_usertallies
!===============================================================================
! SETUP_ACTIVE_CMFDTALLIES
!===============================================================================
subroutine setup_active_cmfdtallies()
integer :: i ! loop counter
type(ListInt), pointer :: curr_ptr ! pointer to current list node
type(ListInt), pointer :: tall_ptr ! pointer to active tallies only
! check to see if actives tallies has been allocated
tall_ptr => active_tallies
if (associated(active_tallies)) then
message = 'Active tallies should not exist before CMFD tallies!'
call fatal_error()
end if
! check to see if analog tallies have already been allocated
curr_ptr => null()
if (associated(active_analog_tallies)) then
message = 'Active analog tallies should not exist before CMFD tallies!'
call fatal_error()
end if
do i = n_cmfd_analog_tallies + n_user_analog_tallies, n_user_analog_tallies + 1, -1
! allocate node
allocate(curr_ptr)
! set the tally index
curr_ptr % data = i
curr_ptr % next => active_analog_tallies
active_analog_tallies => curr_ptr
! set indices in active tallies
allocate(tall_ptr)
tall_ptr % data = analog_tallies(i)
tall_ptr % next => active_tallies
active_tallies => tall_ptr
end do
! check to see if tracklength tallies have already been allocated
curr_ptr => null()
if (associated(active_tracklength_tallies)) then
message = 'Active tracklength tallies should not exist before CMFD tallies!'
call fatal_error()
end if
do i = n_cmfd_tracklength_tallies + n_user_tracklength_tallies, n_user_tracklength_tallies + 1, -1
! allocate node
allocate(curr_ptr)
! set the tally index
curr_ptr % data = i
curr_ptr % next => active_tracklength_tallies
active_tracklength_tallies => curr_ptr
! set indices in active tallies
allocate(tall_ptr)
tall_ptr % data = tracklength_tallies(i)
tall_ptr % next => active_tallies
active_tallies => tall_ptr
end do
! check to see if current tallies have already been allocated
curr_ptr => null()
if (associated(active_current_tallies)) then
message = 'Active current tallies should not exist before CMFD tallies!'
call fatal_error()
end if
do i = n_cmfd_current_tallies + n_user_current_tallies, n_user_current_tallies + 1, -1
! allocate node
allocate(curr_ptr)
! set the tally index
curr_ptr % data = i
curr_ptr % next => active_current_tallies
active_current_tallies => curr_ptr
! set indices in active tallies
allocate(tall_ptr)
tall_ptr % data = current_tallies(i)
tall_ptr % next => active_tallies
active_tallies => tall_ptr
end do
end subroutine setup_active_cmfdtallies
end module tally

View file

@ -30,7 +30,7 @@
<variable name="write_hdf5_" tag="write_hdf5" type="logical" default=".false." />
<variable name="begin_" tag="begin" type="integer" default="1" />
<variable name="inactive_" tag="inactive" type="integer" default=".true." />
<variable name="active_flush_" tag="active_flush" type="integer" default="99999" />
<variable name="active_flush_" tag="active_flush" type="integer" default="0" />
<variable name="keff_tol_" tag="keff_tol" type="double" default="0.005" />
</template>