Merge branch 'master' into inactive_tallies

This commit is contained in:
Paul Romano 2012-09-16 21:40:36 -04:00
commit d4eca784f5
13 changed files with 362 additions and 38 deletions

View file

@ -938,6 +938,13 @@ sub-elements:
Specifies the custom color for the cell or material. Should be 3 integers separated
by spaces.
As an example, if your plot is colored by material and you want material 23
to be blue, the corresponding ``col_spec`` element would look like:
.. code-block:: xml
<col_spec id="23" rgb="0 0 255" />
*Default*: None
:mask:

View file

@ -179,3 +179,27 @@ Alternatively, you could run from any directory:
Note that in the latter case, any output files will be placed in the present
working directory which may be different from ``/home/username/somemodel``.
-----------------------------------------------------
Configuring Input Validation with GNU Emacs nXML mode
-----------------------------------------------------
The `GNU Emacs`_ text editor has a built-in mode that extends functionality for
editing XML files. One of the features in nXML mode is the ability to perform
real-time `validation`_ of XML files against a `RELAX NG`_ schema. The OpenMC
source contains RELAX NG schemas for each type of user input file. In order for
nXML mode to know about these schemas, you need to tell emacs where to find a
"locating files" description. Adding the following lines to your ``~/.emacs``
file will enable real-time validation of XML input files:
.. code-block:: common-lisp
(require 'rng-loc)
(add-to-list 'rng-schema-locating-files "~/openmc/schemas.xml")
Make sure to replace the last string on the second line with the path to the
schemas.xml file in your own OpenMC source directory.
.. _GNU Emacs: http://www.gnu.org/software/emacs/
.. _validation: http://en.wikipedia.org/wiki/XML_validation
.. _RELAX NG: http://relaxng.org/

9
schemas.xml Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
<documentElement localName="geometry" uri="src/templates/geometry.rnc"/>
<documentElement localName="materials" uri="src/templates/materials.rnc"/>
<documentElement localName="settings" uri="src/templates/settings.rnc"/>
<documentElement localName="tallies" uri="src/templates/tallies.rnc"/>
<documentElement localName="plots" uri="src/templates/plots.rnc"/>
<documentElement localName="cross_sections" uri="src/templates/cross_sections.rnc"/>
</locatingRules>

View file

@ -217,10 +217,14 @@ contains
! Read XSS array
read(UNIT=in, FMT='(4E20.0)') XSS
! Close ACE file
close(UNIT=in)
elseif (filetype == BINARY) then
! =======================================================================
! READ ACE TABLE IN BINARY FORMAT
! Open ACE file
open(UNIT=in, FILE=filename, STATUS='old', ACTION='read', &
ACCESS='direct', RECL=record_length)
@ -238,6 +242,9 @@ contains
j2 = min(length, j1 + entries - 1)
read(UNIT=IN, REC=location + i) (XSS(j), j=j1,j2)
end do
! Close ACE file
close(UNIT=in)
end if
! ==========================================================================
@ -287,8 +294,6 @@ contains
if(associated(nuc)) nullify(nuc)
if(associated(sab)) nullify(sab)
close(UNIT=in)
end subroutine read_ace_table
!===============================================================================

View file

@ -156,12 +156,14 @@ contains
type(ListInt), pointer :: current
type(ListInt), pointer :: next
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
enddo
if (associated(list)) then
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
end do
end if
end subroutine list_int_delete
@ -175,12 +177,14 @@ contains
type(ListReal), pointer :: current
type(ListReal), pointer :: next
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
enddo
if (associated(list)) then
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
end do
end if
end subroutine list_real_delete
@ -194,12 +198,14 @@ contains
type(ListKeyValueCI), pointer :: current
type(ListKeyValueCI), pointer :: next
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
enddo
if (associated(list)) then
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
end do
end if
end subroutine list_kvci_delete
@ -213,12 +219,14 @@ contains
type(ListKeyValueII), pointer :: current
type(ListKeyValueII), pointer :: next
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
enddo
if (associated(list)) then
current => list
do while (associated(current%next))
next => current%next
deallocate(current)
current => next
end do
end if
end subroutine list_kvii_delete

View file

@ -117,18 +117,16 @@ contains
call timer_stop(time_ic_tallies)
! Write out state point if it's been specified for this batch
if (master) then
do i = 1, n_state_points
if (current_batch == statepoint_batch(i)) then
do i = 1, n_state_points
if (current_batch == statepoint_batch(i)) then
#ifdef HDF5
call hdf5_write_state_point()
call hdf5_write_state_point()
#else
call write_state_point()
call write_state_point()
#endif
exit
end if
end do
end if
exit
end if
end do
end subroutine finalize_batch

View file

@ -115,9 +115,16 @@ contains
if (pl % color_by == PLOT_COLOR_MATS) then
! Assign color based on material
c => cells(p % coord % cell)
r = pl % colors(c % material) % rgb(1)
g = pl % colors(c % material) % rgb(2)
b = pl % colors(c % material) % rgb(3)
if (c % material == MATERIAL_VOID) then
! By default, color void cells white
r = 255
g = 255
b = 255
else
r = pl % colors(c % material) % rgb(1)
g = pl % colors(c % material) % rgb(2)
b = pl % colors(c % material) % rgb(3)
end if
else if (pl % color_by == PLOT_COLOR_CELLS) then
! Assign color based on cell
r = pl % colors(p % coord % cell) % rgb(1)

View file

@ -0,0 +1,23 @@
element cross_sections {
element ace_table {
(element name { xsd:string { maxLength = "15" } } |
attribute name { xsd:string { maxLength = "15" } }) &
(element alias { xsd:string { maxLength = "15" } } |
attribute alias { xsd:string { maxLength = "15" } })? &
(element zaid { xsd:int } | attribute zaid { xsd:int }) &
(element metastable { xsd:int } | attribute metastable { xsd:int })? &
(element awr { xsd:double } | attribute awr { xsd:double }) &
(element temperature { xsd:double } | attribute temperature { xsd:double }) &
(element path { xsd:string { maxLength = "255" } } |
attribute path { xsd:string { maxLength = "255" } }) &
(element location { xsd:int } | attribute location { xsd:int })?
}* &
element directory { xsd:string { maxLength = "255" } }? &
element filetype { ( "ascii" | "binary" ) } &
element record_length { xsd:int }? &
element entries { xsd:int }?
}

View file

@ -0,0 +1,32 @@
element geometry {
element cell {
(element id { xsd:int } | attribute id { xsd:int }) &
(element universe { xsd:int } | attribute universe { xsd:int })? &
(
(element fill { xsd:int } | attribute fill { xsd:int }) |
(element material { xsd:int } | attribute material { xsd:int })
) &
(element surfaces { list { xsd:int+ } } | attribute surfaces { list { xsd:int+ } }) &
(element rotation { list { xsd:double+ } } | attribute rotation { list { xsd:double+ } })? &
(element translation { list { xsd:double+ } } | attribute translation { list { xsd:double+ } })?
}*
& element surface {
(element id { xsd:int } | attribute id { xsd:int }) &
(element type { xsd:string { maxLength = "15" } } |
attribute type { xsd:string { maxLength = "15" } }) &
(element coeffs { list { xsd:double+ } } | attribute coeffs { list { xsd:double+ } }) &
(element boundary { ( "transmit" | "reflective" | "vacuum" ) } |
attribute boundary { ( "transmit" | "reflective" | "vacuum" ) })?
}*
& element lattice {
(element id { xsd:int } | attribute id { xsd:int }) &
(element type { ( "rectangular" | "hexagonal" ) } |
attribute type { ( "rectangular" | "hexagonal" ) })? &
(element dimension { list { xsd:int+ } } | attribute dimension { list { xsd:int+ } }) &
(element lower_left { list { xsd:double+ } } | attribute lower_left { list { xsd:double+ } }) &
(element width { list { xsd:double+ } } | attribute width { list { xsd:double+ } }) &
(element universes { list { xsd:int+ } } | attribute universes { list { xsd:int+ } })
}*
}

View file

@ -0,0 +1,31 @@
element materials {
element material {
(element id { xsd:int } | attribute id { xsd:int }) &
element density {
(element value { xsd:double } | attribute value { xsd:double })? &
(element units { xsd:string { maxLength = "10" } } |
attribute units { xsd:string { maxLength = "10" } })
} &
element nuclide {
(element name { xsd:string { maxLength = "7" } } |
attribute name { xsd:string { maxLength = "7" } }) &
(element xs { xsd:string { maxLength = "3" } } |
attribute xs { xsd:string { maxLength = "3" } })? &
(
(element ao { xsd:double } | attribute ao { xsd:double }) |
(element wo { xsd:double } | attribute wo { xsd:double })
)
}* &
element sab {
(element name { xsd:string { maxLength = "7" } } |
attribute name { xsd:string { maxLength = "7" } }) &
(element xs { xsd:string { maxLength = "3" } } |
attribute xs { xsd:string { maxLength = "3" } })?
}*
}+ &
element default_xs { xsd:string { maxLength = "3" } }
}

31
src/templates/plots.rnc Normal file
View file

@ -0,0 +1,31 @@
element plots {
element plot {
(element id { xsd:int } | attribute id { xsd:int })? &
(element filename { xsd:string { maxLength = "50" } } |
attribute filename { xsd:string { maxLength = "50" } })? &
(element type { "slice" } | attribute type { "slice" })? &
(element color { ( "cell" | "mat" | "material" ) } |
attribute color { ( "cell" | "mat" | "material" ) })? &
(element origin { list { xsd:double+ } } |
attribute origin { list { xsd:double+ } })? &
(element width { list { xsd:double+ } } |
attribute width { list { xsd:double+ } })? &
(element basis { ( "xy" | "yz" | "xz" ) } |
attribute basis { ( "xy" | "yz" | "xz" ) })? &
(element pixels { list { xsd:int+ } } |
attribute pixels { list { xsd:int+ } })? &
(element background { list { xsd:int+ } } |
attribute background { list { xsd:int+ } })? &
element col_spec {
(element id { xsd:int } | attribute id { xsd:int }) &
(element rgb { list { xsd:int+ } } |
attribute rgb { list { xsd:int+ } })
}* &
element mask {
(element components { list { xsd:int+ } } |
attribute components { list { xsd:int+ } }) &
(element background { list { xsd:int+ } } |
attribute background { list { xsd:int+ } })
}*
}*
}

View file

@ -0,0 +1,99 @@
element settings {
element confidence_intervals { ( "on" | "off" ) }? &
(
element criticality {
(element batches { xsd:int } | attribute batches { xsd:int }) &
(element inactive { xsd:int } | attribute inactive { xsd:int }) &
(element particles { xsd:int } | attribute particles { xsd:int }) &
(element generations_per_batch { xsd:int } | attribute generations_per_batch { xsd:int })?
} |
element fixed_source {
(element batches { xsd:int } | attribute batches { xsd:int }) &
(element particles { xsd:int } | attribute particles { xsd:int })
}
) &
element cross_sections { xsd:string { maxLength = "255" } }? &
element cutoff {
(element weight { xsd:double } | attribute weight { xsd:double })? &
(element weight_avg { xsd:double } | attribute weight_avg { xsd:double })?
}? &
element energy_grid { xsd:string { maxLength = "7" } }? &
element entropy {
(element dimension { list { xsd:int+ } } |
attribute dimension { list { xsd:int+ } })? &
(element lower_left { list { xsd:double+ } } |
attribute lower_left { list { xsd:double+ } }) &
(element upper_right { list { xsd:double+ } } |
attribute upper_right { list { xsd:double+ } })
}? &
element no_reduce { ( "off" | "on" ) }? &
element output { list {
( "summary" | "cross_sections" | "tallies" )+ } }? &
element ptables { ( "off" | "on" ) }? &
element seed { xsd:integer }? &
element source {
element file { xsd:string { maxLength = "255" } }? &
element space {
(element type { xsd:string { maxLength = "10" } } |
attribute type { xsd:string { maxLength = "10" } }) &
(element length { xsd:int } | attribute length { xsd:int })? &
(element interpolation { xsd:string { maxLength = "10" } } |
attribute interplation { xsd:string { maxLength = "10" } })? &
(element parameters { list { xsd:double+ } } |
attribute parameters { list { xsd:double+ } })?
}? &
element angle {
(element type { xsd:string { maxLength = "10" } } |
attribute type { xsd:string { maxLength = "10" } }) &
(element length { xsd:int } | attribute length { xsd:int })? &
(element interpolation { xsd:string { maxLength = "10" } } |
attribute interplation { xsd:string { maxLength = "10" } })? &
(element parameters { list { xsd:double+ } } |
attribute parameters { list { xsd:double+ } })?
}? &
element energy {
(element type { xsd:string { maxLength = "10" } } |
attribute type { xsd:string { maxLength = "10" } }) &
(element length { xsd:int } | attribute length { xsd:int })? &
(element interpolation { xsd:string { maxLength = "10" } } |
attribute interplation { xsd:string { maxLength = "10" } })? &
(element parameters { list { xsd:double+ } } |
attribute parameters { list { xsd:double+ } })?
}?
}? &
element state_point {
(
(element batches { list { xsd:int } } |
attribute batches { list { xsd:int } }) |
(element interval { xsd:int} | attribute interval { xsd:int })
) &
(element source_separate { ( "off" | "on" ) } |
attribute source_separate { ( "off" | "on" ) })?
}? &
element survival_biasing { ( "off" | "on" ) }? &
element trace { list { xsd:int } }? &
element verbosity { xsd:int }? &
element uniform_fs{
(element dimension { list { xsd:int+ } } |
attribute dimension { list { xsd:int+ } }) &
(element lower_left { list { xsd:double+ } } |
attribute lower_left { list { xsd:double+ } }) &
(element upper_right { list { xsd:double+ } } |
attribute upper_right { list { xsd:double+ } })
}?
}

50
src/templates/tallies.rnc Normal file
View file

@ -0,0 +1,50 @@
element tallies {
element mesh {
(element id { xsd:int } | attribute id { xsd:int }) &
(element type { ( "rectangular" | "hexagonal" ) } |
attribute type { ( "rectangular" | "hexagonal" ) }) &
(element dimension { list { xsd:int+ } } |
attribute dimension { list { xsd:int+ } }) &
(element lower_left { list { xsd:double+ } } |
attribute lower_left { list { xsd:double+ } }) &
(
(element upper_right { list { xsd:double+ } } |
attribute upper_right { list { xsd:double+ } }) |
(element width { list { xsd:double+ } } |
attribute width { list { xsd:double+ } })
)
}* &
element tally {
(element id { xsd:int } | attribute id { xsd:int }) &
(element label { xsd:string { maxLength="52" } } |
attribute label { xsd:string { maxLength="52" } })? &
(element estimator { ( "analog" | "tracklength" ) } |
attribute estimator { ( "analog" | "tracklength" ) })? &
element filters {
(element cell { list { xsd:string { maxLength = "20" } } } |
attribute cell { list { xsd:string { maxLength = "20" } } })? &
(element surface { list { xsd:string { maxLength = "20" } } } |
attribute surface { list { xsd:string { maxLength = "20" } } })? &
(element universe { list { xsd:string { maxLength = "20" } } } |
attribute universe { list { xsd:string { maxLength = "20" } } })? &
(element material { list { xsd:string { maxLength = "20" } } } |
attribute material { list { xsd:string { maxLength = "20" } } })? &
(element mesh { xsd:int } | attribute mesh { xsd:int })? &
(element cellborn { list { xsd:string { maxLength = "20" } } } |
attribute cellborn { list { xsd:string { maxLength = "20" } } })? &
(element energy { list { xsd:double+ } } |
attribute energy { list { xsd:double+ } })? &
(element energyout { list { xsd:double+ } } |
attribute energyout { list { xsd:double+ } })?
}? &
element nuclides {
list { xsd:string { maxLength = "20" }+ }
}? &
element scores {
list { xsd:string { maxLength = "12" }+ }
}
}* &
element assume_separate { ( "off" | "on" ) }?
}