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

Adding regression tests #195

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
73ea5ca
moved two methods out of start
shimwell May 21, 2024
5b15352
removed unnecessary logger line
shimwell May 21, 2024
604eb9b
Merge branch 'dev' of github.com:shimwell/GEOUNED into dev
shimwell May 21, 2024
bb17d1b
Merge branch 'dev' of github.com:shimwell/GEOUNED into dev
shimwell May 22, 2024
119fb5f
adding reg tests
shimwell May 23, 2024
8ffeb2b
added reg test
shimwell May 23, 2024
92abe49
format
shimwell May 23, 2024
e00d0a1
added regression files
shimwell May 23, 2024
deb4b9e
skipping lines with code version in
shimwell May 23, 2024
db69203
added another exception for step file name
shimwell May 24, 2024
b3634c0
format
shimwell May 24, 2024
e5c8877
removed space to match
shimwell May 24, 2024
4eb4240
one space allows :smile:
shimwell May 24, 2024
7195930
Merge branch 'dev' of github.com:shimwell/GEOUNED into dev
shimwell May 24, 2024
d69b944
Merge branch 'dev' of github.com:shimwell/GEOUNED into dev
shimwell May 27, 2024
ffab0d0
Merge branch 'dev' into adding_more_tests
shimwell May 27, 2024
b202289
splitting lines when needed to check floats
shimwell May 27, 2024
602c870
included xml files
shimwell May 27, 2024
48a6a6a
format
shimwell May 27, 2024
aabf500
rel tol to abs tol
shimwell May 27, 2024
48a99a5
increased tolerance to 1e-6
shimwell May 27, 2024
22e925a
added escape chars
shimwell May 27, 2024
5279256
format
shimwell May 27, 2024
2bbb66a
updated reg tests
shimwell May 27, 2024
2f5fdb6
pytest with -vv
shimwell May 27, 2024
fdc9397
split on single space
shimwell May 27, 2024
f4cff2d
using find all to get deliminators
shimwell May 27, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

- name: testing GEOUNED functionality
run: |
python -m pytest -v tests/test_convert.py
python -m pytest -vv tests/test_convert.py
geouned_cadtocsg -i tests/config_complete_defaults.json
geouned_cadtocsg -i tests/config_non_defaults.json

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ geouned_cadtocsg = "geouned.GEOUNED.scripts.geouned_cadtocsg:main"

[tool.black]
line-length = 128
exclude = '(tests/regression_test_files/.*|tests/regression_test_files)'

[tool.setuptools_scm]
write_to = "src/_version.py"
Expand Down
99 changes: 99 additions & 0 deletions tests/regression_test_files/DoubleCylinder/pieza/pieza.inp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
$ Converted with GEOUNED
$ ______ _______ _____ _ _ __ _ _______ ______
$ | ____ |______ | | ___ | | | \ | |______ | \
$ |_____| |______ |_____| |_____| | \_| |______ |_____/
$ Version : 1.0.2.dev9+gde280a7.d20240516
$ FreeCAD Version : 0.21.2
$ PHITSFormat Version : 0.0.2.3 06/03/2024
$
$ *************************************************************
$ Original Step file : /home/j/GEOUNED/testing/inputSTEP/DoubleCylinder/pieza.stp
$
$ Creation Date : 2024-05-27 14:58:50.279561
$ Solid Cells : 1
$ Total Cells : 4
$ Surfaces : 25
$ Materials : 0
$
$ **************************************************************


$
$ ##########################################################
$ CELL DEFINITION
$ ##########################################################
$
[CELL]
1 0 c0 5 12 13 17 -2 -6 -4 -3 -1:9 14 15 18 -8 -7 -6 -4 -3 -2:8 11
-10 -5 -3 -2:8 16 -11 -6 -5 -4 -3
$
$ ##########################################################
$ VOID CELLS
$ ##########################################################
$
3 0 -25 #1
$Inner void
$VOID CELL 2 merged, so the auto-genarated void definition is eliminated

4 -1 25
$Outer void

$
$ ##########################################################
$ SURFACE DEFINITION
$ ##########################################################
$
[SURFACE]
1 P 7.3784606e-01 1.3010219e-01 6.6231157e-01 6.2151356e+01
2 P -7.3317589e-01 -1.5876420e-01 6.6124659e-01 3.9619377e+00
3 P 1.9454321e-01 -9.8069494e-01 -1.9757901e-02 -2.5616969e-01
4 P 7.3317589e-01 1.5876420e-01 -6.6124659e-01 -3.5619377e+00
5 P 6.5161800e-01 1.1415500e-01 7.4990840e-01 6.1718805e+01
6 P -1.9454321e-01 9.8069494e-01 1.9757901e-02 1.5561697e+00
7 P -9.7530811e-01 -1.9803970e-01 9.7746401e-02 -3.1181735e+01
8 P 6.5161800e-01 1.1415500e-01 7.4990840e-01 5.9918805e+01
9 P 5.5507811e-01 9.7875202e-02 8.2601982e-01 5.8552434e+01
10 P -1.9454321e-01 9.8069494e-01 1.9757901e-02 4.3230585e-01
11 P -7.3317589e-01 -1.5876420e-01 6.6124659e-01 3.7619377e+00
12 GQ 0.581445710493123 0.979428677648543 0.439125611858333
-0.185582490672266 0.214829493665443 0.969033293610163
-91.036563460162242 -20.182321164678221 -82.507973908567408
3874.124028650739547
13 GQ 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-80.683629717363132 -15.212760650973010 -93.112824124640355
3852.757597861383147
14 GQ 0.350210777037867 0.966999139089362 0.682790083872771
-0.292872694310718 0.204628446913812 0.908007896256846
-64.287210850087817 -14.487746777464189 -96.683453265628231
3421.094783220790760
15 GQ 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-77.425539729930506 -14.641985610164674 -89.363282191651308
3548.663578546907047
16 GQ 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-78.898950172057866 -15.711929124146245 -91.253859470415335
3699.733024074039349
17 P -3.2073283e-01 -8.3985920e-01 -4.3791206e-01 -4.0147773e+01
18 P 5.1299389e-01 -6.8898809e-01 5.1198895e-01 3.7237088e+01
19 PX 3.4132386e+01
20 PX 3.9459381e+01
21 PY 5.3357981e+00
22 PY 9.0325477e+00
23 PZ 4.5197695e+01
24 PZ 5.0972496e+01
25 S 3.6795884e+01 7.1841729e+00 4.8085095e+01 4.4282323e+00

$
$ ##########################################################
$ MATERIAL DEFINITION
$ ##########################################################
$ All material labels present in this model are listed below
$ Need to change the dummy material definition(H2O1) to appropriate one(s)
$
[MATERIAL]
$ Change dummyMat M0, None c0 g/cm3 is assigned
M0 H 2 O 1


98 changes: 98 additions & 0 deletions tests/regression_test_files/DoubleCylinder/pieza/pieza.mcnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Converted with GEOUNED
C ______ _______ _____ _ _ __ _ _______ ______
C | ____ |______ | | ___ | | | \ | |______ | \
C |_____| |______ |_____| |_____| | \_| |______ |_____/
C Version : 1.0.2.dev9+gde280a7.d20240516
C FreeCAD Version : 0.21.2
C
C *************************************************************
C Original Step file : /home/j/GEOUNED/testing/inputSTEP/DoubleCylinder/pieza.stp
C
C Creation Date : 2024-05-27 14:58:50.276045
C Solid Cells : 1
C Total Cells : 4
C Surfaces : 25
C Materials : 0
C
C **************************************************************
1 0 5 12 13 17 -2 -6 -4 -3 -1:9 14 15 18 -8 -7 -6 -4 -3 -2:8 11 -10 -5
-3 -2:8 16 -11 -6 -5 -4 -3
imp:n=1.0 imp:p=1.0
C
C ##########################################################
C VOID CELLS
C ##########################################################
C
2 0 19 -20 21 -22 23 -24 (3:(2:((-17:-13:-12:1:-5) (-18:-15:-14:-9:7:8)
:4:6) (10:-11:-8:5)) (-16:-8:11:6:5:4))
imp:n=1.0 imp:p=1.0
$Automatic Generated Void Cell. Enclosure(34.132, 39.459, 5.336, 9.033, 45.198, 50.972)
$Enclosed cells : (1)
3 0 -25 (-19:20:-21:22:-23:24)
imp:n=1.0 imp:p=1.0
$Graveyard_in
4 0 25
imp:n=0 imp:p=0
$Graveyard

C ##########################################################
C SURFACE DEFINITION
C ##########################################################
1 P 7.3784606e-01 1.3010219e-01 6.6231157e-01 6.2151356e+01
2 P -7.3317589e-01 -1.5876420e-01 6.6124659e-01 3.9619377e+00
3 P 1.9454321e-01 -9.8069494e-01 -1.9757901e-02 -2.5616969e-01
4 P 7.3317589e-01 1.5876420e-01 -6.6124659e-01 -3.5619377e+00
5 P 6.5161800e-01 1.1415500e-01 7.4990840e-01 6.1718805e+01
6 P -1.9454321e-01 9.8069494e-01 1.9757901e-02 1.5561697e+00
7 P -9.7530811e-01 -1.9803970e-01 9.7746401e-02 -3.1181735e+01
8 P 6.5161800e-01 1.1415500e-01 7.4990840e-01 5.9918805e+01
9 P 5.5507811e-01 9.7875202e-02 8.2601982e-01 5.8552434e+01
10 P -1.9454321e-01 9.8069494e-01 1.9757901e-02 4.3230585e-01
11 P -7.3317589e-01 -1.5876420e-01 6.6124659e-01 3.7619377e+00
12 GQ 0.581445710493123 0.979428677648543 0.439125611858333
-0.185582490672266 0.214829493665443 0.969033293610163
-91.036563460162242 -20.182321164678221 -82.507973908567408
3874.124028650739547
13 GQ 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-80.683629717363132 -15.212760650973010 -93.112824124640355
3852.757597861383147
14 GQ 0.350210777037867 0.966999139089362 0.682790083872771
-0.292872694310718 0.204628446913812 0.908007896256846
-64.287210850087817 -14.487746777464189 -96.683453265628231
3421.094783220790760
15 GQ 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-77.425539729930506 -14.641985610164674 -89.363282191651308
3548.663578546907047
16 GQ 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-78.898950172057866 -15.711929124146245 -91.253859470415335
3699.733024074039349
17 P -3.2073283e-01 -8.3985920e-01 -4.3791206e-01 -4.0147773e+01
18 P 5.1299389e-01 -6.8898809e-01 5.1198895e-01 3.7237088e+01
19 PX 3.4132386e+01
20 PX 3.9459381e+01
21 PY 5.3357981e+00
22 PY 9.0325477e+00
23 PZ 4.5197695e+01
24 PZ 5.0972496e+01
25 S 3.6795884e+01 7.1841729e+00 4.8085095e+01 4.4282323e+00

C
MODE P
VOID
NPS 1e6
PRDMP 2J -1
C SDEF PAR=P X=D1 Y=D2 Z=D3
C SI1 3.4132386e+01 3.9459381e+01
C SI2 5.3357981e+00 9.0325477e+00
C SI3 4.5197695e+01 5.0972496e+01
C SP1 0 1
C SP2 0 1
C SP3 0 1
SDEF PAR=P NRM=-1 SUR=25 WGT=6.1604248e+01 DIR=d1
SI1 0 1
SP1 -21 1
F4:P 1
SD4 1.1545693e+00
42 changes: 42 additions & 0 deletions tests/regression_test_files/DoubleCylinder/pieza/pieza.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# openMC geometry script generated by GEOUNED
import openmc

###############################################################################
# Define problem geometry
###############################################################################


# Surface setup
S1 = openmc.Plane(a=0.7378460611802498,b=0.13010219315504395,c=0.6623115651542247,d=62.151356300075804)
S2 = openmc.Plane(a=-0.733175886232957,b=-0.158764197018991,c=0.661246587583961,d=3.9619377256223913)
S3 = openmc.Plane(a=0.194543207959962,b=-0.980694940127811,c=-0.0197579008084462,d=-0.25616969049352606)
S4 = openmc.Plane(a=0.733175886232957,b=0.158764197018991,c=-0.661246587583961,d=-3.561937733133169)
S5 = openmc.Plane(a=0.6516180031473319,b=0.11415500055105819,c=0.7499084036223835,d=61.71880510810279)
S6 = openmc.Plane(a=-0.194543207959962,b=0.980694940127811,c=0.0197579008084462,d=1.5561697436868895)
S7 = openmc.Plane(a=-0.9753081139396753,b=-0.19803970283093406,c=0.09774640139702742,d=-31.181734815666985)
S8 = openmc.Plane(a=0.6516180031473329,b=0.11415500055105797,c=0.7499084036223829,d=59.91880509940907)
S9 = openmc.Plane(a=0.5550781105833491,b=0.09787520186621142,c=0.8260198157495181,d=58.55243395636722)
S10 = openmc.Plane(a=-0.194543207959962,b=0.980694940127811,c=0.0197579008084462,d=0.43230584769981795)
S11 = openmc.Plane(a=-0.7331758862329569,b=-0.1587641970189915,c=0.661246587583961,d=3.7619377293777805)
S12 = openmc.Cylinder(x0=37.673800035056,y0=8.3520809844321,z0=50.33472525295301,r=1.2300018418939,dx=-0.6469577184846603,dy=-0.14342706282796008,dz=0.7489154746309274)
S13 = openmc.Cylinder(x0=37.04412122692,y0=6.8922876314062,z0=49.530580397858,r=0.2468886454605,dx=-0.7331759139790219,dy=-0.15876416129305196,dz=0.6612465653974618)
S14 = openmc.Cylinder(x0=34.270219418778,y0=7.7231266204682,z0=46.855873812881,r=1.229968297897,dx=-0.8060950458613012,dy=-0.18166139080893806,dz=0.5632139168444162)
S15 = openmc.Cylinder(x0=35.246685437671,y0=6.570436251630101,z0=47.807679989394,r=0.246898236319,dx=-0.7331759139790219,dy=-0.15876416129305196,dz=0.6612465653974618)
S16 = openmc.Cylinder(x0=36.125776629678,y0=7.1362407035113,z0=48.624551652097004,r=0.24689421075430001,dx=-0.7331759139790219,dy=-0.15876416129305196,dz=0.6612465653974618)
S17 = openmc.Plane(a=-0.32073283389413365,b=-0.839859199072995,c=-0.4379120630842516,d=-40.14777337947996)
S18 = openmc.Plane(a=0.512993890808528,b=-0.6889880897445669,c=0.5119889453721248,d=37.23708775977344)
S19 = openmc.XPlane(x0=34.13238636210711)
S20 = openmc.XPlane(x0=39.45938114769521)
S21 = openmc.YPlane(y0=5.3357981334812665)
S22 = openmc.YPlane(y0=9.032547691019097)
S23 = openmc.ZPlane(z0=45.19769476089668)
S24 = openmc.ZPlane(z0=50.972496101482704)
S25 = openmc.Sphere(x0=36.79588375490116,y0=7.184172912250182,z0=48.08509543118969,r=4.428232270753759, boundary_type="vacuum")

# Cell definition
C1 = openmc.Cell(name="", region=((+S5 & +S12 & +S13 & +S17 & -S2 & -S6 & -S4 & -S3 & -S1) | (+S9 & +S14 & +S15 & +S18 & -S8 & -S7 & -S6 & -S4 & -S3 & -S2) | (+S8 & +S11 & -S10 & -S5 & -S3 & -S2) | (+S8 & +S16 & -S11 & -S6 & -S5 & -S4 & -S3)))
C2 = openmc.Cell(name="Automatic Generated Void Cell. Enclosure(34.132, 39.459, 5.336, 9.033, 45.198, 50.972). Enclosed cells : (1)", region=(+S19 & -S20 & +S21 & -S22 & +S23 & -S24 & ((+S3) | (((+S2) | ((((-S17 | -S13 | -S12 | +S1 | -S5) & (-S18 | -S15 | -S14 | -S9 | +S7 | +S8)) | (+S4 | +S6)) & (+S10 | -S11 | -S8 | +S5))) & (-S16 | -S8 | +S11 | +S6 | +S5 | +S4)))))
C3 = openmc.Cell(name="", region=(-S25 & (-S19 | +S20 | -S21 | +S22 | -S23 | +S24)))

geometry = openmc.Geometry([C1, C2, C3])
geometry.export_to_xml()
76 changes: 76 additions & 0 deletions tests/regression_test_files/DoubleCylinder/pieza/pieza.serp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
Converted with GEOUNED
% ______ _______ _____ _ _ __ _ _______ ______
% | ____ |______ | | ___ | | | \ | |______ | \
% |_____| |______ |_____| |_____| | \_| |______ |_____/
% Version : 1.0.2.dev9+gde280a7.d20240516
% FreeCAD Version : 0.21.2
%
% *************************************************************
% Original Step file : /home/j/GEOUNED/testing/inputSTEP/DoubleCylinder/pieza.stp
%
% Creation Date : 2024-05-27 14:58:50.278283
% Solid Cells : 1
% Total Cells : 4
% Surfaces : 25
% Materials : 0
%
% **************************************************************
% --- CELL DEFINITIONS
cell 1 0 void 5 12 13 17 -2 -6 -4 -3 -1:9 14 15 18 -8 -7 -6 -4 -3 -2:8 11
-10 -5 -3 -2:8 16 -11 -6 -5 -4 -3%
% ##########################################################
% VOID CELLS
% ##########################################################
%
cell 2 0 void 19 -20 21 -22 23 -24 (3:(2:((-17:-13:-12:1:-5) (-18:-15:-14:
-9:7:8):4:6) (10:-11:-8:5)) (-16:-8:11:6:5:4)) %Automatic Generated Void Cell. Enclosure(34.132, 39.459, 5.336, 9.033, 45.198, 50.972)
%Enclosed cells : (1)
cell 3 0 void -25 (-19:20:-21:22:-23:24) %Graveyard_in
cell 4 0 outside 25 %Graveyard

% --- SURFACE DEFINITIONS
surf 1 plane 7.3784606e-01 1.3010219e-01 6.6231157e-01 6.2151356e+01
surf 2 plane -7.3317589e-01 -1.5876420e-01 6.6124659e-01 3.9619377e+00
surf 3 plane 1.9454321e-01 -9.8069494e-01 -1.9757901e-02 -2.5616969e-01
surf 4 plane 7.3317589e-01 1.5876420e-01 -6.6124659e-01 -3.5619377e+00
surf 5 plane 6.5161800e-01 1.1415500e-01 7.4990840e-01 6.1718805e+01
surf 6 plane -1.9454321e-01 9.8069494e-01 1.9757901e-02 1.5561697e+00
surf 7 plane -9.7530811e-01 -1.9803970e-01 9.7746401e-02 -3.1181735e+01
surf 8 plane 6.5161800e-01 1.1415500e-01 7.4990840e-01 5.9918805e+01
surf 9 plane 5.5507811e-01 9.7875202e-02 8.2601982e-01 5.8552434e+01
surf 10 plane -1.9454321e-01 9.8069494e-01 1.9757901e-02 4.3230585e-01
surf 11 plane -7.3317589e-01 -1.5876420e-01 6.6124659e-01 3.7619377e+00
surf quadratic 0.581445710493123 0.979428677648543 0.439125611858333
-0.185582490672266 0.214829493665443 0.969033293610163
-91.036563460162242 -20.182321164678221 -82.507973908567408
3874.124028650739547
surf quadratic 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-80.683629717363132 -15.212760650973010 -93.112824124640355
3852.757597861383147
surf quadratic 0.350210777037867 0.966999139089362 0.682790083872771
-0.292872694310718 0.204628446913812 0.908007896256846
-64.287210850087817 -14.487746777464189 -96.683453265628231
3421.094783220790760
surf quadratic 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-77.425539729930506 -14.641985610164674 -89.363282191651308
3548.663578546907047
surf quadratic 0.462453079161026 0.974793941088914 0.562752979750060
-0.232804118126292 0.209964512726479 0.969620109901546
-78.898950172057866 -15.711929124146245 -91.253859470415335
3699.733024074039349
surf 17 plane -3.2073283e-01 -8.3985920e-01 -4.3791206e-01 -4.0147773e+01
surf 18 plane 5.1299389e-01 -6.8898809e-01 5.1198895e-01 3.7237088e+01
surf 19 px 3.4132386e+01
surf 20 px 3.9459381e+01
surf 21 py 5.3357981e+00
surf 22 py 9.0325477e+00
surf 23 pz 4.5197695e+01
surf 24 pz 5.0972496e+01
surf 25 sph 3.6795884e+01 7.1841729e+00 4.8085095e+01 4.4282323e+00

%

set nps 1e6
set bc 1
Loading
Loading