mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Added default_xs option in materials.xml. Closes gh-55.
This commit is contained in:
parent
58a5f871c4
commit
4a3166e6b8
2 changed files with 30 additions and 2 deletions
|
|
@ -423,6 +423,7 @@ contains
|
|||
integer :: n
|
||||
real(8) :: val
|
||||
logical :: file_exists
|
||||
character(3) :: default_xs
|
||||
character(MAX_WORD_LEN) :: units
|
||||
character(MAX_WORD_LEN) :: name
|
||||
character(MAX_LINE_LEN) :: filename
|
||||
|
|
@ -442,9 +443,15 @@ contains
|
|||
call fatal_error()
|
||||
end if
|
||||
|
||||
! Initialize default cross section variable
|
||||
default_xs_ = ""
|
||||
|
||||
! Parse materials.xml file
|
||||
call read_xml_file_materials_t(filename)
|
||||
|
||||
! Copy default cross section if present
|
||||
default_xs = default_xs_
|
||||
|
||||
! Allocate cells array
|
||||
n_materials = size(material_)
|
||||
allocate(materials(n_materials))
|
||||
|
|
@ -495,6 +502,26 @@ contains
|
|||
do j = 1, n
|
||||
! Combine nuclide identifier and cross section and copy into names
|
||||
nuc => material_(i) % nuclides(j)
|
||||
|
||||
! Check for empty name on nuclide
|
||||
if (len_trim(nuc % name) == 0) then
|
||||
message = "No name specified on nuclide in material " // &
|
||||
trim(int_to_str(m % id))
|
||||
call fatal_error()
|
||||
end if
|
||||
|
||||
! Check for cross section
|
||||
if (len_trim(nuc % xs) == 0) then
|
||||
if (default_xs == '') then
|
||||
message = "No cross section specified for nuclide in material " &
|
||||
// trim(int_to_str(m % id))
|
||||
call fatal_error()
|
||||
else
|
||||
nuc % xs = default_xs
|
||||
end if
|
||||
end if
|
||||
|
||||
! copy full name
|
||||
name = trim(nuc % name) // "." // trim(nuc % xs)
|
||||
m % names(j) = name
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
<!-- Type for specifying a nuclide -->
|
||||
|
||||
<typedef name="nuclide_xml">
|
||||
<component name="name" type="word" length="10" />
|
||||
<component name="xs" type="word" length="3" />
|
||||
<component name="name" type="word" length="10" default="''" />
|
||||
<component name="xs" type="word" length="3" default="''" />
|
||||
<component name="ao" type="double" default="0.0" />
|
||||
<component name="wo" type="double" default="0.0" />
|
||||
</typedef>
|
||||
|
|
@ -38,5 +38,6 @@
|
|||
</typedef>
|
||||
|
||||
<variable name="material_" tag="material" type="material_xml" dimension="1" />
|
||||
<variable name="default_xs_" tag="default_xs" type="word" length="3" />
|
||||
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue