Merge branch 'develop' into xml

Conflicts:
	src/DEPENDENCIES
	src/input_xml.F90
	src/templates/settings_t.xml
This commit is contained in:
Paul Romano 2013-11-08 22:23:36 +01:00
commit b56fa43088
21 changed files with 794 additions and 1 deletions

BIN
docs/img/Tracks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View file

@ -405,6 +405,15 @@ integers: the batch number, generation number, and particle number.
*Default*: None
.. _track:
``<track>`` Element
-------------------
The ``<track>`` element specifies particles for which OpenMC will output binary files describing particle position at every step of its transport. This element should be followed by triplets of integers. Each triplet describes one particle. The integers in each triplet specify the batch number, generation number, and particle number, respectively.
*Default*: None
``<uniform_fs>`` Element
------------------------

View file

@ -358,6 +358,7 @@ OpenMC accepts the following command line flags:
-r, --restart file Restart a previous run from a state point or a particle
restart file
-s, --threads N Run with *N* OpenMP threads
-t, --track Write tracks for all particles
-v, --version Show version information
-----------------------------------------------------

View file

@ -353,9 +353,41 @@ file. Note that the data contained in the output from
``StatePoint.extract_result`` is already in a Numpy array that can be reshaped
and dumped to MATLAB in one step.
----------------------------
Particle Track Visualization
----------------------------
.. image:: ../../img/Tracks.png
:height: 200px
OpenMC can dump particle tracks—the position of particles as they are
transported through the geometry. There are two ways to make OpenMC output
tracks: all particle tracks through a commandline argument or specific particle
tracks through settings.xml.
Running OpenMC with the argument "-t", "-track", or "--track" will cause a track
file to be created for every particle transported in the code.
The settings.xml file can dictate that specific particle tracks are output.
These particles are specified withen a ''track'' element. The ''track'' element
should contain triplets of integers specifying the batch, generation, and
particle numbers, respectively. For example, to output the tracks for particles
3 and 4 of batch 1 and generation 2 the settings.xml file should contain:
.. code-block:: xml
<track>
1 2 3
1 2 4
</track>
After running OpenMC, the directory should contain a file of the form
"track_(batch #)_(generation #)_(particle #).(binary or h5)" for each particle
tracked. These track files can be converted into VTK poly data files with the
"track.py" utility. The usage of track.py is of the form "track.py [-o OUT] IN"
where OUT is the optional output filename and IN is one or more filenames
describing track files. The default output name is "track.pvtp". A common
usage of track.py is "track.py track*.binary" which will use the data from all
binary track files in the directory to write a "track.pvtp" VTK output file.
The .pvtp file can then be read and plotted by 3d visualization programs such as
Paraview.

View file

@ -27,6 +27,9 @@ Restart a previous run from a state point or a particle restart file named
.BI \-s " N" "\fR,\fP \-\-threads" " N"
Use \fIN\fP OpenMP threads.
.TP
.B "\-t\fR, \fP\-\-track"
Write tracks for all particles.
.TP
.B "\-v\fR, \fP\-\-version"
Show version information.
.TP

View file

@ -370,6 +370,11 @@ tally_initialize.o: tally_header.o
timer_header.o: constants.o
track_output.o: global.o
track_output.o: output_interface.o
track_output.o: particle_header.o
track_output.o: string.o
tracking.o: cross_section.o
tracking.o: error.o
tracking.o: geometry.o
@ -381,10 +386,10 @@ tracking.o: physics.o
tracking.o: random_lcg.o
tracking.o: string.o
tracking.o: tally.o
tracking.o: track_output.o
vector_header.o: constants.o
xml_interface.o: constants.o
xml_interface.o: error.o
xml_interface.o: global.o

View file

@ -283,6 +283,10 @@ module global
integer :: trace_gen
integer(8) :: trace_particle
! Particle tracks
logical :: write_all_tracks = .false.
integer, allocatable :: track_identifiers(:,:)
! Particle restart run
logical :: particle_restart_run = .false.
@ -451,6 +455,9 @@ contains
call active_tracklength_tallies % clear()
call active_current_tallies % clear()
call active_tallies % clear()
! Deallocate track_identifiers
if (allocated(track_identifiers)) deallocate(track_identifiers)
! Deallocate dictionaries
call cell_dict % clear()

View file

@ -394,6 +394,9 @@ contains
case ('-eps_tol', '-ksp_gmres_restart')
! Handle options that would be based to PETSC
i = i + 1
case ('-t', '-track', '--track')
write_all_tracks = .true.
i = i + 1
case default
message = "Unknown command line option: " // argv(i)
call fatal_error()

View file

@ -56,6 +56,7 @@ contains
integer :: temp_int_array3(3)
integer, allocatable :: temp_int_array(:)
integer(8) :: temp_long
integer :: n_tracks
logical :: file_exists
character(MAX_FILE_LEN) :: env_variable
character(MAX_WORD_LEN) :: type
@ -459,6 +460,24 @@ contains
trace_particle = int(temp_int_array3(3), 8)
end if
! Particle tracks
if (check_for_node(doc, "track")) then
! Make sure that there are three values per particle
n_tracks = get_arraysize_integer(doc, "track")
if (mod(n_tracks, 3) /= 0) then
message = "Number of integers specified in 'track' is not divisible &
&by 3. Please provide 3 integers per particle to be tracked."
call fatal_error()
end if
! Allocate space and get list of tracks
allocate(temp_int_array(n_tracks))
call get_node_array(doc, "track", temp_int_array)
! Reshape into track_identifiers -- note automatic array allocation
track_identifiers = reshape(temp_int_array, [3, n_tracks/3])
end if
! Shannon Entropy mesh
if (check_for_node(doc, "entropy")) then

View file

@ -172,6 +172,7 @@ contains
write(OUTPUT_UNIT,*) ' -r, --restart Restart a previous run from a state point'
write(OUTPUT_UNIT,*) ' or a particle restart file'
write(OUTPUT_UNIT,*) ' -s, --threads Number of OpenMP threads'
write(OUTPUT_UNIT,*) ' -t, --track Write tracks for all particles'
write(OUTPUT_UNIT,*) ' -v, --version Show version information'
write(OUTPUT_UNIT,*) ' -?, --help Show this message'
end if

View file

@ -76,6 +76,9 @@ module particle_header
! Statistical data
integer :: n_collision ! # of collisions
! Track output
logical :: write_track
contains
procedure :: initialize => initialize_particle
procedure :: clear => clear_particle

View file

@ -105,6 +105,8 @@ element settings {
element trace { list { xsd:positiveInteger+ } }? &
element track { list { xsd:positiveInteger+ } }? &
element verbosity { xsd:positiveInteger }? &
element uniform_fs{

View file

@ -155,6 +155,7 @@ contains
integer(8), intent(in) :: index_source
integer(8) :: particle_seed ! unique index for particle
integer :: i
type(Bank), pointer, save :: src => null()
!$omp threadprivate(src)
@ -177,6 +178,21 @@ contains
if (current_batch == trace_batch .and. current_gen == trace_gen .and. &
p % id == trace_particle) trace = .true.
! Set particle track.
p % write_track = .false.
if (write_all_tracks) then
p % write_track = .true.
else if (allocated(track_identifiers)) then
do i=1, size(track_identifiers(1,:))
if (current_batch == track_identifiers(1,i) .and. &
&current_gen == track_identifiers(2,i) .and. &
&p % id == track_identifiers(3,i)) then
p % write_track = .true.
exit
end if
end do
end if
end subroutine get_source_particle
!===============================================================================

73
src/track_output.F90 Normal file
View file

@ -0,0 +1,73 @@
!===============================================================================
! TRACK_OUTPUT handles output of particle tracks (the paths taken by particles
! as they are transported through the geometry).
!===============================================================================
module track_output
use global
use output_interface, only: BinaryOutput
use particle_header, only: Particle
use string, only: to_str
implicit none
integer, private :: n_tracks ! total number of tracks
real(8), private, allocatable :: coords(:,:) ! track coordinates
contains
!===============================================================================
! INITIALIZE_PARTICLE_TRACK
!===============================================================================
subroutine initialize_particle_track()
n_tracks = 0
allocate(coords(1,1))
end subroutine initialize_particle_track
!===============================================================================
! WRITE_PARTICLE_TRACK copies particle position to an array.
!===============================================================================
subroutine write_particle_track(p)
type(Particle), intent(in) :: p
real(8), allocatable :: new_coords(:, :)
! Add another column to coords.
n_tracks = n_tracks + 1
allocate(new_coords(3, n_tracks))
new_coords(:, 1:n_tracks-1) = coords
call move_alloc(FROM=new_coords, TO=coords)
! Write current coordinates into the newest column.
coords(:, n_tracks) = p % coord0 % xyz
end subroutine write_particle_track
!===============================================================================
! FINALIZE_PARTICLE_TRACK writes the particle track array to disk.
!===============================================================================
subroutine finalize_particle_track(p)
type(Particle), intent(in) :: p
character(MAX_FILE_LEN) :: fname
type(BinaryOutput) :: binout
#ifdef HDF5
fname = trim(path_output) // 'track_' // trim(to_str(current_batch)) &
// '_' // trim(to_str(current_gen)) // '_' // trim(to_str(p % id)) &
// '.h5'
#else
fname = trim(path_output) // 'track_' // trim(to_str(current_batch)) &
// '_' // trim(to_str(current_gen)) // '_' // trim(to_str(p % id)) &
// '.binary'
#endif
call binout % file_create(fname)
call binout % write_data(coords, 'coordinates', length=(/3, n_tracks/))
call binout % file_close()
deallocate(coords)
end subroutine finalize_particle_track
end module track_output

View file

@ -13,6 +13,8 @@ module tracking
use string, only: to_str
use tally, only: score_analog_tally, score_tracklength_tally, &
score_surface_current
use track_output, only: initialize_particle_track, write_particle_track, &
finalize_particle_track
contains
@ -67,8 +69,16 @@ contains
! Force calculation of cross-sections by setting last energy to zero
micro_xs % last_E = ZERO
! Prepare to write out particle track.
if (p % write_track) then
call initialize_particle_track()
endif
do while (p % alive)
! Write particle track.
if (p % write_track) call write_particle_track(p)
if (check_overlaps) call check_cell_overlap(p)
! Calculate microscopic and macroscopic cross sections -- note: if the
@ -196,6 +206,12 @@ contains
end do
! Finish particle track output.
if (p % write_track) then
call write_particle_track(p)
call finalize_particle_track(p)
endif
end subroutine transport
end module tracking

99
src/utils/track.py Executable file
View file

@ -0,0 +1,99 @@
#!/usr/bin/env python2
"""Convert binary particle track to VTK poly data.
Usage information can be obtained by running 'track.py --help':
usage: track.py [-h] [-o OUT] IN [IN ...]
Convert particle track file to a .pvtp file.
positional arguments:
IN Input particle track data filename(s).
optional arguments:
-h, --help show this help message and exit
-o OUT, --out OUT Output VTK poly data filename.
"""
import os
import argparse
import struct
import vtk
def _parse_args():
# Create argument parser.
parser = argparse.ArgumentParser(
description='Convert particle track file to a .pvtp file.')
parser.add_argument('input', metavar='IN', type=str, nargs='+',
help='Input particle track data filename(s).')
parser.add_argument('-o', '--out', metavar='OUT', type=str, dest='out',
help='Output VTK poly data filename.')
# Parse and return commandline arguments.
return parser.parse_args()
def main():
# Parse commandline arguments.
args = _parse_args()
# Check input file extensions.
for fname in args.input:
if not (fname.endswith('.h5') or fname.endswith('.binary')):
raise ValueError("Input file names must either end with '.h5' or"
"'.binary'.")
# Make sure that the output filename ends with '.pvtp'.
if not args.out:
args.out = 'tracks.pvtp'
elif os.path.splitext(args.out)[1] != '.pvtp':
args.out = ''.join([args.out, '.pvtp'])
# Import HDF library if HDF files are present
for fname in args.input:
if fname.endswith('.h5'):
import h5py
break
# Initialize data arrays and offset.
points = vtk.vtkPoints()
cells = vtk.vtkCellArray()
point_offset = 0
for fname in args.input:
# Write coordinate values to points array.
if fname.endswith('.binary'):
track = open(fname, 'rb').read()
coords = [struct.unpack("ddd", track[24*i : 24*(i+1)])
for i in range(len(track)/24)]
n_points = len(coords)
for triplet in coords:
points.InsertNextPoint(triplet)
else:
coords = h5py.File(fname).get('coordinates')
n_points = coords.shape[0]
for i in range(n_points):
points.InsertNextPoint(coords[i,:])
# Create VTK line and assign points to line.
line = vtk.vtkPolyLine()
line.GetPointIds().SetNumberOfIds(n_points)
for i in range(n_points):
line.GetPointIds().SetId(i, point_offset+i)
cells.InsertNextCell(line)
point_offset += n_points
data = vtk.vtkPolyData()
data.SetPoints(points)
data.SetLines(cells)
writer = vtk.vtkXMLPPolyDataWriter()
writer.SetInput(data)
writer.SetFileName(args.out)
writer.Write()
if __name__ == '__main__':
main()

View file

@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8"?>
<geometry>
<!-- Based on ISCBEP model for leu-comp-therm-008 benchmarks (see LA-UR-10-06230) -->
<!-- pin-cell surfaces -->
<surface id="1" type="z-cylinder" coeffs="0.0 0.0 0.514858"/> <!-- fuel OR -->
<surface id="2" type="z-cylinder" coeffs="0.0 0.0 0.602996"/> <!-- fuel clad OR -->
<surface id="3" type="z-cylinder" coeffs="0.0 0.0 0.585000"/> <!-- pyrex OR -->
<surface id="99" type="sphere" coeffs="0.0 0.0 0.0 400.0"/> <!-- dummy outer boundary -->
<!-- pin-cell construction -->
<!-- Water pin-cell -->
<cell id="11" universe="1" material="1" surfaces="-99"/>
<cell id="12" universe="1" material="1" surfaces=" 99"/>
<!-- Fuel Rod -->
<cell id="21" universe="2" material="2" surfaces=" -1"/> <!-- fuel -->
<cell id="22" universe="2" material="3" surfaces="1 -2"/> <!-- clad -->
<cell id="23" universe="2" material="1" surfaces=" 2"/> <!-- water -->
<!-- Pyrex Rod -->
<cell id="31" universe="3" material="4" surfaces=" -3"/> <!-- pyrex -->
<cell id="32" universe="3" material="1" surfaces=" 3"/> <!-- water -->
<!-- Assembly construction -->
<!-- Dummy Water Assembly Universe -->
<cell id="99" universe="999" fill="1" surfaces="-99"/>
<!-- Central Fuel Assemblies -->
<!-- Central Fuel Assembly -->
<lattice id="11" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 1 2 2 2 1 2 2 2 2 2
2 2 2 3 2 2 2 2 2 2 2 3 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 1 2 2 1 2 2 2 1 2 2 1 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 1 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 1 2 2 1 2 2 2 1 2 2 1 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 3 2 2 2 2 2 2 2 3 2 2 2
2 2 2 2 2 1 2 2 2 1 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
</universes>
</lattice>
<cell id="111" universe="111" fill="11" surfaces=""/>
<!-- North Fuel Assembly -->
<lattice id="22" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 1 2 2 2 1 2 2 2 2 2
2 2 2 1 2 2 2 2 2 2 2 1 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 1 2 2 1 2 2 2 1 2 2 1 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 1 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 1 2 2 1 2 2 2 1 2 2 1 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 3 2 2 2 2 2 2 2 3 2 2 2
2 2 2 2 2 1 2 2 2 1 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
</universes>
</lattice>
<cell id="222" universe="222" fill="22" surfaces=""/> <!-- north -->
<cell id="444" universe="444" fill="222" surfaces="" rotation="0 0 90"/> <!-- west -->
<cell id="555" universe="555" fill="222" surfaces="" rotation="0 0 180"/> <!-- south -->
<cell id="666" universe="666" fill="222" surfaces="" rotation="0 0 270"/> <!-- east -->
<!-- Northeast Fuel Assembly -->
<lattice id="33" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 1 2 2 2 1 2 2 2 2 2
2 2 2 1 2 2 2 2 2 2 2 1 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 1 2 2 1 2 2 2 1 2 2 1 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 1 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 1 2 2 1 2 2 2 1 2 2 1 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 3 2 2 2 2 2 2 2 1 2 2 2
2 2 2 2 2 1 2 2 2 1 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
</universes>
</lattice>
<cell id="333" universe="333" fill="33" surfaces=""/> <!-- northeast -->
<cell id="777" universe="777" fill="333" surfaces="" rotation="0 0 90"/> <!-- northwest -->
<cell id="888" universe="888" fill="333" surfaces="" rotation="0 0 180"/> <!-- southwest -->
<cell id="998" universe="998" fill="333" surfaces="" rotation="0 0 270"/> <!-- southeast -->
<!-- Surrounding Driver Assemblies -->
<!-- Full Driver Assembly -->
<lattice id="24" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
</universes>
</lattice>
<cell id="240" universe="240" fill="24" surfaces="-99"/>
<!-- North Edge -->
<lattice id="14" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
</universes>
</lattice>
<cell id="140" universe="140" fill="14" surfaces=""/> <!-- north -->
<cell id="410" universe="410" fill="140" surfaces="" rotation="0 0 90"/> <!-- east -->
<cell id="740" universe="740" fill="140" surfaces="" rotation="0 0 180"/> <!-- south -->
<cell id="470" universe="470" fill="140" surfaces="" rotation="0 0 270"/> <!-- west -->
<!-- Northeast Edge Corner -->
<lattice id="15" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
</universes>
</lattice>
<cell id="150" universe="150" fill="15" surfaces=""/> <!-- northeast -->
<cell id="130" universe="130" fill="150" surfaces="" rotation="0 0 90"/> <!-- northwest -->
<cell id="510" universe="510" fill="150" surfaces="" rotation="0 0 180"/> <!-- southwest -->
<cell id="570" universe="570" fill="150" surfaces="" rotation="0 0 270"/> <!-- southeast -->
<!-- Northeast Top Steps -->
<lattice id="25" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
</universes>
</lattice>
<cell id="250" universe="250" fill="25" surfaces=""/> <!-- northeast -->
<cell id="320" universe="320" fill="250" surfaces="" rotation="0 0 90"/> <!-- northwest -->
<cell id="630" universe="630" fill="250" surfaces="" rotation="0 0 180"/> <!-- southwest -->
<cell id="560" universe="560" fill="250" surfaces="" rotation="0 0 270"/> <!-- southeast -->
<!-- Northeast Middle Corner -->
<lattice id="26" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
</universes>
</lattice>
<cell id="260" universe="260" fill="26" surfaces=""/> <!-- northeast -->
<cell id="220" universe="220" fill="260" surfaces="" rotation="0 0 90"/> <!-- southeast -->
<cell id="620" universe="620" fill="260" surfaces="" rotation="0 0 180"/> <!-- southwest -->
<cell id="660" universe="660" fill="260" surfaces="" rotation="0 0 270"/> <!-- northwest -->
<!-- Northeast Bottom Steps -->
<lattice id="36" type="rectangular" dimension="15 15">
<lower_left> -12.2682 -12.2682 </lower_left>
<width> 1.63576 1.63576 </width>
<universes>
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 1 1
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
</universes>
</lattice>
<cell id="360" universe="360" fill="36" surfaces=""/> <!-- northeast -->
<cell id="230" universe="230" fill="360" surfaces="" rotation="0 0 90"/> <!-- southeast -->
<cell id="520" universe="520" fill="360" surfaces="" rotation="0 0 180"/> <!-- southwest -->
<cell id="650" universe="650" fill="360" surfaces="" rotation="0 0 270"/> <!-- northwest -->
<!-- Core construction -->
<!-- Core Surfaces -->
<surface id="10" type="z-plane" coeffs=" -81.662" boundary="vacuum"/>
<surface id="20" type="z-plane" coeffs=" 81.662" boundary="vacuum"/>
<surface id="30" type="z-cylinder" coeffs="0.0 0.0 76.200" />
<surface id="40" type="z-cylinder" coeffs="0.0 0.0 77.470" boundary="vacuum"/>
<!-- Core lattice -->
<lattice id="99" type="rectangular" dimension="7 7">
<lower_left> -85.8774 -85.8774 </lower_left>
<width> 24.5364 24.5364 </width>
<universes>
999 999 130 140 150 999 999
999 220 230 240 250 260 999
130 320 777 222 333 360 150
410 240 444 111 666 240 470
510 520 888 555 998 560 570
999 620 630 240 650 660 999
999 999 510 740 570 999 999
</universes>
</lattice>
<!-- Core Bounding Cell -->
<cell id="1111" universe="0" fill="99" surfaces="10 -20 -30"/>
<cell id="1112" universe="0" material="3" surfaces="10 -20 30 -40"/>
</geometry>

View file

@ -0,0 +1,95 @@
<?xml version="1.0"?>
<materials>
<!-- material 1: Water with 1511 PPM -->
<material id="1">
<density value="0.99823" units="g/cc" />
<nuclide name="H-1" xs="70c" ao="6.6737E-002" />
<nuclide name="O-16" xs="70c" ao="3.3369E-002" />
<nuclide name="B-10" xs="70c" ao="1.6769E-005" />
<nuclide name="B-11" xs="70c" ao="6.7497E-005" />
<sab name="lwtr" xs="10t" />
</material>
<!-- material 2: Fuel (2.459 w/o with B-10 for impurities) -->
<material id="2">
<density value="10.24" units="g/cc" />
<nuclide name="U-235" xs="70c" ao="5.6868E-004" />
<!-- <nuclide name="U-234" xs="70c" ao="4.5689E-006" /> -->
<nuclide name="U-238" xs="70c" ao="2.2268E-002" />
<nuclide name="O-16" xs="70c" ao="4.5683E-002" />
<nuclide name="B-10" xs="70c" ao="2.6055E-007" />
</material>
<!-- Zircaloy-4 -->
<material id="3">
<density value=" 6.55" units="g/cc" />
<nuclide name="O-16" xs="70c" ao="3.0743e-04" />
<!-- <nuclide name="O-17" xs="71c" ao="7.4887e-07" />-->
<!-- <nuclide name="Cr-50" xs="71c" ao="3.2962e-06" />-->
<!-- <nuclide name="Cr-52" xs="71c" ao="6.3564e-05" />-->
<!-- <nuclide name="Cr-53" xs="71c" ao="7.2076e-06" />-->
<!-- <nuclide name="Cr-54" xs="71c" ao="1.7941e-06" />-->
<!-- <nuclide name="Fe-54" xs="71c" ao="8.6699e-06" />-->
<!-- <nuclide name="Fe-56" xs="71c" ao="1.3610e-04" />-->
<!-- <nuclide name="Fe-57" xs="71c" ao="3.1431e-06" />-->
<!-- <nuclide name="Fe-58" xs="71c" ao="4.1829e-07" />-->
<nuclide name="Zr-90" xs="70c" ao="2.1827e-02" />
<nuclide name="Zr-91" xs="70c" ao="4.7600e-03" />
<nuclide name="Zr-92" xs="70c" ao="7.2758e-03" />
<nuclide name="Zr-94" xs="70c" ao="7.3734e-03" />
<nuclide name="Zr-96" xs="70c" ao="1.1879e-03" />
<!-- <nuclide name="Sn-112" xs="71c" ao="4.6735e-06" />-->
<!-- <nuclide name="Sn-114" xs="71c" ao="3.1799e-06" />-->
<!-- <nuclide name="Sn-115" xs="71c" ao="1.6381e-06" />-->
<!-- <nuclide name="Sn-116" xs="71c" ao="7.0055e-05" />-->
<!-- <nuclide name="Sn-117" xs="71c" ao="3.7003e-05" />-->
<!-- <nuclide name="Sn-118" xs="71c" ao="1.1669e-04" />-->
<!-- <nuclide name="Sn-119" xs="71c" ao="4.1387e-05" />-->
<!-- <nuclide name="Sn-120" xs="71c" ao="1.5697e-04" />-->
<!-- <nuclide name="Sn-122" xs="71c" ao="2.2308e-05" />-->
<!-- <nuclide name="Sn-124" xs="71c" ao="2.7897e-05" />-->
</material>
<!-- material 3: Fuel Aluminum 6061 cladding -->
<!-- <material id="3">-->
<!-- <density value="2.5052" units="g/cc" />-->
<!-- <nuclide name="Al-27" xs="70c" ao="5.3985e-02" />-->
<!-- <nuclide name="Mn-55" xs="70c" ao="4.1191e-05" />-->
<!-- <nuclide name="Mg-24" xs="70c" ao="4.9031e-04" />-->
<!-- <nuclide name="Mg-25" xs="70c" ao="6.2072e-05" />-->
<!-- <nuclide name="Mg-26" xs="70c" ao="6.8341e-05" />-->
<!-- <nuclide name="Si-28" xs="70c" ao="2.9726e-04" />-->
<!-- <nuclide name="Si-29" xs="70c" ao="1.5094e-05" />-->
<!-- <nuclide name="Si-30" xs="70c" ao="9.9499e-06" />-->
<!-- <nuclide name="Cr-50" xs="70c" ao="2.5214e-06" />-->
<!-- <nuclide name="Cr-52" xs="70c" ao="4.8622e-05" />-->
<!-- <nuclide name="Cr-53" xs="70c" ao="5.5133e-06" />-->
<!-- <nuclide name="Cr-54" xs="70c" ao="1.3724e-06" />-->
<!-- <nuclide name="Fe-54" xs="70c" ao="1.1053e-05" />-->
<!-- <nuclide name="Fe-56" xs="70c" ao="1.7351e-04" />-->
<!-- <nuclide name="Fe-57" xs="70c" ao="4.0070e-06" />-->
<!-- <nuclide name="Fe-58" xs="70c" ao="5.3326e-07" />-->
<!-- <nuclide name="Ti-46" xs="70c" ao="3.8992e-06" />-->
<!-- <nuclide name="Ti-47" xs="70c" ao="3.5164e-06" />-->
<!-- <nuclide name="Ti-48" xs="70c" ao="3.4842e-05" />-->
<!-- <nuclide name="Ti-49" xs="70c" ao="2.5569e-06" />-->
<!-- <nuclide name="Ti-50" xs="70c" ao="2.4482e-06" />-->
<!-- <nuclide name="Cu-63" xs="70c" ao="4.1054e-05" />-->
<!-- <nuclide name="Cu-65" xs="70c" ao="1.8299e-05" />-->
<!-- </material>-->
<!-- material 4: Control Rod Material -->
<material id="4">
<density value="2.2442" units="g/cc" />
<nuclide name="B-10" xs="70c" ao="9.7491e-4" />
<nuclide name="B-11" xs="70c" ao="3.9241e-3" />
<nuclide name="O-16" xs="70c" ao="4.4829e-2" />
<!-- <nuclide name="Na-23" xs="70c" ao="1.7444e-3" />-->
<!-- <nuclide name="Al-27" xs="70c" ao="1.0018e-3" />-->
<!-- <nuclide name="Si-28" xs="70c" ao="1.6884e-02" />-->
<!-- <nuclide name="Si-29" xs="70c" ao="8.5730e-04" />-->
<!-- <nuclide name="Si-30" xs="70c" ao="5.6513e-04" />-->
</material>
</materials>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<!-- <cross_sections> -->
<!-- cross_sections.xml-->
<!-- </cross_sections>-->
<!-- Parameters for criticality calculation -->
<eigenvalue>
<batches>2</batches>
<inactive>0</inactive>
<particles>100</particles>
</eigenvalue>
<!-- How verbose output should be -->
<verbosity value="7" />
<!-- Starting source -->
<source>
<space type="box">
<parameters>-1 -1 -1 1 1 1</parameters>
</space>
</source>
<track>
1 1 1
1 1 2
</track>
</settings>

View file

@ -0,0 +1,65 @@
#!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE, call
import filecmp
import glob
from nose.plugins.skip import SkipTest
from nose_mpi import NoseMPI
pwd = os.path.dirname(__file__)
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
openmc_path = pwd + '/../../src/openmc'
if int(NoseMPI.mpi_np) > 0:
proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path],
stderr=STDOUT, stdout=PIPE)
else:
proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])
assert returncode == 0
def test_created_outputs():
outputs = [glob.glob(''.join((pwd, '/track_1_1_1.*')))]
outputs.append(glob.glob(''.join((pwd, '/track_1_1_2.*'))))
for files in outputs:
assert len(files) == 1
assert files[0].endswith('binary') or files[0].endswith('h5')
def test_outputs():
# If vtk python module is not available, we can't run track.py so skip this
# test
try:
import vtk
except ImportError:
raise SkipTest
call(['../../src/utils/track.py', '-o', 'poly'] +
glob.glob(''.join((pwd, '/track*'))))
poly = ''.join((pwd, '/poly.pvtp'))
assert os.path.isfile(poly)
metric = ''.join((pwd, '/true_poly.pvtp'))
compare = filecmp.cmp(poly, metric)
if not compare:
os.rename('poly.pvtp', 'error_poly.pvtp')
assert compare
def teardown():
temp_files = glob.glob(''.join((pwd, '/statepoint*')))
temp_files = temp_files + glob.glob(''.join((pwd, '/track*')))
temp_files = temp_files + glob.glob(''.join((pwd, '/poly*')))
for f in temp_files:
if os.path.exists(f):
os.remove(f)

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<VTKFile type="PPolyData" version="0.1" byte_order="LittleEndian" compressor="vtkZLibDataCompressor">
<PPolyData GhostLevel="0">
<PPoints>
<PDataArray type="Float32" Name="Points" NumberOfComponents="3"/>
</PPoints>
<Piece Source="poly_0.vtp"/>
</PPolyData>
</VTKFile>