mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Moved counting of nuclides and S(a,b) tables into read_materials_xml instead of read_xs.
This commit is contained in:
parent
06254d1a48
commit
529fd69641
2 changed files with 62 additions and 80 deletions
72
src/ace.F90
72
src/ace.F90
|
|
@ -38,7 +38,7 @@ contains
|
|||
integer :: i ! index in materials array
|
||||
integer :: j ! index over nuclides in material
|
||||
integer :: index_list ! index in xs_listings array
|
||||
integer :: index_nuclides ! index in nuclides
|
||||
integer :: index_nuclide ! index in nuclides
|
||||
integer :: index_sab ! index in sab_tables
|
||||
character(12) :: name ! name of isotope, e.g. 92235.03c
|
||||
character(12) :: alias ! alias of nuclide, e.g. U-235.03c
|
||||
|
|
@ -47,70 +47,6 @@ contains
|
|||
type(SAB_Table), pointer :: sab => null()
|
||||
type(DictionaryCI), pointer :: already_read => null()
|
||||
|
||||
! ==========================================================================
|
||||
! COUNT NUMBER OF TABLES AND CREATE DICTIONARIES
|
||||
|
||||
! First we need to determine how many continuous-energy tables and how many
|
||||
! S(a,b) thermal scattering tables there are -- this loop doesn't actually
|
||||
! read the data, it simply counts the number of nuclides and S(a,b) tables
|
||||
index_nuclides = 0
|
||||
index_sab = 0
|
||||
do i = 1, n_materials
|
||||
! Get pointer to material
|
||||
mat => materials(i)
|
||||
|
||||
! First go through all the nuclide and check if they exist on other
|
||||
! materials -- if not, then increment the count for the number of
|
||||
! nuclides and add to dictionary
|
||||
do j = 1, mat % n_nuclides
|
||||
name = mat % names(j)
|
||||
|
||||
! Find index in xs_listing and set the name and alias according to the
|
||||
! listing
|
||||
index_list = dict_get_key(xs_listing_dict, name)
|
||||
name = xs_listings(index_list) % name
|
||||
alias = xs_listings(index_list) % alias
|
||||
|
||||
! If this nuclide hasn't been encountered yet, we need to add its name
|
||||
! and alias to the nuclide_dict
|
||||
if (.not. dict_has_key(nuclide_dict, name)) then
|
||||
index_nuclides = index_nuclides + 1
|
||||
mat % nuclide(j) = index_nuclides
|
||||
|
||||
call dict_add_key(nuclide_dict, name, index_nuclides)
|
||||
call dict_add_key(nuclide_dict, alias, index_nuclides)
|
||||
else
|
||||
mat % nuclide(j) = dict_get_key(nuclide_dict, name)
|
||||
end if
|
||||
end do
|
||||
|
||||
! Check if S(a,b) exists on other materials
|
||||
if (mat % has_sab_table) then
|
||||
name = mat % sab_name
|
||||
|
||||
! Find index in xs_listing and set the name and alias according to the
|
||||
! listing
|
||||
index_list = dict_get_key(xs_listing_dict, name)
|
||||
name = xs_listings(index_list) % name
|
||||
alias = xs_listings(index_list) % alias
|
||||
|
||||
! If this S(a,b) table hasn't been encountered yet, we need to add its
|
||||
! name and alias to the sab_dict
|
||||
if (.not. dict_has_key(sab_dict, name)) then
|
||||
index_sab = index_sab + 1
|
||||
mat % sab_table = index_sab
|
||||
|
||||
call dict_add_key(sab_dict, name, index_sab)
|
||||
call dict_add_key(sab_dict, alias, index_sab)
|
||||
else
|
||||
mat % sab_table = dict_get_key(sab_dict, name)
|
||||
end if
|
||||
end if
|
||||
end do
|
||||
|
||||
n_nuclides_total = index_nuclides
|
||||
n_sab_tables = index_sab
|
||||
|
||||
! allocate arrays for ACE table storage and cross section cache
|
||||
allocate(nuclides(n_nuclides_total))
|
||||
allocate(sab_tables(n_sab_tables))
|
||||
|
|
@ -133,16 +69,16 @@ contains
|
|||
|
||||
if (.not. dict_has_key(already_read, name)) then
|
||||
index_list = dict_get_key(xs_listing_dict, name)
|
||||
index_nuclides = dict_get_key(nuclide_dict, name)
|
||||
index_nuclide = dict_get_key(nuclide_dict, name)
|
||||
name = xs_listings(index_list) % name
|
||||
alias = xs_listings(index_list) % alias
|
||||
|
||||
! Read the ACE table into the appropriate entry on the nuclides
|
||||
! array
|
||||
call read_ace_table(index_nuclides, index_list)
|
||||
call read_ace_table(index_nuclide, index_list)
|
||||
|
||||
! Print out information on table to cross_sections.out file
|
||||
nuc => nuclides(index_nuclides)
|
||||
nuc => nuclides(index_nuclide)
|
||||
if (master) call print_nuclide(nuc, unit=UNIT_XS)
|
||||
|
||||
call dict_add_key(already_read, name, 0)
|
||||
|
|
|
|||
|
|
@ -618,16 +618,20 @@ contains
|
|||
|
||||
use xml_data_materials_t
|
||||
|
||||
integer :: i ! loop index for materials
|
||||
integer :: j ! loop index for nuclides
|
||||
integer :: n ! number of nuclides
|
||||
real(8) :: val ! value entered for density
|
||||
logical :: file_exists ! does materials.xml exist?
|
||||
logical :: sum_density ! density is taken to be sum of nuclide densities
|
||||
character(3) :: default_xs ! default xs identifier (e.g. 70c)
|
||||
character(12) :: name ! name of nuclide
|
||||
character(MAX_WORD_LEN) :: units ! units on density
|
||||
character(MAX_LINE_LEN) :: filename ! absolute path to materials.xml
|
||||
integer :: i ! loop index for materials
|
||||
integer :: j ! loop index for nuclides
|
||||
integer :: n ! number of nuclides
|
||||
integer :: index_list ! index in xs_listings array
|
||||
integer :: index_nuclide ! index in nuclides
|
||||
integer :: index_sab ! index in sab_tables
|
||||
real(8) :: val ! value entered for density
|
||||
logical :: file_exists ! does materials.xml exist?
|
||||
logical :: sum_density ! density is taken to be sum of nuclide densities
|
||||
character(3) :: default_xs ! default xs identifier (e.g. 70c)
|
||||
character(12) :: name ! name of isotope, e.g. 92235.03c
|
||||
character(12) :: alias ! alias of nuclide, e.g. U-235.03c
|
||||
character(MAX_WORD_LEN) :: units ! units on density
|
||||
character(MAX_LINE_LEN) :: filename ! absolute path to materials.xml
|
||||
type(Material), pointer :: mat => null()
|
||||
type(nuclide_xml), pointer :: nuc => null()
|
||||
type(sab_xml), pointer :: sab => null()
|
||||
|
|
@ -646,7 +650,7 @@ contains
|
|||
|
||||
! Initialize default cross section variable
|
||||
default_xs_ = ""
|
||||
|
||||
|
||||
! Parse materials.xml file
|
||||
call read_xml_file_materials_t(filename)
|
||||
|
||||
|
|
@ -657,6 +661,10 @@ contains
|
|||
n_materials = size(material_)
|
||||
allocate(materials(n_materials))
|
||||
|
||||
! Initialize count for number of nuclides/S(a,b) tables
|
||||
index_nuclide = 0
|
||||
index_sab = 0
|
||||
|
||||
do i = 1, n_materials
|
||||
mat => materials(i)
|
||||
|
||||
|
|
@ -762,6 +770,23 @@ contains
|
|||
call fatal_error()
|
||||
end if
|
||||
|
||||
! Find xs_listing and set the name/alias according to the listing
|
||||
index_list = dict_get_key(xs_listing_dict, name)
|
||||
name = xs_listings(index_list) % name
|
||||
alias = xs_listings(index_list) % alias
|
||||
|
||||
! If this nuclide hasn't been encountered yet, we need to add its name
|
||||
! and alias to the nuclide_dict
|
||||
if (.not. dict_has_key(nuclide_dict, name)) then
|
||||
index_nuclide = index_nuclide + 1
|
||||
mat % nuclide(j) = index_nuclide
|
||||
|
||||
call dict_add_key(nuclide_dict, name, index_nuclide)
|
||||
call dict_add_key(nuclide_dict, alias, index_nuclide)
|
||||
else
|
||||
mat % nuclide(j) = dict_get_key(nuclide_dict, name)
|
||||
end if
|
||||
|
||||
! Check if no atom/weight percents were specified or if both atom and
|
||||
! weight percents were specified
|
||||
if (nuc % ao == ZERO .and. nuc % wo == ZERO) then
|
||||
|
|
@ -813,6 +838,24 @@ contains
|
|||
end if
|
||||
mat % has_sab_table = .true.
|
||||
|
||||
! Find index in xs_listing and set the name and alias according to the
|
||||
! listing
|
||||
index_list = dict_get_key(xs_listing_dict, name)
|
||||
name = xs_listings(index_list) % name
|
||||
alias = xs_listings(index_list) % alias
|
||||
|
||||
! If this S(a,b) table hasn't been encountered yet, we need to add its
|
||||
! name and alias to the sab_dict
|
||||
if (.not. dict_has_key(sab_dict, name)) then
|
||||
index_sab = index_sab + 1
|
||||
mat % sab_table = index_sab
|
||||
|
||||
call dict_add_key(sab_dict, name, index_sab)
|
||||
call dict_add_key(sab_dict, alias, index_sab)
|
||||
else
|
||||
mat % sab_table = dict_get_key(sab_dict, name)
|
||||
end if
|
||||
|
||||
elseif (size(material_(i) % sab) > 1) then
|
||||
message = "Cannot have multiple S(a,b) tables on a single material."
|
||||
call fatal_error()
|
||||
|
|
@ -820,9 +863,12 @@ contains
|
|||
|
||||
! Add material to dictionary
|
||||
call dict_add_key(material_dict, mat % id, i)
|
||||
|
||||
end do
|
||||
|
||||
! Set total number of nuclides and S(a,b) tables
|
||||
n_nuclides_total = index_nuclide
|
||||
n_sab_tables = index_sab
|
||||
|
||||
end subroutine read_materials_xml
|
||||
|
||||
!===============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue