Skip to content

Commit 0b11ae4

Browse files
authored
Add test for converting full models (#49)
1 parent e2d6fcf commit 0b11ae4

4 files changed

Lines changed: 182 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*~
22
__pycache__
33
*.egg-info
4+
.coverage

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ to manually set boundary conditions on the outermost surfaces.
2929
Some geometry features are not currently supported:
3030

3131
- Periodic boundary conditions
32-
- `X`, `Y`, and `Z` surfaces with 1 or 3 coordinate pairs
32+
- `X`, `Y`, and `Z` surfaces with 3 coordinate pairs
3333
- `RHP`, `REC`, `ELL`, `WED`, and `ARB` macrobodies
3434
- Hexagonal lattices
3535
- One-dimensional lattices

tests/models/tinkertoy.mcnp

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
Tinkertoy 2
2+
1 1 -18.76 -1 2 3 7 -8 u=1 $ HEU Cylinder
3+
2 2 0.087058 -2 7 u=1 $ Left SS Rod
4+
3 2 0.087058 -3 7 u=1 $ Right SS Rod
5+
4 0 1 7 -8 u=1 $ Side Void
6+
5 0 -7 u=1 $ Bottom Void
7+
6 0 2 3 8 u=1 $ Top Void
8+
41 1 -18.76 -1 2 3 7 -8 u=2 $ HEU Cylinder
9+
42 2 0.087058 -2 u=2 $ Left SS Rod
10+
43 2 0.087058 -3 u=2 $ Right SS Rod
11+
44 0 1 7 -8 u=2 $ Side Void
12+
45 0 2 3 -7 u=2 $ Bottom Void
13+
46 0 2 3 8 u=2 $ Top Void
14+
51 1 -18.76 -1 2 3 7 -8 u=3 $ HEU Cylinder
15+
52 2 0.087058 -2 -8 u=3 $ Left SS Rod
16+
53 2 0.087058 -3 -8 u=3 $ Right SS Rod
17+
54 0 1 7 -8 u=3 $ Side Void
18+
55 0 2 3 -7 u=3 $ Bottom Void
19+
56 0 8 u=3 $ Top Void
20+
7 0 -9 6 -15 14 -25 22 u=4 $ 3x3x3 Array
21+
lat=1 fill=-1:1 -1:1 -1:1
22+
1 2 3 1 2 3 1 2 3
23+
1 2 3 1 2 3 1 2 3
24+
1 2 3 1 2 3 1 2 3
25+
8 0 5 -10 13 -16 19 -28 fill=4 $ Core
26+
9 0 4 -5 13 -16 20 -21 $ Left Void
27+
10 0 4 -5 13 -16 23 -24 $ Center Void
28+
11 0 4 -5 13 -16 26 -27 $ Right Void
29+
12 4 -0.93 4 -5 13 -16 19 -28
30+
#9 #10 #11 $ Lower Reflector
31+
13 0 10 -11 13 -16 20 -21 $ Left Void
32+
14 0 10 -11 13 -16 23 -24 $ Center Void
33+
15 0 10 -11 13 -16 26 -27 $ Right Void
34+
16 4 -0.93 10 -11 13 -16 19 -28
35+
#13 #14 #15 $ Upper Reflector
36+
17 4 -0.93 4 -11 12 -13 18 -29 $ Back Reflector
37+
18 4 -0.93 4 -11 16 -17 18 -29 $ Front Reflector
38+
19 4 -0.93 4 -11 13 -16 18 -19 $ Left Reflector
39+
20 4 -0.93 4 -11 13 -16 28 -29 $ Right Reflector
40+
c Concrete Room
41+
21 0 31 -32 36 -37 40 -41 (-4:11:-12:17:-18:29) $ Room void
42+
22 0 31 -32 35 -37 41 -42 $ Room void
43+
23 3 7.96492e-02 30 -33 34 -38 39 -40 $ floor of room
44+
24 3 7.96492e-02 30 -33 34 -36 40 -41 $ ledge
45+
25 3 7.96492e-02 30 -33 34 -35 41 -42 $ wall above ledge (south)
46+
26 3 7.96492e-02 30 -31 35 -36 41 -42 $ wall above ledge (west)
47+
27 3 7.96492e-02 32 -33 35 -36 41 -42 $ wall above ledge (east)
48+
28 3 7.96492e-02 30 -31 36 -37 40 -42 $ west wall
49+
29 3 7.96492e-02 32 -33 36 -37 40 -42 $ east wall
50+
30 3 7.96492e-02 30 -33 37 -38 40 -42 $ north wall
51+
31 3 7.96492e-02 30 -33 34 -38 42 -43 $ ceiling of room
52+
32 0 -30:33:-34:38:-39:43
53+
54+
1 cz 5.742 $ Radius of HEU Cylinder
55+
2 c/z 0 -4.2735 0.254 $ Radius of Left SS Rod
56+
3 c/z 0 4.2735 0.254 $ Radius of Right SS Rod
57+
4 pz -51.8275 $ Bottom of Lower Paraffin Sheet
58+
5 pz -44.2275 $ Top of Lower Paraffin Sheet
59+
6 pz -14.7425 $ Bottom of Cell
60+
7 pz -5.3825 $ Bottom of HEU Cylinder
61+
8 pz 5.3825 $ Top of HEU Cylinder
62+
9 pz 14.7425 $ Top of Cell
63+
10 pz 44.2275 $ Bottom of Upper Paraffin Sheet
64+
11 pz 51.8275 $ Top of Upper Paraffin Sheet
65+
12 py -52.906 $ Front Edge of Front Paraffin Sheet
66+
13 py -45.306 $ Back Edge of Front Paraffin Sheet
67+
14 py -15.102 $ Front Edge of Cell
68+
15 py 15.102 $ Back Edge of Cell
69+
16 py 45.306 $ Front Edge of Back Paraffin Sheet
70+
17 py 52.906 $ Back Edge of Back Paraffin Sheet
71+
18 px -52.906 $ Left Edge of Left Paraffin Sheet
72+
19 px -45.306 $ Right Edge of Left Paraffin Sheet
73+
20 px -30.458 $ Left Edge of Left Paraffin Gap
74+
21 px -29.950 $ Right Edge of Left Paraffin Gap
75+
22 px -15.102 $ Left Edge of Cell
76+
23 px -0.254 $ Left Edge of Center Paraffin Gap
77+
24 px 0.254 $ Right Edge of Center Paraffin Gap
78+
25 px 15.102 $ Right Edge of Cell
79+
26 px 29.950 $ Left Edge of Right Paraffin Gap
80+
27 px 30.458 $ Right Edge of Right Paraffin Ggap
81+
28 px 45.306 $ Left Edge of Right Paraffin Sheet
82+
29 px 52.906 $ Right Edge of Right Paraffin Sheet
83+
c Surfaces for room
84+
30 px -496.57 $ outside surface of concrete room
85+
31 px -344.17 $ inside surface of concrete room
86+
32 px 554.99 $ inside surface of concrete room
87+
33 px 600.71 $ outside surface of concrete room
88+
34 py -624.84 $ outside surface of concrete room
89+
35 py -563.88 $ inside surface of concrete room above 12 ft level
90+
36 py -502.92 $ inside surface of concrete room below 12 ft level
91+
37 py 428.96 $ inside surface of concrete room
92+
38 py 581.36 $ outside surface of concrete room
93+
c Heights in room -- these vary for each case
94+
39 pz -265.3725 $ bottom of room
95+
40 pz -173.9325 $ floor of room
96+
41 pz 191.8275 $ 12 ft high ledge in room
97+
42 pz 905.5675 $ ceiling of room
98+
43 pz 936.0475 $ top of room
99+
100+
c HEU
101+
m1 92234.80c 4.8271e-04
102+
92235.80c 4.4797e-02
103+
92236.80c 9.5723e-05
104+
92238.80c 2.6577e-03
105+
c Stainless steel
106+
m2 6000.80c 3.1691e-04
107+
25055.80c 1.7321e-03
108+
14028.80c 1.5624e-03
109+
14029.80c 7.9333e-05
110+
14030.80c 5.2296e-05
111+
24050.80c 7.1571e-04
112+
24052.80c 1.3802e-02
113+
24053.80c 1.5650e-03
114+
24054.80c 3.8956e-04
115+
26054.80c 3.5280e-03
116+
26056.80c 5.5383e-02
117+
26057.80c 1.2790e-03
118+
26058.80c 1.7022e-04
119+
28058.80c 4.4137e-03
120+
28060.80c 1.7001e-03
121+
28061.80c 7.3904e-05
122+
28062.80c 2.3564e-04
123+
28064.80c 6.0010e-05
124+
c Concrete
125+
m3 1001.80c 1.4866e-02
126+
1002.80c 1.7098e-06
127+
6000.80c 3.8144e-03
128+
8016.80c 4.1503e-02
129+
8017.80c 1.5777e-05
130+
11023.80c 3.0400e-04
131+
12024.80c 4.6367e-04
132+
12025.80c 5.8700e-05
133+
12026.80c 6.4629e-05
134+
13027.80c 7.3500e-04
135+
14028.80c 5.5679e-03
136+
14029.80c 2.8272e-04
137+
14030.80c 1.8637e-04
138+
20040.80c 1.1234e-02
139+
20042.80c 7.4974e-05
140+
20043.80c 1.5644e-05
141+
20044.80c 2.4173e-04
142+
20046.80c 4.6352e-07
143+
20048.80c 2.1670e-05
144+
26054.80c 1.1503e-05
145+
26056.80c 1.8057e-04
146+
26057.80c 4.1702e-06
147+
26058.80c 5.5498e-07
148+
c Paraffin
149+
m4 1001.80c 8.2565e-02
150+
1002.80c 9.4960e-06
151+
6000.80c 3.9699e-02
152+
mt4 poly.20t
153+
kcode 10000 1.0 20 3000
154+
ksrc 0 0 0
155+
imp:n 1 42r 0

tests/test_models.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from pathlib import Path
2+
import sys
3+
4+
import pytest
5+
from openmc_mcnp_adapter.openmc_conversion import mcnp_to_openmc
6+
7+
8+
MODELS_DIR = Path(__file__).parent / "models"
9+
MODELS = sorted(MODELS_DIR.glob("*.mcnp"))
10+
11+
12+
@pytest.mark.parametrize("mcnp_model", MODELS, ids=[path.stem for path in MODELS])
13+
def test_mcnp_models_convert(tmp_path, monkeypatch, mcnp_model):
14+
output_path = tmp_path / "model.xml"
15+
monkeypatch.chdir(tmp_path)
16+
monkeypatch.setattr(sys, "argv", [
17+
"mcnp_to_openmc",
18+
str(mcnp_model),
19+
"-o",
20+
str(output_path),
21+
])
22+
23+
mcnp_to_openmc()
24+
25+
assert output_path.exists(), "Expected OpenMC model.xml was not created"

0 commit comments

Comments
 (0)