From 6fc608a88909df73d77e9510b346501d273500f6 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 31 May 2012 18:41:03 +0700 Subject: [PATCH] Ability to specify a void material. Closes #66 on github. --- src/constants.F90 | 6 ++++-- src/cross_section.F90 | 3 +++ src/hdf5_interface.F90 | 10 +++++++--- src/initialize.F90 | 4 +++- src/input_xml.F90 | 22 +++++++++++++++++++++- src/output.F90 | 2 ++ src/xml-fortran/templates/geometry_t.xml | 2 +- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/constants.F90 b/src/constants.F90 index 20edd77e5a..69f255739f 100644 --- a/src/constants.F90 +++ b/src/constants.F90 @@ -72,8 +72,10 @@ module constants integer, parameter :: & CELL_NORMAL = 1, & ! Cell with a specified material CELL_FILL = 2, & ! Cell filled by a separate universe - CELL_LATTICE = 3, & ! Cell filled with a lattice - CELL_VOID = -1 + CELL_LATTICE = 3 ! Cell filled with a lattice + + ! Void material + integer, parameter :: MATERIAL_VOID = -1 ! Lattice types integer, parameter :: & diff --git a/src/cross_section.F90 b/src/cross_section.F90 index be8f009a7b..3d1a380e6a 100644 --- a/src/cross_section.F90 +++ b/src/cross_section.F90 @@ -34,6 +34,9 @@ contains material_xs % fission = ZERO material_xs % nu_fission = ZERO + ! Exit subroutine if material is void + if (p % material == MATERIAL_VOID) return + mat => materials(p % material) ! Find energy index on unionized grid diff --git a/src/hdf5_interface.F90 b/src/hdf5_interface.F90 index 819acfe442..c4c696f168 100644 --- a/src/hdf5_interface.F90 +++ b/src/hdf5_interface.F90 @@ -166,9 +166,13 @@ contains select case (c % type) case (CELL_NORMAL) call h5ltmake_dataset_string_f(temp_group, "fill_type", "normal", & - hdf5_err) - call hdf5_make_integer(temp_group, "material", & - materials(c % material) % id) + hdf5_err) + if (c % material == MATERIAL_VOID) then + call hdf5_make_integer(temp_group, "material", -1) + else + call hdf5_make_integer(temp_group, "material", & + materials(c % material) % id) + end if case (CELL_FILL) call h5ltmake_dataset_string_f(temp_group, "fill_type", "universe", & hdf5_err) diff --git a/src/initialize.F90 b/src/initialize.F90 index 39830da387..b837cd8334 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -445,7 +445,9 @@ contains ! ADJUST MATERIAL/FILL POINTERS FOR EACH CELL id = c % material - if (id /= 0) then + if (id == MATERIAL_VOID) then + c % type = CELL_NORMAL + elseif (id /= 0) then if (dict_has_key(material_dict, id)) then c % type = CELL_NORMAL c % material = dict_get_key(material_dict, id) diff --git a/src/input_xml.F90 b/src/input_xml.F90 index 2c01771985..cf5807aa98 100644 --- a/src/input_xml.F90 +++ b/src/input_xml.F90 @@ -368,9 +368,29 @@ contains ! Copy data into cells c % id = cell_(i) % id c % universe = cell_(i) % universe - c % material = cell_(i) % material c % fill = cell_(i) % fill + ! Read material + word = cell_(i) % material + call lower_case(word) + select case(word) + case ('void') + c % material = MATERIAL_VOID + + case ('') + ! This case is called if no material was specified + c % material = 0 + + case default + c % material = str_to_int(word) + + ! Check for error + if (c % material == ERROR_INT) then + message = "Invalid material specified on cell " // to_str(c % id) + call fatal_error() + end if + end select + ! Check to make sure that either material or fill was specified if (c % material == 0 .and. c % fill == 0) then message = "Neither material nor fill was specified for cell " // & diff --git a/src/output.F90 b/src/output.F90 index 1e40543518..a3a540d060 100644 --- a/src/output.F90 +++ b/src/output.F90 @@ -344,6 +344,8 @@ contains ! Write information on material if (c % material == 0) then write(unit_,*) ' Material = NONE' + elseif (c % material == MATERIAL_VOID) then + write(unit_,*) ' Material = Void' else m => materials(c % material) write(unit_,*) ' Material = ' // to_str(m % id) diff --git a/src/xml-fortran/templates/geometry_t.xml b/src/xml-fortran/templates/geometry_t.xml index ef56586523..fcae61b709 100644 --- a/src/xml-fortran/templates/geometry_t.xml +++ b/src/xml-fortran/templates/geometry_t.xml @@ -8,7 +8,7 @@ - +