added energy grid to cmfd properties and is used for energy mesh acceleration

This commit is contained in:
Bryan Herman 2012-03-29 12:41:55 -07:00
parent 449b6f008a
commit 17fc0e1cd3
3 changed files with 31 additions and 17 deletions

View file

@ -76,7 +76,7 @@ contains
call calc_fission_source()
! perform cmfd re-weighting
! call cmfd_reweight()
call cmfd_reweight()
! write out hdf5 file for cmfd object
if (master) then
@ -368,8 +368,9 @@ contains
cmfd%weightfactors = 0.0_8
! count fission sites in mesh
call count_fission_sites(m,cmfd%sourcecounts,total,outside)
! call count_fission_sites(m,cmfd%sourcecounts,total,outside)
print *,'CMFD energy grid:',cmfd%egrid
stop
! check for source sites outside of mesh
if (outside) then
write(*,*) 'FATAL: source sites found outside of mesh'

View file

@ -14,6 +14,9 @@ module cmfd_header
! array indices([1-x,2-y,3-z,4-g],upper bound)
integer :: indices(4)
! energy grid
real(8), allocatable :: egrid(:)
! cross sections
real(8), allocatable :: totalxs(:,:,:,:)
real(8), allocatable :: p1scattxs(:,:,:,:)
@ -94,26 +97,26 @@ contains
ng = this % indices(4)
! allocate flux, cross sections and diffusion coefficient
if (.not. allocated(this % flux)) allocate(this % flux(ng,nx,ny,nz))
if (.not. allocated(this % totalxs)) allocate(this % totalxs(ng,nx,ny,nz))
if (.not. allocated(this % p1scattxs)) allocate(this % p1scattxs(ng,nx,ny,nz))
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))
if (.not. allocated(this % flux)) allocate(this % flux(ng,nx,ny,nz))
if (.not. allocated(this % totalxs)) allocate(this % totalxs(ng,nx,ny,nz))
if (.not. allocated(this % p1scattxs)) allocate(this % p1scattxs(ng,nx,ny,nz))
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))
if (.not. allocated(this % dhat)) allocate(this % dhat(6,ng,nx,ny,nz))
if (.not. allocated(this % dtilde)) allocate(this % dtilde(6,ng,nx,ny,nz))
if (.not. allocated(this % dhat)) allocate(this % dhat(6,ng,nx,ny,nz))
! allocate dimensions for each box (here for general case)
if (.not. allocated(this % hxyz)) allocate(this % hxyz(3,nx,ny,nz))
if (.not. allocated(this % hxyz)) allocate(this % hxyz(3,nx,ny,nz))
! allocate this fission source
if (.not. allocated(this % source)) allocate(this % source(ng,nx,ny,nz))
if (.not. allocated(this % source)) allocate(this % source(ng,nx,ny,nz))
! allocate surface currents
if (.not. allocated(this % current)) allocate(this % current(12,ng,nx,ny,nz))
if (.not. allocated(this % current)) allocate(this % current(12,ng,nx,ny,nz))
! allocate openmc source distribution
if (.not. allocated(this % openmc_src)) allocate(this % openmc_src(ng,nx,ny,nz))
@ -129,6 +132,7 @@ contains
type(cmfd_obj) :: this
! deallocate cmfd
if (allocated(this % egrid)) deallocate(this % egrid)
if (allocated(this % totalxs)) deallocate(this % totalxs)
if (allocated(this % p1scattxs)) deallocate(this % p1scattxs)
if (allocated(this % scattxs)) deallocate(this % scattxs)

View file

@ -17,7 +17,8 @@ contains
use string
use xml_data_cmfd_t
integer :: ng=1 ! number of energy groups (default 1)
integer :: j ! iteration counter
integer :: ng ! number of energy groups
integer :: n_words ! number of words read
logical :: file_exists ! does cmfd.xml exist?
character(MAX_LINE_LEN) :: filename
@ -50,8 +51,16 @@ contains
if (len_trim(mesh_ % energy) > 0) then
call split_string(mesh_ % energy, words, n_words)
ng = n_words - 1
if(.not.allocated(cmfd%egrid)) allocate(cmfd%egrid(n_words))
do j = 1,n_words
cmfd%egrid(j) = str_to_real(words(j))
end do
cmfd % indices(4) = ng ! sets energy group dimension
else
if(.not.allocated(cmfd%egrid)) allocate(cmfd%egrid(2))
cmfd%egrid = (/0.0_8,20.0_8/)
cmfd % indices(4) = 1 ! one energy group
end if
cmfd % indices(4) = ng ! sets energy group dimension
! set global albedo
cmfd % albedo = mesh_ % albedo