added openmc source distribution to HDF5 output

This commit is contained in:
Bryan Herman 2012-02-27 13:50:56 -05:00
parent 4de58721d6
commit 3b61602b24
3 changed files with 27 additions and 3 deletions

View file

@ -80,8 +80,9 @@ contains
nz = cmfd % indices(3)
ng = cmfd % indices(4)
! set flux object to all zeros
! set flux object and source distribution to all zeros
cmfd % flux = 0.0_8
cmfd % openmc_src = 0.0_8
! associate tallies and mesh
t => tallies(1)
@ -179,13 +180,17 @@ contains
score_index = sum((bins - 1) * t%stride) + 1
! get scattering
cmfd % scattxs(h,g,i,j,k) = t % scores(score_index,1) % val / &
cmfd % scattxs(h,g,i,j,k) = t % scores(score_index,1) % val /&
& cmfd % flux(h,i,j,k)
! get nu-fission
cmfd % nfissxs(h,g,i,j,k) = t % scores(score_index,2) % val / &
cmfd % nfissxs(h,g,i,j,k) = t % scores(score_index,2) % val /&
& cmfd % flux(h,i,j,k)
! bank source
cmfd % openmc_src(g,i,j,k) = cmfd % openmc_src(g,i,j,k) + &
& cmfd % nfissxs(h,g,i,j,k)
end do INGROUP
else
@ -260,6 +265,9 @@ contains
end do TAL
! normalize openmc source distribution
cmfd % openmc_src = cmfd % openmc_src/sum(cmfd % openmc_src)
end subroutine compute_xs
!===============================================================================

View file

@ -63,6 +63,9 @@ module cmfd_header
! entropy calculation
real(8) :: entropy = 0.0_8
! openmc source
real(8), allocatable :: openmc_src(:,:,:,:)
end type cmfd_obj
contains
@ -107,6 +110,9 @@ contains
! allocate surface currents
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))
end subroutine allocate_cmfd
!===============================================================================
@ -134,6 +140,7 @@ contains
if (allocated(this % source)) deallocate(this % source)
if (allocated(this % sourcecounts)) deallocate(this % sourcecounts)
if (allocated(this % weightfactors)) deallocate(this % weightfactors)
if (allocated(this % openmc_src)) deallocate(this % openmc_src)
end subroutine deallocate_cmfd

View file

@ -356,6 +356,15 @@ contains
call h5dwrite_f(dataset_id,H5T_NATIVE_DOUBLE,cmfd%source,dim1,hdf5_err)
call h5dclose_f(dataset_id,hdf5_err)
! write out openmc source vector
dim4 = (/ng,nx,ny,nz/)
call h5screate_simple_f(4,dim4,dataspace_id,hdf5_err)
call h5dcreate_f(hdf5_output_file,trim(cycname)//"/openmc_src", &
& H5T_NATIVE_DOUBLE,dataspace_id,dataset_id,hdf5_err)
call h5dwrite_f(dataset_id,H5T_NATIVE_DOUBLE,cmfd%openmc_src,dim4,hdf5_err)
call h5sclose_f(dataspace_id,hdf5_err)
call h5dclose_f(dataset_id,hdf5_err)
! close the cycle
call h5gclose_f(cycle_id,hdf5_err)