From 83b04738681489b21f6a824ddc7047a06ec5f76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Delaporte-Mathurin?= <40028739+RemiTheWarrior@users.noreply.github.com> Date: Wed, 17 Feb 2021 13:38:09 +0100 Subject: [PATCH 01/26] new script --- examples/example_parametric_reactors/DEMO.py | 261 +++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 examples/example_parametric_reactors/DEMO.py diff --git a/examples/example_parametric_reactors/DEMO.py b/examples/example_parametric_reactors/DEMO.py new file mode 100644 index 000000000..a9b1179f9 --- /dev/null +++ b/examples/example_parametric_reactors/DEMO.py @@ -0,0 +1,261 @@ +import paramak + + +def main(rotation_angle=180): + + outboard_pf_coils = paramak.PoloidalFieldCoilSet( + center_points=[ + (689, -985), + (1421, -689), + (1580, -252), + (1550, 293), + (1400, 598), + (621, 811), + ], + widths=[ + 803-599, + 1492 - 1351, + 1628 - 1526, + 1598 - 1503, + 1439 - 1360, + 684 - 563 + ], + heights=[ + 803-599, + 1492 - 1351, + 1628 - 1526, + 1598 - 1503, + 1439 - 1360, + 684 - 563 + ], + rotation_angle=rotation_angle, + stp_filename='outboard_pf_coils.stp' + ) + + EFCCu_coils_1 = paramak.RotateStraightShape( + points=[ + (263.6088589363423, -881.6221003581469), + (263.6088589363423, -609.1721122963762), + (363.04586051526934, -609.1721122963762), + (363.04586051526934, -881.6221003581469), + ], + rotation_angle=rotation_angle, + stp_filename='EFCCu_coils_1.stp', + stl_filename='EFCCu_coils_1.stl' + ) + EFCCu_coils_2 = paramak.RotateStraightShape( + points=[ + (266.2030353910733, -332.3839488581665), + (357.77071359802824, -332.3839488581665), + (357.77071359802824, -600.8478453421652), + (266.2030353910733, -600.8478453421652), + ], + rotation_angle=rotation_angle, + stp_filename='EFCCu_coils_2.stp', + stl_filename='EFCCu_coils_2.stl' + ) + EFCCu_coils_3 = paramak.RotateStraightShape( + points=[ + (263.5606400431317, 217.1559887549579), + (360.3263149381907, 217.1559887549579), + (360.3263149381907, -316.0372010628879), + (263.5606400431317, -316.0372010628879), + ], + rotation_angle=rotation_angle, + stp_filename='EFCCu_coils_3.stp', + stl_filename='EFCCu_coils_3.stl' + ) + + EFCCu_coils_4 = paramak.RotateStraightShape( + points=[ + (262.2297985905187, 493.9315777717868), + (357.70320714753336, 493.9315777717868), + (357.70320714753336, 229.49149612970268), + (262.2297985905187, 229.49149612970268), + ], + rotation_angle=rotation_angle, + stp_filename='EFCCu_coils_4.stp', + stl_filename='EFCCu_coils_4.stl' + ) + EFCCu_coils_5 = paramak.RotateStraightShape( + points=[ + (261.01468248161126, 746.6397242654133), + (356.35307813763615, 746.6397242654133), + (356.35307813763615, 510.27832556706545), + (261.01468248161126, 510.27832556706545), + ], + rotation_angle=rotation_angle, + stp_filename='EFCCu_coils_5.stp', + stl_filename='EFCCu_coils_5.stl' + ) + + centre_coils = [EFCCu_coils_1, EFCCu_coils_2, EFCCu_coils_3, EFCCu_coils_4, EFCCu_coils_5] + + # plasma = paramak.Plasma( + # major_radius=185, + # minor_radius=57 - 6, # 3 is a small ofset to avoid overlaps + # triangularity=0.31, + # elongation=1.97, + # rotation_angle=rotation_angle, + # stp_filename='plasma.stp', + # ) + thickness_outer_leg = 1500 - 1340 + R1 = 511-50/2 + R2 = 1340+50/2 + coil_thickness = 25 + tf_coil = paramak.ToroidalFieldCoilPrincetonD( + R1=R1, + R2=R2, + thickness=coil_thickness, + distance=coil_thickness, + number_of_coils=6, + rotation_angle=rotation_angle, + stl_filename='tf_coil.stl' + ) + offset = (1500 - 1340 - coil_thickness)/2 + tf_coil_casing = paramak.TFCoilCasing( + tf_coil, + inner_offset=R2 - 1340, + outer_offset=1500-R2-coil_thickness, + vertical_section_offset=25, + distance=100, + rotation_angle=rotation_angle, + stl_filename="tf_coil_casing.stl" + ) + + vac_vessel = paramak.RotateStraightShape( + points=[ + (807.3058112219354, 599.9716732776211), + (944.7007255362573, 596.4005376054217), + (1066.6077313513304, 548.6554596218273), + (1176.8939839026452, 468.7827350098197), + (1252.009375746139, 356.7069172411133), + (1311.4632710748253, 236.55832094581558), + (1331.6284122155039, 124.30646127777527), + (1335.7655932529747, 80.19539107328501), + (1344.2521184580423, -52.150393961566806), + (1336.6142457734813, -96.29918743020028), + (1325.2635183117027, -184.5841999460855), + (1313.874215735356, -264.8467316209036), + (1286.7848415296335, -345.1595609812456), + (1224.659619517079, -485.7541664420229), + (1162.3222343743978, -582.2251272769284), + (1072.4518612084566, -666.7503877998998), + (1013.7308930565716, -699.0289274848848), + (947.1406015327145, -727.321375592098), + (813.6899926830206, -727.7489059190513), + (738.9989270997804, -703.9203774020874), + (668.1364416374629, -660.0230723610736), + (609.0297223398928, -612.0768036353835), + (549.6915523549119, -515.9956498632881), + (521.8113883005352, -431.84762198174633), + (517.6742072630645, -387.73655177725584), + (516.1119151230407, -62.82607771402195), + (514.4917603111641, 274.11811761081333), + (533.6539484730619, 370.4507598105283), + (564.7262032579812, 438.74244233065), + (607.6120868795008, 499.0493672738471), + (674.0866530596526, 551.4092579042626), + (732.8269087688219, 579.6765571687138), + ], + rotation_angle=rotation_angle, + stp_filename='vacvessel.stp', + stl_filename='vacvessel.stl', + ) + + blanket = paramak.RotateMixedShape( + points=[ + (1028.5051619363035, -506.43908961374075, "spline"), + (1130.0155759232866, -393.79742288289015, "spline"), + (1192.275810836831, -281.2815003658492, "spline"), + (1238.8359741209995, -168.81587553433235, "spline"), + (1257.92101205376, -56.43827165248217, "spline"), + (1269.0210012708435, 83.99286633034205, "spline"), + (1244.8344044363996, 216.28835367966997, "spline"), + (1205.0441737590018, 328.47734124080523, "spline"), + (1153.671764932414, 400.5162013324601, "spline"), + (1074.843518311703, 468.4558000539141, "spline"), + (988.2423861054414, 520.3252882504712, "spline"), + (941.0843085454615, 532.2081164555008, "spline"), + (807.595124581199, 539.8030669696149, "spline"), + (740.9855455000577, 515.5218592829356, "spline"), + (670.5280987407093, 475.18311549274034, "spline"), + (619.7728917472175, 418.862282127315, "spline"), + (584.8527692840913, 334.5130635036775, "spline"), + (577.2148965995302, 290.3642700350441, "spline"), + (574.292831670967, 81.767193745908, "spline"), + (579.0665020988178, -94.71481033619636, "spline"), + (579.3751030153657, -158.89465706473618, "spline"), + (579.8572919474718, -259.17566757808015, "spline"), + (580.3587684368622, -363.4679185119577, "straight"), + (686.29567682058, -355.1059282936036, "spline"), + (670.190566488235, -270.9201771479187, "spline"), + (657.9911865059497, -182.71061116031922, "straight"), + (657.4125597874224, -62.3733985443065, "straight"), + (656.6796326106211, 90.05373743597613, "straight"), + (652.0409750837601, 238.45705857434393, "spline"), + (671.3960388185003, 294.67729656872143, "spline"), + (694.7146955751529, 342.8876281434125, "spline"), + (725.9412508183462, 379.089387299264, "spline"), + (765.0757045480802, 403.2825740362764, "spline"), + (804.2487333923825, 419.4532799322212, "spline"), + (949.5322586359608, 407.8848122617163, "spline"), + (1036.1333908422225, 356.0153240651591, "spline"), + (1067.764984788385, 307.98103438980206, "spline"), + (1095.4908483844877, 255.92292987253006, "spline"), + (1115.4631139523237, 183.7834744098276, "spline"), + (1127.4889059190507, 131.6750722070317, "spline"), + (1135.5703924211496, 83.56533600338867, "spline"), + (1128.4147086686944, -60.864467978588436, "spline"), + (1113.0811006277195, -137.12833365425365, "spline"), + (1082.0859960719372, -221.46497785651047, "spline"), + (1031.4658019794351, -305.864494165672, "spline"), + (945.6554596218276, -418.4558632109989, "straight"), + + ], + rotation_angle=rotation_angle, + stl_filename="blanket.stl" + ) + + divertor = paramak.RotateMixedShape( + points=[ + (580.3587684368622, -363.4679185119577, "straight"), + (678.5035036777448, -367.1647983979668, "straight"), + (698.2057434436014, -383.14688797319684, "straight"), + (706.2100797165632, -415.21166249470514, "straight"), + (698.4950568028651, -443.3154942812033, "straight"), + (694.7436269110794, -479.42923248738805, "straight"), + (690.8764716755882, -491.47552817037024, "straight"), + (726.2209203989679, -495.3735987984752, "straight"), + (745.6917094774136, -463.22080332730013, "straight"), + (769.222529364193, -459.1341163784806, "straight"), + (788.8861940154811, -467.093725112643, "straight"), + (808.5691462240535, -479.0645742673395, "straight"), + (863.866572957985, -551.0908599376131, "straight"), + (891.3995609812453, -563.0365602495477, "straight"), + (895.1702784303153, -530.9340624638968, "straight"), + (883.2602118072937, -502.8931027843033, "straight"), + (886.9923541417953, -462.76812415758457, "straight"), + (929.9168128778833, -410.48368005545524, "straight"), + (1036.3937728655599, -514.4364216120463, "straight"), + (985.8893041167635, -622.9033804444106, "straight"), + (946.7548503870296, -647.096567181423, "straight"), + (801.5291878153039, -647.5618207725194, "straight"), + (675.5814387491815, -575.7618746871029, "straight"), + (612.3761135287094, -491.72701659798975, "straight"), + (584.5345245889013, -415.60146955751554, "straight"), + ], + rotation_angle=rotation_angle, + stl_filename="divertor.stl" + ) + + + demo = paramak.Reactor([*centre_coils, blanket, vac_vessel, outboard_pf_coils, divertor, tf_coil, tf_coil_casing, ]) + + demo.export_stl() + demo.export_svg('demo.svg') + demo.export_html('demo.html') + + +if __name__ == "__main__": + main() \ No newline at end of file From 7882bef1a46bde649e511ee728df2b5d3074f6bb Mon Sep 17 00:00:00 2001 From: autopep8 Date: Wed, 17 Feb 2021 12:41:01 +0000 Subject: [PATCH 02/26] Automated autopep8 fixes --- examples/example_parametric_reactors/DEMO.py | 35 +++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/examples/example_parametric_reactors/DEMO.py b/examples/example_parametric_reactors/DEMO.py index a9b1179f9..6e7e95e07 100644 --- a/examples/example_parametric_reactors/DEMO.py +++ b/examples/example_parametric_reactors/DEMO.py @@ -13,21 +13,21 @@ def main(rotation_angle=180): (621, 811), ], widths=[ - 803-599, + 803 - 599, 1492 - 1351, 1628 - 1526, 1598 - 1503, 1439 - 1360, 684 - 563 - ], + ], heights=[ - 803-599, + 803 - 599, 1492 - 1351, 1628 - 1526, 1598 - 1503, 1439 - 1360, 684 - 563 - ], + ], rotation_angle=rotation_angle, stp_filename='outboard_pf_coils.stp' ) @@ -89,7 +89,12 @@ def main(rotation_angle=180): stl_filename='EFCCu_coils_5.stl' ) - centre_coils = [EFCCu_coils_1, EFCCu_coils_2, EFCCu_coils_3, EFCCu_coils_4, EFCCu_coils_5] + centre_coils = [ + EFCCu_coils_1, + EFCCu_coils_2, + EFCCu_coils_3, + EFCCu_coils_4, + EFCCu_coils_5] # plasma = paramak.Plasma( # major_radius=185, @@ -100,8 +105,8 @@ def main(rotation_angle=180): # stp_filename='plasma.stp', # ) thickness_outer_leg = 1500 - 1340 - R1 = 511-50/2 - R2 = 1340+50/2 + R1 = 511 - 50 / 2 + R2 = 1340 + 50 / 2 coil_thickness = 25 tf_coil = paramak.ToroidalFieldCoilPrincetonD( R1=R1, @@ -112,11 +117,11 @@ def main(rotation_angle=180): rotation_angle=rotation_angle, stl_filename='tf_coil.stl' ) - offset = (1500 - 1340 - coil_thickness)/2 + offset = (1500 - 1340 - coil_thickness) / 2 tf_coil_casing = paramak.TFCoilCasing( tf_coil, inner_offset=R2 - 1340, - outer_offset=1500-R2-coil_thickness, + outer_offset=1500 - R2 - coil_thickness, vertical_section_offset=25, distance=100, rotation_angle=rotation_angle, @@ -249,8 +254,14 @@ def main(rotation_angle=180): stl_filename="divertor.stl" ) - - demo = paramak.Reactor([*centre_coils, blanket, vac_vessel, outboard_pf_coils, divertor, tf_coil, tf_coil_casing, ]) + demo = paramak.Reactor([*centre_coils, + blanket, + vac_vessel, + outboard_pf_coils, + divertor, + tf_coil, + tf_coil_casing, + ]) demo.export_stl() demo.export_svg('demo.svg') @@ -258,4 +269,4 @@ def main(rotation_angle=180): if __name__ == "__main__": - main() \ No newline at end of file + main() From 52eee75a593ee8260afac1fb41a2f7969058deba Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Wed, 17 Feb 2021 19:32:02 +0000 Subject: [PATCH 03/26] added docs for eu demo --- docs/source/paramak.parametric_reactors.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/source/paramak.parametric_reactors.rst b/docs/source/paramak.parametric_reactors.rst index a1cb56d39..c2ed2d56b 100644 --- a/docs/source/paramak.parametric_reactors.rst +++ b/docs/source/paramak.parametric_reactors.rst @@ -126,3 +126,16 @@ studies can be performed quickly. .. automodule:: paramak.parametric_reactors.center_column_study_reactor :members: :show-inheritance: + +EuDemoFrom2015PaperDiagram() +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. image:: https://user-images.githubusercontent.com/8583900/108257452-b142c000-7156-11eb-9373-94750c935ca6.png + :width: 400 + :align: center + +The above image is colored by component. + +.. automodule:: paramak.parametric_reactors.eu_demo_2015_reactor + :members: + :show-inheritance: From 680647c427356c82839ef7ee9e80dd29485b0ed6 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Wed, 17 Feb 2021 19:32:26 +0000 Subject: [PATCH 04/26] moved example to class --- examples/example_parametric_reactors/DEMO.py | 272 ---------------- paramak/__init__.py | 1 + .../eu_demo_2015_reactor.py | 299 ++++++++++++++++++ 3 files changed, 300 insertions(+), 272 deletions(-) delete mode 100644 examples/example_parametric_reactors/DEMO.py create mode 100644 paramak/parametric_reactors/eu_demo_2015_reactor.py diff --git a/examples/example_parametric_reactors/DEMO.py b/examples/example_parametric_reactors/DEMO.py deleted file mode 100644 index 6e7e95e07..000000000 --- a/examples/example_parametric_reactors/DEMO.py +++ /dev/null @@ -1,272 +0,0 @@ -import paramak - - -def main(rotation_angle=180): - - outboard_pf_coils = paramak.PoloidalFieldCoilSet( - center_points=[ - (689, -985), - (1421, -689), - (1580, -252), - (1550, 293), - (1400, 598), - (621, 811), - ], - widths=[ - 803 - 599, - 1492 - 1351, - 1628 - 1526, - 1598 - 1503, - 1439 - 1360, - 684 - 563 - ], - heights=[ - 803 - 599, - 1492 - 1351, - 1628 - 1526, - 1598 - 1503, - 1439 - 1360, - 684 - 563 - ], - rotation_angle=rotation_angle, - stp_filename='outboard_pf_coils.stp' - ) - - EFCCu_coils_1 = paramak.RotateStraightShape( - points=[ - (263.6088589363423, -881.6221003581469), - (263.6088589363423, -609.1721122963762), - (363.04586051526934, -609.1721122963762), - (363.04586051526934, -881.6221003581469), - ], - rotation_angle=rotation_angle, - stp_filename='EFCCu_coils_1.stp', - stl_filename='EFCCu_coils_1.stl' - ) - EFCCu_coils_2 = paramak.RotateStraightShape( - points=[ - (266.2030353910733, -332.3839488581665), - (357.77071359802824, -332.3839488581665), - (357.77071359802824, -600.8478453421652), - (266.2030353910733, -600.8478453421652), - ], - rotation_angle=rotation_angle, - stp_filename='EFCCu_coils_2.stp', - stl_filename='EFCCu_coils_2.stl' - ) - EFCCu_coils_3 = paramak.RotateStraightShape( - points=[ - (263.5606400431317, 217.1559887549579), - (360.3263149381907, 217.1559887549579), - (360.3263149381907, -316.0372010628879), - (263.5606400431317, -316.0372010628879), - ], - rotation_angle=rotation_angle, - stp_filename='EFCCu_coils_3.stp', - stl_filename='EFCCu_coils_3.stl' - ) - - EFCCu_coils_4 = paramak.RotateStraightShape( - points=[ - (262.2297985905187, 493.9315777717868), - (357.70320714753336, 493.9315777717868), - (357.70320714753336, 229.49149612970268), - (262.2297985905187, 229.49149612970268), - ], - rotation_angle=rotation_angle, - stp_filename='EFCCu_coils_4.stp', - stl_filename='EFCCu_coils_4.stl' - ) - EFCCu_coils_5 = paramak.RotateStraightShape( - points=[ - (261.01468248161126, 746.6397242654133), - (356.35307813763615, 746.6397242654133), - (356.35307813763615, 510.27832556706545), - (261.01468248161126, 510.27832556706545), - ], - rotation_angle=rotation_angle, - stp_filename='EFCCu_coils_5.stp', - stl_filename='EFCCu_coils_5.stl' - ) - - centre_coils = [ - EFCCu_coils_1, - EFCCu_coils_2, - EFCCu_coils_3, - EFCCu_coils_4, - EFCCu_coils_5] - - # plasma = paramak.Plasma( - # major_radius=185, - # minor_radius=57 - 6, # 3 is a small ofset to avoid overlaps - # triangularity=0.31, - # elongation=1.97, - # rotation_angle=rotation_angle, - # stp_filename='plasma.stp', - # ) - thickness_outer_leg = 1500 - 1340 - R1 = 511 - 50 / 2 - R2 = 1340 + 50 / 2 - coil_thickness = 25 - tf_coil = paramak.ToroidalFieldCoilPrincetonD( - R1=R1, - R2=R2, - thickness=coil_thickness, - distance=coil_thickness, - number_of_coils=6, - rotation_angle=rotation_angle, - stl_filename='tf_coil.stl' - ) - offset = (1500 - 1340 - coil_thickness) / 2 - tf_coil_casing = paramak.TFCoilCasing( - tf_coil, - inner_offset=R2 - 1340, - outer_offset=1500 - R2 - coil_thickness, - vertical_section_offset=25, - distance=100, - rotation_angle=rotation_angle, - stl_filename="tf_coil_casing.stl" - ) - - vac_vessel = paramak.RotateStraightShape( - points=[ - (807.3058112219354, 599.9716732776211), - (944.7007255362573, 596.4005376054217), - (1066.6077313513304, 548.6554596218273), - (1176.8939839026452, 468.7827350098197), - (1252.009375746139, 356.7069172411133), - (1311.4632710748253, 236.55832094581558), - (1331.6284122155039, 124.30646127777527), - (1335.7655932529747, 80.19539107328501), - (1344.2521184580423, -52.150393961566806), - (1336.6142457734813, -96.29918743020028), - (1325.2635183117027, -184.5841999460855), - (1313.874215735356, -264.8467316209036), - (1286.7848415296335, -345.1595609812456), - (1224.659619517079, -485.7541664420229), - (1162.3222343743978, -582.2251272769284), - (1072.4518612084566, -666.7503877998998), - (1013.7308930565716, -699.0289274848848), - (947.1406015327145, -727.321375592098), - (813.6899926830206, -727.7489059190513), - (738.9989270997804, -703.9203774020874), - (668.1364416374629, -660.0230723610736), - (609.0297223398928, -612.0768036353835), - (549.6915523549119, -515.9956498632881), - (521.8113883005352, -431.84762198174633), - (517.6742072630645, -387.73655177725584), - (516.1119151230407, -62.82607771402195), - (514.4917603111641, 274.11811761081333), - (533.6539484730619, 370.4507598105283), - (564.7262032579812, 438.74244233065), - (607.6120868795008, 499.0493672738471), - (674.0866530596526, 551.4092579042626), - (732.8269087688219, 579.6765571687138), - ], - rotation_angle=rotation_angle, - stp_filename='vacvessel.stp', - stl_filename='vacvessel.stl', - ) - - blanket = paramak.RotateMixedShape( - points=[ - (1028.5051619363035, -506.43908961374075, "spline"), - (1130.0155759232866, -393.79742288289015, "spline"), - (1192.275810836831, -281.2815003658492, "spline"), - (1238.8359741209995, -168.81587553433235, "spline"), - (1257.92101205376, -56.43827165248217, "spline"), - (1269.0210012708435, 83.99286633034205, "spline"), - (1244.8344044363996, 216.28835367966997, "spline"), - (1205.0441737590018, 328.47734124080523, "spline"), - (1153.671764932414, 400.5162013324601, "spline"), - (1074.843518311703, 468.4558000539141, "spline"), - (988.2423861054414, 520.3252882504712, "spline"), - (941.0843085454615, 532.2081164555008, "spline"), - (807.595124581199, 539.8030669696149, "spline"), - (740.9855455000577, 515.5218592829356, "spline"), - (670.5280987407093, 475.18311549274034, "spline"), - (619.7728917472175, 418.862282127315, "spline"), - (584.8527692840913, 334.5130635036775, "spline"), - (577.2148965995302, 290.3642700350441, "spline"), - (574.292831670967, 81.767193745908, "spline"), - (579.0665020988178, -94.71481033619636, "spline"), - (579.3751030153657, -158.89465706473618, "spline"), - (579.8572919474718, -259.17566757808015, "spline"), - (580.3587684368622, -363.4679185119577, "straight"), - (686.29567682058, -355.1059282936036, "spline"), - (670.190566488235, -270.9201771479187, "spline"), - (657.9911865059497, -182.71061116031922, "straight"), - (657.4125597874224, -62.3733985443065, "straight"), - (656.6796326106211, 90.05373743597613, "straight"), - (652.0409750837601, 238.45705857434393, "spline"), - (671.3960388185003, 294.67729656872143, "spline"), - (694.7146955751529, 342.8876281434125, "spline"), - (725.9412508183462, 379.089387299264, "spline"), - (765.0757045480802, 403.2825740362764, "spline"), - (804.2487333923825, 419.4532799322212, "spline"), - (949.5322586359608, 407.8848122617163, "spline"), - (1036.1333908422225, 356.0153240651591, "spline"), - (1067.764984788385, 307.98103438980206, "spline"), - (1095.4908483844877, 255.92292987253006, "spline"), - (1115.4631139523237, 183.7834744098276, "spline"), - (1127.4889059190507, 131.6750722070317, "spline"), - (1135.5703924211496, 83.56533600338867, "spline"), - (1128.4147086686944, -60.864467978588436, "spline"), - (1113.0811006277195, -137.12833365425365, "spline"), - (1082.0859960719372, -221.46497785651047, "spline"), - (1031.4658019794351, -305.864494165672, "spline"), - (945.6554596218276, -418.4558632109989, "straight"), - - ], - rotation_angle=rotation_angle, - stl_filename="blanket.stl" - ) - - divertor = paramak.RotateMixedShape( - points=[ - (580.3587684368622, -363.4679185119577, "straight"), - (678.5035036777448, -367.1647983979668, "straight"), - (698.2057434436014, -383.14688797319684, "straight"), - (706.2100797165632, -415.21166249470514, "straight"), - (698.4950568028651, -443.3154942812033, "straight"), - (694.7436269110794, -479.42923248738805, "straight"), - (690.8764716755882, -491.47552817037024, "straight"), - (726.2209203989679, -495.3735987984752, "straight"), - (745.6917094774136, -463.22080332730013, "straight"), - (769.222529364193, -459.1341163784806, "straight"), - (788.8861940154811, -467.093725112643, "straight"), - (808.5691462240535, -479.0645742673395, "straight"), - (863.866572957985, -551.0908599376131, "straight"), - (891.3995609812453, -563.0365602495477, "straight"), - (895.1702784303153, -530.9340624638968, "straight"), - (883.2602118072937, -502.8931027843033, "straight"), - (886.9923541417953, -462.76812415758457, "straight"), - (929.9168128778833, -410.48368005545524, "straight"), - (1036.3937728655599, -514.4364216120463, "straight"), - (985.8893041167635, -622.9033804444106, "straight"), - (946.7548503870296, -647.096567181423, "straight"), - (801.5291878153039, -647.5618207725194, "straight"), - (675.5814387491815, -575.7618746871029, "straight"), - (612.3761135287094, -491.72701659798975, "straight"), - (584.5345245889013, -415.60146955751554, "straight"), - ], - rotation_angle=rotation_angle, - stl_filename="divertor.stl" - ) - - demo = paramak.Reactor([*centre_coils, - blanket, - vac_vessel, - outboard_pf_coils, - divertor, - tf_coil, - tf_coil_casing, - ]) - - demo.export_stl() - demo.export_svg('demo.svg') - demo.export_html('demo.html') - - -if __name__ == "__main__": - main() diff --git a/paramak/__init__.py b/paramak/__init__.py index c3c002583..86010b719 100644 --- a/paramak/__init__.py +++ b/paramak/__init__.py @@ -78,6 +78,7 @@ from .parametric_components.hollow_cube import HollowCube from .parametric_components.shell_fs import ShellFS +from .parametric_reactors.eu_demo_2015_reactor import EuDemoFrom2015PaperDiagram from .parametric_reactors.ball_reactor import BallReactor from .parametric_reactors.submersion_reactor import SubmersionTokamak from .parametric_reactors.single_null_submersion_reactor import SingleNullSubmersionTokamak diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py new file mode 100644 index 000000000..666831241 --- /dev/null +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -0,0 +1,299 @@ + +import paramak + + +class EuDemoFrom2015PaperDiagram(paramak.Reactor): + """Creates geometry of a simplified EU DEMO model based on the published + diagram in Figure 2 of Definition of the basic DEMO tokamak geometry based + on systems code studies. Published in Fusion Engineering and Design + http://dx.doi.org/10.1016/j.fusengdes.2015.06.097 . Coordinates extracted + from the figure are not exact and therefore this model does not + perfectly represent the reactor. + + Arguments: + rotation_angle (float): the angle of the sector that is desired. + Defaults to 360.0. + """ + + def __init__( + self, + rotation_angle=360.0, + ): + + super().__init__([]) + + self.rotation_angle = rotation_angle + + def create_solids(self): + """Creates a 3d solids for each component. + + Returns: + A list of CadQuery solids: A list of 3D solid volumes + + """ + + outboard_pf_coils = paramak.PoloidalFieldCoilSet( + center_points=[ + (689, -985), + (1421, -689), + (1580, -252), + (1550, 293), + (1400, 598), + (621, 811), + ], + widths=[ + 803 - 599, + 1492 - 1351, + 1628 - 1526, + 1598 - 1503, + 1439 - 1360, + 684 - 563 + ], + heights=[ + 803 - 599, + 1492 - 1351, + 1628 - 1526, + 1598 - 1503, + 1439 - 1360, + 684 - 563 + ], + rotation_angle=self.rotation_angle, + stl_filename='outboard_pf_coils.stl', + stp_filename='outboard_pf_coils.stp', + ) + + pf_coils_1 = paramak.RotateStraightShape( + points=[ + (263.6088589363423, -881.6221003581469), + (263.6088589363423, -609.1721122963762), + (363.04586051526934, -609.1721122963762), + (363.04586051526934, -881.6221003581469), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_1.stl', + stp_filename='pf_coils_1.stp', + ) + pf_coils_2 = paramak.RotateStraightShape( + points=[ + (266.2030353910733, -332.3839488581665), + (357.77071359802824, -332.3839488581665), + (357.77071359802824, -600.8478453421652), + (266.2030353910733, -600.8478453421652), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_2.stl', + stp_filename='pf_coils_2.stp', + ) + pf_coils_3 = paramak.RotateStraightShape( + points=[ + (263.5606400431317, 217.1559887549579), + (360.3263149381907, 217.1559887549579), + (360.3263149381907, -316.0372010628879), + (263.5606400431317, -316.0372010628879), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_3.stl', + stp_filename='pf_coils_3.stp', + ) + + pf_coils_4 = paramak.RotateStraightShape( + points=[ + (262.2297985905187, 493.9315777717868), + (357.70320714753336, 493.9315777717868), + (357.70320714753336, 229.49149612970268), + (262.2297985905187, 229.49149612970268), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_4.stl', + stp_filename='pf_coils_4.stp', + ) + pf_coils_5 = paramak.RotateStraightShape( + points=[ + (261.01468248161126, 746.6397242654133), + (356.35307813763615, 746.6397242654133), + (356.35307813763615, 510.27832556706545), + (261.01468248161126, 510.27832556706545), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_5.stl', + stp_filename='pf_coils_5.stp', + ) + + centre_coils = [ + pf_coils_1, + pf_coils_2, + pf_coils_3, + pf_coils_4, + pf_coils_5] + + # plasma = paramak.Plasma( + # major_radius=185, + # minor_radius=57 - 6, # 3 is a small ofset to avoid overlaps + # triangularity=0.31, + # elongation=1.97, + # rotation_angle=self.rotation_angle, + # stp_filename='plasma.stp', + # ) + + R1 = 511 - 50 / 2 + R2 = 1340 + 50 / 2 + coil_thickness = 25 + tf_coil = paramak.ToroidalFieldCoilPrincetonD( + R1=R1, + R2=R2, + thickness=coil_thickness, + distance=coil_thickness, + number_of_coils=6, + rotation_angle=self.rotation_angle, + stp_filename='tf_coil.stp', + stl_filename='tf_coil.stl', + ) + + tf_coil_casing = paramak.TFCoilCasing( + tf_coil, + inner_offset=R2 - 1340, + outer_offset=1500 - R2 - coil_thickness, + vertical_section_offset=25, + distance=100, + rotation_angle=self.rotation_angle, + stp_filename="tf_coil_casing.stp", + stl_filename="tf_coil_casing.stl", + ) + + vac_vessel = paramak.RotateStraightShape( + points=[ + (807.3058112219354, 599.9716732776211), + (944.7007255362573, 596.4005376054217), + (1066.6077313513304, 548.6554596218273), + (1176.8939839026452, 468.7827350098197), + (1252.009375746139, 356.7069172411133), + (1311.4632710748253, 236.55832094581558), + (1331.6284122155039, 124.30646127777527), + (1335.7655932529747, 80.19539107328501), + (1344.2521184580423, -52.150393961566806), + (1336.6142457734813, -96.29918743020028), + (1325.2635183117027, -184.5841999460855), + (1313.874215735356, -264.8467316209036), + (1286.7848415296335, -345.1595609812456), + (1224.659619517079, -485.7541664420229), + (1162.3222343743978, -582.2251272769284), + (1072.4518612084566, -666.7503877998998), + (1013.7308930565716, -699.0289274848848), + (947.1406015327145, -727.321375592098), + (813.6899926830206, -727.7489059190513), + (738.9989270997804, -703.9203774020874), + (668.1364416374629, -660.0230723610736), + (609.0297223398928, -612.0768036353835), + (549.6915523549119, -515.9956498632881), + (521.8113883005352, -431.84762198174633), + (517.6742072630645, -387.73655177725584), + (516.1119151230407, -62.82607771402195), + (514.4917603111641, 274.11811761081333), + (533.6539484730619, 370.4507598105283), + (564.7262032579812, 438.74244233065), + (607.6120868795008, 499.0493672738471), + (674.0866530596526, 551.4092579042626), + (732.8269087688219, 579.6765571687138), + ], + rotation_angle=self.rotation_angle, + stp_filename='vacvessel.stp', + stl_filename='vacvessel.stl', + ) + + blanket = paramak.RotateMixedShape( + points=[ + (1028.5051619363035, -506.43908961374075, "spline"), + (1130.0155759232866, -393.79742288289015, "spline"), + (1192.275810836831, -281.2815003658492, "spline"), + (1238.8359741209995, -168.81587553433235, "spline"), + (1257.92101205376, -56.43827165248217, "spline"), + (1269.0210012708435, 83.99286633034205, "spline"), + (1244.8344044363996, 216.28835367966997, "spline"), + (1205.0441737590018, 328.47734124080523, "spline"), + (1153.671764932414, 400.5162013324601, "spline"), + (1074.843518311703, 468.4558000539141, "spline"), + (988.2423861054414, 520.3252882504712, "spline"), + (941.0843085454615, 532.2081164555008, "spline"), + (807.595124581199, 539.8030669696149, "spline"), + (740.9855455000577, 515.5218592829356, "spline"), + (670.5280987407093, 475.18311549274034, "spline"), + (619.7728917472175, 418.862282127315, "spline"), + (584.8527692840913, 334.5130635036775, "spline"), + (577.2148965995302, 290.3642700350441, "spline"), + (574.292831670967, 81.767193745908, "spline"), + (579.0665020988178, -94.71481033619636, "spline"), + (579.3751030153657, -158.89465706473618, "spline"), + (579.8572919474718, -259.17566757808015, "spline"), + (580.3587684368622, -363.4679185119577, "straight"), + (686.29567682058, -355.1059282936036, "spline"), + (670.190566488235, -270.9201771479187, "spline"), + (657.9911865059497, -182.71061116031922, "straight"), + (657.4125597874224, -62.3733985443065, "straight"), + (656.6796326106211, 90.05373743597613, "straight"), + (652.0409750837601, 238.45705857434393, "spline"), + (671.3960388185003, 294.67729656872143, "spline"), + (694.7146955751529, 342.8876281434125, "spline"), + (725.9412508183462, 379.089387299264, "spline"), + (765.0757045480802, 403.2825740362764, "spline"), + (804.2487333923825, 419.4532799322212, "spline"), + (949.5322586359608, 407.8848122617163, "spline"), + (1036.1333908422225, 356.0153240651591, "spline"), + (1067.764984788385, 307.98103438980206, "spline"), + (1095.4908483844877, 255.92292987253006, "spline"), + (1115.4631139523237, 183.7834744098276, "spline"), + (1127.4889059190507, 131.6750722070317, "spline"), + (1135.5703924211496, 83.56533600338867, "spline"), + (1128.4147086686944, -60.864467978588436, "spline"), + (1113.0811006277195, -137.12833365425365, "spline"), + (1082.0859960719372, -221.46497785651047, "spline"), + (1031.4658019794351, -305.864494165672, "spline"), + (945.6554596218276, -418.4558632109989, "straight"), + + ], + rotation_angle=self.rotation_angle, + stp_filename="blanket.stp", + stl_filename="blanket.stl", + ) + + divertor = paramak.RotateMixedShape( + points=[ + (580.3587684368622, -363.4679185119577, "straight"), + (678.5035036777448, -367.1647983979668, "straight"), + (698.2057434436014, -383.14688797319684, "straight"), + (706.2100797165632, -415.21166249470514, "straight"), + (698.4950568028651, -443.3154942812033, "straight"), + (694.7436269110794, -479.42923248738805, "straight"), + (690.8764716755882, -491.47552817037024, "straight"), + (726.2209203989679, -495.3735987984752, "straight"), + (745.6917094774136, -463.22080332730013, "straight"), + (769.222529364193, -459.1341163784806, "straight"), + (788.8861940154811, -467.093725112643, "straight"), + (808.5691462240535, -479.0645742673395, "straight"), + (863.866572957985, -551.0908599376131, "straight"), + (891.3995609812453, -563.0365602495477, "straight"), + (895.1702784303153, -530.9340624638968, "straight"), + (883.2602118072937, -502.8931027843033, "straight"), + (886.9923541417953, -462.76812415758457, "straight"), + (929.9168128778833, -410.48368005545524, "straight"), + (1036.3937728655599, -514.4364216120463, "straight"), + (985.8893041167635, -622.9033804444106, "straight"), + (946.7548503870296, -647.096567181423, "straight"), + (801.5291878153039, -647.5618207725194, "straight"), + (675.5814387491815, -575.7618746871029, "straight"), + (612.3761135287094, -491.72701659798975, "straight"), + (584.5345245889013, -415.60146955751554, "straight"), + ], + rotation_angle=self.rotation_angle, + stp_filename="divertor.stp", + stl_filename="divertor.stl", + ) + + self.shapes_and_components = [ + *centre_coils, + blanket, + vac_vessel, + outboard_pf_coils, + divertor, + tf_coil, + tf_coil_casing, + ] From 4a490eaee06c93cd8621574b6ba8613be554311c Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Wed, 17 Feb 2021 19:35:19 +0000 Subject: [PATCH 05/26] corrected title underlining --- docs/source/paramak.parametric_reactors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/paramak.parametric_reactors.rst b/docs/source/paramak.parametric_reactors.rst index c2ed2d56b..3068e1862 100644 --- a/docs/source/paramak.parametric_reactors.rst +++ b/docs/source/paramak.parametric_reactors.rst @@ -128,7 +128,7 @@ studies can be performed quickly. :show-inheritance: EuDemoFrom2015PaperDiagram() -^^^^^^^^^^^^^^^^^^^^^^^^^^ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. image:: https://user-images.githubusercontent.com/8583900/108257452-b142c000-7156-11eb-9373-94750c935ca6.png :width: 400 From d260a1069d66c3d3e21c55d6bacecdf5d79abdaa Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Wed, 17 Feb 2021 19:36:29 +0000 Subject: [PATCH 06/26] added simple creation tests --- .../test_eu_demo_2015_reactor.py | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 tests/test_parametric_reactors/test_eu_demo_2015_reactor.py diff --git a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py new file mode 100644 index 000000000..ba7ea56b9 --- /dev/null +++ b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py @@ -0,0 +1,57 @@ + +import os +import unittest +from pathlib import Path + +import paramak + + +class TestSparc2020Reactor(unittest.TestCase): + + def test_make_sparc_2020_reactor(self): + output_filenames = [ + 'blanket.stp', + 'divertor.stp', + 'Graveyard.stp', + 'outboard_pf_coils.stp', + 'pf_coils_1.stp', + 'pf_coils_2.stp', + 'pf_coils_3.stp', + 'pf_coils_4.stp', + 'pf_coils_5.stp', + 'tf_coil_casing.stp', + 'tf_coil.stp', + 'vacvessel.stp', + ] + os.system("rm *.stp") + my_reactor = paramak.EuDemoFrom2015PaperDiagram() + my_reactor.export_stp() + for output_filename in output_filenames: + assert Path(output_filename).exists() is True + os.system("rm *.stp") + + def test_make_parametric_sparc_2020_rector(self): + """Runs the example to check the output files are produced""" + output_filenames = [ + 'blanket.stp', + 'divertor.stp', + 'Graveyard.stp', + 'outboard_pf_coils.stp', + 'pf_coils_1.stp', + 'pf_coils_2.stp', + 'pf_coils_3.stp', + 'pf_coils_4.stp', + 'pf_coils_5.stp', + 'tf_coil_casing.stp', + 'tf_coil.stp', + 'vacvessel.stp', + ] + os.system("rm *.stp") + my_reactor = paramak.EuDemoFrom2015PaperDiagram(rotation_angle=90) + my_reactor.export_stp() + for output_filename in output_filenames: + assert Path(output_filename).exists() is True + os.system("rm *.stp") + + + From 1d818d0868e38602ceb4ea747d7e2e20c502ff52 Mon Sep 17 00:00:00 2001 From: autopep8 Date: Wed, 17 Feb 2021 19:37:27 +0000 Subject: [PATCH 07/26] Automated autopep8 fixes --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 2 +- tests/test_parametric_reactors/test_eu_demo_2015_reactor.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 666831241..8212c697d 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -296,4 +296,4 @@ def create_solids(self): divertor, tf_coil, tf_coil_casing, - ] + ] diff --git a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py index ba7ea56b9..be0bbb19a 100644 --- a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py +++ b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py @@ -52,6 +52,3 @@ def test_make_parametric_sparc_2020_rector(self): for output_filename in output_filenames: assert Path(output_filename).exists() is True os.system("rm *.stp") - - - From 50e7537f213435de776e660cf5d5af530bf9109e Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Thu, 25 Feb 2021 11:20:27 +0100 Subject: [PATCH 08/26] removed TF coils and casing for now --- .../eu_demo_2015_reactor.py | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 8212c697d..0fe5db622 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -135,30 +135,30 @@ def create_solids(self): # stp_filename='plasma.stp', # ) - R1 = 511 - 50 / 2 - R2 = 1340 + 50 / 2 - coil_thickness = 25 - tf_coil = paramak.ToroidalFieldCoilPrincetonD( - R1=R1, - R2=R2, - thickness=coil_thickness, - distance=coil_thickness, - number_of_coils=6, - rotation_angle=self.rotation_angle, - stp_filename='tf_coil.stp', - stl_filename='tf_coil.stl', - ) + # R1 = 511 - 50 / 2 + # R2 = 1340 + 50 / 2 + # coil_thickness = 25 + # tf_coil = paramak.ToroidalFieldCoilPrincetonD( + # R1=R1, + # R2=R2, + # thickness=coil_thickness, + # distance=coil_thickness, + # number_of_coils=6, + # rotation_angle=self.rotation_angle, + # stp_filename='tf_coil.stp', + # stl_filename='tf_coil.stl', + # ) - tf_coil_casing = paramak.TFCoilCasing( - tf_coil, - inner_offset=R2 - 1340, - outer_offset=1500 - R2 - coil_thickness, - vertical_section_offset=25, - distance=100, - rotation_angle=self.rotation_angle, - stp_filename="tf_coil_casing.stp", - stl_filename="tf_coil_casing.stl", - ) + # tf_coil_casing = paramak.TFCoilCasing( + # tf_coil, + # inner_offset=R2 - 1340, + # outer_offset=1500 - R2 - coil_thickness, + # vertical_section_offset=25, + # distance=100, + # rotation_angle=self.rotation_angle, + # stp_filename="tf_coil_casing.stp", + # stl_filename="tf_coil_casing.stl", + # ) vac_vessel = paramak.RotateStraightShape( points=[ @@ -294,6 +294,6 @@ def create_solids(self): vac_vessel, outboard_pf_coils, divertor, - tf_coil, - tf_coil_casing, + # tf_coil, + # tf_coil_casing, ] From d37e8bf4203ab25469e480b048a4e9642329f492 Mon Sep 17 00:00:00 2001 From: remdelaportemathurin Date: Sat, 27 Feb 2021 14:07:24 +0100 Subject: [PATCH 09/26] new shapes but infinite loop somewhere... --- .../eu_demo_2015_reactor.py | 276 +++++++++++++----- 1 file changed, 207 insertions(+), 69 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 0fe5db622..d895c287f 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -1,6 +1,6 @@ import paramak - +import numpy as np class EuDemoFrom2015PaperDiagram(paramak.Reactor): """Creates geometry of a simplified EU DEMO model based on the published @@ -18,20 +18,16 @@ class EuDemoFrom2015PaperDiagram(paramak.Reactor): def __init__( self, rotation_angle=360.0, + number_of_tf_coils=11, ): super().__init__([]) self.rotation_angle = rotation_angle + self.number_of_tf_coils = number_of_tf_coils def create_solids(self): - """Creates a 3d solids for each component. - - Returns: - A list of CadQuery solids: A list of 3D solid volumes - - """ - + # PF coils outboard_pf_coils = paramak.PoloidalFieldCoilSet( center_points=[ (689, -985), @@ -126,14 +122,15 @@ def create_solids(self): pf_coils_4, pf_coils_5] - # plasma = paramak.Plasma( - # major_radius=185, - # minor_radius=57 - 6, # 3 is a small ofset to avoid overlaps - # triangularity=0.31, - # elongation=1.97, - # rotation_angle=self.rotation_angle, - # stp_filename='plasma.stp', - # ) + # Plasma + plasma = paramak.PlasmaFromPoints( + outer_equatorial_x_point=1118, + inner_equatorial_x_point=677, + high_point=(853, 368), + configuration="single-null", + rotation_angle=self.rotation_angle, + stp_filename='plasma.stp', + ) # R1 = 511 - 50 / 2 # R2 = 1340 + 50 / 2 @@ -149,57 +146,7 @@ def create_solids(self): # stl_filename='tf_coil.stl', # ) - # tf_coil_casing = paramak.TFCoilCasing( - # tf_coil, - # inner_offset=R2 - 1340, - # outer_offset=1500 - R2 - coil_thickness, - # vertical_section_offset=25, - # distance=100, - # rotation_angle=self.rotation_angle, - # stp_filename="tf_coil_casing.stp", - # stl_filename="tf_coil_casing.stl", - # ) - - vac_vessel = paramak.RotateStraightShape( - points=[ - (807.3058112219354, 599.9716732776211), - (944.7007255362573, 596.4005376054217), - (1066.6077313513304, 548.6554596218273), - (1176.8939839026452, 468.7827350098197), - (1252.009375746139, 356.7069172411133), - (1311.4632710748253, 236.55832094581558), - (1331.6284122155039, 124.30646127777527), - (1335.7655932529747, 80.19539107328501), - (1344.2521184580423, -52.150393961566806), - (1336.6142457734813, -96.29918743020028), - (1325.2635183117027, -184.5841999460855), - (1313.874215735356, -264.8467316209036), - (1286.7848415296335, -345.1595609812456), - (1224.659619517079, -485.7541664420229), - (1162.3222343743978, -582.2251272769284), - (1072.4518612084566, -666.7503877998998), - (1013.7308930565716, -699.0289274848848), - (947.1406015327145, -727.321375592098), - (813.6899926830206, -727.7489059190513), - (738.9989270997804, -703.9203774020874), - (668.1364416374629, -660.0230723610736), - (609.0297223398928, -612.0768036353835), - (549.6915523549119, -515.9956498632881), - (521.8113883005352, -431.84762198174633), - (517.6742072630645, -387.73655177725584), - (516.1119151230407, -62.82607771402195), - (514.4917603111641, 274.11811761081333), - (533.6539484730619, 370.4507598105283), - (564.7262032579812, 438.74244233065), - (607.6120868795008, 499.0493672738471), - (674.0866530596526, 551.4092579042626), - (732.8269087688219, 579.6765571687138), - ], - rotation_angle=self.rotation_angle, - stp_filename='vacvessel.stp', - stl_filename='vacvessel.stl', - ) - + # Blanket blanket = paramak.RotateMixedShape( points=[ (1028.5051619363035, -506.43908961374075, "spline"), @@ -255,6 +202,196 @@ def create_solids(self): stl_filename="blanket.stl", ) + # Vacuum vessel + vac_vessel_inner = paramak.RotateSplineShape( + points=[ + (574.1267649651465, 101.10991818268735), + (578.248235352396, 276.2517419573795), + (576.2157294079991, 183.80759081183805), + (574.6913499497014, 165.8825455403886), + (592.9839034492745, 356.1350119397756), + (618.3902277542372, 410.1718551122461), + (660.0565996143763, 462.707847631295), + (711.8855011965004, 503.98791778753997), + (763.7144027786246, 528.2384308674821), + (800.8076362638702, 535.0747131490673), + + (957.8187204685404, 529.1614255259608), + (1009.6476220506645, 511.7304778365887), + (1061.4765236327887, 484.3593637684569), + (1113.3054252149127, 445.67421552338743), + (1160.0530619360443, 396.81085941923095), + (1196.1300424490914, 343.45306647581924), + (1221.5363667540544, 290.06656753580216), + (1239.3207937675284, 234.97736402844578), + (1251.5158294339103, 177.39960361334886), + (1259.8999164545482, 119.15248445488135), + (1262.8978627225338, 91.48061850063345), + + (1248.4670705173148, -117.9739684683608), + (1257.7636381996099, -69.66392221833257), + (1236.2720348509329, -162.39122749437956), + (1219.5038608096575, -215.31064328924913), + (1198.1625483934886, -267.65634357273507), + (1171.7399711163273, -320.87421415048993), + (1140.7442554642726, -372.27816805066277), + (1102.6347690068283, -425.0006755712611), + (1058.9358912022924, -476.2931568156555), + (1022.8589106892452, -523.1641842564957), + (998.4688393564809, -582.3229466099988), + (961.8837323573345, -633.8322193152558), + (788.1044741113889, -641.8422854712626), + (746.4381022512498, -626.4054742155761), + (694.6092006691258, -595.170356965071), + (646.3371844896964, -549.174826941633), + (610.7683304627485, -496.43258230780384), + (588.9188915604805, -442.35157799696844), + (578.1466100551762, -383.4976698929381), + (577.6991331872189, -343.8423522802541), + (576.2157294079991, -254.96634344146696), + (576.2157294079991, -201.97055742152952), + (576.2157294079991, -148.97477140159208), + (576.2157294079991, -95.97898538165487), + ], + rotation_angle=360, + ) + vac_vessel = paramak.RotateSplineShape( + points=[ + (512.4324836529082, 96.83488831627005), + (518.0121500911752, 287.54134932536317), + (515.8212670602018, 194.68137603861783), + (515.494614319138, 142.76183497286695), + (532.0087251173638, 362.3780050073017), + (553.3500375335325, 416.5461291634835), + (586.3782591299841, 470.34782313240567), + (631.601516392818, 520.0453534354622), + (683.4304179749421, 557.8818925196001), + (735.2593195570662, 582.9203420676915), + (785.0557151947934, 596.532729851823), + (975.0950209959151, 588.576086076301), + (1026.9239225780393, 570.6573643071777), + (1078.7528241601635, 545.2847562872191), + (1130.5817257422875, 510.37733286778285), + (1181.9228258977564, 463.9075673559904), + (1225.5731493936205, 410.0396175787416), + (1258.121473753201, 357.0383914794887), + (1283.0196715720645, 304.7333152394166), + (1302.3284780438362, 252.00512715901004), + (1316.5560196546153, 198.48201099512573), + (1326.9576677230002, 139.3967559638328), + (1333.0932271113002, 100.84655663599938), + (1343.486723417876, -64.80499360522106), + (1336.0857506855605, -109.3437847848545), + (1327.3439358210303, -183.2032210908526), + (1318.0168833021507, -232.47769228107745), + (1302.8366045299354, -287.56146830105854), + (1285.5603040025608, -341.50033045928376), + (1263.7108651002927, -396.8254592659823), + (1237.2882878231312, -451.74417276722556), + (1207.308825143275, -505.037036237552), + (1172.7562240885259, -556.0143836057805), + (1128.0410933117912, -612.4026336941533), + (1076.7203182157664, -658.2571906430871), + (1024.8914166336422, -689.9315329406068), + (973.0625150515181, -711.7812967192153), + (799.7913832916718, -721.926761925964), + (771.8444265562126, -713.390499628048), + (720.0155249740885, -692.618352547739), + (668.6744248186197, -662.2813242945683), + (617.902426327582, -618.1096350415803), + (575.7076029218998, -565.7680010488721), + (546.7443932142421, -511.7869024735646), + (524.9457669605843, -451.3051510254827), + (516.3584293455067, -107.40944903301386), + (516.3584293455067, -393.5263922426077), + (515.7486775621876, -175.64585325476332), + (515.7486775621876, -228.64163927470076), + (515.7486775621876, -281.637425294638), + (515.7486775621876, -334.6332113145754), + ], + cut=vac_vessel_inner, + rotation_angle=360, + stp_filename='vacvessel.stp', + stl_filename='vacvessel.stl', + ) + vac_vessel_inner.export_stl("test.stl") + + # TF coils casings + + tf_coil_casing = paramak.ExtrudeMixedShape( + points=[ + (956.8024674963419, 744.1181924666533, "spline"), + (988.3063096344957, 738.8135858014698, "spline"), + (1019.8101517726496, 731.2212103849513, "spline"), + (1051.3139939108037, 721.6678903244313, "spline"), + (1082.8178360489574, 710.3882685687647, "spline"), + (1114.3216781871113, 697.3488246966865, "spline"), + (1145.8255203252652, 680.4042517472378, "spline"), + (1177.329362463419, 662.5713876342671, "spline"), + (1208.833204601573, 642.5177956124913, "spline"), + (1240.3370467397267, 619.9585521011581, "spline"), + (1271.8408888778808, 593.9467051995316, "spline"), + (1302.8891693388423, 565.6173257242399, "spline"), + (1332.8160672097915, 533.1872171654991, "spline"), + (1359.2386444869526, 501.3146970548157, "spline"), + (1382.6124628475186, 468.4187133516837, "spline"), + (1402.9375222914887, 436.6860898930407, "spline"), + (1420.2138228188637, 405.19488907747836, "spline"), + (1435.9657438879403, 372.8648617726685, "spline"), + (1450.1932854987194, 339.5005122098444, "spline"), + (1461.8801946790027, 307.09972636870566, "spline"), + (1472.0427244009875, 273.43725790865426, "spline"), + (1480.1727481785756, 239.98954216774905, "spline"), + (1486.7783924978662, 209.78591729219943, "spline"), + (1492.8759103310572, 174.77571120207222, "spline"), + (1498.1749436860923, 130.9324032157914, "spline"), + (1501.6592395907728, 102.27275755847506, "spline"), + + (1506.997123663055, -64.35717673922625, "spline"), + (1504.0546930252408, -117.45192781242213, "spline"), + (1499.4815546503473, -158.26084228529953, "spline"), + (1495.9972587456668, -190.83442948891366, "spline"), + (1489.8271514144617, -227.50802018403465, "spline"), + (1481.6971276368736, -265.756008372977, "spline"), + (1473.5671038592855, -301.2681259821559, "spline"), + (1464.420827109499, -336.3824186309196, "spline"), + (1453.7501709014145, -371.5510611717634, "spline"), + (1442.0632617211313, -405.28950140590587, "spline"), + (1429.3600995686502, -437.8837368553043, "spline"), + (1416.1488109300694, -469.95425339523854, "spline"), + (1402.4293958053895, -500.68420005071425, "spline"), + (1386.1693482502133, -532.0973573725228, "spline"), + (1367.3686682645407, -566.760952419447, "spline"), + (1347.5517353066698, -601.9386852449743, "spline"), + (1327.1758632140895, -630.9951968657044, "spline"), + (1303.3823700150047, -662.8068259783415, "spline"), + (1276.5156525499938, -694.4364968444456, "spline"), + (1246.434564572918, -726.5651502185058, "spline"), + (1214.930722434764, -753.1636044922695, "spline"), + (1183.4268802966103, -776.6949402202872, "spline"), + (1151.9230381584562, -796.9412746643368, "spline"), + (1120.4191960203025, -814.2378120370677, "spline"), + (1088.9153538821483, -828.8191952873351, "spline"), + (1057.4115117439947, -841.3642129457548, "spline"), + (1025.9076696058407, -851.7220231166343, "spline"), + (994.4038274676868, -860.160789170094, "spline"), + (962.899985329533, -866.3620671041153, "spline"), + + (805.5787769784172, -875., "straight"), + (377.70287769784176, -875., "straight"), + (375.4508992805756, 755, "straight"), + (805.5787769784172, 755, "spline"), + ], + distance=200, + cut=[vac_vessel, vac_vessel_inner], + azimuth_placement_angle=np.linspace( + 0, 360, self.number_of_tf_coils), + rotation_angle=self.rotation_angle, + stp_filename="tf_coil_casing.stp", + stl_filename="tf_coil_casing.stl", + ) + + # SN Divertor divertor = paramak.RotateMixedShape( points=[ (580.3587684368622, -363.4679185119577, "straight"), @@ -289,11 +426,12 @@ def create_solids(self): ) self.shapes_and_components = [ + plasma, *centre_coils, + outboard_pf_coils, blanket, vac_vessel, - outboard_pf_coils, divertor, # tf_coil, - # tf_coil_casing, + tf_coil_casing, ] From 9084543f9896f55cc485e3b9dd11b8f4ade34534 Mon Sep 17 00:00:00 2001 From: autopep8 Date: Sat, 27 Feb 2021 13:09:06 +0000 Subject: [PATCH 10/26] Automated autopep8 fixes --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index d895c287f..069e03a15 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -2,6 +2,7 @@ import paramak import numpy as np + class EuDemoFrom2015PaperDiagram(paramak.Reactor): """Creates geometry of a simplified EU DEMO model based on the published diagram in Figure 2 of Definition of the basic DEMO tokamak geometry based From 54ef86c8914c1f891d3e6099191fe7c7bc96ab2d Mon Sep 17 00:00:00 2001 From: remdelaportemathurin Date: Sat, 27 Feb 2021 16:46:58 +0100 Subject: [PATCH 11/26] fixed vacuum vessel --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index d895c287f..054bd4a5d 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -228,8 +228,8 @@ def create_solids(self): (1259.8999164545482, 119.15248445488135), (1262.8978627225338, 91.48061850063345), - (1248.4670705173148, -117.9739684683608), (1257.7636381996099, -69.66392221833257), + (1248.4670705173148, -117.9739684683608), (1236.2720348509329, -162.39122749437956), (1219.5038608096575, -215.31064328924913), (1198.1625483934886, -267.65634357273507), @@ -253,7 +253,7 @@ def create_solids(self): (576.2157294079991, -148.97477140159208), (576.2157294079991, -95.97898538165487), ], - rotation_angle=360, + rotation_angle=self.rotation_angle, ) vac_vessel = paramak.RotateSplineShape( points=[ @@ -309,13 +309,11 @@ def create_solids(self): (515.7486775621876, -281.637425294638), (515.7486775621876, -334.6332113145754), ], - cut=vac_vessel_inner, - rotation_angle=360, + cut=vac_vessel_inner, # hollow shape + rotation_angle=self.rotation_angle, stp_filename='vacvessel.stp', stl_filename='vacvessel.stl', ) - vac_vessel_inner.export_stl("test.stl") - # TF coils casings tf_coil_casing = paramak.ExtrudeMixedShape( From 99efe9e358aca174172227ddc6ce519e35fe64dc Mon Sep 17 00:00:00 2001 From: remdelaportemathurin Date: Sat, 27 Feb 2021 16:51:50 +0100 Subject: [PATCH 12/26] changed class names --- .../test_parametric_reactors/test_eu_demo_2015_reactor.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py index be0bbb19a..7c8bb10b7 100644 --- a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py +++ b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py @@ -6,9 +6,9 @@ import paramak -class TestSparc2020Reactor(unittest.TestCase): +class TestDemo2015Reactor(unittest.TestCase): - def test_make_sparc_2020_reactor(self): + def test_make_demo_2015_reactor(self): output_filenames = [ 'blanket.stp', 'divertor.stp', @@ -20,7 +20,6 @@ def test_make_sparc_2020_reactor(self): 'pf_coils_4.stp', 'pf_coils_5.stp', 'tf_coil_casing.stp', - 'tf_coil.stp', 'vacvessel.stp', ] os.system("rm *.stp") @@ -30,7 +29,7 @@ def test_make_sparc_2020_reactor(self): assert Path(output_filename).exists() is True os.system("rm *.stp") - def test_make_parametric_sparc_2020_rector(self): + def test_make_parametric_demo_2015_rector(self): """Runs the example to check the output files are produced""" output_filenames = [ 'blanket.stp', @@ -43,7 +42,6 @@ def test_make_parametric_sparc_2020_rector(self): 'pf_coils_4.stp', 'pf_coils_5.stp', 'tf_coil_casing.stp', - 'tf_coil.stp', 'vacvessel.stp', ] os.system("rm *.stp") From 101fbf3bdefb098ff4c5ee8cbceb390dfbde08f0 Mon Sep 17 00:00:00 2001 From: remdelaportemathurin Date: Sat, 27 Feb 2021 18:32:37 +0100 Subject: [PATCH 13/26] changed number of tf coils in test until #747 is solved --- tests/test_parametric_reactors/test_eu_demo_2015_reactor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py index 7c8bb10b7..53ae26be9 100644 --- a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py +++ b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py @@ -23,7 +23,7 @@ def test_make_demo_2015_reactor(self): 'vacvessel.stp', ] os.system("rm *.stp") - my_reactor = paramak.EuDemoFrom2015PaperDiagram() + my_reactor = paramak.EuDemoFrom2015PaperDiagram(number_of_tf_coils=1) my_reactor.export_stp() for output_filename in output_filenames: assert Path(output_filename).exists() is True @@ -45,7 +45,7 @@ def test_make_parametric_demo_2015_rector(self): 'vacvessel.stp', ] os.system("rm *.stp") - my_reactor = paramak.EuDemoFrom2015PaperDiagram(rotation_angle=90) + my_reactor = paramak.EuDemoFrom2015PaperDiagram(number_of_tf_coils=1, rotation_angle=90) my_reactor.export_stp() for output_filename in output_filenames: assert Path(output_filename).exists() is True From 8dc10b8b4a1cfef2484ae49cdd61b7bf4cf36ce3 Mon Sep 17 00:00:00 2001 From: autopep8 Date: Sat, 27 Feb 2021 17:33:25 +0000 Subject: [PATCH 14/26] Automated autopep8 fixes --- tests/test_parametric_reactors/test_eu_demo_2015_reactor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py index 53ae26be9..51ecc5aab 100644 --- a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py +++ b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py @@ -45,7 +45,8 @@ def test_make_parametric_demo_2015_rector(self): 'vacvessel.stp', ] os.system("rm *.stp") - my_reactor = paramak.EuDemoFrom2015PaperDiagram(number_of_tf_coils=1, rotation_angle=90) + my_reactor = paramak.EuDemoFrom2015PaperDiagram( + number_of_tf_coils=1, rotation_angle=90) my_reactor.export_stp() for output_filename in output_filenames: assert Path(output_filename).exists() is True From 02cc79e67832ad4e392e0db7edc055fa0749832d Mon Sep 17 00:00:00 2001 From: remdelaportemathurin Date: Sat, 27 Feb 2021 18:44:36 +0100 Subject: [PATCH 15/26] removed points + no overlap between blanket div and vacuum vessel --- .../eu_demo_2015_reactor.py | 120 ++++++------------ 1 file changed, 37 insertions(+), 83 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 5bde36931..15f67686a 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -151,50 +151,29 @@ def create_solids(self): blanket = paramak.RotateMixedShape( points=[ (1028.5051619363035, -506.43908961374075, "spline"), - (1130.0155759232866, -393.79742288289015, "spline"), (1192.275810836831, -281.2815003658492, "spline"), - (1238.8359741209995, -168.81587553433235, "spline"), (1257.92101205376, -56.43827165248217, "spline"), - (1269.0210012708435, 83.99286633034205, "spline"), (1244.8344044363996, 216.28835367966997, "spline"), - (1205.0441737590018, 328.47734124080523, "spline"), (1153.671764932414, 400.5162013324601, "spline"), - (1074.843518311703, 468.4558000539141, "spline"), (988.2423861054414, 520.3252882504712, "spline"), - (941.0843085454615, 532.2081164555008, "spline"), (807.595124581199, 539.8030669696149, "spline"), - (740.9855455000577, 515.5218592829356, "spline"), (670.5280987407093, 475.18311549274034, "spline"), - (619.7728917472175, 418.862282127315, "spline"), (584.8527692840913, 334.5130635036775, "spline"), - (577.2148965995302, 290.3642700350441, "spline"), (574.292831670967, 81.767193745908, "spline"), - (579.0665020988178, -94.71481033619636, "spline"), (579.3751030153657, -158.89465706473618, "spline"), - (579.8572919474718, -259.17566757808015, "spline"), (580.3587684368622, -363.4679185119577, "straight"), (686.29567682058, -355.1059282936036, "spline"), - (670.190566488235, -270.9201771479187, "spline"), (657.9911865059497, -182.71061116031922, "straight"), (657.4125597874224, -62.3733985443065, "straight"), (656.6796326106211, 90.05373743597613, "straight"), - (652.0409750837601, 238.45705857434393, "spline"), (671.3960388185003, 294.67729656872143, "spline"), - (694.7146955751529, 342.8876281434125, "spline"), (725.9412508183462, 379.089387299264, "spline"), - (765.0757045480802, 403.2825740362764, "spline"), (804.2487333923825, 419.4532799322212, "spline"), - (949.5322586359608, 407.8848122617163, "spline"), (1036.1333908422225, 356.0153240651591, "spline"), - (1067.764984788385, 307.98103438980206, "spline"), (1095.4908483844877, 255.92292987253006, "spline"), - (1115.4631139523237, 183.7834744098276, "spline"), (1127.4889059190507, 131.6750722070317, "spline"), - (1135.5703924211496, 83.56533600338867, "spline"), (1128.4147086686944, -60.864467978588436, "spline"), - (1113.0811006277195, -137.12833365425365, "spline"), (1082.0859960719372, -221.46497785651047, "spline"), - (1031.4658019794351, -305.864494165672, "spline"), (945.6554596218276, -418.4558632109989, "straight"), ], @@ -203,6 +182,40 @@ def create_solids(self): stl_filename="blanket.stl", ) + # SN Divertor + divertor = paramak.RotateMixedShape( + points=[ + (580.3587684368622, -363.4679185119577, "straight"), + (678.5035036777448, -367.1647983979668, "straight"), + (698.2057434436014, -383.14688797319684, "straight"), + (706.2100797165632, -415.21166249470514, "straight"), + (698.4950568028651, -443.3154942812033, "straight"), + (694.7436269110794, -479.42923248738805, "straight"), + (690.8764716755882, -491.47552817037024, "straight"), + (726.2209203989679, -495.3735987984752, "straight"), + (745.6917094774136, -463.22080332730013, "straight"), + (769.222529364193, -459.1341163784806, "straight"), + (788.8861940154811, -467.093725112643, "straight"), + (808.5691462240535, -479.0645742673395, "straight"), + (863.866572957985, -551.0908599376131, "straight"), + (891.3995609812453, -563.0365602495477, "straight"), + (895.1702784303153, -530.9340624638968, "straight"), + (883.2602118072937, -502.8931027843033, "straight"), + (886.9923541417953, -462.76812415758457, "straight"), + (945.6554596218276, -418.4558632109989, "straight"), + (1028.5051619363035, -506.43908961374075, "straight"), + (985.8893041167635, -622.9033804444106, "straight"), + (946.7548503870296, -647.096567181423, "straight"), + (801.5291878153039, -647.5618207725194, "straight"), + (675.5814387491815, -575.7618746871029, "straight"), + (612.3761135287094, -491.72701659798975, "straight"), + (584.5345245889013, -415.60146955751554, "straight"), + ], + rotation_angle=self.rotation_angle, + stp_filename="divertor.stp", + stl_filename="divertor.stl", + ) + # Vacuum vessel vac_vessel_inner = paramak.RotateSplineShape( points=[ @@ -255,6 +268,8 @@ def create_solids(self): (576.2157294079991, -95.97898538165487), ], rotation_angle=self.rotation_angle, + # avoid overlap between VV and blanket divertor + union=[blanket, divertor] ) vac_vessel = paramak.RotateSplineShape( points=[ @@ -320,60 +335,33 @@ def create_solids(self): tf_coil_casing = paramak.ExtrudeMixedShape( points=[ (956.8024674963419, 744.1181924666533, "spline"), - (988.3063096344957, 738.8135858014698, "spline"), (1019.8101517726496, 731.2212103849513, "spline"), - (1051.3139939108037, 721.6678903244313, "spline"), (1082.8178360489574, 710.3882685687647, "spline"), - (1114.3216781871113, 697.3488246966865, "spline"), (1145.8255203252652, 680.4042517472378, "spline"), - (1177.329362463419, 662.5713876342671, "spline"), (1208.833204601573, 642.5177956124913, "spline"), - (1240.3370467397267, 619.9585521011581, "spline"), (1271.8408888778808, 593.9467051995316, "spline"), - (1302.8891693388423, 565.6173257242399, "spline"), (1332.8160672097915, 533.1872171654991, "spline"), - (1359.2386444869526, 501.3146970548157, "spline"), (1382.6124628475186, 468.4187133516837, "spline"), - (1402.9375222914887, 436.6860898930407, "spline"), (1420.2138228188637, 405.19488907747836, "spline"), - (1435.9657438879403, 372.8648617726685, "spline"), (1450.1932854987194, 339.5005122098444, "spline"), - (1461.8801946790027, 307.09972636870566, "spline"), (1472.0427244009875, 273.43725790865426, "spline"), - (1480.1727481785756, 239.98954216774905, "spline"), (1486.7783924978662, 209.78591729219943, "spline"), - (1492.8759103310572, 174.77571120207222, "spline"), (1498.1749436860923, 130.9324032157914, "spline"), - (1501.6592395907728, 102.27275755847506, "spline"), (1506.997123663055, -64.35717673922625, "spline"), - (1504.0546930252408, -117.45192781242213, "spline"), (1499.4815546503473, -158.26084228529953, "spline"), - (1495.9972587456668, -190.83442948891366, "spline"), (1489.8271514144617, -227.50802018403465, "spline"), - (1481.6971276368736, -265.756008372977, "spline"), (1473.5671038592855, -301.2681259821559, "spline"), - (1464.420827109499, -336.3824186309196, "spline"), (1453.7501709014145, -371.5510611717634, "spline"), - (1442.0632617211313, -405.28950140590587, "spline"), (1429.3600995686502, -437.8837368553043, "spline"), - (1416.1488109300694, -469.95425339523854, "spline"), (1402.4293958053895, -500.68420005071425, "spline"), - (1386.1693482502133, -532.0973573725228, "spline"), (1367.3686682645407, -566.760952419447, "spline"), - (1347.5517353066698, -601.9386852449743, "spline"), (1327.1758632140895, -630.9951968657044, "spline"), - (1303.3823700150047, -662.8068259783415, "spline"), (1276.5156525499938, -694.4364968444456, "spline"), - (1246.434564572918, -726.5651502185058, "spline"), (1214.930722434764, -753.1636044922695, "spline"), - (1183.4268802966103, -776.6949402202872, "spline"), (1151.9230381584562, -796.9412746643368, "spline"), - (1120.4191960203025, -814.2378120370677, "spline"), (1088.9153538821483, -828.8191952873351, "spline"), - (1057.4115117439947, -841.3642129457548, "spline"), (1025.9076696058407, -851.7220231166343, "spline"), - (994.4038274676868, -860.160789170094, "spline"), (962.899985329533, -866.3620671041153, "spline"), (805.5787769784172, -875., "straight"), @@ -382,7 +370,7 @@ def create_solids(self): (805.5787769784172, 755, "spline"), ], distance=200, - cut=[vac_vessel, vac_vessel_inner], + cut=[vac_vessel_inner, vac_vessel], azimuth_placement_angle=np.linspace( 0, 360, self.number_of_tf_coils), rotation_angle=self.rotation_angle, @@ -390,40 +378,6 @@ def create_solids(self): stl_filename="tf_coil_casing.stl", ) - # SN Divertor - divertor = paramak.RotateMixedShape( - points=[ - (580.3587684368622, -363.4679185119577, "straight"), - (678.5035036777448, -367.1647983979668, "straight"), - (698.2057434436014, -383.14688797319684, "straight"), - (706.2100797165632, -415.21166249470514, "straight"), - (698.4950568028651, -443.3154942812033, "straight"), - (694.7436269110794, -479.42923248738805, "straight"), - (690.8764716755882, -491.47552817037024, "straight"), - (726.2209203989679, -495.3735987984752, "straight"), - (745.6917094774136, -463.22080332730013, "straight"), - (769.222529364193, -459.1341163784806, "straight"), - (788.8861940154811, -467.093725112643, "straight"), - (808.5691462240535, -479.0645742673395, "straight"), - (863.866572957985, -551.0908599376131, "straight"), - (891.3995609812453, -563.0365602495477, "straight"), - (895.1702784303153, -530.9340624638968, "straight"), - (883.2602118072937, -502.8931027843033, "straight"), - (886.9923541417953, -462.76812415758457, "straight"), - (929.9168128778833, -410.48368005545524, "straight"), - (1036.3937728655599, -514.4364216120463, "straight"), - (985.8893041167635, -622.9033804444106, "straight"), - (946.7548503870296, -647.096567181423, "straight"), - (801.5291878153039, -647.5618207725194, "straight"), - (675.5814387491815, -575.7618746871029, "straight"), - (612.3761135287094, -491.72701659798975, "straight"), - (584.5345245889013, -415.60146955751554, "straight"), - ], - rotation_angle=self.rotation_angle, - stp_filename="divertor.stp", - stl_filename="divertor.stl", - ) - self.shapes_and_components = [ plasma, *centre_coils, From 97da5da3fcdf47557e45bf5615d66ac18e94be21 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 1 Mar 2021 13:46:32 +0000 Subject: [PATCH 16/26] seperated create solid into seperate components --- .../eu_demo_2015_reactor.py | 362 ++++++++++-------- paramak/reactor.py | 3 +- paramak/shape.py | 26 +- .../test_eu_demo_2015_reactor.py | 34 +- 4 files changed, 245 insertions(+), 180 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 15f67686a..9318aa435 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -8,8 +8,8 @@ class EuDemoFrom2015PaperDiagram(paramak.Reactor): diagram in Figure 2 of Definition of the basic DEMO tokamak geometry based on systems code studies. Published in Fusion Engineering and Design http://dx.doi.org/10.1016/j.fusengdes.2015.06.097 . Coordinates extracted - from the figure are not exact and therefore this model does not - perfectly represent the reactor. + from the figure are not exact and therefore this model does not perfectly + represent the reactor. Arguments: rotation_angle (float): the angle of the sector that is desired. @@ -19,7 +19,7 @@ class EuDemoFrom2015PaperDiagram(paramak.Reactor): def __init__( self, rotation_angle=360.0, - number_of_tf_coils=11, + number_of_tf_coils=16, ): super().__init__([]) @@ -27,127 +27,79 @@ def __init__( self.rotation_angle = rotation_angle self.number_of_tf_coils = number_of_tf_coils - def create_solids(self): - # PF coils - outboard_pf_coils = paramak.PoloidalFieldCoilSet( - center_points=[ - (689, -985), - (1421, -689), - (1580, -252), - (1550, 293), - (1400, 598), - (621, 811), - ], - widths=[ - 803 - 599, - 1492 - 1351, - 1628 - 1526, - 1598 - 1503, - 1439 - 1360, - 684 - 563 - ], - heights=[ - 803 - 599, - 1492 - 1351, - 1628 - 1526, - 1598 - 1503, - 1439 - 1360, - 684 - 563 - ], - rotation_angle=self.rotation_angle, - stl_filename='outboard_pf_coils.stl', - stp_filename='outboard_pf_coils.stp', - ) + def create_tf_coils(self, vac_vessel_inner, vac_vessel) -> list: + """Creates a 3d solids for each tf coil. - pf_coils_1 = paramak.RotateStraightShape( - points=[ - (263.6088589363423, -881.6221003581469), - (263.6088589363423, -609.1721122963762), - (363.04586051526934, -609.1721122963762), - (363.04586051526934, -881.6221003581469), - ], - rotation_angle=self.rotation_angle, - stl_filename='pf_coils_1.stl', - stp_filename='pf_coils_1.stp', - ) - pf_coils_2 = paramak.RotateStraightShape( - points=[ - (266.2030353910733, -332.3839488581665), - (357.77071359802824, -332.3839488581665), - (357.77071359802824, -600.8478453421652), - (266.2030353910733, -600.8478453421652), - ], - rotation_angle=self.rotation_angle, - stl_filename='pf_coils_2.stl', - stp_filename='pf_coils_2.stp', - ) - pf_coils_3 = paramak.RotateStraightShape( - points=[ - (263.5606400431317, 217.1559887549579), - (360.3263149381907, 217.1559887549579), - (360.3263149381907, -316.0372010628879), - (263.5606400431317, -316.0372010628879), - ], - rotation_angle=self.rotation_angle, - stl_filename='pf_coils_3.stl', - stp_filename='pf_coils_3.stp', - ) + Args: + vac_vessel (Paramak.Shape): The vac_vessel that is used in a + Boolean cut opperation to prevent overlaps + vac_vessel_inner (Paramak.Shape): The vac_vessel_inner that is + used in a Boolean cut opperation to prevent overlaps - pf_coils_4 = paramak.RotateStraightShape( - points=[ - (262.2297985905187, 493.9315777717868), - (357.70320714753336, 493.9315777717868), - (357.70320714753336, 229.49149612970268), - (262.2297985905187, 229.49149612970268), - ], - rotation_angle=self.rotation_angle, - stl_filename='pf_coils_4.stl', - stp_filename='pf_coils_4.stp', - ) - pf_coils_5 = paramak.RotateStraightShape( + Returns: + A list of CadQuery solids: A list of 3D solid volumes + """ + # coil could be approximated with a ToroidalFieldCoilPrincetonD but is + # not included in the paper diagram + # R1 = 511 - 50 / 2 + # R2 = 1340 + 50 / 2 + # coil_thickness = 25 + + tf_coil_casing = paramak.ExtrudeMixedShape( points=[ - (261.01468248161126, 746.6397242654133), - (356.35307813763615, 746.6397242654133), - (356.35307813763615, 510.27832556706545), - (261.01468248161126, 510.27832556706545), + (956.8024674963419, 744.1181924666533, "spline"), + (1019.8101517726496, 731.2212103849513, "spline"), + (1082.8178360489574, 710.3882685687647, "spline"), + (1145.8255203252652, 680.4042517472378, "spline"), + (1208.833204601573, 642.5177956124913, "spline"), + (1271.8408888778808, 593.9467051995316, "spline"), + (1332.8160672097915, 533.1872171654991, "spline"), + (1382.6124628475186, 468.4187133516837, "spline"), + (1420.2138228188637, 405.19488907747836, "spline"), + (1450.1932854987194, 339.5005122098444, "spline"), + (1472.0427244009875, 273.43725790865426, "spline"), + (1486.7783924978662, 209.78591729219943, "spline"), + (1498.1749436860923, 130.9324032157914, "spline"), + + (1506.997123663055, -64.35717673922625, "spline"), + (1499.4815546503473, -158.26084228529953, "spline"), + (1489.8271514144617, -227.50802018403465, "spline"), + (1473.5671038592855, -301.2681259821559, "spline"), + (1453.7501709014145, -371.5510611717634, "spline"), + (1429.3600995686502, -437.8837368553043, "spline"), + (1402.4293958053895, -500.68420005071425, "spline"), + (1367.3686682645407, -566.760952419447, "spline"), + (1327.1758632140895, -630.9951968657044, "spline"), + (1276.5156525499938, -694.4364968444456, "spline"), + (1214.930722434764, -753.1636044922695, "spline"), + (1151.9230381584562, -796.9412746643368, "spline"), + (1088.9153538821483, -828.8191952873351, "spline"), + (1025.9076696058407, -851.7220231166343, "spline"), + (962.899985329533, -866.3620671041153, "spline"), + + (805.5787769784172, -875., "straight"), + (377.70287769784176, -875., "straight"), + (375.4508992805756, 755, "straight"), + (805.5787769784172, 755, "spline"), ], + distance=200, + cut=[vac_vessel_inner, vac_vessel], + azimuth_placement_angle=np.linspace( + 0, 360, self.number_of_tf_coils), rotation_angle=self.rotation_angle, - stl_filename='pf_coils_5.stl', - stp_filename='pf_coils_5.stp', + stp_filename="tf_coil_casing.stp", + stl_filename="tf_coil_casing.stl", ) - centre_coils = [ - pf_coils_1, - pf_coils_2, - pf_coils_3, - pf_coils_4, - pf_coils_5] + return [tf_coil_casing] - # Plasma - plasma = paramak.PlasmaFromPoints( - outer_equatorial_x_point=1118, - inner_equatorial_x_point=677, - high_point=(853, 368), - configuration="single-null", - rotation_angle=self.rotation_angle, - stp_filename='plasma.stp', - ) + def create_vessel_components(self) -> list: + """Creates a 3d solids for each vessel component. + + Returns: + A list of CadQuery solids: A list of 3D solid volumes + """ - # R1 = 511 - 50 / 2 - # R2 = 1340 + 50 / 2 - # coil_thickness = 25 - # tf_coil = paramak.ToroidalFieldCoilPrincetonD( - # R1=R1, - # R2=R2, - # thickness=coil_thickness, - # distance=coil_thickness, - # number_of_coils=6, - # rotation_angle=self.rotation_angle, - # stp_filename='tf_coil.stp', - # stl_filename='tf_coil.stl', - # ) - - # Blanket blanket = paramak.RotateMixedShape( points=[ (1028.5051619363035, -506.43908961374075, "spline"), @@ -175,7 +127,6 @@ def create_solids(self): (1128.4147086686944, -60.864467978588436, "spline"), (1082.0859960719372, -221.46497785651047, "spline"), (945.6554596218276, -418.4558632109989, "straight"), - ], rotation_angle=self.rotation_angle, stp_filename="blanket.stp", @@ -330,61 +281,140 @@ def create_solids(self): stp_filename='vacvessel.stp', stl_filename='vacvessel.stl', ) - # TF coils casings - tf_coil_casing = paramak.ExtrudeMixedShape( + return [divertor, blanket, vac_vessel, vac_vessel_inner] + + def create_plasma(self) -> list: + """Creates a 3d solids for the plasma. + Returns: + A list of CadQuery solids: A list of 3D solid volumes + """ + + plasma = paramak.PlasmaFromPoints( + outer_equatorial_x_point=1118, + inner_equatorial_x_point=677, + high_point=(853, 368), + configuration="single-null", + rotation_angle=self.rotation_angle, + stp_filename='plasma.stp', + ) + + return [plasma] + + def create_pf_coils(self) -> list: + """Creates a 3d solids for each pf coil. + + Returns: + A list of CadQuery solids: A list of 3D solid volumes + """ + + outboard_pf_coils = paramak.PoloidalFieldCoilSet( + center_points=[ + (689, -985), + (1421, -689), + (1580, -252), + (1550, 293), + (1400, 598), + (621, 811), + ], + widths=[ + 803 - 599, + 1492 - 1351, + 1628 - 1526, + 1598 - 1503, + 1439 - 1360, + 684 - 563 + ], + heights=[ + 803 - 599, + 1492 - 1351, + 1628 - 1526, + 1598 - 1503, + 1439 - 1360, + 684 - 563 + ], + rotation_angle=self.rotation_angle, + stl_filename='outboard_pf_coils.stl', + stp_filename='outboard_pf_coils.stp', + ) + + pf_coils_1 = paramak.RotateStraightShape( points=[ - (956.8024674963419, 744.1181924666533, "spline"), - (1019.8101517726496, 731.2212103849513, "spline"), - (1082.8178360489574, 710.3882685687647, "spline"), - (1145.8255203252652, 680.4042517472378, "spline"), - (1208.833204601573, 642.5177956124913, "spline"), - (1271.8408888778808, 593.9467051995316, "spline"), - (1332.8160672097915, 533.1872171654991, "spline"), - (1382.6124628475186, 468.4187133516837, "spline"), - (1420.2138228188637, 405.19488907747836, "spline"), - (1450.1932854987194, 339.5005122098444, "spline"), - (1472.0427244009875, 273.43725790865426, "spline"), - (1486.7783924978662, 209.78591729219943, "spline"), - (1498.1749436860923, 130.9324032157914, "spline"), + (263.6088589363423, -881.6221003581469), + (263.6088589363423, -609.1721122963762), + (363.04586051526934, -609.1721122963762), + (363.04586051526934, -881.6221003581469), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_1.stl', + stp_filename='pf_coils_1.stp', + ) - (1506.997123663055, -64.35717673922625, "spline"), - (1499.4815546503473, -158.26084228529953, "spline"), - (1489.8271514144617, -227.50802018403465, "spline"), - (1473.5671038592855, -301.2681259821559, "spline"), - (1453.7501709014145, -371.5510611717634, "spline"), - (1429.3600995686502, -437.8837368553043, "spline"), - (1402.4293958053895, -500.68420005071425, "spline"), - (1367.3686682645407, -566.760952419447, "spline"), - (1327.1758632140895, -630.9951968657044, "spline"), - (1276.5156525499938, -694.4364968444456, "spline"), - (1214.930722434764, -753.1636044922695, "spline"), - (1151.9230381584562, -796.9412746643368, "spline"), - (1088.9153538821483, -828.8191952873351, "spline"), - (1025.9076696058407, -851.7220231166343, "spline"), - (962.899985329533, -866.3620671041153, "spline"), + pf_coils_2 = paramak.RotateStraightShape( + points=[ + (266.2030353910733, -332.3839488581665), + (357.77071359802824, -332.3839488581665), + (357.77071359802824, -600.8478453421652), + (266.2030353910733, -600.8478453421652), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_2.stl', + stp_filename='pf_coils_2.stp', + ) - (805.5787769784172, -875., "straight"), - (377.70287769784176, -875., "straight"), - (375.4508992805756, 755, "straight"), - (805.5787769784172, 755, "spline"), + pf_coils_3 = paramak.RotateStraightShape( + points=[ + (263.5606400431317, 217.1559887549579), + (360.3263149381907, 217.1559887549579), + (360.3263149381907, -316.0372010628879), + (263.5606400431317, -316.0372010628879), ], - distance=200, - cut=[vac_vessel_inner, vac_vessel], - azimuth_placement_angle=np.linspace( - 0, 360, self.number_of_tf_coils), rotation_angle=self.rotation_angle, - stp_filename="tf_coil_casing.stp", - stl_filename="tf_coil_casing.stl", + stl_filename='pf_coils_3.stl', + stp_filename='pf_coils_3.stp', + ) + + pf_coils_4 = paramak.RotateStraightShape( + points=[ + (262.2297985905187, 493.9315777717868), + (357.70320714753336, 493.9315777717868), + (357.70320714753336, 229.49149612970268), + (262.2297985905187, 229.49149612970268), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_4.stl', + stp_filename='pf_coils_4.stp', ) - self.shapes_and_components = [ - plasma, - *centre_coils, - outboard_pf_coils, - blanket, - vac_vessel, - divertor, - # tf_coil, - tf_coil_casing, - ] + pf_coils_5 = paramak.RotateStraightShape( + points=[ + (261.01468248161126, 746.6397242654133), + (356.35307813763615, 746.6397242654133), + (356.35307813763615, 510.27832556706545), + (261.01468248161126, 510.27832556706545), + ], + rotation_angle=self.rotation_angle, + stl_filename='pf_coils_5.stl', + stp_filename='pf_coils_5.stp', + ) + + return [outboard_pf_coils, pf_coils_1, pf_coils_2, pf_coils_3, + pf_coils_4, pf_coils_5] + + def create_solids(self): + """Creates a 3d solids for each component. + + Returns: + A list of CadQuery solids: A list of 3D solid volumes + """ + + plasma = self.create_plasma() + pf_coils = self.create_pf_coils() + vessel = self.create_vessel_components() + tf_coil_casing = self.create_tf_coils(vessel[-2], vessel[-1]) + + shapes_and_components = plasma + pf_coils + vessel[:-1] + tf_coil_casing + + self.shapes_and_components = shapes_and_components + + return shapes_and_components diff --git a/paramak/reactor.py b/paramak/reactor.py index bb3fac3bc..160c31ca6 100644 --- a/paramak/reactor.py +++ b/paramak/reactor.py @@ -578,7 +578,8 @@ def export_graveyard( def make_graveyard( self, - graveyard_offset: Optional[float] = 100) -> paramak.Shape: + graveyard_offset: Optional[float] = 100, + ) -> paramak.Shape: """Creates a graveyard volume (bounding box) that encapsulates all volumes. This is required by DAGMC when performing neutronics simulations. diff --git a/paramak/shape.py b/paramak/shape.py index fcb5ddeff..7005aed92 100644 --- a/paramak/shape.py +++ b/paramak/shape.py @@ -191,23 +191,25 @@ def largest_dimension(self): largest_dimension = 0 if isinstance(self.solid, (cq.Compound, cq.occ_impl.shapes.Solid)): for solid in self.solid.Solids(): + bound_box = solid.BoundingBox() largest_dimension = max( - abs(self.solid.BoundingBox().xmax), - abs(self.solid.BoundingBox().xmin), - abs(self.solid.BoundingBox().ymax), - abs(self.solid.BoundingBox().ymin), - abs(self.solid.BoundingBox().zmax), - abs(self.solid.BoundingBox().zmin), + abs(bound_box.xmax), + abs(bound_box.xmin), + abs(bound_box.ymax), + abs(bound_box.ymin), + abs(bound_box.zmax), + abs(bound_box.zmin), largest_dimension ) else: + bound_box = self.solid.val().BoundingBox() largest_dimension = max( - abs(self.solid.val().BoundingBox().xmax), - abs(self.solid.val().BoundingBox().xmin), - abs(self.solid.val().BoundingBox().ymax), - abs(self.solid.val().BoundingBox().ymin), - abs(self.solid.val().BoundingBox().zmax), - abs(self.solid.val().BoundingBox().zmin), + abs(bound_box.xmax), + abs(bound_box.xmin), + abs(bound_box.ymax), + abs(bound_box.ymin), + abs(bound_box.zmax), + abs(bound_box.zmin), largest_dimension ) self.largest_dimension = largest_dimension diff --git a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py index 51ecc5aab..a3548591d 100644 --- a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py +++ b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py @@ -8,7 +8,36 @@ class TestDemo2015Reactor(unittest.TestCase): + def test_plasma_construction(self): + """Creates the plasma part of the EuDemoFrom2015PaperDiagram and checks + the contruction runs""" + + my_reactor = paramak.EuDemoFrom2015PaperDiagram(number_of_tf_coils=1) + plasma = my_reactor.create_plasma() + assert plasma.volume > 0 + + def test_pf_coil_construction(self): + """Creates the pf coil part of the EuDemoFrom2015PaperDiagram and + checks the contruction runs""" + + my_reactor = paramak.EuDemoFrom2015PaperDiagram(number_of_tf_coils=1) + pf_coils = my_reactor.create_pf_coils() + for coil in pf_coils: + assert coil.volume > 0 + + def test_vessel_construction(self): + """Creates the pf coil part of the EuDemoFrom2015PaperDiagram and + checks the contruction runs""" + + my_reactor = paramak.EuDemoFrom2015PaperDiagram(number_of_tf_coils=1) + vessel_components = my_reactor.create_vessel_components() + for component in vessel_components: + assert component.volume > 0 + def test_make_demo_2015_reactor(self): + """Creates a EuDemoFrom2015PaperDiagram reactor and eports the stp + files checking that each component results in a stp file""" + output_filenames = [ 'blanket.stp', 'divertor.stp', @@ -30,7 +59,10 @@ def test_make_demo_2015_reactor(self): os.system("rm *.stp") def test_make_parametric_demo_2015_rector(self): - """Runs the example to check the output files are produced""" + """Creates a EuDemoFrom2015PaperDiagram reactor with a non defulat + rotation angle and eports the stp files checking that each component + results in a stp file""" + output_filenames = [ 'blanket.stp', 'divertor.stp', From bc530867280164f0f76e272c5367eb736203fd0a Mon Sep 17 00:00:00 2001 From: autopep8 Date: Mon, 1 Mar 2021 13:47:32 +0000 Subject: [PATCH 17/26] Automated autopep8 fixes --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 3 ++- paramak/reactor.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 9318aa435..4ae410f6c 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -413,7 +413,8 @@ def create_solids(self): vessel = self.create_vessel_components() tf_coil_casing = self.create_tf_coils(vessel[-2], vessel[-1]) - shapes_and_components = plasma + pf_coils + vessel[:-1] + tf_coil_casing + shapes_and_components = plasma + \ + pf_coils + vessel[:-1] + tf_coil_casing self.shapes_and_components = shapes_and_components diff --git a/paramak/reactor.py b/paramak/reactor.py index 160c31ca6..93dc7b16e 100644 --- a/paramak/reactor.py +++ b/paramak/reactor.py @@ -579,7 +579,7 @@ def export_graveyard( def make_graveyard( self, graveyard_offset: Optional[float] = 100, - ) -> paramak.Shape: + ) -> paramak.Shape: """Creates a graveyard volume (bounding box) that encapsulates all volumes. This is required by DAGMC when performing neutronics simulations. From f5e41f7b5b15d80584cec2771b2c1b0d895bf191 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Mon, 1 Mar 2021 14:27:03 +0000 Subject: [PATCH 18/26] corrected plasma test --- paramak/shape.py | 1 - tests/test_parametric_reactors/test_eu_demo_2015_reactor.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/paramak/shape.py b/paramak/shape.py index 7005aed92..23823f8f1 100644 --- a/paramak/shape.py +++ b/paramak/shape.py @@ -210,7 +210,6 @@ def largest_dimension(self): abs(bound_box.ymin), abs(bound_box.zmax), abs(bound_box.zmin), - largest_dimension ) self.largest_dimension = largest_dimension return largest_dimension diff --git a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py index a3548591d..f86cf7efc 100644 --- a/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py +++ b/tests/test_parametric_reactors/test_eu_demo_2015_reactor.py @@ -14,7 +14,7 @@ def test_plasma_construction(self): my_reactor = paramak.EuDemoFrom2015PaperDiagram(number_of_tf_coils=1) plasma = my_reactor.create_plasma() - assert plasma.volume > 0 + assert plasma[0].volume > 0 def test_pf_coil_construction(self): """Creates the pf coil part of the EuDemoFrom2015PaperDiagram and From fd82d25cced0e4da396917015d9eceb3b456f9d0 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Wed, 3 Mar 2021 16:23:16 +0100 Subject: [PATCH 19/26] fixed order of points in vacuum vessel --- .../eu_demo_2015_reactor.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 4ae410f6c..72770d7fa 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -180,7 +180,6 @@ def create_vessel_components(self) -> list: (711.8855011965004, 503.98791778753997), (763.7144027786246, 528.2384308674821), (800.8076362638702, 535.0747131490673), - (957.8187204685404, 529.1614255259608), (1009.6476220506645, 511.7304778365887), (1061.4765236327887, 484.3593637684569), @@ -192,7 +191,6 @@ def create_vessel_components(self) -> list: (1251.5158294339103, 177.39960361334886), (1259.8999164545482, 119.15248445488135), (1262.8978627225338, 91.48061850063345), - (1257.7636381996099, -69.66392221833257), (1248.4670705173148, -117.9739684683608), (1236.2720348509329, -162.39122749437956), @@ -225,9 +223,9 @@ def create_vessel_components(self) -> list: vac_vessel = paramak.RotateSplineShape( points=[ (512.4324836529082, 96.83488831627005), - (518.0121500911752, 287.54134932536317), - (515.8212670602018, 194.68137603861783), (515.494614319138, 142.76183497286695), + (515.8212670602018, 194.68137603861783), + (518.0121500911752, 287.54134932536317), (532.0087251173638, 362.3780050073017), (553.3500375335325, 416.5461291634835), (586.3782591299841, 470.34782313240567), @@ -269,12 +267,13 @@ def create_vessel_components(self) -> list: (575.7076029218998, -565.7680010488721), (546.7443932142421, -511.7869024735646), (524.9457669605843, -451.3051510254827), - (516.3584293455067, -107.40944903301386), - (516.3584293455067, -393.5263922426077), - (515.7486775621876, -175.64585325476332), - (515.7486775621876, -228.64163927470076), - (515.7486775621876, -281.637425294638), - (515.7486775621876, -334.6332113145754), + (516.7486775621876, -393.5263922426077), + (516.7486775621876, -228.64163927470076), + (516.7486775621876, -281.637425294638), + (516.7486775621876, -334.6332113145754), + (516.7486775621876, -175.64585325476332), + (516.7486775621876, -107.40944903301386), + ], cut=vac_vessel_inner, # hollow shape rotation_angle=self.rotation_angle, From 313fcfd61777f9f5d88e91f9e78f4c4d0b59f97b Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Thu, 4 Mar 2021 09:24:53 +0100 Subject: [PATCH 20/26] reordered points for TF casing --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 72770d7fa..9fc0a773e 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -47,6 +47,7 @@ def create_tf_coils(self, vac_vessel_inner, vac_vessel) -> list: tf_coil_casing = paramak.ExtrudeMixedShape( points=[ + (805.5787769784172, 755, "spline"), (956.8024674963419, 744.1181924666533, "spline"), (1019.8101517726496, 731.2212103849513, "spline"), (1082.8178360489574, 710.3882685687647, "spline"), @@ -80,7 +81,6 @@ def create_tf_coils(self, vac_vessel_inner, vac_vessel) -> list: (805.5787769784172, -875., "straight"), (377.70287769784176, -875., "straight"), (375.4508992805756, 755, "straight"), - (805.5787769784172, 755, "spline"), ], distance=200, cut=[vac_vessel_inner, vac_vessel], From a10eadee50470db92b4eec0126f18ac2ddc76611 Mon Sep 17 00:00:00 2001 From: RemDelaporteMathurin Date: Thu, 4 Mar 2021 11:19:15 +0100 Subject: [PATCH 21/26] modified azimuth_placement_angle until #757 is solved + fixed ordering of points for VV --- .../parametric_reactors/eu_demo_2015_reactor.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 9fc0a773e..f5279da83 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -19,7 +19,7 @@ class EuDemoFrom2015PaperDiagram(paramak.Reactor): def __init__( self, rotation_angle=360.0, - number_of_tf_coils=16, + number_of_tf_coils=11, ): super().__init__([]) @@ -84,8 +84,10 @@ def create_tf_coils(self, vac_vessel_inner, vac_vessel) -> list: ], distance=200, cut=[vac_vessel_inner, vac_vessel], + # azimuth placement angle can't start at + # zero nor end at 360 until #757 is solved azimuth_placement_angle=np.linspace( - 0, 360, self.number_of_tf_coils), + 0 + 20, 360 + 20, self.number_of_tf_coils), rotation_angle=self.rotation_angle, stp_filename="tf_coil_casing.stp", stl_filename="tf_coil_casing.stl", @@ -222,7 +224,7 @@ def create_vessel_components(self) -> list: ) vac_vessel = paramak.RotateSplineShape( points=[ - (512.4324836529082, 96.83488831627005), + (515.494614319138, 96.83488831627005), (515.494614319138, 142.76183497286695), (515.8212670602018, 194.68137603861783), (518.0121500911752, 287.54134932536317), @@ -268,12 +270,11 @@ def create_vessel_components(self) -> list: (546.7443932142421, -511.7869024735646), (524.9457669605843, -451.3051510254827), (516.7486775621876, -393.5263922426077), - (516.7486775621876, -228.64163927470076), - (516.7486775621876, -281.637425294638), (516.7486775621876, -334.6332113145754), + (516.7486775621876, -281.637425294638), + (516.7486775621876, -228.64163927470076), (516.7486775621876, -175.64585325476332), (516.7486775621876, -107.40944903301386), - ], cut=vac_vessel_inner, # hollow shape rotation_angle=self.rotation_angle, @@ -410,11 +411,11 @@ def create_solids(self): plasma = self.create_plasma() pf_coils = self.create_pf_coils() vessel = self.create_vessel_components() - tf_coil_casing = self.create_tf_coils(vessel[-2], vessel[-1]) + tf_coil_casing = self.create_tf_coils(vessel[-1], vessel[-2]) shapes_and_components = plasma + \ pf_coils + vessel[:-1] + tf_coil_casing - + # shapes_and_components = tf_coil_casing self.shapes_and_components = shapes_and_components return shapes_and_components From 277bca4eda6e084ca127a78f342af9514005ed75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Delaporte-Mathurin?= <40028739+RemDelaporteMathurin@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:27:15 +0100 Subject: [PATCH 22/26] remove the rotation_angle type in the docstrings Co-authored-by: Jonathan Shimwell --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index f5279da83..9e1931abc 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -12,7 +12,7 @@ class EuDemoFrom2015PaperDiagram(paramak.Reactor): represent the reactor. Arguments: - rotation_angle (float): the angle of the sector that is desired. + rotation_angle: the angle of the sector that is desired. Defaults to 360.0. """ From 07d1ff3ddf468a1ba85e36c4533ca39c84172d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Delaporte-Mathurin?= <40028739+RemDelaporteMathurin@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:27:32 +0100 Subject: [PATCH 23/26] added space Co-authored-by: Jonathan Shimwell --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 9e1931abc..facea4ae6 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -286,6 +286,7 @@ def create_vessel_components(self) -> list: def create_plasma(self) -> list: """Creates a 3d solids for the plasma. + Returns: A list of CadQuery solids: A list of 3D solid volumes """ From c5a71ada4ade5e1e9418e535a94b3fbf7079de16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Delaporte-Mathurin?= <40028739+RemDelaporteMathurin@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:29:55 +0100 Subject: [PATCH 24/26] Added type hinting + changed default value of number_of_tf_coils Co-authored-by: Jonathan Shimwell --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index facea4ae6..e7a457d0c 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -18,8 +18,8 @@ class EuDemoFrom2015PaperDiagram(paramak.Reactor): def __init__( self, - rotation_angle=360.0, - number_of_tf_coils=11, + rotation_angle: float = 360., + number_of_tf_coils: int = 16, ): super().__init__([]) From 0caad9a9b241e7b58e6eb4553d10b1a372e3515e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Delaporte-Mathurin?= <40028739+RemDelaporteMathurin@users.noreply.github.com> Date: Sat, 6 Mar 2021 22:36:38 +0100 Subject: [PATCH 25/26] Added docstrings for number_of_tf_coils Co-authored-by: Jonathan Shimwell --- paramak/parametric_reactors/eu_demo_2015_reactor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index e7a457d0c..4b5295e62 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -13,7 +13,7 @@ class EuDemoFrom2015PaperDiagram(paramak.Reactor): Arguments: rotation_angle: the angle of the sector that is desired. - Defaults to 360.0. + number_of_tf_coils: the number of tf coils to include in the model """ def __init__( From c5b33360a061fc776645278e9685621f73518980 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Sat, 6 Mar 2021 23:27:23 +0000 Subject: [PATCH 26/26] updated eu demo from paper diagram picture --- docs/source/paramak.parametric_reactors.rst | 2 +- paramak/parametric_reactors/eu_demo_2015_reactor.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/source/paramak.parametric_reactors.rst b/docs/source/paramak.parametric_reactors.rst index c87e0f7ab..321c6156c 100644 --- a/docs/source/paramak.parametric_reactors.rst +++ b/docs/source/paramak.parametric_reactors.rst @@ -130,7 +130,7 @@ studies can be performed quickly. EuDemoFrom2015PaperDiagram() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. image:: https://user-images.githubusercontent.com/8583900/108257452-b142c000-7156-11eb-9373-94750c935ca6.png +.. image:: https://user-images.githubusercontent.com/8583900/110224418-4f62b400-7ed3-11eb-85f1-e40dc74f5671.png :width: 400 :align: center diff --git a/paramak/parametric_reactors/eu_demo_2015_reactor.py b/paramak/parametric_reactors/eu_demo_2015_reactor.py index 4b5295e62..39ffad2e3 100644 --- a/paramak/parametric_reactors/eu_demo_2015_reactor.py +++ b/paramak/parametric_reactors/eu_demo_2015_reactor.py @@ -416,7 +416,6 @@ def create_solids(self): shapes_and_components = plasma + \ pf_coils + vessel[:-1] + tf_coil_casing - # shapes_and_components = tf_coil_casing self.shapes_and_components = shapes_and_components return shapes_and_components