revised output to user to include generation information, currently only entropy is printed if this option is on. Entropy is now calculated on the generation level instead of batches, and adjustments to entropy vector sizes was done for reading and writing statepoints

This commit is contained in:
Bryan Herman 2012-12-06 13:28:53 -08:00
parent 38b4efae61
commit 4afb2baeeb
4 changed files with 48 additions and 21 deletions

View file

@ -12,7 +12,7 @@ module eigenvalue
use mesh, only: count_bank_sites
use mesh_header, only: StructuredMesh
use output, only: write_message, header, print_columns, &
print_batch_keff
print_batch_keff, print_generation
use physics, only: transport
use random_lcg, only: prn, set_particle_seed, prn_skip
use search, only: binary_search
@ -93,6 +93,12 @@ contains
call synchronize_bank()
call timer_stop(time_bank)
! Calculate shannon entropy
if (entropy_on) call shannon_entropy()
! Write generation output
if (master .and. current_gen /= gen_per_batch) call print_generation()
end do GENERATION_LOOP
call finalize_batch()
@ -167,9 +173,6 @@ contains
call synchronize_tallies()
call timer_stop(time_tallies)
! Calculate shannon entropy
if (entropy_on) call shannon_entropy()
! Collect results and statistics
call calculate_keff()
@ -462,6 +465,7 @@ contains
subroutine shannon_entropy()
integer :: ent_idx ! entropy index
integer :: i, j, k ! index for bank sites
integer :: n ! # of boxes in each dimension
logical :: sites_outside ! were there sites outside entropy box?
@ -512,12 +516,13 @@ contains
! Normalize to total weight of bank sites
entropy_p = entropy_p / sum(entropy_p)
entropy(current_batch) = ZERO
ent_idx = current_gen + gen_per_batch*(current_batch - 1)
entropy(ent_idx) = ZERO
do i = 1, m % dimension(1)
do j = 1, m % dimension(2)
do k = 1, m % dimension(3)
if (entropy_p(1,i,j,k) > ZERO) then
entropy(current_batch) = entropy(current_batch) - &
entropy(ent_idx) = entropy(ent_idx) - &
entropy_p(1,i,j,k) * log(entropy_p(1,i,j,k))/log(TWO)
end if
end do

View file

@ -139,7 +139,7 @@ contains
! Allocate array for batch keff and entropy
allocate(k_batch(n_batches))
allocate(entropy(n_batches))
allocate(entropy(n_batches*gen_per_batch))
entropy = ZERO
end if

View file

@ -1196,32 +1196,53 @@ contains
if (entropy_on) then
if (cmfd_run) then
message = " Batch k(batch) Entropy Average k CMFD k CMFD Ent"
message = " Bat./Gen. k(batch) Entropy Average k CMFD k CMFD Ent"
call write_message(1)
message = " ===== ======== ======== ==================== ======== ========"
message = " ========= ======== ======== ==================== ======== ========"
call write_message(1)
else
message = " Batch k(batch) Entropy Average k"
message = " Bat./Gen. k(batch) Entropy Average k"
call write_message(1)
message = " ===== ======== ======== ===================="
message = " ========= ======== ======== ===================="
call write_message(1)
end if
else
if (cmfd_run) then
message = " Batch k(batch) Average k CMFD k"
message = " Bat./Gen. k(batch) Average k CMFD k"
call write_message(1)
message = " ===== ======== ==================== ========"
message = " ========= ======== ==================== ========"
call write_message(1)
else
message = " Batch k(batch) Average k"
message = " Bat./Gen. k(batch) Average k"
call write_message(1)
message = " ===== ======== ===================="
message = " ========= ======== ===================="
call write_message(1)
end if
end if
end subroutine print_columns
!===============================================================================
! PRINT_GENERATION displays information for a generation of neutrons. For now,
! if the user has entropy on, it will print out the entropy
!===============================================================================
subroutine print_generation()
! write out information about batch and generation
write(UNIT=OUTPUT_UNIT, FMT='(2X,A9)', ADVANCE='NO') &
trim(to_str(current_batch)) // "/" // trim(to_str(current_gen))
write(UNIT=OUTPUT_UNIT, FMT='(11X)', ADVANCE='NO')
! write out entropy info
if (entropy_on) write(UNIT=OUTPUT_UNIT, FMT='(3X, F8.5)', ADVANCE='NO') &
entropy(current_batch)
! next line
write(UNIT=OUTPUT_UNIT, FMT=*)
end subroutine print_generation
!===============================================================================
! PRINT_BATCH_KEFF displays the last batch's tallied value of the neutron
! multiplication factor as well as the average value if we're in active batches
@ -1230,7 +1251,8 @@ contains
subroutine print_batch_keff()
! write out information batch and option independent output
write(UNIT=OUTPUT_UNIT, FMT='(2X,I5)', ADVANCE='NO') current_batch
write(UNIT=OUTPUT_UNIT, FMT='(2X,A9)', ADVANCE='NO') &
trim(to_str(current_batch)) // "/" // trim(to_str(gen_per_batch))
write(UNIT=OUTPUT_UNIT, FMT='(3X,F8.5)', ADVANCE='NO') &
k_batch(current_batch)

View file

@ -186,7 +186,7 @@ contains
if (run_mode == MODE_EIGENVALUE) then
write(UNIT_STATE) n_inactive, gen_per_batch
write(UNIT_STATE) k_batch(1:current_batch)
write(UNIT_STATE) entropy(1:current_batch)
write(UNIT_STATE) entropy(1:current_batch*gen_per_batch)
end if
! Write number of meshes
@ -368,7 +368,7 @@ contains
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_WRITE(fh, k_batch, current_batch, MPI_REAL8, &
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_WRITE(fh, entropy, current_batch, MPI_REAL8, &
call MPI_FILE_WRITE(fh, entropy, current_batch*gen_per_batch, MPI_REAL8, &
MPI_STATUS_IGNORE, mpi_err)
end if
@ -674,8 +674,8 @@ contains
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_READ_ALL(fh, k_batch, restart_batch, MPI_REAL8, &
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_READ_ALL(fh, entropy, restart_batch, MPI_REAL8, &
MPI_STATUS_IGNORE, mpi_err)
call MPI_FILE_READ_ALL(fh, entropy, restart_batch*gen_per_batch, &
MPI_REAL8, MPI_STATUS_IGNORE, mpi_err)
end if
if (master) then
@ -874,7 +874,7 @@ contains
if (mode == MODE_EIGENVALUE) then
read(UNIT_STATE) n_inactive, gen_per_batch
read(UNIT_STATE) k_batch(1:restart_batch)
read(UNIT_STATE) entropy(1:restart_batch)
read(UNIT_STATE) entropy(1:restart_batch*gen_per_batch)
end if
if (master) then