From 75f1b03346d2fb46c48e098eed2834469fcff892 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 28 Mar 2012 07:41:26 -0700 Subject: [PATCH] added tally for diffusion coefficient in cmfd, now there are 3 options hardcoded for diffusion coef --- src/cmfd_data.F90 | 13 +++++++++---- src/cmfd_header.F90 | 3 +++ src/cmfd_input.F90 | 5 +++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/cmfd_data.F90 b/src/cmfd_data.F90 index db439f716..3d3a91cf1 100644 --- a/src/cmfd_data.F90 +++ b/src/cmfd_data.F90 @@ -12,7 +12,7 @@ contains subroutine set_up_cmfd() - use global, only: cmfd,cmfd_coremap,current_cycle,n_inactive,time_cmfd + use global, only: cmfd,cmfd_coremap,current_batch,n_inactive,time_cmfd use cmfd_header, only: allocate_cmfd use cmfd_output, only: neutron_balance,write_cmfd_hdf5 use timing @@ -21,7 +21,7 @@ contains call allocate_cmfd(cmfd) ! check for core map - if ((cmfd_coremap) .and. (current_cycle == n_inactive+1)) then + if ((cmfd_coremap) .and. (current_batch == n_inactive+1)) then call set_coremap() end if @@ -151,9 +151,14 @@ contains ! get p1 scatter rr and convert to p1 scatter xs cmfd % p1scattxs(h,i,j,k) = t % scores(score_index,3) % sum / flux + ! extract diffusion coefficient tally + cmfd % diffusion(h,i,j,k) = t % scores(score_index,4) % sum / flux + ! calculate diffusion coefficient - cmfd % diffcof(h,i,j,k) = 1.0_8/(3.0_8*(cmfd % totalxs(h,i,j,k) -& - & cmfd % p1scattxs(h,i,j,k))) + cmfd % diffcof(h,i,j,k) = 1.0_8/(3.0_8*cmfd%totalxs(h,i,j,k)) +! cmfd % diffcof(h,i,j,k) = 1.0_8/(3.0_8*(cmfd % totalxs(h,i,j,k) -& +! & cmfd % p1scattxs(h,i,j,k))) +! cmfd % diffcof(h,i,j,k) = cmfd % diffusion(h,i,j,k) else if (ital == 2) then diff --git a/src/cmfd_header.F90 b/src/cmfd_header.F90 index f84402ea8..f61b50402 100644 --- a/src/cmfd_header.F90 +++ b/src/cmfd_header.F90 @@ -22,6 +22,7 @@ module cmfd_header ! diffusion coefficient real(8), allocatable :: diffcof(:,:,:,:) + real(8), allocatable :: diffusion(:,:,:,:) ! current real(8), allocatable :: current(:,:,:,:,:) @@ -99,6 +100,7 @@ contains if (.not. allocated(this % scattxs)) allocate(this % scattxs(ng,ng,nx,ny,nz)) if (.not. allocated(this % nfissxs)) allocate(this % nfissxs(ng,ng,nx,ny,nz)) if (.not. allocated(this % diffcof)) allocate(this % diffcof(ng,nx,ny,nz)) + if (.not. allocated(this % diffusion)) allocate(this%diffusion(ng,nx,ny,nz)) ! allocate dtilde and dhat if (.not. allocated(this % dtilde)) allocate(this % dtilde(6,ng,nx,ny,nz)) @@ -132,6 +134,7 @@ contains if (allocated(this % scattxs)) deallocate(this % scattxs) if (allocated(this % nfissxs)) deallocate(this % nfissxs) if (allocated(this % diffcof)) deallocate(this % diffcof) + if (allocated(this % diffusion)) deallocate(this % diffusion) if (allocated(this % current)) deallocate(this % current) if (allocated(this % flux)) deallocate(this % flux) if (allocated(this % dtilde)) deallocate(this % dtilde) diff --git a/src/cmfd_input.F90 b/src/cmfd_input.F90 index fea1d532e..4d15cea1b 100644 --- a/src/cmfd_input.F90 +++ b/src/cmfd_input.F90 @@ -237,13 +237,14 @@ contains t % filters = filters(1:n_filters) ! allocate macro reactions - allocate(t % score_bins(3)) - t % n_score_bins = 3 + allocate(t % score_bins(4)) + t % n_score_bins = 4 ! set macro_bins t % score_bins(1) % scalar = SCORE_FLUX t % score_bins(2) % scalar = SCORE_TOTAL t % score_bins(3) % scalar = SCORE_SCATTER_1 + t % score_bins(4) % scalar = SCORE_DIFFUSION ! Increment the appropriate index and set pointer analog_tallies(1) = 1