automatically created tally for total reaction rate on mesh

This commit is contained in:
Bryan Herman 2011-11-06 23:28:37 -05:00
parent 81d91ea28f
commit 72cc06ad2a
3 changed files with 137 additions and 0 deletions

View file

@ -1,5 +1,9 @@
cmfd_utils.o: datatypes.o
cmfd_utils.o: global.o
cmfd_utils.o: mesh.o
cmfd_utils.o: mesh_header.o
cmfd_utils.o: string.o
cmfd_utils.o: xml-fortran/templates/cmfd_t.o
cross_section.o: constants.o
cross_section.o: cross_section_header.o
@ -82,6 +86,7 @@ initialize.o: string.o
initialize.o: tally.o
initialize.o: timing.o
input_xml.o: cmfd_utils.o
input_xml.o: constants.o
input_xml.o: datatypes.o
input_xml.o: error.o

View file

@ -1,7 +1,11 @@
module cmfd_utils
use datatypes, only: dict_add_key
use error, only: fatal_error, warning
use global
use mesh, only: mesh_indices_to_bin
use mesh_header, only: StructuredMesh
use string, only: lower_case, str_to_real, split_string
use tally_header, only: TallyObject, TallyScore
implicit none
@ -82,4 +86,130 @@ contains
end subroutine print_cmfd
!===============================================================================
! CREATE_CMFD_TALLY creates the tally object for OpenMC to process for CMFD
! accleration.
! There are 3 tally types:
! 1: Only an energy in filter-> flux,total,p1 scatter
! 2: Energy in and energy out filter-> nu-scatter,nu-fission
! 3: Surface current
!===============================================================================
subroutine create_cmfd_tally()
use xml_data_cmfd_t
integer :: i ! loop counter
integer :: j ! loop counter
integer :: n ! size of arrays in mesh specification
integer :: n_words ! number of words read
logical :: file_exists ! does cmfd.xml file exist?
character(MAX_LINE_LEN) :: filename
character(MAX_WORD_LEN) :: words(MAX_WORDS)
type(TallyObject), pointer :: t => null()
type(StructuredMesh), pointer :: m => null()
! check if cmfd.xml exists
filename = trim(path_input) // "cmfd.xml"
inquire(FILE=filename, EXIST=file_exists)
if (.not. file_exists) then
write(*,*) "Cannot perform CMFD"
STOP
end if
! parse cmfd.xml file
call read_xml_file_cmfd_t(filename)
! allocate mesh
n_meshes = 1
allocate(meshes(n_meshes))
m => meshes(1)
! set mesh id
m % id = 1
! set mesh type to rectangular
m % type = LATTICE_RECT
! determine number of dimensions for mesh
n = size(mesh_ % dimension)
if (n /= 2 .and. n /= 3) then
message = "Mesh must be two or three dimensions."
call fatal_error()
end if
m % n_dimension = n
! allocate attribute arrays
allocate(m % dimension(n))
allocate(m % origin(n))
allocate(m % width(n))
! read dimensions in each direction
m % dimension = mesh_ % dimension
! read mesh origin location
if (m % n_dimension /= size(mesh_ % origin)) then
message = "Number of entries on <origin> must be the same as " // &
"the number of entries on <dimension>."
call fatal_error()
end if
m % origin = mesh_ % origin
! read mesh widths
if (size(mesh_ % width) /= size(mesh_ % origin)) then
message = "Number of entries on <width> must be the same as " // &
"the number of entries on <origin>."
call fatal_error()
end if
m % width = mesh_ % width
! add mesh to dictionary
call dict_add_key(mesh_dict, m % id, 1)
! allocate tallies
n_tallies = 1
allocate(tallies(n_tallies))
! begin loop around tallies
! do i = 1,max_tal
i = 1
t => tallies(i)
! allocate arrays for number of bins and stride in scores array
allocate(t % n_bins(TALLY_TYPES))
allocate(t % stride(TALLY_TYPES))
! initialize number of bins and stride
t % n_bins = 0
t % stride = 0
! record tally id which is equivalent to loop number
t % id = i
! set mesh filter mesh id = 1
t % mesh = 1
m => meshes(1)
t % n_bins(T_MESH) = t % n_bins(T_MESH) + product(m % dimension)
! read and set incoming energy mesh filter
if (len_trim(energy_) > 0) then
call split_string(energy_,words,n_words)
allocate(t % energy_in(n_words))
do j = 1,n_words
t % energy_in(j) = str_to_real(words(j))
end do
t % n_bins(T_ENERGYIN) = n_words - 1
end if
! set macro reactions
allocate(t % macro_bins(1))
t % n_macro_bins = 1
! set total reaction rate
t % macro_bins(1) % scalar = MACRO_TOTAL
! end do
end subroutine create_cmfd_tally
end module cmfd_utils

View file

@ -1,5 +1,6 @@
module input_xml
use cmfd_utils, only: create_cmfd_tally
use constants
use datatypes, only: dict_create, dict_add_key, dict_has_key, &
dict_get_key
@ -30,6 +31,7 @@ contains
call read_geometry_xml()
call read_materials_xml()
call read_tallies_xml()
call create_cmfd_tally()
if (plotting) call read_plot_xml()
end subroutine read_input_xml