Skip to content

Commit

Permalink
Ability to run volume calculation mode from command line or Python API
Browse files Browse the repository at this point in the history
  • Loading branch information
paulromano committed Feb 24, 2017
1 parent cfb6339 commit f40578d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/source/pythonapi/index.rst
Expand Up @@ -185,6 +185,7 @@ Running OpenMC
:template: myfunction.rst

openmc.run
openmc.run_volume_calculation
openmc.plot_geometry

Post-processing
Expand Down
7 changes: 5 additions & 2 deletions man/man1/openmc.1
Expand Up @@ -13,9 +13,12 @@ It is assumed that if no
is specified, the XML input files are present in the current directory.
.SH OPTIONS
.TP
.B "\-c\fR, \fP\-\-volume"
Run in stochastic volume calculation mode
.TP
.B "\-g\fR, \fP\-\-geometry-debug"
Run in geometry debugging mode, where cell overlaps are checked for after each
move of a particle
Run with geometry debugging turned on, where cell overlaps are checked for after
each move of a particle
.TP
.B "\-p\fR, \fP\-\-plot"
Run in plotting mode
Expand Down
18 changes: 17 additions & 1 deletion openmc/executor.py
Expand Up @@ -39,10 +39,26 @@ def plot_geometry(output=True, openmc_exec='openmc', cwd='.'):
Path to working directory to run in. Defaults to the current working directory.
"""

return _run(openmc_exec + ' -p', output, cwd)


def run_volume_calculation(output=True, openmc_exec='openmc', cwd='.'):
"""Run stochastic volume calculations in OpenMC
Parameters
----------
output : bool
Capture OpenMC output from standard out
openmc_exec : str
Path to OpenMC executable
cwd : str, optional
Path to working directory to run in. Defaults to the current working directory.
"""
return _run(openmc_exec + ' --volume', output, cwd)



def run(particles=None, threads=None, geometry_debug=False,
restart_file=None, tracks=False, output=True, cwd='.',
openmc_exec='openmc', mpi_args=None):
Expand Down
3 changes: 3 additions & 0 deletions src/initialize.F90
Expand Up @@ -363,6 +363,9 @@ subroutine read_command_line()
case ('-g', '-geometry-debug', '--geometry-debug')
check_overlaps = .true.

case ('-c', '--volume')
run_mode = MODE_VOLUME

case ('-s', '--threads')
! Read number of threads
i = i + 1
Expand Down
3 changes: 2 additions & 1 deletion src/output.F90
Expand Up @@ -194,7 +194,8 @@ subroutine print_usage()
write(OUTPUT_UNIT,*) 'Usage: openmc [options] [directory]'
write(OUTPUT_UNIT,*)
write(OUTPUT_UNIT,*) 'Options:'
write(OUTPUT_UNIT,*) ' -g, --geometry-debug Run in geometry debugging mode'
write(OUTPUT_UNIT,*) ' -c, --volume Run in stochastic volume calculation mode'
write(OUTPUT_UNIT,*) ' -g, --geometry-debug Run with geometry debugging on'
write(OUTPUT_UNIT,*) ' -n, --particles Number of particles per generation'
write(OUTPUT_UNIT,*) ' -p, --plot Run in plotting mode'
write(OUTPUT_UNIT,*) ' -r, --restart Restart a previous run from a state point'
Expand Down

0 comments on commit f40578d

Please sign in to comment.