Skip to content

Commit 8406340

Browse files
committed
Merge branch 'release-0.6.0'
2 parents fea6a80 + 81c7527 commit 8406340

File tree

396 files changed

+19422
-51041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

396 files changed

+19422
-51041
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ src/openmc
2121
docs/build
2222
docs/source/_images/*.pdf
2323

24+
# Source build
25+
src/build
26+
27+
# build from src/utils/setup.py
28+
src/utils/build
29+
2430
# xml-fortran reader
2531
src/xml-fortran/xmlreader
2632

@@ -32,3 +38,6 @@ results_error.dat
3238

3339
# HDF5 files
3440
*.h5
41+
42+
# Data downloaded from NNDC
43+
data/nndc

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "src/xml/fox"]
2+
path = src/xml/fox
3+
url = https://github.com/mit-crpg/fox.git

data/get_nndc_data.py

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
import subprocess
77
import sys
88
import tarfile
9+
import glob
910

1011
try:
1112
from urllib.request import urlopen
1213
except ImportError:
1314
from urllib2 import urlopen
1415

16+
cwd = os.getcwd()
17+
sys.path.append(os.path.join(cwd, '..', 'src', 'utils'))
18+
from convert_binary import ascii_to_binary
19+
1520
baseUrl = 'http://www.nndc.bnl.gov/endf/b7.1/aceFiles/'
1621
files = ['ENDF-B-VII.1-neutron-293.6K.tar.gz',
17-
'ENDF-B-VII.1-neutron-300K.tar.gz',
18-
'ENDF-B-VII.1-neutron-900K.tar.gz',
19-
'ENDF-B-VII.1-neutron-1500K.tar.gz',
2022
'ENDF-B-VII.1-tsl.tar.gz']
2123
block_size = 16384
2224

@@ -73,6 +75,17 @@
7375
print('Extracting {0}...'.format(f))
7476
tgz.extractall(path='nndc/' + suffix)
7577

78+
#===============================================================================
79+
# EDIT GRAPHITE ZAID (6012 to 6000)
80+
81+
print('Changing graphite ZAID from 6012 to 6000')
82+
graphite = os.path.join('nndc', 'tsl', 'graphite.acer')
83+
with open(graphite) as fh:
84+
text = fh.read()
85+
text = text.replace('6012', '6000', 1)
86+
with open(graphite, 'w') as fh:
87+
fh.write(text)
88+
7689
# ==============================================================================
7790
# COPY CROSS_SECTIONS.XML
7891

@@ -94,3 +107,43 @@
94107
if os.path.exists(f):
95108
print('Removing {0}...'.format(f))
96109
os.remove(f)
110+
111+
# ==============================================================================
112+
# PROMPT USER TO CONVERT ASCII TO BINARY
113+
114+
# Ask user to convert
115+
if sys.version_info[0] < 3:
116+
response = raw_input('Convert ACE files to binary? ([y]/n) ')
117+
else:
118+
response = input('Convert ACE files to binary? ([y]/n) ')
119+
120+
# Convert files if requested
121+
if not response or response.lower().startswith('y'):
122+
123+
# get a list of directories
124+
ace_dirs = glob.glob(os.path.join('nndc', '*K'))
125+
ace_dirs += glob.glob(os.path.join('nndc', 'tsl'))
126+
127+
# loop around ace directories
128+
for d in ace_dirs:
129+
print('Coverting {0}...'.format(d))
130+
131+
# get a list of files to convert
132+
ace_files = glob.glob(os.path.join(d, '*.ace*'))
133+
134+
# convert files
135+
for f in ace_files:
136+
print(' Coverting {0}...'.format(os.path.split(f)[1]))
137+
ascii_to_binary(f, f)
138+
139+
# Change cross_sections.xml file
140+
xs_file = os.path.join('nndc', 'cross_sections.xml')
141+
asc_str = "<filetype>ascii</filetype>"
142+
bin_str = "<filetype> binary </filetype>\n "
143+
bin_str += "<record_length> 4096 </record_length>\n "
144+
bin_str += "<entries> 512 </entries>"
145+
with open(xs_file) as fh:
146+
text = fh.read()
147+
text = text.replace(asc_str, bin_str)
148+
with open(xs_file, 'w') as fh:
149+
fh.write(text)

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
# built documents.
4747
#
4848
# The short X.Y version.
49-
version = "0.5"
49+
version = "0.6"
5050
# The full version, including alpha/beta/rc tags.
51-
release = "0.5.3"
51+
release = "0.6.0"
5252

5353
# The language for content autogenerated by Sphinx. Refer to documentation
5454
# for a list of supported languages.

docs/source/devguide/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ as debugging.
1010

1111
.. toctree::
1212
:numbered:
13-
:maxdepth: 2
13+
:maxdepth: 3
1414

1515
structures
1616
styleguide

docs/source/devguide/workflow.rst

Lines changed: 130 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ following criteria must be satisfied for all proposed changes:
3838

3939
- Changes have a clear purpose and are useful.
4040
- Compiles under all conditions (MPI, OpenMP, HDF5, etc.). This is checked as
41-
part of the test suite (see `test_compile.py`_).
41+
part of the test suite.
4242
- Passes the regression suite.
4343
- If appropriate, test cases are added to regression suite.
4444
- No memory leaks (checked with valgrind_).
@@ -91,6 +91,133 @@ features and bug fixes. The general steps for contributing are as follows:
9191
6. After the pull request has been thoroughly vetted, it is merged back into the
9292
*develop* branch of mit-crpg/openmc.
9393

94+
.. _test suite:
95+
96+
OpenMC Test Suite
97+
-----------------
98+
99+
The purpose of this test suite is to ensure that OpenMC compiles using various
100+
combinations of compiler flags and options, and that all user input options can
101+
be used successfully without breaking the code. The test suite is comprised of
102+
regression tests where different types of input files are configured and the
103+
full OpenMC code is executed. Results from simulations are compared with
104+
expected results. The test suite is comprised of many build configurations
105+
(e.g. debug, mpi, hdf5) and the actual tests which reside in sub-directories
106+
in the tests directory. We recommend to developers to test their branches
107+
before submitting a formal pull request using gfortran and intel compilers
108+
if available.
109+
110+
The test suite is designed to integrate with cmake using ctest_.
111+
It is configured to run with cross sections from NNDC_. To
112+
download these cross sections please do the following:
113+
114+
.. code-block:: sh
115+
116+
cd ../data
117+
python get_nndc.py
118+
export CROSS_SECTIONS=<path_to_data_folder>/nndc/cross_sections.xml
119+
120+
The test suite can be run on an already existing build using:
121+
122+
.. code-block:: sh
123+
124+
cd build
125+
make test
126+
127+
or
128+
129+
.. code-block:: sh
130+
131+
cd build
132+
ctest
133+
134+
There are numerous ctest_ command line options that can be set to have
135+
more control over which tests are executed.
136+
137+
Before running the test suite python script, the following environmental
138+
variables should be set if the default paths are incorrect:
139+
140+
* **FC** - The command of the Fortran compiler (e.g. gfotran, ifort).
141+
142+
* Default - *gfortran*
143+
144+
* **MPI_DIR** - The path to the MPI directory.
145+
146+
* Default - */opt/mpich/3.1-gnu*
147+
148+
* **HDF5_DIR** - The path to the HDF5 directory.
149+
150+
* Default - */opt/hdf5/1.8.12-gnu*
151+
152+
* **PHDF5_DIR** - The path to the parallel HDF5 directory.
153+
154+
* Default - */opt/phdf5/1.8.12-gnu*
155+
156+
* **PETSC_DIR** - The path to the PETSc directory.
157+
158+
* Default - */opt/petsc/3.4.4-gnu*
159+
160+
To run the full test suite, the following command can be executed in the
161+
tests directory:
162+
163+
.. code-block:: sh
164+
165+
python run_tests.py
166+
167+
A subset of build configurations and/or tests can be run. To see how to use
168+
the script run:
169+
170+
.. code-block:: sh
171+
172+
python run_tests.py --help
173+
174+
As an example, say we want to run all tests with debug flags only on tests
175+
that have cone and plot in their name. Also, we would like to run this on
176+
4 processors. We can run:
177+
178+
.. code-block:: sh
179+
180+
python run_tests.py -j 4 -C debug -R "cone|plot"
181+
182+
Note that standard regular expression syntax is used for selecting build
183+
configurations and tests. To print out a list of build configurations, we
184+
can run:
185+
186+
.. code-block:: sh
187+
188+
python run_tests.py -p
189+
190+
Adding tests to test suite
191+
++++++++++++++++++++++++++
192+
193+
To add a new test to the test suite, create a sub-directory in the tests
194+
directory that conforms to the regular expression *test_*. To configure
195+
a test you need to add the following files to your new test directory,
196+
*test_name* for example:
197+
198+
* OpenMC input XML files
199+
* **test_name.py** - python test driver script, please refer to other
200+
tests to see how to construct. Any output files that are generated
201+
during testing must be removed at the end of this script.
202+
* **results.py** - python script that extracts results from statepoint
203+
output files. By default it should look for a binary file, but can
204+
take an argument to overwrite which statepoint file is processed,
205+
whether it is at a different batch or with an HDF5 extension. This
206+
script must output a results file that is named *results_test.dat*.
207+
It is recommended that any real numbers reported use *12.6E* format.
208+
* **results_true.dat** - ASCII file that contains the expected results
209+
from the test. The file *results_test.dat* is compared to this file
210+
during the execution of the python test driver script. When the
211+
above files have been created, generate a *results_test.dat* file and
212+
copy it to this name and commit. It should be noted that this file
213+
should be generated with basic compiler options during openmc
214+
configuration and build (e.g., no MPI/HDF5, no debug/optimization).
215+
216+
In addition to this description, please see the various types of tests that
217+
are already included in the test suite to see how to create them. If all is
218+
implemented correctly, the new test directory will automatically be added
219+
to the CTest framework.
220+
94221
Private Development
95222
-------------------
96223

@@ -108,10 +235,11 @@ from your private repository into a public fork.
108235
.. _git: http://git-scm.com/
109236
.. _GitHub: https://github.com/
110237
.. _git flow: http://nvie.com/git-model
111-
.. _test_compile.py: https://github.com/mit-crpg/openmc/blob/develop/tests/test_compile/test_compile.py
112238
.. _valgrind: http://valgrind.org/
113239
.. _style guide: http://mit-crpg.github.io/openmc/devguide/styleguide.html
114240
.. _pull request: https://help.github.com/articles/using-pull-requests
115241
.. _mit-crpg/openmc: https://github.com/mit-crpg/openmc
116242
.. _paid plan: https://github.com/plans
117243
.. _Bitbucket: https://bitbucket.org
244+
.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html
245+
.. _NNDC: http://http://www.nndc.bnl.gov/endf/b7.1/acefiles.html

docs/source/devguide/xml-parsing.rst

Lines changed: 86 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ With the FoX library, extending the user input files to include new tags is
1313
fairly straightforward. The steps for modifying/adding input are as follows:
1414

1515
1. Add appropriate calls to procedures from the `xml_interface module`_, such as
16-
``check_for_node``, ``get_node_value``, and ``get_node_array``. All input
17-
reading is performed in the `input_xml module`_.
16+
``check_for_node``, ``get_node_value``, and ``get_node_array``. All input
17+
reading is performed in the `input_xml module`_.
1818

1919
2. Make sure that your input can be categorized as one of the datatypes from
20-
`XML Schema Part 2`_ and that parsing of the data appropriately reflects
21-
this. For example, for a boolean_ value, true can be represented either by "true"
22-
or by "1".
20+
`XML Schema Part 2`_ and that parsing of the data appropriately reflects
21+
this. For example, for a boolean_ value, true can be represented either by
22+
"true" or by "1".
2323

2424
3. Add code to check the variable for any possible errors.
2525

@@ -29,10 +29,90 @@ schema for the file you changed (e.g. src/relaxng/geometry.rnc) so that
2929
those who use Emacs can confirm whether their input is valid before they
3030
run. You will need to be familiar with RELAX NG `compact syntax`_.
3131

32-
.. _FoX: https://github.com/andreww/fox
32+
Working with the FoX Submodule
33+
==============================
34+
35+
The FoX_ library is included as a submodule_ in OpenMC. This means that for a
36+
given commit in OpenMC, there is an associated commit id that links to FoX.
37+
The actual FoX source code is maintained at mit-crpg/fox, branch openmc. When
38+
cloning the OpenMC repo for the first time, you will notice that the directory
39+
*src/xml/fox* is empty. To fetch the submodule source code, you can manually
40+
enter the following from the root directory of OpenMC:
41+
42+
.. code-block:: sh
43+
44+
git submodule init
45+
git submodule update
46+
47+
It should be noted that if the submodule is not initialized and updated, *cmake*
48+
will automatically perform these commands if it cannot file the FoX source code.
49+
50+
If you navigate into the FoX source code in OpenMC, src/xml/fox, and check git
51+
information, you will notice that you are in a completely different repo. Actually,
52+
you are in a clone of mit-crpg/fox. If you have write access to this repo, you can
53+
make changes to the FoX source code, commit and push just like any other repo.
54+
Just because you make changes to the FoX source code in OpenMC or in a standalone
55+
repo, this does not mean that OpenMC will automatically fetch these changes. The
56+
way submodules work is that they are just stored as a commit id. To save FoX xml
57+
source changes to your OpenMC branch, do the following:
58+
59+
1. Go into src/xml/fox and check out the appropriate source code state
60+
61+
2. Navigate back out of fox subdirectory and type:
62+
63+
.. code-block:: sh
64+
65+
git status
66+
67+
3. Make sure you see that git recognized that the state of FoX changed:
68+
69+
::
70+
71+
# On branch fox_submodule
72+
# Changes not staged for commit:
73+
# (use "git add <file>..." to update what will be committed)
74+
# (use "git checkout -- <file>..." to discard changes in working directory)
75+
#
76+
# modified: fox (new commits)
77+
78+
4. Commit and push this change
79+
80+
Editing FoX on Personal Fork
81+
============================
82+
83+
If you don't have write access to mit-crpg/fox and thus can't make a branch off of the openmc
84+
branch there, you will need to fork mit-crpg/fox to your personal account. You need to then
85+
link your branch in your OpenMC repo, to the *openmc* branch on your own personal FoX fork.
86+
To do this, edit the *.gitmodules* file in the root folder of the repo. It contains the
87+
following information:
88+
89+
::
90+
91+
[submodule "src/xml/fox"]
92+
path = src/xml/fox
93+
url = [email protected]:mit-crpg/fox
94+
95+
Change the url remote to your own fork. The commit id should stay constant until you start
96+
making modification to FoX yourself. Once you have made changes to your FoX fork and linked
97+
the new commit id to your OpenMC branch, you can pull request your changes in by peforming
98+
the following steps:
99+
100+
1. Create a pull request from your fork of FoX to mit-crpg/fox and wait until it
101+
is merged into the openmc branch.
102+
103+
2. In your OpenMC repo, change your *.gitmodules* file back to point at mit-crpg/fox.
104+
105+
3. Submit a pull request to mit-crpg/openmc
106+
107+
.. warning:: If you make changes to your FoX submodule inside of an OpenMC repo and do not
108+
commit, do **not** run *git submodule update*. This may throw away any changes that
109+
were not committed.
110+
111+
.. _FoX: https://github.com/mit-crpg/fox
33112
.. _xml_interface module: https://github.com/mit-crpg/openmc/blob/develop/src/xml_interface.F90
34113
.. _input_xml module: https://github.com/mit-crpg/openmc/blob/develop/src/input_xml.F90
35114
.. _XML Schema Part 2: http://www.w3.org/TR/xmlschema-2/
36115
.. _boolean: http://www.w3.org/TR/xmlschema-2/#boolean
37116
.. _RELAX NG: http://relaxng.org/
38117
.. _compact syntax: http://relaxng.org/compact-tutorial-20030326.html
118+
.. _submodule: http://git-scm.com/book/en/Git-Tools-Submodules

0 commit comments

Comments
 (0)