diff --git a/src/criticality.F90 b/src/criticality.F90 index cd470f8b23..c7978d4e84 100644 --- a/src/criticality.F90 +++ b/src/criticality.F90 @@ -4,7 +4,7 @@ module criticality use global use intercycle, only: shannon_entropy, calculate_keff, synchronize_bank, & count_source_for_ufs - use output, only: write_message, header + use output, only: write_message, header, print_columns use physics, only: transport use source, only: get_source_particle use string, only: to_str @@ -31,31 +31,7 @@ contains allocate(p) ! Display column titles - if (entropy_on) then - if (cmfd_on) then - message = " Cycle k(batch) Entropy Average k CMFD k CMFD Ent." - call write_message(1) - message = " ===== ======== ======= =================== ========== =========" - call write_message(1) - else - message = " Cycle k(batch) Entropy Average k" - call write_message(1) - message = " ===== ======== ======= ===================" - call write_message(1) - end if - else - if (cmfd_on) then - message = " Cycle k(batch) Average k CMFD k" - call write_message(1) - message = " ===== ======== =================== ==========" - call write_message(1) - else - message = " Cycle k(batch) Average k" - call write_message(1) - message = " ===== ======== ===================" - call write_message(1) - end if - end if + call print_columns() ! ========================================================================== ! LOOP OVER BATCHES @@ -143,8 +119,6 @@ contains subroutine finalize_batch() - use cmfd_execute, only: execute_cmfd - ! Collect tallies if (tallies_on) then call timer_start(time_ic_tallies) @@ -158,11 +132,6 @@ contains ! Collect results and statistics call calculate_keff() - ! run cmfd - if (current_batch > n_inactive .and. cmfd_on) then - call execute_cmfd() - end if - ! Turn tallies on once inactive cycles are complete if (current_batch == n_inactive) then tallies_on = .true. diff --git a/src/intercycle.F90 b/src/intercycle.F90 index 25ec88abe3..c789c79aa7 100644 --- a/src/intercycle.F90 +++ b/src/intercycle.F90 @@ -2,11 +2,12 @@ module intercycle use, intrinsic :: ISO_FORTRAN_ENV + use cmfd_execute, only: execute_cmfd use error, only: fatal_error, warning use global use mesh, only: count_bank_sites use mesh_header, only: StructuredMesh - use output, only: write_message + use output, only: write_message, print_batch_keff use random_lcg, only: prn, set_particle_seed, prn_skip use search, only: binary_search use string, only: to_str @@ -350,7 +351,7 @@ contains !=============================================================================== ! CALCULATE_KEFF calculates the single batch estimate of keff as well as the -! mean and standard deviation of the mean for active batches and displays them +! mean and standard deviation of the mean for active batches !=============================================================================== subroutine calculate_keff() @@ -430,47 +431,13 @@ contains end if end if - ! Display output for this batch - if (master) then - if (current_batch > n_inactive + 1) then - if (entropy_on) then - if (cmfd_on) then - write(UNIT=OUTPUT_UNIT, FMT=104) current_batch, k_batch, & - entropy, keff, keff_std, cmfd%keff, cmfd%entropy - else - write(UNIT=OUTPUT_UNIT, FMT=103) current_batch, k_batch, & - entropy, keff, keff_std - end if - else - if (cmfd_on) then - write(UNIT=OUTPUT_UNIT, FMT=105) current_batch, k_batch, & - keff, keff_std, cmfd%keff - else - write(UNIT=OUTPUT_UNIT, FMT=101) current_batch, k_batch, & - keff, keff_std - end if - end if - else - if (entropy_on) then - write(UNIT=OUTPUT_UNIT, FMT=102) current_batch, k_batch, entropy - else - write(UNIT=OUTPUT_UNIT, FMT=100) current_batch, k_batch - end if - end if - end if + ! perform CMFD calculation if on + if (cmfd_on) call execute_cmfd() + else ! ======================================================================= ! INACTIVE BATCHES - ! Display output for inactive batch - if (master) then - if (entropy_on) then - write(UNIT=OUTPUT_UNIT, FMT=102) current_batch, k_batch, entropy - else - write(UNIT=OUTPUT_UNIT, FMT=100) current_batch, k_batch - end if - end if - ! Set keff keff = k_batch @@ -478,18 +445,14 @@ contains global_tallies(:) % value = ZERO end if + ! Display output + if (master) call print_batch_keff() + #ifdef MPI ! Broadcast new keff value to all processors call MPI_BCAST(keff, 1, MPI_REAL8, 0, MPI_COMM_WORLD, mpi_err) #endif -100 format (2X,I5,2X,F8.5) -101 format (2X,I5,2X,F8.5,5X,F8.5," +/-",F8.5) -102 format (2X,I5,2X,F8.5,3X,F8.5) -103 format (2X,I5,2X,F8.5,3X,F8.5,3X,F8.5," +/-",F8.5) -104 format (2X,I5,2X,F8.5,3X,F8.5,3X,F8.5," +/-",F8.5,2X,F8.5,4X,F8.5) -105 format (2X,I5,2X,F8.5,5X,F8.5," +/-",F8.5,2X,F8.5) - end subroutine calculate_keff !=============================================================================== diff --git a/src/output.F90 b/src/output.F90 index 09fd645376..9e3b90fc06 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -933,6 +933,91 @@ contains end subroutine print_summary +!=============================================================================== +! PRINT_COLUMNS displays a header listing what physical values will displayed +! below them +!=============================================================================== + + subroutine print_columns() + + if (entropy_on) then + if (cmfd_on) then + message = " Cycle k(batch) Entropy Average k CMFD k CMFD Ent." + call write_message(1) + message = " ===== ======== ======= =================== ========== =========" + call write_message(1) + else + message = " Cycle k(batch) Entropy Average k" + call write_message(1) + message = " ===== ======== ======= ===================" + call write_message(1) + end if + else + if (cmfd_on) then + message = " Cycle k(batch) Average k CMFD k" + call write_message(1) + message = " ===== ======== =================== ==========" + call write_message(1) + else + message = " Cycle k(batch) Average k" + call write_message(1) + message = " ===== ======== ===================" + call write_message(1) + end if + end if + + end subroutine print_columns + +!=============================================================================== +! 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 +!=============================================================================== + + subroutine print_batch_keff() + + if (current_batch <= n_inactive) then + ! ====================================================================== + ! INACTIVE BATCHES + + if (entropy_on) then + write(UNIT=OUTPUT_UNIT, FMT=102) current_batch, k_batch, entropy + else + write(UNIT=OUTPUT_UNIT, FMT=100) current_batch, k_batch + end if + + elseif (current_batch >= n_inactive + 1) then + ! ====================================================================== + ! ACTIVE BATCHES + + if (entropy_on) then + if (cmfd_on) then + write(UNIT=OUTPUT_UNIT, FMT=104) current_batch, k_batch, & + entropy, keff, keff_std, cmfd%keff, cmfd%entropy + else + write(UNIT=OUTPUT_UNIT, FMT=103) current_batch, k_batch, & + entropy, keff, keff_std + end if + else + if (cmfd_on) then + write(UNIT=OUTPUT_UNIT, FMT=105) current_batch, k_batch, & + keff, keff_std, cmfd%keff + else + write(UNIT=OUTPUT_UNIT, FMT=101) current_batch, k_batch, & + keff, keff_std + end if + end if + + end if + +100 format (2X,I5,2X,F8.5) +101 format (2X,I5,2X,F8.5,5X,F8.5," +/-",F8.5) +102 format (2X,I5,2X,F8.5,3X,F8.5) +103 format (2X,I5,2X,F8.5,3X,F8.5,3X,F8.5," +/-",F8.5) +104 format (2X,I5,2X,F8.5,3X,F8.5,3X,F8.5," +/-",F8.5,2X,F8.5,4X,F8.5) +105 format (2X,I5,2X,F8.5,5X,F8.5," +/-",F8.5,2X,F8.5) + + end subroutine print_batch_keff + !=============================================================================== ! PRINT_PLOT displays selected options for plotting !===============================================================================