diff --git a/src/cmfd_header.F90 b/src/cmfd_header.F90 index 3b9db1ea0b..2a9edd084d 100644 --- a/src/cmfd_header.F90 +++ b/src/cmfd_header.F90 @@ -49,9 +49,6 @@ module cmfd_header ! core map for xs association integer, allocatable :: coremap(:,:,:) - ! we may need to add the mesh object - ! add accumulation of important parameters - end type cmfd_obj end module cmfd_header diff --git a/src/cmfd_utils.F90 b/src/cmfd_utils.F90 index fdde35d455..7fff76f410 100644 --- a/src/cmfd_utils.F90 +++ b/src/cmfd_utils.F90 @@ -17,9 +17,49 @@ contains ! READ_INPUT reads the CMFD input file and organizes it into a data structure !=============================================================================== - subroutine read_input() + subroutine read_cmfd_xml() - end subroutine read_input + use xml_data_cmfd_t + + integer :: ng=1 ! number of energy groups (default 1) + integer :: n_words ! number of words read + logical :: file_exists ! does cmfd.xml exist? + character(MAX_LINE_LEN) :: filename + character(MAX_WORD_LEN) :: words(MAX_WORDS) + + ! read cmfd infput file + 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) + + ! set spatial dimensions in cmfd object + cmfd % indices(1:3) = mesh_ % dimension(1:3) ! sets spatial dimensions + + ! get number of energy groups + if (len_trim(mesh_ % energy) > 0) then + call split_string(mesh_ % energy, words, n_words) + ng = n_words + end if + cmfd % indices(4) = ng ! sets energy group dimension + + ! set global albedo + cmfd % albedo = mesh_ % albedo + + ! get acceleration map + allocate(cmfd % coremap(cmfd % indices(1), cmfd % indices(2), & + & cmfd % indices(3))) + cmfd % coremap = reshape(mesh_ % map,(cmfd % indices(1:3))) + + ! create tally objects + call create_cmfd_tally() + + end subroutine read_cmfd_xml !=============================================================================== ! GET_MATRIX_IDX takes (x,y,z,g) indices and computes location in matrix @@ -106,7 +146,7 @@ contains subroutine create_cmfd_tally() - use xml_data_cmfd_t + use xml_data_cmfd_t integer :: i ! loop counter integer :: j ! loop counter @@ -115,22 +155,14 @@ contains integer :: n ! size of arrays in mesh specification integer :: ng=1 ! number of energy groups (default 1) 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) + filename = trim(path_input) // "cmfd.xml" + call read_xml_file_cmfd_t(filename) ! allocate mesh n_meshes = 1 @@ -282,13 +314,6 @@ contains end do - ! set dimensions in cmfd object - cmfd % indices(1:3) = m % dimension(1:3) ! sets spatial dimensions - cmfd % indices(4) = ng ! sets energy group dimension - - ! set global albedo - cmfd % albedo = mesh_ % albedo - end subroutine create_cmfd_tally end module cmfd_utils diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 776e0a6f2e..cc8b2e21d2 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -1,6 +1,6 @@ module input_xml - use cmfd_utils, only: create_cmfd_tally + use cmfd_utils, only: read_cmfd_xml use constants use datatypes, only: dict_create, dict_add_key, dict_has_key, & dict_get_key @@ -31,7 +31,7 @@ contains call read_geometry_xml() call read_materials_xml() call read_tallies_xml() - call create_cmfd_tally() + call read_cmfd_xml() if (plotting) call read_plot_xml() end subroutine read_input_xml diff --git a/src/xml-fortran/templates/cmfd_t.xml b/src/xml-fortran/templates/cmfd_t.xml index 1f1e69ffed..0b590c20f6 100644 --- a/src/xml-fortran/templates/cmfd_t.xml +++ b/src/xml-fortran/templates/cmfd_t.xml @@ -8,9 +8,10 @@ + + -