added keff balance

This commit is contained in:
Bryan Herman 2014-03-15 08:18:07 -04:00
parent 71dc3be387
commit e0397ef15f
2 changed files with 28 additions and 7 deletions

View file

@ -108,6 +108,8 @@ contains
cmfd % hxyz(2,:,:,:) = m % width(2) ! set y width
cmfd % hxyz(3,:,:,:) = m % width(3) ! set z width
cmfd % keff_bal = ZERO
! Begin loop around tallies
TAL: do ital = 1, n_cmfd_tallies
@ -216,6 +218,7 @@ contains
! Bank source
cmfd % openmc_src(g,i,j,k) = cmfd % openmc_src(g,i,j,k) + &
t % results(2,score_index) % sum
cmfd % keff_bal = cmfd % keff_bal + t % results(2,score_index) % sum / dble(t % n_realizations)
end do INGROUP
@ -707,8 +710,9 @@ contains
subroutine compute_dhat()
use constants, only: CMFD_NOACCEL, ZERO
use global, only: cmfd, cmfd_coremap, message, dhat_reset
use global, only: cmfd, cmfd_coremap, message, dhat_reset, current_batch
use output, only: write_message
use string, only: to_str
integer :: nx ! maximum number of cells in x direction
integer :: ny ! maximum number of cells in y direction
@ -742,6 +746,9 @@ contains
nxyz(1,:) = (/1,nx/)
nxyz(2,:) = (/1,ny/)
nxyz(3,:) = (/1,nz/)
#ifdef CMFD_DEBUG
open(file='cmfd_dhat_' // trim(to_str(current_batch)) // '.dat', unit=125)
#endif
! Geting loop over group and spatial indices
ZLOOP: do k = 1,nz
@ -826,7 +833,9 @@ contains
! record dhat in cmfd object
cmfd%dhat(l,g,i,j,k) = dhat
#ifdef CMFD_DEBUG
write(125,*) dhat
#endif
! check for dhat reset
if (dhat_reset) then
cmfd%dhat(l,g,i,j,k) = ZERO
@ -848,6 +857,10 @@ contains
call write_message(1)
end if
#ifdef CMFD_DEBUG
close(unit=125)
#endif
end subroutine compute_dhat
!===============================================================================
@ -897,7 +910,7 @@ contains
subroutine fix_neutron_balance()
use constants, only: ONE, ZERO, CMFD_NOACCEL
use global, only: cmfd, keff, message
use global, only: cmfd, message
use output, only: write_message
integer :: nx ! number of mesh cells in x direction
@ -932,6 +945,7 @@ contains
real(8) :: r1 ! right hand side element 1
real(8) :: r2 ! right hand side element 2
real(8) :: det ! determinant of balance matrix
real(8) :: keff_bal ! keffective for balance eq.
message = 'Correcting neutron balance'
call write_message(1)
@ -942,6 +956,10 @@ contains
nz = cmfd % indices(3)
ng = cmfd % indices(4)
keff_bal = cmfd % keff_bal
print *, 'KEFF BALANCE is:', keff_bal
! Return if not two groups
if (ng /= 2) return
@ -994,12 +1012,12 @@ contains
! Create matrix and solve for effective downscatter and thermal flux
a = flux1
b = -ONE/keff*nsigf21
b = -ONE/keff_bal*nsigf21
c = flux1
d = -siga2 + ONE/keff*nsigf22
d = -siga2 + ONE/keff_bal*nsigf22
det = a*d - b*c
r1 = ONE/keff*nsigf11*flux1 - siga1*flux1 - leak1
r2 = leak2 - ONE/keff*nsigf12*flux1
r1 = ONE/keff_bal*nsigf11*flux1 - siga1*flux1 - leak1
r2 = leak2 - ONE/keff_bal*nsigf12*flux1
sigs12_eff = ONE/det*(d*r1 - b*r2)
flux2 = ONE/det*(a*r2 - c*r1)

View file

@ -83,6 +83,9 @@ module cmfd_header
! List of CMFD k
real(8), allocatable :: k_cmfd(:)
! Balance keff
real(8) :: keff_bal
end type cmfd_type
contains