mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Don't use lowercase nuclide/element names in maps
This commit is contained in:
parent
d1acaa525c
commit
98e7396cbd
7 changed files with 31 additions and 34 deletions
|
|
@ -136,9 +136,7 @@ void read_cross_sections_xml()
|
|||
int i = 0;
|
||||
for (const auto& lib : data::libraries) {
|
||||
for (const auto& name : lib.materials_) {
|
||||
std::string lower_name = name;
|
||||
to_lower(lower_name);
|
||||
LibraryKey key {lib.type_, lower_name};
|
||||
LibraryKey key {lib.type_, name};
|
||||
data::library_map.insert({key, i});
|
||||
}
|
||||
++i;
|
||||
|
|
@ -146,9 +144,7 @@ void read_cross_sections_xml()
|
|||
|
||||
// Check that 0K nuclides are listed in the cross_sections.xml file
|
||||
for (const auto& name : settings::res_scat_nuclides) {
|
||||
std::string lower_name = name;
|
||||
to_lower(lower_name);
|
||||
LibraryKey key {Library::Type::neutron, lower_name};
|
||||
LibraryKey key {Library::Type::neutron, name};
|
||||
if (data::library_map.find(key) == data::library_map.end()) {
|
||||
fatal_error("Could not find resonant scatterer " +
|
||||
name + " in cross_sections.xml file!");
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ contains
|
|||
associate (mat => materials(i_material))
|
||||
NUC_NAMES_LOOP: do k = 1, size(mat % names)
|
||||
! Get index in nuc_temps array
|
||||
i_nuclide = nuclide_dict % get(to_lower(mat % names(k)))
|
||||
i_nuclide = nuclide_dict % get(mat % names(k))
|
||||
|
||||
! Add temperature if it hasn't already been added
|
||||
if (find(nuc_temps(i_nuclide), temperature) == -1) then
|
||||
|
|
@ -226,7 +226,7 @@ contains
|
|||
if (present(sab_temps) .and. mat % n_sab > 0) then
|
||||
SAB_NAMES_LOOP: do k = 1, size(mat % sab_names)
|
||||
! Get index in nuc_temps array
|
||||
i_sab = sab_dict % get(to_lower(mat % sab_names(k)))
|
||||
i_sab = sab_dict % get(mat % sab_names(k))
|
||||
|
||||
! Add temperature if it hasn't already been added
|
||||
if (find(sab_temps(i_sab), temperature) == -1) then
|
||||
|
|
|
|||
|
|
@ -752,20 +752,20 @@ contains
|
|||
ALL_NUCLIDES: do j = 1, mat % n_nuclides
|
||||
! Check that this nuclide is listed in the cross_sections.xml file
|
||||
name = trim(names % data(j))
|
||||
if (.not. library_present(LIBRARY_NEUTRON, (to_lower(name)))) then
|
||||
if (.not. library_present(LIBRARY_NEUTRON, (name))) then
|
||||
call fatal_error("Could not find nuclide " // trim(name) &
|
||||
// " in cross_sections data file!")
|
||||
end if
|
||||
|
||||
! If this nuclide hasn't been encountered yet, we need to add its name
|
||||
! and alias to the nuclide_dict
|
||||
if (.not. nuclide_dict % has(to_lower(name))) then
|
||||
if (.not. nuclide_dict % has(name)) then
|
||||
index_nuclide = index_nuclide + 1
|
||||
mat % nuclide(j) = index_nuclide
|
||||
|
||||
call nuclide_dict % set(to_lower(name), index_nuclide)
|
||||
call nuclide_dict % set(name, index_nuclide)
|
||||
else
|
||||
mat % nuclide(j) = nuclide_dict % get(to_lower(name))
|
||||
mat % nuclide(j) = nuclide_dict % get(name)
|
||||
end if
|
||||
|
||||
! If the corresponding element hasn't been encountered yet and photon
|
||||
|
|
@ -774,7 +774,7 @@ contains
|
|||
element = name(1:scan(name, '0123456789') - 1)
|
||||
|
||||
! Make sure photon cross section data is available
|
||||
if (.not. library_present(LIBRARY_PHOTON, to_lower(element))) then
|
||||
if (.not. library_present(LIBRARY_PHOTON, element)) then
|
||||
call fatal_error("Could not find element " // trim(element) &
|
||||
// " in cross_sections data file!")
|
||||
end if
|
||||
|
|
@ -868,19 +868,19 @@ contains
|
|||
end if
|
||||
|
||||
! Check that this nuclide is listed in the cross_sections.xml file
|
||||
if (.not. library_present(LIBRARY_THERMAL, to_lower(name))) then
|
||||
if (.not. library_present(LIBRARY_THERMAL, name)) then
|
||||
call fatal_error("Could not find S(a,b) table " // trim(name) &
|
||||
// " in cross_sections.xml file!")
|
||||
end if
|
||||
|
||||
! 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. sab_dict % has(to_lower(name))) then
|
||||
if (.not. sab_dict % has(name)) then
|
||||
index_sab = index_sab + 1
|
||||
mat % i_sab_tables(j) = index_sab
|
||||
call sab_dict % set(to_lower(name), index_sab)
|
||||
call sab_dict % set(name, index_sab)
|
||||
else
|
||||
mat % i_sab_tables(j) = sab_dict % get(to_lower(name))
|
||||
mat % i_sab_tables(j) = sab_dict % get(name)
|
||||
end if
|
||||
end do
|
||||
end if
|
||||
|
|
@ -1199,7 +1199,7 @@ contains
|
|||
end if
|
||||
|
||||
! If a specific nuclide was specified
|
||||
word = to_lower(sarray(j))
|
||||
word = sarray(j)
|
||||
|
||||
! Search through nuclides
|
||||
if (.not. nuclide_dict % has(word)) then
|
||||
|
|
@ -2052,8 +2052,8 @@ contains
|
|||
name = materials(i) % names(j)
|
||||
|
||||
if (.not. already_read % contains(name)) then
|
||||
filename = library_path(LIBRARY_NEUTRON, to_lower(name))
|
||||
i_nuclide = nuclide_dict % get(to_lower(name))
|
||||
filename = library_path(LIBRARY_NEUTRON, name)
|
||||
i_nuclide = nuclide_dict % get(name)
|
||||
|
||||
call write_message('Reading ' // trim(name) // ' from ' // &
|
||||
trim(filename), 6)
|
||||
|
|
@ -2089,7 +2089,7 @@ contains
|
|||
if (photon_transport) then
|
||||
if (.not. element_already_read % contains(element)) then
|
||||
! Read photon interaction data from HDF5 photon library
|
||||
filename = library_path(LIBRARY_PHOTON, to_lower(element))
|
||||
filename = library_path(LIBRARY_PHOTON, element)
|
||||
i_element = element_dict % get(element)
|
||||
call write_message('Reading ' // trim(element) // ' from ' // &
|
||||
trim(filename), 6)
|
||||
|
|
@ -2138,8 +2138,8 @@ contains
|
|||
name = materials(i) % sab_names(j)
|
||||
|
||||
if (.not. already_read % contains(name)) then
|
||||
filename = library_path(LIBRARY_THERMAL, to_lower(name))
|
||||
i_sab = sab_dict % get(to_lower(name))
|
||||
filename = library_path(LIBRARY_THERMAL, name)
|
||||
i_sab = sab_dict % get(name)
|
||||
|
||||
call write_message('Reading ' // trim(name) // ' from ' // &
|
||||
trim(filename), 6)
|
||||
|
|
@ -2233,8 +2233,8 @@ contains
|
|||
associate (nuc => nuclides(i_table))
|
||||
|
||||
! Look for WMP data in cross_sections.xml
|
||||
if (library_present(LIBRARY_WMP, to_lower(nuc % name))) then
|
||||
filename = library_path(LIBRARY_WMP, to_lower(nuc % name))
|
||||
if (library_present(LIBRARY_WMP, nuc % name)) then
|
||||
filename = library_path(LIBRARY_WMP, nuc % name)
|
||||
else
|
||||
nuc % mp_present = .false.
|
||||
return
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "openmc/search.h"
|
||||
#include "openmc/settings.h"
|
||||
#include "openmc/simulation.h"
|
||||
#include "openmc/string_utils.h"
|
||||
#include "openmc/thermal.h"
|
||||
#include "openmc/xml_interface.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -666,7 +666,7 @@ contains
|
|||
call move_alloc(FROM=new_density, TO=m % atom_density)
|
||||
|
||||
! Append new nuclide/density
|
||||
k = nuclide_dict % get(to_lower(name_))
|
||||
k = nuclide_dict % get(name_)
|
||||
m % nuclide(n + 1) = k
|
||||
m % atom_density(n + 1) = density
|
||||
m % density = m % density + density
|
||||
|
|
@ -810,7 +810,7 @@ contains
|
|||
do i = 1, n
|
||||
! Convert C string to Fortran string
|
||||
call c_f_pointer(name(i), string, [10])
|
||||
name_ = to_lower(to_f_string(string))
|
||||
name_ = to_f_string(string)
|
||||
|
||||
if (.not. nuclide_dict % has(name_)) then
|
||||
err = openmc_load_nuclide(string)
|
||||
|
|
|
|||
|
|
@ -707,8 +707,8 @@ contains
|
|||
name_ = to_f_string(name)
|
||||
|
||||
if (allocated(nuclides)) then
|
||||
if (nuclide_dict % has(to_lower(name_))) then
|
||||
index = nuclide_dict % get(to_lower(name_))
|
||||
if (nuclide_dict % has(name_)) then
|
||||
index = nuclide_dict % get(name_)
|
||||
err = 0
|
||||
else
|
||||
err = E_DATA
|
||||
|
|
@ -740,8 +740,8 @@ contains
|
|||
name_ = to_f_string(name)
|
||||
|
||||
err = 0
|
||||
if (.not. nuclide_dict % has(to_lower(name_))) then
|
||||
if (library_present(LIBRARY_NEUTRON, to_lower(name_))) then
|
||||
if (.not. nuclide_dict % has(name_)) then
|
||||
if (library_present(LIBRARY_NEUTRON, name_)) then
|
||||
! allocate extra space in nuclides array
|
||||
n = n_nuclides
|
||||
allocate(new_nuclides(n + 1))
|
||||
|
|
@ -749,7 +749,7 @@ contains
|
|||
call move_alloc(FROM=new_nuclides, TO=nuclides)
|
||||
n = n + 1
|
||||
|
||||
filename = library_path(LIBRARY_NEUTRON, to_lower(name_))
|
||||
filename = library_path(LIBRARY_NEUTRON, name_)
|
||||
|
||||
! Open file and make sure version is sufficient
|
||||
file_id = file_open(filename, 'r')
|
||||
|
|
@ -764,7 +764,7 @@ contains
|
|||
call file_close(file_id)
|
||||
|
||||
! Add entry to nuclide dictionary
|
||||
call nuclide_dict % set(to_lower(name_), n)
|
||||
call nuclide_dict % set(name_, n)
|
||||
n_nuclides = n
|
||||
|
||||
! Initialize nuclide grid
|
||||
|
|
|
|||
|
|
@ -838,7 +838,7 @@ contains
|
|||
do i = 1, n
|
||||
! Convert C string to Fortran string
|
||||
call c_f_pointer(nuclides(i), string, [10])
|
||||
nuclide_ = to_lower(to_f_string(string))
|
||||
nuclide_ = to_f_string(string)
|
||||
|
||||
select case (nuclide_)
|
||||
case ('total')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue