From 73fd4449dfe38728ff959035acc5b347fd65a95d Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 2 Mar 2012 13:56:04 -0800 Subject: [PATCH] added user-defined fission source normalization constant --- src/cmfd_data.F90 | 2 +- src/cmfd_execute.F90 | 10 +++++++--- src/cmfd_header.F90 | 3 +++ src/cmfd_input.F90 | 6 +++++- src/xml-fortran/templates/cmfd_t.xml | 1 + 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/cmfd_data.F90 b/src/cmfd_data.F90 index 64a069846..a26c60702 100644 --- a/src/cmfd_data.F90 +++ b/src/cmfd_data.F90 @@ -266,7 +266,7 @@ contains end do TAL ! normalize openmc source distribution - cmfd % openmc_src = cmfd % openmc_src/sum(cmfd % openmc_src) + cmfd % openmc_src = cmfd % openmc_src/sum(cmfd % openmc_src)*cmfd%norm end subroutine compute_xs diff --git a/src/cmfd_execute.F90 b/src/cmfd_execute.F90 index baef72422..2d8fe1788 100644 --- a/src/cmfd_execute.F90 +++ b/src/cmfd_execute.F90 @@ -191,6 +191,7 @@ contains integer :: idx ! index in vector real(8) :: hxyz(3) ! cell dimensions of current ijk cell real(8) :: vol ! volume of cell + real(8) :: norm ! normalization factor for entropy real(8),allocatable :: source(:,:,:,:) ! tmp source array for entropy ! get maximum of spatial and group indices @@ -235,12 +236,15 @@ contains end do ZLOOP - ! normalize source such that it sums to 1.0 - cmfd%source = cmfd%source/sum(cmfd%source) + ! normalize source such that it sums to 1.0 (1 group for now) + cmfd%source = cmfd%source/sum(cmfd%source)*cmfd%norm ! compute entropy if (entropy_on) then + ! compute normalization factor + norm = sum(cmfd%source) + ! allocate tmp array if (.not.allocated(source)) allocate(source(ng,nx,ny,nz)) @@ -249,7 +253,7 @@ contains ! compute log where (cmfd%source > 0.0_8) - source = cmfd%source*log(cmfd%source)/log(2.0) + source = cmfd%source/norm*log(cmfd%source/norm)/log(2.0) end where ! sum that source diff --git a/src/cmfd_header.F90 b/src/cmfd_header.F90 index e25c358be..f84402ea8 100644 --- a/src/cmfd_header.F90 +++ b/src/cmfd_header.F90 @@ -66,6 +66,9 @@ module cmfd_header ! openmc source real(8), allocatable :: openmc_src(:,:,:,:) + ! openmc source normalization factor + real(8) :: norm = 1.0_8 + end type cmfd_obj contains diff --git a/src/cmfd_input.F90 b/src/cmfd_input.F90 index 1836c1f25..fea1d532e 100644 --- a/src/cmfd_input.F90 +++ b/src/cmfd_input.F90 @@ -69,9 +69,13 @@ contains end if ! check for core map activation by printing note - if (cmfd_coremap .and. master) write(*,*)"Core Map Overlay Activated" + ! check for normalization constant + if (norm_ > 0.0_8) then + cmfd % norm = norm_ + end if + ! create tally objects call create_cmfd_tally() diff --git a/src/xml-fortran/templates/cmfd_t.xml b/src/xml-fortran/templates/cmfd_t.xml index 00aadc3ee..cbba27bd0 100644 --- a/src/xml-fortran/templates/cmfd_t.xml +++ b/src/xml-fortran/templates/cmfd_t.xml @@ -13,5 +13,6 @@ +