diff --git a/.gitignore b/.gitignore index b8ca166..8f53157 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ __pycache__ *.egg-info +.coverage diff --git a/README.md b/README.md index 711a6cb..db94889 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ to manually set boundary conditions on the outermost surfaces. Some geometry features are not currently supported: - Periodic boundary conditions -- `X`, `Y`, and `Z` surfaces with 1 or 3 coordinate pairs +- `X`, `Y`, and `Z` surfaces with 3 coordinate pairs - `RHP`, `REC`, `ELL`, `WED`, and `ARB` macrobodies - Hexagonal lattices - One-dimensional lattices diff --git a/tests/models/tinkertoy.mcnp b/tests/models/tinkertoy.mcnp new file mode 100644 index 0000000..5f63173 --- /dev/null +++ b/tests/models/tinkertoy.mcnp @@ -0,0 +1,155 @@ +Tinkertoy 2 +1 1 -18.76 -1 2 3 7 -8 u=1 $ HEU Cylinder +2 2 0.087058 -2 7 u=1 $ Left SS Rod +3 2 0.087058 -3 7 u=1 $ Right SS Rod +4 0 1 7 -8 u=1 $ Side Void +5 0 -7 u=1 $ Bottom Void +6 0 2 3 8 u=1 $ Top Void +41 1 -18.76 -1 2 3 7 -8 u=2 $ HEU Cylinder +42 2 0.087058 -2 u=2 $ Left SS Rod +43 2 0.087058 -3 u=2 $ Right SS Rod +44 0 1 7 -8 u=2 $ Side Void +45 0 2 3 -7 u=2 $ Bottom Void +46 0 2 3 8 u=2 $ Top Void +51 1 -18.76 -1 2 3 7 -8 u=3 $ HEU Cylinder +52 2 0.087058 -2 -8 u=3 $ Left SS Rod +53 2 0.087058 -3 -8 u=3 $ Right SS Rod +54 0 1 7 -8 u=3 $ Side Void +55 0 2 3 -7 u=3 $ Bottom Void +56 0 8 u=3 $ Top Void +7 0 -9 6 -15 14 -25 22 u=4 $ 3x3x3 Array + lat=1 fill=-1:1 -1:1 -1:1 + 1 2 3 1 2 3 1 2 3 + 1 2 3 1 2 3 1 2 3 + 1 2 3 1 2 3 1 2 3 +8 0 5 -10 13 -16 19 -28 fill=4 $ Core +9 0 4 -5 13 -16 20 -21 $ Left Void +10 0 4 -5 13 -16 23 -24 $ Center Void +11 0 4 -5 13 -16 26 -27 $ Right Void +12 4 -0.93 4 -5 13 -16 19 -28 + #9 #10 #11 $ Lower Reflector +13 0 10 -11 13 -16 20 -21 $ Left Void +14 0 10 -11 13 -16 23 -24 $ Center Void +15 0 10 -11 13 -16 26 -27 $ Right Void +16 4 -0.93 10 -11 13 -16 19 -28 + #13 #14 #15 $ Upper Reflector +17 4 -0.93 4 -11 12 -13 18 -29 $ Back Reflector +18 4 -0.93 4 -11 16 -17 18 -29 $ Front Reflector +19 4 -0.93 4 -11 13 -16 18 -19 $ Left Reflector +20 4 -0.93 4 -11 13 -16 28 -29 $ Right Reflector +c Concrete Room +21 0 31 -32 36 -37 40 -41 (-4:11:-12:17:-18:29) $ Room void +22 0 31 -32 35 -37 41 -42 $ Room void +23 3 7.96492e-02 30 -33 34 -38 39 -40 $ floor of room +24 3 7.96492e-02 30 -33 34 -36 40 -41 $ ledge +25 3 7.96492e-02 30 -33 34 -35 41 -42 $ wall above ledge (south) +26 3 7.96492e-02 30 -31 35 -36 41 -42 $ wall above ledge (west) +27 3 7.96492e-02 32 -33 35 -36 41 -42 $ wall above ledge (east) +28 3 7.96492e-02 30 -31 36 -37 40 -42 $ west wall +29 3 7.96492e-02 32 -33 36 -37 40 -42 $ east wall +30 3 7.96492e-02 30 -33 37 -38 40 -42 $ north wall +31 3 7.96492e-02 30 -33 34 -38 42 -43 $ ceiling of room +32 0 -30:33:-34:38:-39:43 + +1 cz 5.742 $ Radius of HEU Cylinder +2 c/z 0 -4.2735 0.254 $ Radius of Left SS Rod +3 c/z 0 4.2735 0.254 $ Radius of Right SS Rod +4 pz -51.8275 $ Bottom of Lower Paraffin Sheet +5 pz -44.2275 $ Top of Lower Paraffin Sheet +6 pz -14.7425 $ Bottom of Cell +7 pz -5.3825 $ Bottom of HEU Cylinder +8 pz 5.3825 $ Top of HEU Cylinder +9 pz 14.7425 $ Top of Cell +10 pz 44.2275 $ Bottom of Upper Paraffin Sheet +11 pz 51.8275 $ Top of Upper Paraffin Sheet +12 py -52.906 $ Front Edge of Front Paraffin Sheet +13 py -45.306 $ Back Edge of Front Paraffin Sheet +14 py -15.102 $ Front Edge of Cell +15 py 15.102 $ Back Edge of Cell +16 py 45.306 $ Front Edge of Back Paraffin Sheet +17 py 52.906 $ Back Edge of Back Paraffin Sheet +18 px -52.906 $ Left Edge of Left Paraffin Sheet +19 px -45.306 $ Right Edge of Left Paraffin Sheet +20 px -30.458 $ Left Edge of Left Paraffin Gap +21 px -29.950 $ Right Edge of Left Paraffin Gap +22 px -15.102 $ Left Edge of Cell +23 px -0.254 $ Left Edge of Center Paraffin Gap +24 px 0.254 $ Right Edge of Center Paraffin Gap +25 px 15.102 $ Right Edge of Cell +26 px 29.950 $ Left Edge of Right Paraffin Gap +27 px 30.458 $ Right Edge of Right Paraffin Ggap +28 px 45.306 $ Left Edge of Right Paraffin Sheet +29 px 52.906 $ Right Edge of Right Paraffin Sheet +c Surfaces for room +30 px -496.57 $ outside surface of concrete room +31 px -344.17 $ inside surface of concrete room +32 px 554.99 $ inside surface of concrete room +33 px 600.71 $ outside surface of concrete room +34 py -624.84 $ outside surface of concrete room +35 py -563.88 $ inside surface of concrete room above 12 ft level +36 py -502.92 $ inside surface of concrete room below 12 ft level +37 py 428.96 $ inside surface of concrete room +38 py 581.36 $ outside surface of concrete room +c Heights in room -- these vary for each case +39 pz -265.3725 $ bottom of room +40 pz -173.9325 $ floor of room +41 pz 191.8275 $ 12 ft high ledge in room +42 pz 905.5675 $ ceiling of room +43 pz 936.0475 $ top of room + +c HEU +m1 92234.80c 4.8271e-04 + 92235.80c 4.4797e-02 + 92236.80c 9.5723e-05 + 92238.80c 2.6577e-03 +c Stainless steel +m2 6000.80c 3.1691e-04 + 25055.80c 1.7321e-03 + 14028.80c 1.5624e-03 + 14029.80c 7.9333e-05 + 14030.80c 5.2296e-05 + 24050.80c 7.1571e-04 + 24052.80c 1.3802e-02 + 24053.80c 1.5650e-03 + 24054.80c 3.8956e-04 + 26054.80c 3.5280e-03 + 26056.80c 5.5383e-02 + 26057.80c 1.2790e-03 + 26058.80c 1.7022e-04 + 28058.80c 4.4137e-03 + 28060.80c 1.7001e-03 + 28061.80c 7.3904e-05 + 28062.80c 2.3564e-04 + 28064.80c 6.0010e-05 +c Concrete +m3 1001.80c 1.4866e-02 + 1002.80c 1.7098e-06 + 6000.80c 3.8144e-03 + 8016.80c 4.1503e-02 + 8017.80c 1.5777e-05 + 11023.80c 3.0400e-04 + 12024.80c 4.6367e-04 + 12025.80c 5.8700e-05 + 12026.80c 6.4629e-05 + 13027.80c 7.3500e-04 + 14028.80c 5.5679e-03 + 14029.80c 2.8272e-04 + 14030.80c 1.8637e-04 + 20040.80c 1.1234e-02 + 20042.80c 7.4974e-05 + 20043.80c 1.5644e-05 + 20044.80c 2.4173e-04 + 20046.80c 4.6352e-07 + 20048.80c 2.1670e-05 + 26054.80c 1.1503e-05 + 26056.80c 1.8057e-04 + 26057.80c 4.1702e-06 + 26058.80c 5.5498e-07 +c Paraffin +m4 1001.80c 8.2565e-02 + 1002.80c 9.4960e-06 + 6000.80c 3.9699e-02 +mt4 poly.20t +kcode 10000 1.0 20 3000 +ksrc 0 0 0 +imp:n 1 42r 0 diff --git a/tests/test_models.py b/tests/test_models.py new file mode 100644 index 0000000..2602fa4 --- /dev/null +++ b/tests/test_models.py @@ -0,0 +1,25 @@ +from pathlib import Path +import sys + +import pytest +from openmc_mcnp_adapter.openmc_conversion import mcnp_to_openmc + + +MODELS_DIR = Path(__file__).parent / "models" +MODELS = sorted(MODELS_DIR.glob("*.mcnp")) + + +@pytest.mark.parametrize("mcnp_model", MODELS, ids=[path.stem for path in MODELS]) +def test_mcnp_models_convert(tmp_path, monkeypatch, mcnp_model): + output_path = tmp_path / "model.xml" + monkeypatch.chdir(tmp_path) + monkeypatch.setattr(sys, "argv", [ + "mcnp_to_openmc", + str(mcnp_model), + "-o", + str(output_path), + ]) + + mcnp_to_openmc() + + assert output_path.exists(), "Expected OpenMC model.xml was not created"