Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First major ROLLO PR with source code, tests, and one example problem #6

Merged
merged 434 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
434 commits
Select commit Hold shift + click to select a range
f2c2938
scoop test
gwenchee Jan 18, 2021
e64fa44
rm num2words
gwenchee Jan 19, 2021
b89a6db
fix for h5
gwenchee Jan 19, 2021
f8502fe
multiprocessing w dill
gwenchee Jan 21, 2021
b736ba2
try except
gwenchee Jan 21, 2021
5784b60
try except
gwenchee Jan 21, 2021
c54fa27
remove extra examples
gwenchee Jan 21, 2021
4d4a327
this works with multiprocessing on my mac as of now
gwenchee Jan 21, 2021
f4b0b4c
min max in cli
gwenchee Jan 21, 2021
4cf249b
evals correctly now
gwenchee Jan 21, 2021
8c47714
pep8
gwenchee Jan 21, 2021
65a2502
backend update
gwenchee Jan 22, 2021
ddb5beb
passes tests
gwenchee Jan 22, 2021
743b73a
pep8
gwenchee Jan 22, 2021
941e196
updated mstats backend
gwenchee Jan 22, 2021
c8deb2e
bw script
gwenchee Jan 25, 2021
c93fed8
bw run
gwenchee Jan 25, 2021
bc9575a
more stuff
gwenchee Jan 25, 2021
de95a8c
fix it
gwenchee Jan 27, 2021
b76bbf6
fixed
gwenchee Jan 27, 2021
f222967
err
gwenchee Jan 27, 2021
be0dd8a
ccm
gwenchee Jan 28, 2021
08ae2eb
maybe ready
gwenchee Jan 28, 2021
b091917
maybe ready
gwenchee Jan 28, 2021
6b8caeb
maybe ready
gwenchee Jan 28, 2021
a1386a6
now?
gwenchee Jan 28, 2021
3a3a2f1
nvm
gwenchee Jan 28, 2021
3a14fdd
?
gwenchee Jan 28, 2021
d74e076
ccm run python
gwenchee Jan 28, 2021
8c27dd3
input file
gwenchee Jan 28, 2021
779a20a
print statement
gwenchee Jan 29, 2021
a2c8aa2
it worksssss
gwenchee Jan 29, 2021
f733724
pep8
gwenchee Feb 1, 2021
6d80316
t Merge branch 'framework' of github.com:gwenchee/generative-reactor-…
gwenchee Feb 1, 2021
f682d62
Update README.md
gwenchee Feb 1, 2021
9fd6f62
Update README.md
gwenchee Feb 1, 2021
300e460
edits
gwenchee Feb 1, 2021
c0b281f
Merge branch 'framework' of github.com:gwenchee/realm into framework
gwenchee Feb 1, 2021
43d4bf8
readmeee
gwenchee Feb 1, 2021
43a0600
01/29
gwenchee Feb 1, 2021
2853ef2
Merge branch 'framework' of github.com:gwenchee/realm into framework
gwenchee Feb 1, 2021
b3fe3eb
more docs
gwenchee Feb 1, 2021
8f3e223
Merge branch 'framework' of github.com:gwenchee/generative-reactor-de…
gwenchee Feb 1, 2021
c8d3ada
input file in backend
gwenchee Feb 1, 2021
5d4cf98
pep8
gwenchee Feb 3, 2021
9d0bf88
sine func
gwenchee Feb 3, 2021
dba7a35
removed sine special variable
gwenchee Feb 3, 2021
451460d
sine example
gwenchee Feb 3, 2021
3cb04fc
bw run
gwenchee Feb 3, 2021
c194df0
cp
gwenchee Feb 3, 2021
6208868
save input file
gwenchee Feb 3, 2021
23ba2a2
something new no pf
gwenchee Feb 3, 2021
a7c2629
ready
gwenchee Feb 3, 2021
8803388
update input val
gwenchee Feb 3, 2021
f5240d6
new checkpoinmt
gwenchee Feb 4, 2021
a5f0d5e
documentation
gwenchee Feb 5, 2021
1ef1643
rm redundant input
gwenchee Feb 5, 2021
bc97cbf
more docs
gwenchee Feb 5, 2021
77f09d2
moved report away from docs
gwenchee Feb 5, 2021
c4b8de0
initialize sphinx docs
gwenchee Feb 5, 2021
2cf62f1
more docs updates
gwenchee Feb 5, 2021
d110f62
input file json in backend
gwenchee Feb 5, 2021
cd803b5
moved toolbox stuff to toolbox
gwenchee Feb 9, 2021
149be6e
move ad defaults to input val
gwenchee Feb 9, 2021
67ce1c2
time
gwenchee Feb 9, 2021
d1c3610
output command line results to output.txt
gwenchee Feb 19, 2021
3277b5f
code as is
gwenchee Feb 19, 2021
3cce0da
updates to include time, also some prints
gwenchee Feb 19, 2021
5d5b31b
p3p8
gwenchee Feb 19, 2021
d7d763f
nice analysis
gwenchee Feb 19, 2021
be52528
remove some prints:
gwenchee Feb 22, 2021
43a727e
try on bw
gwenchee Feb 22, 2021
d9271a8
bw
gwenchee Feb 22, 2021
1a315fc
ccm run
gwenchee Feb 22, 2021
1f24e04
update ccm run
gwenchee Feb 22, 2021
623adf3
remove ../
gwenchee Feb 22, 2021
353637c
put it back
gwenchee Feb 22, 2021
7376d98
move invalids
gwenchee Feb 22, 2021
9d99d07
eval this check point
gwenchee Feb 22, 2021
4d06c91
Merge branch 'framework' of github.com:gwenchee/realm into framework
gwenchee Feb 22, 2021
921825f
add evaluators to backend file
gwenchee Feb 22, 2021
d703ace
8000 test
gwenchee Feb 22, 2021
99ea3f2
xe node
gwenchee Feb 22, 2021
1cd4b75
check it out
gwenchee Feb 22, 2021
4388ab9
pep8
gwenchee Feb 22, 2021
6e08141
try no map
gwenchee Feb 23, 2021
db8b005
try scoop
gwenchee Feb 23, 2021
c4ee5df
seq run
gwenchee Feb 23, 2021
6ae454a
prints
gwenchee Feb 23, 2021
e452ba7
dask?
gwenchee Feb 23, 2021
1c43938
prints
gwenchee Feb 23, 2021
3847701
more prints
gwenchee Feb 23, 2021
9591f01
maybe
gwenchee Feb 23, 2021
4d7d7c7
try
gwenchee Feb 23, 2021
30c9b82
try
gwenchee Feb 23, 2021
bb4cffc
add more comments
gwenchee Feb 23, 2021
555a91f
try ray
gwenchee Feb 24, 2021
a8da8fa
ray baby
gwenchee Feb 24, 2021
7a32a91
try mpi
gwenchee Feb 26, 2021
7f3cff3
try multiprocessing again
gwenchee Feb 26, 2021
d0dff24
try this
gwenchee Feb 26, 2021
0a67d1a
try mpi
gwenchee Mar 1, 2021
7eff774
prints
gwenchee Mar 1, 2021
019b1d8
flish
gwenchee Mar 1, 2021
980899f
flish
gwenchee Mar 1, 2021
822f851
try this
gwenchee Mar 1, 2021
05e9c61
more prints
gwenchee Mar 1, 2021
39504ad
more prints
gwenchee Mar 1, 2021
3aec5a2
list
gwenchee Mar 1, 2021
4abf2fa
dill
gwenchee Mar 1, 2021
cc7605a
no buffer -u
gwenchee Mar 2, 2021
af08cb8
alg
gwenchee Mar 3, 2021
a272639
oops
gwenchee Mar 3, 2021
2c6980a
try this
gwenchee Mar 3, 2021
23c6131
try shutdown
gwenchee Mar 3, 2021
8e2270b
try this
gwenchee Mar 3, 2021
7002f3d
clean up
gwenchee Mar 4, 2021
e4603c1
add while loop for mutate operator and add try for solver inputs in …
gwenchee Mar 5, 2021
40763d8
ets go
gwenchee Mar 5, 2021
76f83d9
print
gwenchee Mar 5, 2021
6127b7b
make mating not give bad inds
gwenchee Mar 5, 2021
1d88d67
rm print
gwenchee Mar 5, 2021
fe0ecdb
test this out
gwenchee Mar 5, 2021
0f6639d
rm prints
gwenchee Mar 10, 2021
5f742e9
pep 8 + ...
gwenchee Mar 10, 2021
39c8df0
update h5
gwenchee Mar 15, 2021
890f3b8
oops
gwenchee Mar 15, 2021
4a460b6
time prints
gwenchee Mar 16, 2021
50113e5
updates
gwenchee Mar 16, 2021
d95c065
nicer
gwenchee Mar 16, 2021
39db495
print
gwenchee Mar 16, 2021
72b0d81
print rank
gwenchee Mar 16, 2021
2cb428f
print statements
gwenchee Mar 16, 2021
426ae77
prints
gwenchee Mar 16, 2021
8f3f9ba
prints
gwenchee Mar 16, 2021
09e1c1d
prints
gwenchee Mar 16, 2021
2ff0f83
autolink FALSE
gwenchee Mar 17, 2021
0afb9c0
remove prints
gwenchee Mar 17, 2021
161ea2f
option for realm to del eval files
gwenchee Mar 17, 2021
6ee4245
rm prints
gwenchee Mar 17, 2021
7d4c941
test case fhr slab
gwenchee Apr 26, 2021
ba33463
add trys
gwenchee Apr 26, 2021
814b691
try run
gwenchee Apr 26, 2021
7bac665
run
gwenchee Apr 26, 2021
05a119f
try this
gwenchee Apr 26, 2021
724bf37
realm input
gwenchee Apr 26, 2021
24fa09a
constants
gwenchee Apr 26, 2021
2a6e425
input
gwenchee Apr 26, 2021
2f6d42b
pep8
gwenchee Apr 26, 2021
4eecefa
remove prinst
gwenchee Apr 26, 2021
82f86b9
first go for multiobj
gwenchee Apr 26, 2021
87901e5
add number of objectives
gwenchee Apr 27, 2021
b16635c
algorithm update to multiobj:
gwenchee Apr 27, 2021
2b5619d
fix test
gwenchee Apr 28, 2021
a3b2392
multi obj
gwenchee Apr 28, 2021
b618110
update input validation for multi obj
gwenchee Apr 28, 2021
009b76d
update input file
gwenchee Apr 28, 2021
8f7b89b
comments out creators
gwenchee Apr 28, 2021
23f96df
update main to remove creator
gwenchee Apr 28, 2021
50d52dc
parallel toggle
gwenchee May 3, 2021
63c6bd9
mpi toggle
gwenchee May 3, 2021
2587608
fixes for toggle
gwenchee May 3, 2021
dfbfd82
print
gwenchee May 3, 2021
d71c34a
alg:
gwenchee May 3, 2021
6ba30d9
rm prints + add exception
gwenchee May 3, 2021
e33e75f
fic alg tests
gwenchee May 3, 2021
25c5e7a
executor docs
gwenchee May 4, 2021
67692e0
docs
gwenchee May 4, 2021
1599907
clean up try except
gwenchee May 4, 2021
e9b8f85
rm eextra variables + docs
gwenchee May 4, 2021
9421e6b
progress
gwenchee May 4, 2021
97586e6
put back try except
gwenchee May 5, 2021
f27b4b2
docs
gwenchee May 5, 2021
9cd0f01
update output and individual name in log book
gwenchee May 5, 2021
9eb6aff
docs
gwenchee May 5, 2021
52efaf4
docs + only list allowed for constraints
gwenchee May 5, 2021
20623ca
docs
gwenchee May 5, 2021
61ed40b
docs
gwenchee May 5, 2021
c4b47dc
docs
gwenchee May 5, 2021
be7bbf5
documentation
gwenchee May 5, 2021
049cc95
class docs
gwenchee May 6, 2021
dd0ff69
pep8
gwenchee May 6, 2021
3f00c6d
new name
gwenchee May 6, 2021
c25eae2
rm stuff:
gwenchee May 6, 2021
d1d4935
realm -> rollo
gwenchee May 6, 2021
8f4bdec
realm -> rollo
gwenchee May 6, 2021
194a720
realm -> rollo
gwenchee May 6, 2021
ed9dd0c
rollo
gwenchee May 6, 2021
65e24ce
rollo
gwenchee May 6, 2021
df758b6
update docs
gwenchee May 6, 2021
f472fa8
rollo
gwenchee May 6, 2021
7896fe9
updates from b4 for pypi
gwenchee May 11, 2021
1066a9e
restructure main
gwenchee May 11, 2021
f32140e
updates setup.py and cleans up improts
gwenchee May 11, 2021
1912c83
cli python file
gwenchee May 11, 2021
94d21fd
rename k to inds
gwenchee May 14, 2021
489102a
test
gwenchee May 14, 2021
01f1309
hmm
gwenchee May 14, 2021
c9ed10b
update for pip install
gwenchee May 14, 2021
1682d93
del
gwenchee May 14, 2021
031fded
readme
gwenchee May 19, 2021
cdc9cb9
Update README.md
gwenchee May 19, 2021
f00a6b4
readme
gwenchee May 19, 2021
45420b5
Update README.md
gwenchee May 19, 2021
1ea11a1
Update README.md
gwenchee May 19, 2021
572d1bf
k to inds
gwenchee May 19, 2021
ffdd43a
remove unrequired imports
gwenchee May 19, 2021
2bae575
Fix PEP 8 errors in docs/source/conf.py
pep8speaks May 19, 2021
c15f60d
Fix PEP 8 errors in examples/fhr-slab/constants.py
pep8speaks May 19, 2021
6bfb891
Fix PEP 8 errors in examples/fhr-slab/openmcinp.py
pep8speaks May 19, 2021
5bc95a0
Fix PEP 8 errors in rollo/__init__.py
pep8speaks May 19, 2021
f838bc6
Fix PEP 8 errors in rollo/__main__.py
pep8speaks May 19, 2021
b017116
Fix PEP 8 errors in rollo/algorithm.py
pep8speaks May 19, 2021
d16ac08
Fix PEP 8 errors in rollo/backend.py
pep8speaks May 19, 2021
dfee2b5
Fix PEP 8 errors in rollo/constraints.py
pep8speaks May 19, 2021
eab22bb
Fix PEP 8 errors in rollo/evaluation.py
pep8speaks May 19, 2021
de18779
Fix PEP 8 errors in rollo/executor.py
pep8speaks May 19, 2021
17903f6
Fix PEP 8 errors in rollo/input_validation.py
pep8speaks May 19, 2021
8fc333f
Fix PEP 8 errors in rollo/moltres_evaluation.py
pep8speaks May 19, 2021
4284693
Fix PEP 8 errors in rollo/openmc_evaluation.py
pep8speaks May 19, 2021
27c09ca
Fix PEP 8 errors in rollo/special_variables.py
pep8speaks May 19, 2021
6a12f25
Fix PEP 8 errors in rollo/toolbox_generator.py
pep8speaks May 19, 2021
2a7e379
Fix PEP 8 errors in setup.py
pep8speaks May 19, 2021
50a4944
Fix PEP 8 errors in tests/input_test_files/generate_backend_pickle.py
pep8speaks May 19, 2021
c2d154f
Fix PEP 8 errors in tests/input_test_files/input_test_eval_fn_generat…
pep8speaks May 19, 2021
badf5a7
Fix PEP 8 errors in tests/input_test_files/input_test_eval_fn_generat…
pep8speaks May 19, 2021
659c740
Fix PEP 8 errors in tests/input_test_files/input_test_evaluation_get_…
pep8speaks May 19, 2021
a04045e
Fix PEP 8 errors in tests/input_test_files/input_test_evaluation_get_…
pep8speaks May 19, 2021
092157a
Fix PEP 8 errors in tests/input_test_files/input_test_render_jinja_te…
pep8speaks May 19, 2021
fd317fc
Fix PEP 8 errors in tests/test_algorithm.py
pep8speaks May 19, 2021
ca03710
Fix PEP 8 errors in tests/test_backend.py
pep8speaks May 19, 2021
b46fd34
Fix PEP 8 errors in tests/test_constraints.py
pep8speaks May 19, 2021
687997e
Fix PEP 8 errors in tests/test_evaluation.py
pep8speaks May 19, 2021
05f6bfd
Fix PEP 8 errors in tests/test_executor.py
pep8speaks May 19, 2021
723995a
Fix PEP 8 errors in tests/test_openmc_evaluation.py
pep8speaks May 19, 2021
88db589
Fix PEP 8 errors in tests/test_special_variables.py
pep8speaks May 19, 2021
eafb6c9
Fix PEP 8 errors in tests/test_toolbox_generator.py
pep8speaks May 19, 2021
ae2e332
Update examples/fhr-slab/openmcinp.py
gwenchee May 19, 2021
7a4184f
Update examples/fhr-slab/openmcinp.py
gwenchee May 19, 2021
3f257b0
Update examples/fhr-slab/openmcinp.py
gwenchee May 19, 2021
c7403fb
Update examples/fhr-slab/openmcinp.py
gwenchee May 19, 2021
7b11bb4
Merge pull request #3 from pep8speaks/framework-pep8-patch
gwenchee May 19, 2021
fe7b5cf
del stuf
gwenchee May 19, 2021
b71f5e4
amanda commments
gwenchee May 19, 2021
7895ca1
ammanda comments
gwenchee May 19, 2021
20257a2
del docs from this branch
gwenchee May 20, 2021
7960418
Update rollo/evaluation.py
gwenchee May 21, 2021
c56dd37
sm comments
gwenchee May 21, 2021
eee7f63
sam comments
gwenchee May 26, 2021
1169b25
clearer doc strings
gwenchee May 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# generative-reactor-designs
Repository to hold the framework and code to produce generative reactor designs.
# ROLLO (Reactor evOLutionary aLgorithm Optimizer)

ROLLO is a Python package that applies evolutionary algorithm techniques to optimize nuclear reactor design.

Documentation on the usage of ROLLO is hosted at: ## INSERT WEBSITE ##

## Installation
`python -m pip install rollo`

## Running ROLLO
`python -m rollo -i <input file> -c <checkpoint file>`

Command line flags:
| Flag | Description | Mandatory ? |
| ----------- | ----------- | ----------- |
| -i | name of input file | Yes |
| -c| name of checkpoint file | No |

The checkpoint file holds the results from the ROLLO simulation and also acts
as a restart file. Thus, if a ROLLO simulation ends prematurely, the checkpoint
file can be used to restart the code from the most recent population and
continue the simulation.

## To build documentation
`cd docs`

`make html`

## To upload to PyPI
`python3 -m build`

`python3 -m twine upload dist/*`

## License
ROLLO is distributed under the 3-Clause BSD License.
8 changes: 8 additions & 0 deletions examples/fhr-slab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**ROLLO input file and supporting OpenMC templating scripts for maximizing keff
in a FHR fuel slab by varying the slab's TRISO fuel particle distribution.**

`rollo_input.json`: ROLLO input file

`openmc_input.py`: OpenMC templating script

`constants.py`: Supporting functions for `openmcinp.py`
123 changes: 123 additions & 0 deletions examples/fhr-slab/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import openmc
from numpy import pi

# Constants
T_r1 = 2135e-5
T_r2 = 3135e-5
T_r3 = 3485e-5
T_r4 = 3835e-5
T_r5 = 4235e-5
T_pitch = 0.09266

uoc_9 = openmc.Material()
uoc_9.set_density("g/cc", 11)
uoc_9.add_nuclide("U235", 2.27325e-3)
uoc_9.add_nuclide("U238", 2.269476e-2)
uoc_9.add_nuclide("O16", 3.561871e-2)
uoc_9.add_nuclide("C0", 9.79714e-3)
uoc_9.temperature = 1110
uoc_9.volume = 4 / 3 * pi * (T_r1 ** 3) * 101 * 210 * 4 * 36

por_c = openmc.Material()
por_c.set_density("g/cc", 1)
por_c.add_nuclide("C0", 5.013980e-2)
por_c.temperature = 948

si_c = openmc.Material()
si_c.set_density("g/cc", 3.2)
si_c.add_nuclide("Si28", 4.431240e-2)
si_c.add_nuclide("Si29", 2.25887e-3)
si_c.add_nuclide("Si30", 1.48990e-3)
si_c.add_nuclide("C0", 4.806117e-2)
si_c.temperature = 948

graphite = openmc.Material()
graphite.set_density("g/cc", 1.8)
graphite.add_nuclide("C0", 9.025164e-2)
graphite.temperature = 948

triso_4_layers = openmc.Material()
triso_4_layers.add_nuclide("C0", 0.06851594519357823)
triso_4_layers.add_nuclide("Si28", 0.009418744960032735)
triso_4_layers.add_nuclide("Si29", 0.00048013017638108395)
triso_4_layers.add_nuclide("Si30", 0.0003166830980933728)
triso_4_layers.set_density("sum")
triso_4_layers.temperature = 948

lm_graphite = openmc.Material()
lm_graphite.set_density("g/cc", 1.8)
lm_graphite.add_nuclide("C0", 9.025164e-2)
lm_graphite.temperature = 948

flibe = openmc.Material()
flibe.set_density("g/cc", 1.95)
flibe.add_nuclide("Li6", 1.383014e-6)
flibe.add_nuclide("Li7", 2.37132e-2)
flibe.add_nuclide("Be9", 1.18573e-2)
flibe.add_nuclide("F19", 4.74291e-2)
flibe.temperature = 948

mats = openmc.Materials(
(uoc_9, por_c, si_c, graphite, lm_graphite, flibe, triso_4_layers)
)

# 4 layer triso
two_spheres = [openmc.Sphere(r=r) for r in [T_r1, T_r5]]
two_triso_cells = [
openmc.Cell(fill=uoc_9, region=-two_spheres[0]),
openmc.Cell(fill=triso_4_layers, region=+two_spheres[0] & -two_spheres[1]),
openmc.Cell(fill=lm_graphite, region=+two_spheres[1]),
]
two_triso_univ = openmc.Universe(cells=two_triso_cells)


def create_prism(left, right, left_refl, right_refl):
if left_refl:
xplane_left = +openmc.XPlane(x0=left, boundary_type="reflective")
else:
xplane_left = +openmc.XPlane(x0=left)
if right_refl:
xplane_right = -openmc.XPlane(x0=right, boundary_type="reflective")
else:
xplane_right = -openmc.XPlane(x0=right)
prism = (
xplane_left &
xplane_right &
+openmc.YPlane(y0=0.35) &
-openmc.YPlane(y0=0.35 + 2.55) &
+openmc.ZPlane(z0=0, boundary_type="reflective") &
-openmc.ZPlane(z0=T_pitch * 20, boundary_type="reflective")
)
return prism


def create_prism_vertical(bot, top):
yplane_bot = +openmc.YPlane(y0=bot)
yplane_top = -openmc.YPlane(y0=top)
prism = (
+openmc.XPlane(x0=2) &
-openmc.XPlane(x0=2 + 23.1) &
yplane_bot &
yplane_top &
+openmc.ZPlane(z0=0, boundary_type="reflective") &
-openmc.ZPlane(z0=T_pitch * 20, boundary_type="reflective")
)
return prism


def create_lattice(region, pf):
try:
centers_1 = openmc.model.pack_spheres(radius=T_r5, region=region, pf=pf)
trisos_1 = [openmc.model.TRISO(T_r5, two_triso_univ, c) for c in centers_1]
prism = openmc.Cell(region=region)
lower_left_1, upper_right_1 = prism.region.bounding_box
shape = tuple(((upper_right_1 - lower_left_1) / 0.4).astype(int))
pitch_1 = (upper_right_1 - lower_left_1) / shape
lattice_1 = openmc.model.create_triso_lattice(
trisos_1, lower_left_1, pitch_1, shape, lm_graphite
)
prism.fill = lattice_1
except:
prism = openmc.Cell(region=region)
prism.fill = lm_graphite
return prism
133 changes: 133 additions & 0 deletions examples/fhr-slab/openmc_input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import openmc
import numpy as np
from numpy import sin, cos, tan, pi
import sys

sys.path.insert(1, "../")
from constants import *

# Templating
total_pf = 0.0979
sine_a = {{sine_a}}
sine_b = {{sine_b}}
sine_c = {{sine_c}}
vol_total = 23.1 * 2.55 * T_pitch * 20
vol_slice = 2.31 * 2.55 * T_pitch * 20

x_left = +openmc.XPlane(x0=0, boundary_type="periodic")
x_right = -openmc.XPlane(x0=27.1, boundary_type="periodic")
y_top = -openmc.YPlane(y0=3.25, boundary_type="periodic")
y_bot = +openmc.YPlane(y0=0, boundary_type="periodic")
y_top.periodic_surface = y_bot
x_left.periodic_surface = x_right
z_top = -openmc.ZPlane(z0=T_pitch * 20, boundary_type="reflective")
z_bot = +openmc.ZPlane(z0=0, boundary_type="reflective")
bounds = openmc.Cell(fill=flibe)
bounds.region = x_left & x_right & y_top & y_bot & z_top & z_bot

plank_x_left = +openmc.XPlane(x0=2)
plank_x_right = -openmc.XPlane(x0=2 + 23.1)
plank_y_top = -openmc.YPlane(y0=0.35 + 2.55)
plank_y_bot = +openmc.YPlane(y0=0.35)
plank_region = plank_x_left & plank_x_right & plank_y_top & plank_y_bot & z_top & z_bot
bounds.region &= ~plank_region

graphite1_x_right = -openmc.XPlane(x0=2)
graphite1 = openmc.Cell(fill=graphite)
graphite1.region = x_left & graphite1_x_right & y_top & y_bot & z_top & z_bot
bounds.region &= ~graphite1.region

graphite2_x_left = +openmc.XPlane(x0=25.1)
graphite2 = openmc.Cell(fill=graphite)
graphite2.region = graphite2_x_left & x_right & y_top & y_bot & z_top & z_bot
bounds.region &= ~graphite2.region

boundaries = np.arange(2, 27.1, 2.31)
prism_1 = create_prism(boundaries[0], boundaries[1], False, False)
prism_2 = create_prism(boundaries[1], boundaries[2], False, False)
prism_3 = create_prism(boundaries[2], boundaries[3], False, False)
prism_4 = create_prism(boundaries[3], boundaries[4], False, False)
prism_5 = create_prism(boundaries[4], boundaries[5], False, False)
prism_6 = create_prism(boundaries[5], boundaries[6], False, False)
prism_7 = create_prism(boundaries[6], boundaries[7], False, False)
prism_8 = create_prism(boundaries[7], boundaries[8], False, False)
prism_9 = create_prism(boundaries[8], boundaries[9], False, False)
prism_10 = create_prism(boundaries[9], boundaries[10], False, False)

# triso PF distribution
vol_triso = 4 / 3 * pi * T_r5 ** 3
no_trisos = total_pf * vol_total / vol_triso
midpoints = []
for x in range(len(boundaries) - 1):
midpoints.append((boundaries[x] + boundaries[x + 1]) / 2)
midpoints = np.array(midpoints)
sine_val = sine_a * sin(sine_b * midpoints + sine_c) + 2
sine_val = np.where(sine_val < 0, 0, sine_val)
triso_z = sine_val / sum(sine_val) * no_trisos
pf_z = triso_z * vol_triso / vol_slice

prism_cell_1 = create_lattice(prism_1, pf_z[0])
prism_cell_2 = create_lattice(prism_2, pf_z[1])
prism_cell_3 = create_lattice(prism_3, pf_z[2])
prism_cell_4 = create_lattice(prism_4, pf_z[3])
prism_cell_5 = create_lattice(prism_5, pf_z[4])
prism_cell_6 = create_lattice(prism_6, pf_z[5])
prism_cell_7 = create_lattice(prism_7, pf_z[6])
prism_cell_8 = create_lattice(prism_8, pf_z[7])
prism_cell_9 = create_lattice(prism_9, pf_z[8])
prism_cell_10 = create_lattice(prism_10, pf_z[9])

univ = openmc.Universe(
cells=[
bounds,
graphite1,
graphite2,
prism_cell_1,
prism_cell_2,
prism_cell_3,
prism_cell_4,
prism_cell_5,
prism_cell_6,
prism_cell_7,
prism_cell_8,
prism_cell_9,
prism_cell_10,
]
)
geom = openmc.Geometry(univ)

# settings
point = openmc.stats.Point((13.5, 1.7, T_pitch * 9.5))
src = openmc.Source(space=point)
settings = openmc.Settings()
settings.source = src
settings.batches = 10
settings.inactive = 2
settings.particles = 100
settings.temperature = {"multipole": True, "method": "interpolation"}

plot = openmc.Plot()
plot.basis = "xy"
plot.origin = (13.5, 1.7, T_pitch * 9.5)
plot.width = (30, 4)
plot.pixels = (1000, 200)
colors = {
uoc_9: "yellow",
por_c: "black",
si_c: "orange",
graphite: "grey",
flibe: "blue",
lm_graphite: "red",
}
plot.color_by = "material"
plot.colors = colors
plots = openmc.Plots()
plots.append(plot)

# export
mats.export_to_xml()
geom.export_to_xml()
settings.export_to_xml()
plots.export_to_xml()
openmc.run()
# openmc.run(openmc_exec="openmc-ccm-nompi",threads=16)
32 changes: 32 additions & 0 deletions examples/fhr-slab/rollo_input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"control_variables": {
"sine_a": {"min": 0.0, "max": 2.0},
"sine_b": {"min": 0.0, "max": 1.57},
"sine_c": {"min": 0.0, "max": 6.28}
},
"evaluators": {
"openmc": {
"input_script": "openmcinp.py",
"inputs": ["sine_a", "sine_b", "sine_c"],
"outputs": ["keff"],
"keep_files": false
}
},
"constraints": {"keff": {"operator": [">="], "constrained_val": [1.0]}},
"algorithm": {
"parallel": "multiprocessing",
"objective": ["max"],
"optimized_variable": ["keff"],
"pop_size": 4,
"generations": 10,
"mutation_probability": 0.2374127402121101,
"mating_probability": 0.4699131568275016,
"selection_operator": {"operator": "selTournament", "inds": 1, "tournsize": 5},
"mutation_operator": {
"operator": "mutPolynomialBounded",
"eta": 0.2374127402121101,
"indpb": 0.2374127402121101
},
"mating_operator": {"operator": "cxBlend", "alpha": 0.4699131568275016}
}
}
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion docs/lit-review/Makefile → reports/lit-review/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ epub:
ebook-convert $(manuscript).html $(manuscript).epub

clean:
rm -f *.bcf *.run.xml *.fdb_latexmk *.fls *.dvi *.toc *.aux *.gz *.out *.log *.bbl *.blg *.log *.spl *~ *.spl *.zip *.acn *.glo *.ist *.epub
rm -f *.bcf *.run.xml *.fdb_latexmk *.fls *.dvi *.toc *.aux *.gz *.out *.log *.bbl *.blg *.log *.spl *~ *.spl *.zip *.acn *.glo *.ist *.epub, *.glsdefs

realclean: clean
rm -rf $(manuscript).dvi
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
12 changes: 12 additions & 0 deletions rollo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from rollo.algorithm import *
from rollo.backend import *
from rollo.constraints import *
from rollo.evaluation import *
from rollo.executor import *
from rollo.input_validation import *
from rollo.moltres_evaluation import *
from rollo.openmc_evaluation import *
from rollo.special_variables import *
from rollo.toolbox_generator import *

__version__ = "0.1.1"
29 changes: 29 additions & 0 deletions rollo/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from rollo import executor
import sys
import getopt


def main():
argv = sys.argv[1:]
msg = "python rollo -i <inputfile> -c <checkpoint file> "
try:
opts, args = getopt.getopt(argv, "i:c:")
opts_dict = {}
for opt, arg in opts:
opts_dict[opt] = arg
if "-i" in opts_dict:
if "-c" in opts_dict:
new_run = executor.Executor(
input_file=opts_dict["-i"], checkpoint_file=opts_dict["-c"]
)
else:
new_run = executor.Executor(input_file=opts_dict["-i"])
new_run.execute()
if len(opts) == 0:
raise Exception("To run rollo: " + msg)
except getopt.GetoptError:
raise Exception("To run rollo: " + msg)


if __name__ == "__main__":
main()
Loading