Skip to content

bootstrap_current

BootstrapCurrentFractionModel

Bases: IntEnum

Bootstrap plasma current fraction (f_BS) model types

Source code in process/models/physics/bootstrap_current.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class BootstrapCurrentFractionModel(IntEnum):
    """Bootstrap plasma current fraction (f_BS) model types"""

    USER_INPUT = 0
    ITER_89 = 1
    NEVINS = 2
    WILSON = 3
    SAUTER = 4
    SAKAI = 5
    ARIES = 6
    ANDRADE = 7
    HOANG = 8
    WONG = 9
    GI_1 = 10
    GI_2 = 11
    SUGIYAMA_L_MODE = 12
    SUGIYAMA_H_MODE = 13

USER_INPUT = 0 class-attribute instance-attribute

ITER_89 = 1 class-attribute instance-attribute

NEVINS = 2 class-attribute instance-attribute

WILSON = 3 class-attribute instance-attribute

SAUTER = 4 class-attribute instance-attribute

SAKAI = 5 class-attribute instance-attribute

ARIES = 6 class-attribute instance-attribute

ANDRADE = 7 class-attribute instance-attribute

HOANG = 8 class-attribute instance-attribute

WONG = 9 class-attribute instance-attribute

GI_1 = 10 class-attribute instance-attribute

GI_2 = 11 class-attribute instance-attribute

SUGIYAMA_L_MODE = 12 class-attribute instance-attribute

SUGIYAMA_H_MODE = 13 class-attribute instance-attribute

PlasmaBootstrapCurrent

Class to hold plasma bootstrap current for plasma processing.

Source code in process/models/physics/bootstrap_current.py
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
class PlasmaBootstrapCurrent:
    """Class to hold plasma bootstrap current for plasma processing."""

    def __init__(self, plasma_profile: PlasmaProfile) -> None:
        self.outfile = constants.NOUT
        self.mfile = constants.MFILE
        self.plasma_profile = plasma_profile
        self.sauter_bootstrap = SauterBootstrapCurrent()

    def run(self) -> None:
        # Calculate bootstrap current fraction using various models
        current_drive_variables.f_c_plasma_bootstrap_iter89 = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_iter89(
                aspect=physics_variables.aspect,
                beta=physics_variables.beta_total_vol_avg,
                b_plasma_toroidal_on_axis=physics_variables.b_plasma_total,
                plasma_current=physics_variables.plasma_current,
                q95=physics_variables.q95,
                q0=physics_variables.q0,
                rmajor=physics_variables.rmajor,
                vol_plasma=physics_variables.vol_plasma,
            )
        )

        current_drive_variables.f_c_plasma_bootstrap_nevins = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_nevins(
                alphan=physics_variables.alphan,
                alphat=physics_variables.alphat,
                beta_toroidal=physics_variables.beta_toroidal_vol_avg,
                b_plasma_toroidal_on_axis=physics_variables.b_plasma_toroidal_on_axis,
                nd_plasma_electrons_vol_avg=physics_variables.nd_plasma_electrons_vol_avg,
                plasma_current=physics_variables.plasma_current,
                q95=physics_variables.q95,
                q0=physics_variables.q0,
                rmajor=physics_variables.rmajor,
                rminor=physics_variables.rminor,
                te=physics_variables.temp_plasma_electron_vol_avg_kev,
                zeff=physics_variables.n_charge_plasma_effective_vol_avg,
            )
        )

        # Wilson scaling uses thermal poloidal beta, not total
        current_drive_variables.f_c_plasma_bootstrap_wilson = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_wilson(
                alphaj=physics_variables.alphaj,
                alphap=physics_variables.alphap,
                alphat=physics_variables.alphat,
                betpth=physics_variables.beta_thermal_poloidal_vol_avg,
                q0=physics_variables.q0,
                q95=physics_variables.q95,
                rmajor=physics_variables.rmajor,
                rminor=physics_variables.rminor,
            )
        )

        (
            current_drive_variables.f_c_plasma_bootstrap_sauter,
            physics_variables.j_plasma_bootstrap_sauter_profile,
        ) = self.bootstrap_fraction_sauter(self.plasma_profile)
        current_drive_variables.f_c_plasma_bootstrap_sauter *= (
            current_drive_variables.cboot
        )

        current_drive_variables.f_c_plasma_bootstrap_sakai = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_sakai(
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                q95=physics_variables.q95,
                q0=physics_variables.q0,
                alphan=physics_variables.alphan,
                alphat=physics_variables.alphat,
                eps=physics_variables.eps,
                ind_plasma_internal_norm=physics_variables.ind_plasma_internal_norm,
            )
        )

        current_drive_variables.f_c_plasma_bootstrap_aries = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_aries(
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                ind_plasma_internal_norm=physics_variables.ind_plasma_internal_norm,
                core_density=physics_variables.nd_plasma_electron_on_axis,
                average_density=physics_variables.nd_plasma_electrons_vol_avg,
                inverse_aspect=physics_variables.eps,
            )
        )

        current_drive_variables.f_c_plasma_bootstrap_andrade = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_andrade(
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                core_pressure=physics_variables.pres_plasma_thermal_on_axis,
                average_pressure=physics_variables.pres_plasma_thermal_vol_avg,
                inverse_aspect=physics_variables.eps,
            )
        )
        current_drive_variables.f_c_plasma_bootstrap_hoang = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_hoang(
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                pressure_index=physics_variables.alphap,
                current_index=physics_variables.alphaj,
                inverse_aspect=physics_variables.eps,
            )
        )
        current_drive_variables.f_c_plasma_bootstrap_wong = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_wong(
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                density_index=physics_variables.alphan,
                temperature_index=physics_variables.alphat,
                inverse_aspect=physics_variables.eps,
                elongation=physics_variables.kappa,
            )
        )
        current_drive_variables.bscf_gi_i = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_gi_I(
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                pressure_index=physics_variables.alphap,
                temperature_index=physics_variables.alphat,
                inverse_aspect=physics_variables.eps,
                effective_charge=physics_variables.n_charge_plasma_effective_vol_avg,
                q95=physics_variables.q95,
                q0=physics_variables.q0,
            )
        )

        current_drive_variables.bscf_gi_ii = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_gi_II(
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                pressure_index=physics_variables.alphap,
                temperature_index=physics_variables.alphat,
                inverse_aspect=physics_variables.eps,
                effective_charge=physics_variables.n_charge_plasma_effective_vol_avg,
            )
        )
        current_drive_variables.f_c_plasma_bootstrap_sugiyama_l = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_sugiyama_l_mode(
                eps=physics_variables.eps,
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                alphan=physics_variables.alphan,
                alphat=physics_variables.alphat,
                zeff=physics_variables.n_charge_plasma_effective_vol_avg,
                q95=physics_variables.q95,
                q0=physics_variables.q0,
            )
        )
        current_drive_variables.f_c_plasma_bootstrap_sugiyama_h = (
            current_drive_variables.cboot
            * self.bootstrap_fraction_sugiyama_h_mode(
                eps=physics_variables.eps,
                beta_poloidal=physics_variables.beta_poloidal_vol_avg,
                alphan=physics_variables.alphan,
                alphat=physics_variables.alphat,
                tbeta=physics_variables.tbeta,
                zeff=physics_variables.n_charge_plasma_effective_vol_avg,
                q95=physics_variables.q95,
                q0=physics_variables.q0,
                radius_plasma_pedestal_density_norm=physics_variables.radius_plasma_pedestal_density_norm,
                nd_plasma_pedestal_electron=physics_variables.nd_plasma_pedestal_electron,
                n_greenwald=physics_variables.nd_plasma_electron_max_array[6],
                temp_plasma_pedestal_kev=physics_variables.temp_plasma_pedestal_kev,
            )
        )

        # Calculate beta_norm_max based on i_beta_norm_max
        try:
            model = BootstrapCurrentFractionModel(
                int(physics_variables.i_bootstrap_current)
            )
            current_drive_variables.f_c_plasma_bootstrap = (
                self.get_bootstrap_current_fraction_value(model)
            )
        except ValueError:
            raise ProcessValueError(
                "Illegal value of i_bootstrap_current",
                i_bootstrap_current=physics_variables.i_bootstrap_current,
            ) from None

    def get_bootstrap_current_fraction_value(
        self, model: BootstrapCurrentFractionModel
    ) -> float:
        """Get the plasma current bootstrap fraction (f_BS) for the specified model.

        Parameters
        ----------
        model : BootstrapCurrentFractionModel
            The bootstrap current model type.

        Returns
        -------
        float
            The bootstrap current fraction value.
        """
        model_map = {
            BootstrapCurrentFractionModel.USER_INPUT: current_drive_variables.f_c_plasma_bootstrap,
            BootstrapCurrentFractionModel.ITER_89: current_drive_variables.f_c_plasma_bootstrap_iter89,
            BootstrapCurrentFractionModel.NEVINS: current_drive_variables.f_c_plasma_bootstrap_nevins,
            BootstrapCurrentFractionModel.WILSON: current_drive_variables.f_c_plasma_bootstrap_wilson,
            BootstrapCurrentFractionModel.SAUTER: current_drive_variables.f_c_plasma_bootstrap_sauter,
            BootstrapCurrentFractionModel.SAKAI: current_drive_variables.f_c_plasma_bootstrap_sakai,
            BootstrapCurrentFractionModel.ARIES: current_drive_variables.f_c_plasma_bootstrap_aries,
            BootstrapCurrentFractionModel.ANDRADE: current_drive_variables.f_c_plasma_bootstrap_andrade,
            BootstrapCurrentFractionModel.HOANG: current_drive_variables.f_c_plasma_bootstrap_hoang,
            BootstrapCurrentFractionModel.WONG: current_drive_variables.f_c_plasma_bootstrap_wong,
            BootstrapCurrentFractionModel.GI_1: current_drive_variables.bscf_gi_i,
            BootstrapCurrentFractionModel.GI_2: current_drive_variables.bscf_gi_ii,
            BootstrapCurrentFractionModel.SUGIYAMA_L_MODE: current_drive_variables.f_c_plasma_bootstrap_sugiyama_l,
            BootstrapCurrentFractionModel.SUGIYAMA_H_MODE: current_drive_variables.f_c_plasma_bootstrap_sugiyama_h,
        }
        return model_map[model]

    @staticmethod
    def bootstrap_fraction_iter89(
        aspect: float,
        beta: float,
        b_plasma_toroidal_on_axis: float,
        plasma_current: float,
        q95: float,
        q0: float,
        rmajor: float,
        vol_plasma: float,
    ) -> float:
        """Calculate the bootstrap-driven fraction of the plasma current.

        Parameters
        ----------
        aspect : float
            Plasma aspect ratio.
        beta : float
            Plasma total beta.
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        plasma_current : float
            Plasma current (A).
        q95 : float
            Safety factor at 95% surface.
        q0 : float
            Central safety factor.
        rmajor : float
            Plasma major radius (m).
        vol_plasma : float
            Plasma volume (m³).

        Returns
        -------
        float
            The bootstrap-driven fraction of the plasma current.

        Notes
        -----
        This function performs the original ITER calculation of the plasma current bootstrap fraction.

        References
        ----------
        ITER Physics Design Guidelines: 1989 [IPDG89], N. A. Uckan et al,
        ITER Documentation Series No.10, IAEA/ITER/DS/10, IAEA, Vienna, 1990
        """

        # Calculate the bootstrap current coefficient
        c_bs = 1.32 - 0.235 * (q95 / q0) + 0.0185 * (q95 / q0) ** 2

        # Calculate the average minor radius
        average_a = np.sqrt(vol_plasma / (2 * np.pi**2 * rmajor))

        b_pa = (plasma_current / 1e6) / (5 * average_a)

        # Calculate the poloidal beta for bootstrap current
        betapbs = beta * (b_plasma_toroidal_on_axis / b_pa) ** 2

        # Ensure betapbs is positive
        if betapbs <= 0.0:
            return 0.0

        # Calculate and return the bootstrap current fraction
        return c_bs * (betapbs / np.sqrt(aspect)) ** 1.3

    @staticmethod
    def bootstrap_fraction_wilson(
        alphaj: float,
        alphap: float,
        alphat: float,
        betpth: float,
        q0: float,
        q95: float,
        rmajor: float,
        rminor: float,
    ) -> float:
        """Bootstrap current fraction from Wilson et al scaling.

        Parameters
        ----------
        alphaj : float
            Current profile index.
        alphap : float
            Pressure profile index.
        alphat : float
            Temperature profile index.
        betpth : float
            Thermal component of poloidal beta.
        q0 : float
            Safety factor on axis.
        q95 : float
            Edge safety factor.
        rmajor : float
            Major radius (m).
        rminor : float
            Minor radius (m).

        Returns
        -------
        float
            The bootstrap current fraction.

        Notes
        -----
        This function calculates the bootstrap current fraction using the numerically fitted algorithm
        written by Howard Wilson.

        References
        ----------
        AEA FUS 172: Physics Assessment for the European Reactor Study, 1989

        H. R. Wilson, Nuclear Fusion 32 (1992) 257
        """

        term1 = np.log(0.5)
        term2 = np.log(q0 / q95)

        # Re-arranging of parabolic profile to be equal to (r/a)^2 where the profile value is half of the core value

        termp = 1.0 - 0.5 ** (1.0 / alphap)
        termt = 1.0 - 0.5 ** (1.0 / alphat)
        termj = 1.0 - 0.5 ** (1.0 / alphaj)

        # Assuming a parabolic safety factor profile of the form q = q0 + (q95 - q0) * (r/a)^2
        # Substitute (r/a)^2 term from temperature,pressure and current profiles into q profile when values is 50% of core value
        # Take natural log of q profile over q95 and q0 to get the profile index

        alfpnw = term1 / np.log(np.log((q0 + (q95 - q0) * termp) / q95) / term2)
        alftnw = term1 / np.log(np.log((q0 + (q95 - q0) * termt) / q95) / term2)
        aj = term1 / np.log(np.log((q0 + (q95 - q0) * termj) / q95) / term2)

        # Crude check for NaN errors or other illegal values.
        if np.isnan(aj) or np.isnan(alfpnw) or np.isnan(alftnw) or aj < 0:
            raise ProcessValueError(
                "Illegal profile value found", aj=aj, alfpnw=alfpnw, alftnw=alftnw
            )

        # Ratio of ionic charge to electron charge

        z = 1.0

        # Inverse aspect ratio: r2 = maximum plasma radius, r1 = minimum
        # This is the definition used in the paper
        r2 = rmajor + rminor
        r1 = rmajor - rminor
        eps1 = (r2 - r1) / (r2 + r1)

        # Coefficients fitted using least squares techniques

        # Square root of current profile index term
        saj = np.sqrt(aj)

        a = np.array([
            1.41 * (1.0 - 0.28 * saj) * (1.0 + 0.12 / z),
            0.36 * (1.0 - 0.59 * saj) * (1.0 + 0.8 / z),
            -0.27 * (1.0 - 0.47 * saj) * (1.0 + 3.0 / z),
            0.0053 * (1.0 + 5.0 / z),
            -0.93 * (1.0 - 0.34 * saj) * (1.0 + 0.15 / z),
            -0.26 * (1.0 - 0.57 * saj) * (1.0 - 0.27 * z),
            0.064 * (1.0 - 0.6 * aj + 0.15 * aj * aj) * (1.0 + 7.6 / z),
            -0.0011 * (1.0 + 9.0 / z),
            -0.33 * (1.0 - aj + 0.33 * aj * aj),
            -0.26 * (1.0 - 0.87 / saj - 0.16 * aj),
            -0.14 * (1.0 - 1.14 / saj - 0.45 * saj),
            -0.0069,
        ])

        seps1 = np.sqrt(eps1)

        b = np.array([
            1.0,
            alfpnw,
            alftnw,
            alfpnw * alftnw,
            seps1,
            alfpnw * seps1,
            alftnw * seps1,
            alfpnw * alftnw * seps1,
            eps1,
            alfpnw * eps1,
            alftnw * eps1,
            alfpnw * alftnw * eps1,
        ])

        # Empirical bootstrap current fraction
        return seps1 * betpth * (a * b).sum()

    @staticmethod
    def _nevins_integral(
        y: float,
        nd_plasma_electrons_vol_avg: float,
        te: float,
        b_plasma_toroidal_on_axis: float,
        rminor: float,
        rmajor: float,
        zeff: float,
        alphat: float,
        alphan: float,
        q0: float,
        q95: float,
        beta_toroidal: float,
    ) -> float:
        """Integrand function for Nevins et al bootstrap current scaling.

        Parameters
        ----------
        y : float
            Abscissa of integration, normalized minor radius.
        nd_plasma_electrons_vol_avg : float
            Volume averaged electron density (/m³).
        te : float
            Volume averaged electron temperature (keV).
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        rminor : float
            Plasma minor radius (m).
        rmajor : float
            Plasma major radius (m).
        zeff : float
            Plasma effective charge.
        alphat : float
            Temperature profile index.
        alphan : float
            Density profile index.
        q0 : float
            Normalized safety factor at the magnetic axis.
        q95 : float
            Normalized safety factor at 95% of the plasma radius.
        beta_toroidal : float
            Toroidal plasma beta.

        Returns
        -------
        float
            The integrand value.

        References
        ----------
        Keii Gi, Makoto Nakamura, Kenji Tobita, Yasushi Ono,
        "Bootstrap current fraction scaling for a tokamak reactor design study,"
        Fusion Engineering and Design, Volume 89, Issue 11, 2014, Pages 2709-2715,
        ISSN 0920-3796, https://doi.org/10.1016/j.fusengdes.2014.07.009.

        Nevins, W. M. "Summary report: ITER specialists' meeting on heating and current drive."
        ITER-TN-PH-8-4, June 1988.
        """

        # Compute average electron beta
        betae = (
            nd_plasma_electrons_vol_avg
            * te
            * 1.0e3
            * constants.ELECTRON_CHARGE
            / (b_plasma_toroidal_on_axis**2 / (2.0 * constants.RMU0))
        )

        nabla = rminor * np.sqrt(y) / rmajor
        x = (1.46 * np.sqrt(nabla) + 2.4 * nabla) / (1.0 - nabla) ** 1.5
        z = zeff
        d = (
            1.414 * z
            + z**2
            + x * (0.754 + 2.657 * z + (2.0 * z**2))
            + (x**2 * (0.348 + 1.243 * z + z**2))
        )
        a1 = (alphan + alphat) * (1.0 - y) ** (alphan + alphat - 1.0)
        a2 = alphat * (1.0 - y) ** (alphan + alphat - 1.0)
        al1 = (x / d) * (0.754 + 2.21 * z + z**2 + x * (0.348 + 1.243 * z + z**2))
        al2 = -x * ((0.884 + 2.074 * z) / d)
        alphai = -1.172 / (1.0 + 0.462 * x)

        # q-profile
        q = q0 + (q95 - q0) * ((y + y**2 + y**3) / (3.0))

        pratio = (beta_toroidal - betae) / betae

        return (q / q95) * (al1 * (a1 + (pratio * (a1 + alphai * a2))) + al2 * a2)

    def bootstrap_fraction_sauter(
        self, plasma_profile: PlasmaProfile
    ) -> tuple[float, np.ndarray]:
        """Get the bootstrap current fraction using Sauter et al scaling.

        Parameters
        ----------
        plasma_profile : PlasmaProfile
            The plasma profile object containing the necessary plasma parameters for the Sauter
            bootstrap calculation.

        Returns
        -------
        tuple[float, np.ndarray]
            A tuple containing the bootstrap current fraction and the bootstrap current density profile.
        """
        return self.sauter_bootstrap.bootstrap_fraction_sauter(plasma_profile)

    def bootstrap_fraction_nevins(
        self,
        alphan: float,
        alphat: float,
        beta_toroidal: float,
        b_plasma_toroidal_on_axis: float,
        nd_plasma_electrons_vol_avg: float,
        plasma_current: float,
        q95: float,
        q0: float,
        rmajor: float,
        rminor: float,
        te: float,
        zeff: float,
    ) -> float:
        """Calculate the bootstrap current fraction from Nevins et al scaling.

        Parameters
        ----------
        alphan : float
            Density profile index.
        alphat : float
            Temperature profile index.
        beta_toroidal : float
            Toroidal plasma beta.
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        nd_plasma_electrons_vol_avg : float
            Electron density (/m³).
        plasma_current : float
            Plasma current (A).
        q95 : float
            Safety factor at 95% surface.
        q0 : float
            Central safety factor.
        rmajor : float
            Plasma major radius (m).
        rminor : float
            Plasma minor radius (m).
        te : float
            Volume averaged plasma temperature (keV).
        zeff : float
            Plasma effective charge.

        Returns
        -------
        float
            The bootstrap current fraction.

        Notes
        -----
        This function calculates the bootstrap current fraction using the Nevins et al method.

        References
        ----------
        K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study,"
        Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014,
        doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.

        Nevins, W. M. "Summary report: ITER specialists' meeting on heating and current drive."
        ITER-TN-PH-8-4, June 1988.
        """
        # Calculate peak electron beta at plasma centre, this is not the form used in the paper
        # The paper assumes parabolic profiles for calculating core values with the profile indexes.
        # We instead use the directly calculated electron density and temperature values at the core.
        # So that it is compatible with all profiles

        betae0 = (
            physics_variables.nd_plasma_electron_on_axis
            * physics_variables.temp_plasma_electron_on_axis_kev
            * 1.0e3
            * constants.ELECTRON_CHARGE
            / (b_plasma_toroidal_on_axis**2 / (2.0 * constants.RMU0))
        )

        # Call integration routine using definite integral routine from scipy

        ainteg, _ = integrate.quad(
            lambda y: self._nevins_integral(
                y,
                nd_plasma_electrons_vol_avg,
                te,
                b_plasma_toroidal_on_axis,
                rminor,
                rmajor,
                zeff,
                alphat,
                alphan,
                q0,
                q95,
                beta_toroidal,
            ),
            0,  # Lower bound
            1.0,  # Upper bound
        )

        # Calculate bootstrap current and fraction

        aibs = 2.5 * betae0 * rmajor * b_plasma_toroidal_on_axis * q95 * ainteg
        return 1.0e6 * aibs / plasma_current

    @staticmethod
    def bootstrap_fraction_sakai(
        beta_poloidal: float,
        q95: float,
        q0: float,
        alphan: float,
        alphat: float,
        eps: float,
        ind_plasma_internal_norm: float,
    ) -> float:
        """Calculate the bootstrap fraction using the Sakai formula.

        Parameters
        ----------
        beta_poloidal : float
            Plasma poloidal beta.
        q95 : float
            Safety factor at 95% of the plasma radius.
        q0 : float
            Safety factor at the magnetic axis.
        alphan : float
            Density profile index.
        alphat : float
            Temperature profile index.
        eps : float
            Inverse aspect ratio.
        ind_plasma_internal_norm : float
            Plasma normalized internal inductance.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - The profile assumed for the alphan and alphat indexes is only a parabolic profile without a
          pedestal (L-mode).
        - The Root Mean Squared Error for the fitting database of this formula was 0.025.
        - Concentrating on the positive shear plasmas using the ACCOME code equilibria with the fully
          non-inductively driven conditions with neutral beam (NB) injection only are calculated.
        - The electron temperature and the ion temperature were assumed to be equal.
        - This can be used for all aspect ratios.
        - The diamagnetic fraction is included in this formula.

        References
        ----------
        R. Sakai, T. Fujita, and A. Okamoto, "Derivation of bootstrap current fraction scaling formula for
        0-D system code analysis," Fusion Engineering and Design, vol. 149, p. 111322, Dec. 2019,
        doi: https://doi.org/10.1016/j.fusengdes.2019.111322.
        """
        # Sakai states that the ACCOME dataset used has the toridal diamagnetic current included in the bootstrap current
        # So the diamganetic current should not be calculated with this. i_diamagnetic_current = 0
        return (
            10 ** (0.951 * eps - 0.948)
            * beta_poloidal ** (1.226 * eps + 1.584)
            * ind_plasma_internal_norm ** (-0.184 * eps - 0.282)
            * (q95 / q0) ** (-0.042 * eps - 0.02)
            * alphan ** (0.13 * eps + 0.05)
            * alphat ** (0.502 * eps - 0.273)
        )

    @staticmethod
    def bootstrap_fraction_aries(
        beta_poloidal: float,
        ind_plasma_internal_norm: float,
        core_density: float,
        average_density: float,
        inverse_aspect: float,
    ) -> float:
        """Calculate the bootstrap fraction using the ARIES formula.

        Parameters
        ----------
        beta_poloidal : float
            Plasma poloidal beta.
        ind_plasma_internal_norm : float
            Plasma normalized internal inductance.
        core_density : float
            Core plasma density.
        average_density : float
            Average plasma density.
        inverse_aspect : float
            Inverse aspect ratio.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        The source reference does not provide any info about the derivation of the formula.
        It is only stated.

        References
        ----------
        Zoran Dragojlovic et al., "An advanced computational algorithm for systems analysis of tokamak power plants,"
        Fusion Engineering and Design, vol. 85, no. 2, pp. 243-265, Apr. 2010,
        doi: https://doi.org/10.1016/j.fusengdes.2010.02.015.
        """
        # Using the standard variable naming from the ARIES paper
        a_1 = (
            1.10 - 1.165 * ind_plasma_internal_norm + 0.47 * ind_plasma_internal_norm**2
        )
        b_1 = (
            0.806
            - 0.885 * ind_plasma_internal_norm
            + 0.297 * ind_plasma_internal_norm**2
        )

        c_bs = a_1 + b_1 * (core_density / average_density)

        return c_bs * np.sqrt(inverse_aspect) * beta_poloidal

    @staticmethod
    def bootstrap_fraction_andrade(
        beta_poloidal: float,
        core_pressure: float,
        average_pressure: float,
        inverse_aspect: float,
    ) -> float:
        """Calculate the bootstrap fraction using the Andrade et al formula.

        Parameters
        ----------
        beta_poloidal : float
            Plasma poloidal beta.
        core_pressure : float
            Core plasma pressure.
        average_pressure : float
            Average plasma pressure.
        inverse_aspect : float
            Inverse aspect ratio.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - Based off 350 plasma profiles from Experimento Tokamak Esferico (ETE) spherical tokamak
          with A = 1.5, R_0 = 0.3m, I_p = 200kA, B_0=0.4T, beta = 4-10%.
        - Profiles taken as Gaussian shaped functions.
        - Errors mostly up to the order of 10% are obtained when both expressions are compared with
          the equilibrium estimates for the bootstrap current in ETE.

        References
        ----------
        M. C. R. Andrade and G. O. Ludwig, "Scaling of bootstrap current on equilibrium and plasma profile parameters in tokamak plasmas,"
        Plasma Physics and Controlled Fusion, vol. 50, no. 6, pp. 065001-065001, Apr. 2008,
        doi: https://doi.org/10.1088/0741-3335/50/6/065001.
        """

        # Using the standard variable naming from the Andrade et.al. paper
        c_p = core_pressure / average_pressure

        # Error +- 0.0007
        c_bs = 0.2340

        return c_bs * np.sqrt(inverse_aspect) * beta_poloidal * c_p**0.8

    @staticmethod
    def bootstrap_fraction_hoang(
        beta_poloidal: float,
        pressure_index: float,
        current_index: float,
        inverse_aspect: float,
    ) -> float:
        """Calculate the bootstrap fraction using the Hoang et al formula.

        Parameters
        ----------
        beta_poloidal : float
            Plasma poloidal beta.
        pressure_index : float
            Pressure profile index.
        current_index : float
            Current profile index.
        inverse_aspect : float
            Inverse aspect ratio.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - Based off of TFTR data calculated using the TRANSP plasma analysis code.
        - 170 discharges which was assembled to study the tritium influx and transport in discharges
          with D-only neutral beam injection (NBI).
        - Contains L-mode, supershots, reversed shear, enhanced reversed shear and increased li discharges.
        - Discharges with monotonic flux profiles with reversed shear are also included.
        - Is applied to circular cross-section plasmas.

        References
        ----------
        G. T. Hoang and R. V. Budny, "The bootstrap fraction in TFTR," AIP conference proceedings,
        Jan. 1997, doi: https://doi.org/10.1063/1.53414.
        """

        # Using the standard variable naming from the Hoang et.al. paper
        # Hoang et.al uses a different definition for the profile indexes such that
        # alpha_p is defined as the ratio of the central and the volume-averaged values, and the peakedness of the density of the total plasma current
        # (defined as ratio of the central value and I_p), alpha_j$

        # We assume the pressure and current profile is parabolic and use the (profile_index +1) term in lieu
        # The term represents the ratio of the the core to volume averaged value

        # This could lead to large changes in the value depending on interpretation of the profile index

        c_bs = np.sqrt((pressure_index + 1) / (current_index + 1))

        return 0.4 * np.sqrt(inverse_aspect) * beta_poloidal**0.9 * c_bs

    @staticmethod
    def bootstrap_fraction_wong(
        beta_poloidal: float,
        density_index: float,
        temperature_index: float,
        inverse_aspect: float,
        elongation: float,
    ) -> float:
        """Calculate the bootstrap fraction using the Wong et al formula.

        Parameters
        ----------
        beta_poloidal : float
            Plasma poloidal beta.
        density_index : float
            Density profile index.
        temperature_index : float
            Temperature profile index.
        inverse_aspect : float
            Inverse aspect ratio.
        elongation : float
            Plasma elongation.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - Data is based off of equilibria from Miller et al.
        - A: 1.2 - 3.0 and stable to n ballooning and low n kink modes at a bootstrap fraction of 99%
          for kappa = 2, 2.5 and 3.
        - The results were parameterized as a function of aspect ratio and elongation.
        - The parametric dependency of beta_p and beta_T are based on fitting of the DIII-D high
          equivalent DT yield results.
        - Parabolic profiles should be used for best results as the pressure peaking value is calculated
          as the product of a parabolic temperature and density profile.

        References
        ----------
        C.-P. Wong, J. C. Wesley, R. D. Stambaugh, and E. T. Cheng, "Toroidal reactor designs as a function of aspect ratio and elongation,"
        vol. 42, no. 5, pp. 547-556, May 2002, doi: https://doi.org/10.1088/0029-5515/42/5/307.

        Miller, R L, "Stable bootstrap-current driven equilibria for low aspect ratio tokamaks".
        Switzerland: N. p., 1996. Web.https://fusion.gat.com/pubs-ext/MISCONF96/A22433.pdf
        """
        # Using the standard variable naming from the Wong et.al. paper
        f_peak = 2.0 / scipy.special.beta(0.5, density_index + temperature_index + 1)

        c_bs = 0.773 + 0.019 * elongation

        return c_bs * f_peak**0.25 * beta_poloidal * np.sqrt(inverse_aspect)

    @staticmethod
    def bootstrap_fraction_gi_I(  # noqa: N802
        beta_poloidal: float,
        pressure_index: float,
        temperature_index: float,
        inverse_aspect: float,
        effective_charge: float,
        q95: float,
        q0: float,
    ) -> float:
        """Calculate the bootstrap fraction using the first scaling from the Gi et al formula.

        Parameters
        ----------
        beta_poloidal : float
            Plasma poloidal beta.
        pressure_index : float
            Pressure profile index.
        temperature_index : float
            Temperature profile index.
        inverse_aspect : float
            Inverse aspect ratio.
        effective_charge : float
            Plasma effective charge.
        q95 : float
            Safety factor at 95% of the plasma radius.
        q0 : float
            Safety factor at the magnetic axis.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - Scaling found by solving the Hirshman-Sigmar bootstrap model using the matrix inversion method.
        - Method was done to put the scaling into parameters compatible with the TPC systems code.
        - Uses the ACCOME code to create bootstrap current fractions without using the iterative
          calculations of the current drive and equilibrium models in the scan.
        - R = 5.0 m, A = 1.3 - 5.0, kappa = 2, triang = 0.3, alpha_n = 0.1 - 0.8, alpha_t = 1.0 - 3.0,
          Z_eff = 1.2 - 3.0.
        - Uses parabolic plasma profiles only.
        - Scaling 1 has better accuracy than Scaling 2. However, Scaling 1 overestimated the f_BS value
          for reversed shear equilibrium.

        References
        ----------
        K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study,"
        Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014,
        doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.
        """

        # Using the standard variable naming from the Gi et.al. paper

        c_bs = (
            0.474
            * inverse_aspect**-0.1
            * pressure_index**0.974
            * temperature_index**-0.416
            * effective_charge**0.178
            * (q95 / q0) ** -0.133
        )

        return c_bs * np.sqrt(inverse_aspect) * beta_poloidal

    @staticmethod
    def bootstrap_fraction_gi_II(  # noqa: N802
        beta_poloidal: float,
        pressure_index: float,
        temperature_index: float,
        inverse_aspect: float,
        effective_charge: float,
    ) -> float:
        """Calculate the bootstrap fraction using the second scaling from the Gi et al formula.

        Parameters
        ----------
        beta_poloidal : float
            Plasma poloidal beta.
        pressure_index : float
            Pressure profile index.
        temperature_index : float
            Temperature profile index.
        inverse_aspect : float
            Inverse aspect ratio.
        effective_charge : float
            Plasma effective charge.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - Scaling found by solving the Hirshman-Sigmar bootstrap model using the matrix inversion method.
        - Method was done to put the scaling into parameters compatible with the TPC systems code.
        - Uses the ACCOME code to create bootstrap current fractions without using the iterative
          calculations of the current drive and equilibrium models in the scan.
        - R = 5.0 m, A = 1.3 - 5.0, kappa = 2, triang = 0.3, alpha_n = 0.1 - 0.8, alpha_t = 1.0 - 3.0,
          Z_eff = 1.2 - 3.0.
        - Uses parabolic plasma profiles only.
        - This scaling has the q profile dependence removed to obtain a scaling formula with much more
          flexible variables than that by a single profile factor for internal current profile.

        References
        ----------
        K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study,"
        Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014,
        doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.
        """

        # Using the standard variable naming from the Gi et.al. paper

        c_bs = (
            0.382
            * inverse_aspect**-0.242
            * pressure_index**0.974
            * temperature_index**-0.416
            * effective_charge**0.178
        )

        return c_bs * np.sqrt(inverse_aspect) * beta_poloidal

    @staticmethod
    def bootstrap_fraction_sugiyama_l_mode(
        eps: float,
        beta_poloidal: float,
        alphan: float,
        alphat: float,
        zeff: float,
        q95: float,
        q0: float,
    ) -> float:
        """Calculate the bootstrap fraction using the L-mode scaling from the Sugiyama et al formula.

        Parameters
        ----------
        eps : float
            Inverse aspect ratio.
        beta_poloidal : float
            Plasma poloidal beta.
        alphan : float
            Density profile index.
        alphat : float
            Temperature profile index.
        zeff : float
            Plasma effective charge.
        q95 : float
            Safety factor at 95% of the plasma radius.
        q0 : float
            Safety factor at the magnetic axis.

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - This scaling is derived for L-mode plasmas.
        - Ion and electron temperature are the same.
        - Z_eff has a uniform profile, with only fully stripped carbon impurity.

        References
        ----------
        S. Sugiyama, T. Goto, H. Utoh, and Y. Sakamoto, "Improvement of core plasma power and
        current balance models for tokamak systems code considering H-mode plasma profiles,"
        Fusion Engineering and Design, vol. 216, p. 115022, Jul. 2025, doi:
        https://doi.org/10.1016/j.fusengdes.2025.115022.
        """

        return (
            0.740
            * eps**0.418
            * beta_poloidal**0.904
            * alphan**0.06
            * alphat**-0.138
            * zeff**0.230
            * (q95 / q0) ** -0.142
        )

    @staticmethod
    def bootstrap_fraction_sugiyama_h_mode(
        eps: float,
        beta_poloidal: float,
        alphan: float,
        alphat: float,
        tbeta: float,
        zeff: float,
        q95: float,
        q0: float,
        radius_plasma_pedestal_density_norm: float,
        nd_plasma_pedestal_electron: float,
        n_greenwald: float,
        temp_plasma_pedestal_kev: float,
    ) -> float:
        """Calculate the bootstrap fraction using the H-mode scaling from the Sugiyama et al formula.

        Parameters
        ----------
        eps : float
            Inverse aspect ratio.
        beta_poloidal : float
            Plasma poloidal beta.
        alphan : float
            Density profile index.
        alphat : float
            Temperature profile index.
        tbeta : float
            Second temperature profile index.
        zeff : float
            Plasma effective charge.
        q95 : float
            Safety factor at 95% of the plasma radius.
        q0 : float
            Safety factor at the magnetic axis.
        radius_plasma_pedestal_density_norm : float
            Normalised plasma radius of density pedestal.
        nd_plasma_pedestal_electron : float
            Electron number density at the pedestal [m⁻³].
        n_greenwald : float
            Greenwald density limit [m⁻³].
        temp_plasma_pedestal_kev : float
            Electron temperature at the pedestal [keV].

        Returns
        -------
        float
            The calculated bootstrap fraction.

        Notes
        -----
        - This scaling is derived for H-mode plasmas.
        - The temperature and density pedestal positions are the same.
        - Separatrix temperature and density are zero.
        - Ion and electron temperature are the same.
        - Z_eff has a uniform profile, with only fully stripped carbon impurity.

        References
        ----------
        S. Sugiyama, T. Goto, H. Utoh, and Y. Sakamoto, "Improvement of core plasma power and
        current balance models for tokamak systems code considering H-mode plasma profiles,"
        Fusion Engineering and Design, vol. 216, p. 115022, Jul. 2025, doi:
        https://doi.org/10.1016/j.fusengdes.2025.115022.
        """

        return (
            0.789
            * eps**0.606
            * beta_poloidal**0.960
            * alphan**0.0319
            * alphat**0.00822
            * tbeta**-0.0783
            * zeff**0.241
            * (q95 / q0) ** -0.103
            * radius_plasma_pedestal_density_norm**0.367
            * (nd_plasma_pedestal_electron / n_greenwald) ** -0.174
            * temp_plasma_pedestal_kev**0.0552
        )

    def output_bootstrap_current_information(self):
        """Output the calculated bootstrap current information to the output file."""

        po.ovarrf(
            self.outfile,
            "Bootstrap current fraction multiplier",
            "(cboot)",
            current_drive_variables.cboot,
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (ITER 1989)",
            "(f_c_plasma_bootstrap_iter89)",
            current_drive_variables.f_c_plasma_bootstrap_iter89,
            "OP ",
        )

        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Sauter et al)",
            "(f_c_plasma_bootstrap_sauter)",
            current_drive_variables.f_c_plasma_bootstrap_sauter,
            "OP ",
        )
        for point in range(len(physics_variables.j_plasma_bootstrap_sauter_profile)):
            po.ovarrf(
                self.mfile,
                f"Sauter et al bootstrap current density profile at point {point}",
                f"(j_plasma_bootstrap_sauter_profile{point})",
                physics_variables.j_plasma_bootstrap_sauter_profile[point],
                "OP ",
            )

        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Nevins et al)",
            "(f_c_plasma_bootstrap_nevins)",
            current_drive_variables.f_c_plasma_bootstrap_nevins,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Wilson)",
            "(f_c_plasma_bootstrap_wilson)",
            current_drive_variables.f_c_plasma_bootstrap_wilson,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Sakai)",
            "(f_c_plasma_bootstrap_sakai)",
            current_drive_variables.f_c_plasma_bootstrap_sakai,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (ARIES)",
            "(f_c_plasma_bootstrap_aries)",
            current_drive_variables.f_c_plasma_bootstrap_aries,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Andrade)",
            "(f_c_plasma_bootstrap_andrade)",
            current_drive_variables.f_c_plasma_bootstrap_andrade,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Hoang)",
            "(f_c_plasma_bootstrap_hoang)",
            current_drive_variables.f_c_plasma_bootstrap_hoang,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Wong)",
            "(f_c_plasma_bootstrap_wong)",
            current_drive_variables.f_c_plasma_bootstrap_wong,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Gi I)",
            "(bscf_gi_i)",
            current_drive_variables.bscf_gi_i,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Gi II)",
            "(bscf_gi_ii)",
            current_drive_variables.bscf_gi_ii,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Sugiyama L-mode)",
            "(f_c_plasma_bootstrap_sugiyama_l)",
            current_drive_variables.f_c_plasma_bootstrap_sugiyama_l,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (Sugiyama H-mode)",
            "(f_c_plasma_bootstrap_sugiyama_h)",
            current_drive_variables.f_c_plasma_bootstrap_sugiyama_h,
            "OP ",
        )

        po.ovarrf(
            self.outfile,
            "Diamagnetic fraction (Hender)",
            "(f_c_plasma_diamagnetic_hender)",
            current_drive_variables.f_c_plasma_diamagnetic_hender,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Diamagnetic fraction (SCENE)",
            "(f_c_plasma_diamagnetic_scene)",
            current_drive_variables.f_c_plasma_diamagnetic_scene,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Pfirsch-Schlueter fraction (SCENE)",
            "(f_c_plasma_pfirsch_schluter_scene)",
            current_drive_variables.f_c_plasma_pfirsch_schluter_scene,
            "OP ",
        )
        # Error to catch if bootstap fraction limit has been enforced
        if physics_variables.err242 == 1:
            logger.error("Bootstrap fraction upper limit enforced")

        # Error to catch if self-driven current fraction limit has been enforced
        if physics_variables.err243 == 1:
            logger.error(
                "Predicted plasma driven current is more than upper limit on non-inductive fraction"
            )

        if physics_variables.i_bootstrap_current == 0:
            po.ocmmnt(self.outfile, "  (User-specified bootstrap current fraction used)")
        elif physics_variables.i_bootstrap_current == 1:
            po.ocmmnt(
                self.outfile, "  (ITER 1989 bootstrap current fraction model used)"
            )
        elif physics_variables.i_bootstrap_current == 2:
            po.ocmmnt(
                self.outfile,
                "  (Nevins et al bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 3:
            po.ocmmnt(self.outfile, "  (Wilson bootstrap current fraction model used)")
        elif physics_variables.i_bootstrap_current == 4:
            po.ocmmnt(
                self.outfile,
                "  (Sauter et al bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 5:
            po.ocmmnt(
                self.outfile,
                "  (Sakai et al bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 6:
            po.ocmmnt(
                self.outfile,
                "  (ARIES bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 7:
            po.ocmmnt(
                self.outfile,
                "  (Andrade et al bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 8:
            po.ocmmnt(
                self.outfile,
                "  (Hoang et al bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 9:
            po.ocmmnt(
                self.outfile,
                "  (Wong et al bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 10:
            po.ocmmnt(
                self.outfile,
                "  (Gi-I et al bootstrap current fraction model used)",
            )
        elif physics_variables.i_bootstrap_current == 11:
            po.ocmmnt(
                self.outfile,
                "  (Gi-II et al bootstrap current fraction model used)",
            )

        if physics_variables.i_diamagnetic_current == 0:
            po.ocmmnt(self.outfile, "  (Diamagnetic current fraction not calculated)")
            # Error to show if diamagnetic current is above 1% but not used
            if current_drive_variables.f_c_plasma_diamagnetic_scene > 0.01e0:
                logger.error(
                    "Diamagnetic fraction is more than 1%, but not calculated. "
                    "Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1"
                )

        elif physics_variables.i_diamagnetic_current == 1:
            po.ocmmnt(
                self.outfile, "  (Hender diamagnetic current fraction scaling used)"
            )
        elif physics_variables.i_diamagnetic_current == 2:
            po.ocmmnt(
                self.outfile, "  (SCENE diamagnetic current fraction scaling used)"
            )

        if physics_variables.i_pfirsch_schluter_current == 0:
            po.ocmmnt(self.outfile, "  Pfirsch-Schluter current fraction not calculated")
        elif physics_variables.i_pfirsch_schluter_current == 1:
            po.ocmmnt(
                self.outfile,
                "  (SCENE Pfirsch-Schluter current fraction scaling used)",
            )

        po.ovarrf(
            self.outfile,
            "Bootstrap fraction (enforced)",
            "(f_c_plasma_bootstrap.)",
            current_drive_variables.f_c_plasma_bootstrap,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Diamagnetic fraction (enforced)",
            "(f_c_plasma_diamagnetic.)",
            current_drive_variables.f_c_plasma_diamagnetic,
            "OP ",
        )
        po.ovarrf(
            self.outfile,
            "Pfirsch-Schlueter fraction (enforced)",
            "(f_c_plasma_pfirsch_schluter.)",
            current_drive_variables.f_c_plasma_pfirsch_schluter,
            "OP ",
        )

outfile = constants.NOUT instance-attribute

mfile = constants.MFILE instance-attribute

plasma_profile = plasma_profile instance-attribute

sauter_bootstrap = SauterBootstrapCurrent() instance-attribute

run()

Source code in process/models/physics/bootstrap_current.py
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
def run(self) -> None:
    # Calculate bootstrap current fraction using various models
    current_drive_variables.f_c_plasma_bootstrap_iter89 = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_iter89(
            aspect=physics_variables.aspect,
            beta=physics_variables.beta_total_vol_avg,
            b_plasma_toroidal_on_axis=physics_variables.b_plasma_total,
            plasma_current=physics_variables.plasma_current,
            q95=physics_variables.q95,
            q0=physics_variables.q0,
            rmajor=physics_variables.rmajor,
            vol_plasma=physics_variables.vol_plasma,
        )
    )

    current_drive_variables.f_c_plasma_bootstrap_nevins = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_nevins(
            alphan=physics_variables.alphan,
            alphat=physics_variables.alphat,
            beta_toroidal=physics_variables.beta_toroidal_vol_avg,
            b_plasma_toroidal_on_axis=physics_variables.b_plasma_toroidal_on_axis,
            nd_plasma_electrons_vol_avg=physics_variables.nd_plasma_electrons_vol_avg,
            plasma_current=physics_variables.plasma_current,
            q95=physics_variables.q95,
            q0=physics_variables.q0,
            rmajor=physics_variables.rmajor,
            rminor=physics_variables.rminor,
            te=physics_variables.temp_plasma_electron_vol_avg_kev,
            zeff=physics_variables.n_charge_plasma_effective_vol_avg,
        )
    )

    # Wilson scaling uses thermal poloidal beta, not total
    current_drive_variables.f_c_plasma_bootstrap_wilson = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_wilson(
            alphaj=physics_variables.alphaj,
            alphap=physics_variables.alphap,
            alphat=physics_variables.alphat,
            betpth=physics_variables.beta_thermal_poloidal_vol_avg,
            q0=physics_variables.q0,
            q95=physics_variables.q95,
            rmajor=physics_variables.rmajor,
            rminor=physics_variables.rminor,
        )
    )

    (
        current_drive_variables.f_c_plasma_bootstrap_sauter,
        physics_variables.j_plasma_bootstrap_sauter_profile,
    ) = self.bootstrap_fraction_sauter(self.plasma_profile)
    current_drive_variables.f_c_plasma_bootstrap_sauter *= (
        current_drive_variables.cboot
    )

    current_drive_variables.f_c_plasma_bootstrap_sakai = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_sakai(
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            q95=physics_variables.q95,
            q0=physics_variables.q0,
            alphan=physics_variables.alphan,
            alphat=physics_variables.alphat,
            eps=physics_variables.eps,
            ind_plasma_internal_norm=physics_variables.ind_plasma_internal_norm,
        )
    )

    current_drive_variables.f_c_plasma_bootstrap_aries = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_aries(
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            ind_plasma_internal_norm=physics_variables.ind_plasma_internal_norm,
            core_density=physics_variables.nd_plasma_electron_on_axis,
            average_density=physics_variables.nd_plasma_electrons_vol_avg,
            inverse_aspect=physics_variables.eps,
        )
    )

    current_drive_variables.f_c_plasma_bootstrap_andrade = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_andrade(
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            core_pressure=physics_variables.pres_plasma_thermal_on_axis,
            average_pressure=physics_variables.pres_plasma_thermal_vol_avg,
            inverse_aspect=physics_variables.eps,
        )
    )
    current_drive_variables.f_c_plasma_bootstrap_hoang = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_hoang(
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            pressure_index=physics_variables.alphap,
            current_index=physics_variables.alphaj,
            inverse_aspect=physics_variables.eps,
        )
    )
    current_drive_variables.f_c_plasma_bootstrap_wong = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_wong(
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            density_index=physics_variables.alphan,
            temperature_index=physics_variables.alphat,
            inverse_aspect=physics_variables.eps,
            elongation=physics_variables.kappa,
        )
    )
    current_drive_variables.bscf_gi_i = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_gi_I(
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            pressure_index=physics_variables.alphap,
            temperature_index=physics_variables.alphat,
            inverse_aspect=physics_variables.eps,
            effective_charge=physics_variables.n_charge_plasma_effective_vol_avg,
            q95=physics_variables.q95,
            q0=physics_variables.q0,
        )
    )

    current_drive_variables.bscf_gi_ii = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_gi_II(
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            pressure_index=physics_variables.alphap,
            temperature_index=physics_variables.alphat,
            inverse_aspect=physics_variables.eps,
            effective_charge=physics_variables.n_charge_plasma_effective_vol_avg,
        )
    )
    current_drive_variables.f_c_plasma_bootstrap_sugiyama_l = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_sugiyama_l_mode(
            eps=physics_variables.eps,
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            alphan=physics_variables.alphan,
            alphat=physics_variables.alphat,
            zeff=physics_variables.n_charge_plasma_effective_vol_avg,
            q95=physics_variables.q95,
            q0=physics_variables.q0,
        )
    )
    current_drive_variables.f_c_plasma_bootstrap_sugiyama_h = (
        current_drive_variables.cboot
        * self.bootstrap_fraction_sugiyama_h_mode(
            eps=physics_variables.eps,
            beta_poloidal=physics_variables.beta_poloidal_vol_avg,
            alphan=physics_variables.alphan,
            alphat=physics_variables.alphat,
            tbeta=physics_variables.tbeta,
            zeff=physics_variables.n_charge_plasma_effective_vol_avg,
            q95=physics_variables.q95,
            q0=physics_variables.q0,
            radius_plasma_pedestal_density_norm=physics_variables.radius_plasma_pedestal_density_norm,
            nd_plasma_pedestal_electron=physics_variables.nd_plasma_pedestal_electron,
            n_greenwald=physics_variables.nd_plasma_electron_max_array[6],
            temp_plasma_pedestal_kev=physics_variables.temp_plasma_pedestal_kev,
        )
    )

    # Calculate beta_norm_max based on i_beta_norm_max
    try:
        model = BootstrapCurrentFractionModel(
            int(physics_variables.i_bootstrap_current)
        )
        current_drive_variables.f_c_plasma_bootstrap = (
            self.get_bootstrap_current_fraction_value(model)
        )
    except ValueError:
        raise ProcessValueError(
            "Illegal value of i_bootstrap_current",
            i_bootstrap_current=physics_variables.i_bootstrap_current,
        ) from None

get_bootstrap_current_fraction_value(model)

Get the plasma current bootstrap fraction (f_BS) for the specified model.

Parameters:

Name Type Description Default
model BootstrapCurrentFractionModel

The bootstrap current model type.

required

Returns:

Type Description
float

The bootstrap current fraction value.

Source code in process/models/physics/bootstrap_current.py
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
def get_bootstrap_current_fraction_value(
    self, model: BootstrapCurrentFractionModel
) -> float:
    """Get the plasma current bootstrap fraction (f_BS) for the specified model.

    Parameters
    ----------
    model : BootstrapCurrentFractionModel
        The bootstrap current model type.

    Returns
    -------
    float
        The bootstrap current fraction value.
    """
    model_map = {
        BootstrapCurrentFractionModel.USER_INPUT: current_drive_variables.f_c_plasma_bootstrap,
        BootstrapCurrentFractionModel.ITER_89: current_drive_variables.f_c_plasma_bootstrap_iter89,
        BootstrapCurrentFractionModel.NEVINS: current_drive_variables.f_c_plasma_bootstrap_nevins,
        BootstrapCurrentFractionModel.WILSON: current_drive_variables.f_c_plasma_bootstrap_wilson,
        BootstrapCurrentFractionModel.SAUTER: current_drive_variables.f_c_plasma_bootstrap_sauter,
        BootstrapCurrentFractionModel.SAKAI: current_drive_variables.f_c_plasma_bootstrap_sakai,
        BootstrapCurrentFractionModel.ARIES: current_drive_variables.f_c_plasma_bootstrap_aries,
        BootstrapCurrentFractionModel.ANDRADE: current_drive_variables.f_c_plasma_bootstrap_andrade,
        BootstrapCurrentFractionModel.HOANG: current_drive_variables.f_c_plasma_bootstrap_hoang,
        BootstrapCurrentFractionModel.WONG: current_drive_variables.f_c_plasma_bootstrap_wong,
        BootstrapCurrentFractionModel.GI_1: current_drive_variables.bscf_gi_i,
        BootstrapCurrentFractionModel.GI_2: current_drive_variables.bscf_gi_ii,
        BootstrapCurrentFractionModel.SUGIYAMA_L_MODE: current_drive_variables.f_c_plasma_bootstrap_sugiyama_l,
        BootstrapCurrentFractionModel.SUGIYAMA_H_MODE: current_drive_variables.f_c_plasma_bootstrap_sugiyama_h,
    }
    return model_map[model]

bootstrap_fraction_iter89(aspect, beta, b_plasma_toroidal_on_axis, plasma_current, q95, q0, rmajor, vol_plasma) staticmethod

Calculate the bootstrap-driven fraction of the plasma current.

Parameters:

Name Type Description Default
aspect float

Plasma aspect ratio.

required
beta float

Plasma total beta.

required
b_plasma_toroidal_on_axis float

Toroidal field on axis (T).

required
plasma_current float

Plasma current (A).

required
q95 float

Safety factor at 95% surface.

required
q0 float

Central safety factor.

required
rmajor float

Plasma major radius (m).

required
vol_plasma float

Plasma volume (m³).

required

Returns:

Type Description
float

The bootstrap-driven fraction of the plasma current.

Notes

This function performs the original ITER calculation of the plasma current bootstrap fraction.

References

ITER Physics Design Guidelines: 1989 [IPDG89], N. A. Uckan et al, ITER Documentation Series No.10, IAEA/ITER/DS/10, IAEA, Vienna, 1990

Source code in process/models/physics/bootstrap_current.py
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
@staticmethod
def bootstrap_fraction_iter89(
    aspect: float,
    beta: float,
    b_plasma_toroidal_on_axis: float,
    plasma_current: float,
    q95: float,
    q0: float,
    rmajor: float,
    vol_plasma: float,
) -> float:
    """Calculate the bootstrap-driven fraction of the plasma current.

    Parameters
    ----------
    aspect : float
        Plasma aspect ratio.
    beta : float
        Plasma total beta.
    b_plasma_toroidal_on_axis : float
        Toroidal field on axis (T).
    plasma_current : float
        Plasma current (A).
    q95 : float
        Safety factor at 95% surface.
    q0 : float
        Central safety factor.
    rmajor : float
        Plasma major radius (m).
    vol_plasma : float
        Plasma volume (m³).

    Returns
    -------
    float
        The bootstrap-driven fraction of the plasma current.

    Notes
    -----
    This function performs the original ITER calculation of the plasma current bootstrap fraction.

    References
    ----------
    ITER Physics Design Guidelines: 1989 [IPDG89], N. A. Uckan et al,
    ITER Documentation Series No.10, IAEA/ITER/DS/10, IAEA, Vienna, 1990
    """

    # Calculate the bootstrap current coefficient
    c_bs = 1.32 - 0.235 * (q95 / q0) + 0.0185 * (q95 / q0) ** 2

    # Calculate the average minor radius
    average_a = np.sqrt(vol_plasma / (2 * np.pi**2 * rmajor))

    b_pa = (plasma_current / 1e6) / (5 * average_a)

    # Calculate the poloidal beta for bootstrap current
    betapbs = beta * (b_plasma_toroidal_on_axis / b_pa) ** 2

    # Ensure betapbs is positive
    if betapbs <= 0.0:
        return 0.0

    # Calculate and return the bootstrap current fraction
    return c_bs * (betapbs / np.sqrt(aspect)) ** 1.3

bootstrap_fraction_wilson(alphaj, alphap, alphat, betpth, q0, q95, rmajor, rminor) staticmethod

Bootstrap current fraction from Wilson et al scaling.

Parameters:

Name Type Description Default
alphaj float

Current profile index.

required
alphap float

Pressure profile index.

required
alphat float

Temperature profile index.

required
betpth float

Thermal component of poloidal beta.

required
q0 float

Safety factor on axis.

required
q95 float

Edge safety factor.

required
rmajor float

Major radius (m).

required
rminor float

Minor radius (m).

required

Returns:

Type Description
float

The bootstrap current fraction.

Notes

This function calculates the bootstrap current fraction using the numerically fitted algorithm written by Howard Wilson.

References

AEA FUS 172: Physics Assessment for the European Reactor Study, 1989

H. R. Wilson, Nuclear Fusion 32 (1992) 257

Source code in process/models/physics/bootstrap_current.py
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
@staticmethod
def bootstrap_fraction_wilson(
    alphaj: float,
    alphap: float,
    alphat: float,
    betpth: float,
    q0: float,
    q95: float,
    rmajor: float,
    rminor: float,
) -> float:
    """Bootstrap current fraction from Wilson et al scaling.

    Parameters
    ----------
    alphaj : float
        Current profile index.
    alphap : float
        Pressure profile index.
    alphat : float
        Temperature profile index.
    betpth : float
        Thermal component of poloidal beta.
    q0 : float
        Safety factor on axis.
    q95 : float
        Edge safety factor.
    rmajor : float
        Major radius (m).
    rminor : float
        Minor radius (m).

    Returns
    -------
    float
        The bootstrap current fraction.

    Notes
    -----
    This function calculates the bootstrap current fraction using the numerically fitted algorithm
    written by Howard Wilson.

    References
    ----------
    AEA FUS 172: Physics Assessment for the European Reactor Study, 1989

    H. R. Wilson, Nuclear Fusion 32 (1992) 257
    """

    term1 = np.log(0.5)
    term2 = np.log(q0 / q95)

    # Re-arranging of parabolic profile to be equal to (r/a)^2 where the profile value is half of the core value

    termp = 1.0 - 0.5 ** (1.0 / alphap)
    termt = 1.0 - 0.5 ** (1.0 / alphat)
    termj = 1.0 - 0.5 ** (1.0 / alphaj)

    # Assuming a parabolic safety factor profile of the form q = q0 + (q95 - q0) * (r/a)^2
    # Substitute (r/a)^2 term from temperature,pressure and current profiles into q profile when values is 50% of core value
    # Take natural log of q profile over q95 and q0 to get the profile index

    alfpnw = term1 / np.log(np.log((q0 + (q95 - q0) * termp) / q95) / term2)
    alftnw = term1 / np.log(np.log((q0 + (q95 - q0) * termt) / q95) / term2)
    aj = term1 / np.log(np.log((q0 + (q95 - q0) * termj) / q95) / term2)

    # Crude check for NaN errors or other illegal values.
    if np.isnan(aj) or np.isnan(alfpnw) or np.isnan(alftnw) or aj < 0:
        raise ProcessValueError(
            "Illegal profile value found", aj=aj, alfpnw=alfpnw, alftnw=alftnw
        )

    # Ratio of ionic charge to electron charge

    z = 1.0

    # Inverse aspect ratio: r2 = maximum plasma radius, r1 = minimum
    # This is the definition used in the paper
    r2 = rmajor + rminor
    r1 = rmajor - rminor
    eps1 = (r2 - r1) / (r2 + r1)

    # Coefficients fitted using least squares techniques

    # Square root of current profile index term
    saj = np.sqrt(aj)

    a = np.array([
        1.41 * (1.0 - 0.28 * saj) * (1.0 + 0.12 / z),
        0.36 * (1.0 - 0.59 * saj) * (1.0 + 0.8 / z),
        -0.27 * (1.0 - 0.47 * saj) * (1.0 + 3.0 / z),
        0.0053 * (1.0 + 5.0 / z),
        -0.93 * (1.0 - 0.34 * saj) * (1.0 + 0.15 / z),
        -0.26 * (1.0 - 0.57 * saj) * (1.0 - 0.27 * z),
        0.064 * (1.0 - 0.6 * aj + 0.15 * aj * aj) * (1.0 + 7.6 / z),
        -0.0011 * (1.0 + 9.0 / z),
        -0.33 * (1.0 - aj + 0.33 * aj * aj),
        -0.26 * (1.0 - 0.87 / saj - 0.16 * aj),
        -0.14 * (1.0 - 1.14 / saj - 0.45 * saj),
        -0.0069,
    ])

    seps1 = np.sqrt(eps1)

    b = np.array([
        1.0,
        alfpnw,
        alftnw,
        alfpnw * alftnw,
        seps1,
        alfpnw * seps1,
        alftnw * seps1,
        alfpnw * alftnw * seps1,
        eps1,
        alfpnw * eps1,
        alftnw * eps1,
        alfpnw * alftnw * eps1,
    ])

    # Empirical bootstrap current fraction
    return seps1 * betpth * (a * b).sum()

bootstrap_fraction_sauter(plasma_profile)

Get the bootstrap current fraction using Sauter et al scaling.

Parameters:

Name Type Description Default
plasma_profile PlasmaProfile

The plasma profile object containing the necessary plasma parameters for the Sauter bootstrap calculation.

required

Returns:

Type Description
tuple[float, ndarray]

A tuple containing the bootstrap current fraction and the bootstrap current density profile.

Source code in process/models/physics/bootstrap_current.py
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
def bootstrap_fraction_sauter(
    self, plasma_profile: PlasmaProfile
) -> tuple[float, np.ndarray]:
    """Get the bootstrap current fraction using Sauter et al scaling.

    Parameters
    ----------
    plasma_profile : PlasmaProfile
        The plasma profile object containing the necessary plasma parameters for the Sauter
        bootstrap calculation.

    Returns
    -------
    tuple[float, np.ndarray]
        A tuple containing the bootstrap current fraction and the bootstrap current density profile.
    """
    return self.sauter_bootstrap.bootstrap_fraction_sauter(plasma_profile)

bootstrap_fraction_nevins(alphan, alphat, beta_toroidal, b_plasma_toroidal_on_axis, nd_plasma_electrons_vol_avg, plasma_current, q95, q0, rmajor, rminor, te, zeff)

Calculate the bootstrap current fraction from Nevins et al scaling.

Parameters:

Name Type Description Default
alphan float

Density profile index.

required
alphat float

Temperature profile index.

required
beta_toroidal float

Toroidal plasma beta.

required
b_plasma_toroidal_on_axis float

Toroidal field on axis (T).

required
nd_plasma_electrons_vol_avg float

Electron density (/m³).

required
plasma_current float

Plasma current (A).

required
q95 float

Safety factor at 95% surface.

required
q0 float

Central safety factor.

required
rmajor float

Plasma major radius (m).

required
rminor float

Plasma minor radius (m).

required
te float

Volume averaged plasma temperature (keV).

required
zeff float

Plasma effective charge.

required

Returns:

Type Description
float

The bootstrap current fraction.

Notes

This function calculates the bootstrap current fraction using the Nevins et al method.

References

K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study," Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014, doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.

Nevins, W. M. "Summary report: ITER specialists' meeting on heating and current drive." ITER-TN-PH-8-4, June 1988.

Source code in process/models/physics/bootstrap_current.py
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
def bootstrap_fraction_nevins(
    self,
    alphan: float,
    alphat: float,
    beta_toroidal: float,
    b_plasma_toroidal_on_axis: float,
    nd_plasma_electrons_vol_avg: float,
    plasma_current: float,
    q95: float,
    q0: float,
    rmajor: float,
    rminor: float,
    te: float,
    zeff: float,
) -> float:
    """Calculate the bootstrap current fraction from Nevins et al scaling.

    Parameters
    ----------
    alphan : float
        Density profile index.
    alphat : float
        Temperature profile index.
    beta_toroidal : float
        Toroidal plasma beta.
    b_plasma_toroidal_on_axis : float
        Toroidal field on axis (T).
    nd_plasma_electrons_vol_avg : float
        Electron density (/m³).
    plasma_current : float
        Plasma current (A).
    q95 : float
        Safety factor at 95% surface.
    q0 : float
        Central safety factor.
    rmajor : float
        Plasma major radius (m).
    rminor : float
        Plasma minor radius (m).
    te : float
        Volume averaged plasma temperature (keV).
    zeff : float
        Plasma effective charge.

    Returns
    -------
    float
        The bootstrap current fraction.

    Notes
    -----
    This function calculates the bootstrap current fraction using the Nevins et al method.

    References
    ----------
    K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study,"
    Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014,
    doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.

    Nevins, W. M. "Summary report: ITER specialists' meeting on heating and current drive."
    ITER-TN-PH-8-4, June 1988.
    """
    # Calculate peak electron beta at plasma centre, this is not the form used in the paper
    # The paper assumes parabolic profiles for calculating core values with the profile indexes.
    # We instead use the directly calculated electron density and temperature values at the core.
    # So that it is compatible with all profiles

    betae0 = (
        physics_variables.nd_plasma_electron_on_axis
        * physics_variables.temp_plasma_electron_on_axis_kev
        * 1.0e3
        * constants.ELECTRON_CHARGE
        / (b_plasma_toroidal_on_axis**2 / (2.0 * constants.RMU0))
    )

    # Call integration routine using definite integral routine from scipy

    ainteg, _ = integrate.quad(
        lambda y: self._nevins_integral(
            y,
            nd_plasma_electrons_vol_avg,
            te,
            b_plasma_toroidal_on_axis,
            rminor,
            rmajor,
            zeff,
            alphat,
            alphan,
            q0,
            q95,
            beta_toroidal,
        ),
        0,  # Lower bound
        1.0,  # Upper bound
    )

    # Calculate bootstrap current and fraction

    aibs = 2.5 * betae0 * rmajor * b_plasma_toroidal_on_axis * q95 * ainteg
    return 1.0e6 * aibs / plasma_current

bootstrap_fraction_sakai(beta_poloidal, q95, q0, alphan, alphat, eps, ind_plasma_internal_norm) staticmethod

Calculate the bootstrap fraction using the Sakai formula.

Parameters:

Name Type Description Default
beta_poloidal float

Plasma poloidal beta.

required
q95 float

Safety factor at 95% of the plasma radius.

required
q0 float

Safety factor at the magnetic axis.

required
alphan float

Density profile index.

required
alphat float

Temperature profile index.

required
eps float

Inverse aspect ratio.

required
ind_plasma_internal_norm float

Plasma normalized internal inductance.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • The profile assumed for the alphan and alphat indexes is only a parabolic profile without a pedestal (L-mode).
  • The Root Mean Squared Error for the fitting database of this formula was 0.025.
  • Concentrating on the positive shear plasmas using the ACCOME code equilibria with the fully non-inductively driven conditions with neutral beam (NB) injection only are calculated.
  • The electron temperature and the ion temperature were assumed to be equal.
  • This can be used for all aspect ratios.
  • The diamagnetic fraction is included in this formula.
References

R. Sakai, T. Fujita, and A. Okamoto, "Derivation of bootstrap current fraction scaling formula for 0-D system code analysis," Fusion Engineering and Design, vol. 149, p. 111322, Dec. 2019, doi: https://doi.org/10.1016/j.fusengdes.2019.111322.

Source code in process/models/physics/bootstrap_current.py
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
@staticmethod
def bootstrap_fraction_sakai(
    beta_poloidal: float,
    q95: float,
    q0: float,
    alphan: float,
    alphat: float,
    eps: float,
    ind_plasma_internal_norm: float,
) -> float:
    """Calculate the bootstrap fraction using the Sakai formula.

    Parameters
    ----------
    beta_poloidal : float
        Plasma poloidal beta.
    q95 : float
        Safety factor at 95% of the plasma radius.
    q0 : float
        Safety factor at the magnetic axis.
    alphan : float
        Density profile index.
    alphat : float
        Temperature profile index.
    eps : float
        Inverse aspect ratio.
    ind_plasma_internal_norm : float
        Plasma normalized internal inductance.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - The profile assumed for the alphan and alphat indexes is only a parabolic profile without a
      pedestal (L-mode).
    - The Root Mean Squared Error for the fitting database of this formula was 0.025.
    - Concentrating on the positive shear plasmas using the ACCOME code equilibria with the fully
      non-inductively driven conditions with neutral beam (NB) injection only are calculated.
    - The electron temperature and the ion temperature were assumed to be equal.
    - This can be used for all aspect ratios.
    - The diamagnetic fraction is included in this formula.

    References
    ----------
    R. Sakai, T. Fujita, and A. Okamoto, "Derivation of bootstrap current fraction scaling formula for
    0-D system code analysis," Fusion Engineering and Design, vol. 149, p. 111322, Dec. 2019,
    doi: https://doi.org/10.1016/j.fusengdes.2019.111322.
    """
    # Sakai states that the ACCOME dataset used has the toridal diamagnetic current included in the bootstrap current
    # So the diamganetic current should not be calculated with this. i_diamagnetic_current = 0
    return (
        10 ** (0.951 * eps - 0.948)
        * beta_poloidal ** (1.226 * eps + 1.584)
        * ind_plasma_internal_norm ** (-0.184 * eps - 0.282)
        * (q95 / q0) ** (-0.042 * eps - 0.02)
        * alphan ** (0.13 * eps + 0.05)
        * alphat ** (0.502 * eps - 0.273)
    )

bootstrap_fraction_aries(beta_poloidal, ind_plasma_internal_norm, core_density, average_density, inverse_aspect) staticmethod

Calculate the bootstrap fraction using the ARIES formula.

Parameters:

Name Type Description Default
beta_poloidal float

Plasma poloidal beta.

required
ind_plasma_internal_norm float

Plasma normalized internal inductance.

required
core_density float

Core plasma density.

required
average_density float

Average plasma density.

required
inverse_aspect float

Inverse aspect ratio.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes

The source reference does not provide any info about the derivation of the formula. It is only stated.

References

Zoran Dragojlovic et al., "An advanced computational algorithm for systems analysis of tokamak power plants," Fusion Engineering and Design, vol. 85, no. 2, pp. 243-265, Apr. 2010, doi: https://doi.org/10.1016/j.fusengdes.2010.02.015.

Source code in process/models/physics/bootstrap_current.py
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
@staticmethod
def bootstrap_fraction_aries(
    beta_poloidal: float,
    ind_plasma_internal_norm: float,
    core_density: float,
    average_density: float,
    inverse_aspect: float,
) -> float:
    """Calculate the bootstrap fraction using the ARIES formula.

    Parameters
    ----------
    beta_poloidal : float
        Plasma poloidal beta.
    ind_plasma_internal_norm : float
        Plasma normalized internal inductance.
    core_density : float
        Core plasma density.
    average_density : float
        Average plasma density.
    inverse_aspect : float
        Inverse aspect ratio.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    The source reference does not provide any info about the derivation of the formula.
    It is only stated.

    References
    ----------
    Zoran Dragojlovic et al., "An advanced computational algorithm for systems analysis of tokamak power plants,"
    Fusion Engineering and Design, vol. 85, no. 2, pp. 243-265, Apr. 2010,
    doi: https://doi.org/10.1016/j.fusengdes.2010.02.015.
    """
    # Using the standard variable naming from the ARIES paper
    a_1 = (
        1.10 - 1.165 * ind_plasma_internal_norm + 0.47 * ind_plasma_internal_norm**2
    )
    b_1 = (
        0.806
        - 0.885 * ind_plasma_internal_norm
        + 0.297 * ind_plasma_internal_norm**2
    )

    c_bs = a_1 + b_1 * (core_density / average_density)

    return c_bs * np.sqrt(inverse_aspect) * beta_poloidal

bootstrap_fraction_andrade(beta_poloidal, core_pressure, average_pressure, inverse_aspect) staticmethod

Calculate the bootstrap fraction using the Andrade et al formula.

Parameters:

Name Type Description Default
beta_poloidal float

Plasma poloidal beta.

required
core_pressure float

Core plasma pressure.

required
average_pressure float

Average plasma pressure.

required
inverse_aspect float

Inverse aspect ratio.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • Based off 350 plasma profiles from Experimento Tokamak Esferico (ETE) spherical tokamak with A = 1.5, R_0 = 0.3m, I_p = 200kA, B_0=0.4T, beta = 4-10%.
  • Profiles taken as Gaussian shaped functions.
  • Errors mostly up to the order of 10% are obtained when both expressions are compared with the equilibrium estimates for the bootstrap current in ETE.
References

M. C. R. Andrade and G. O. Ludwig, "Scaling of bootstrap current on equilibrium and plasma profile parameters in tokamak plasmas," Plasma Physics and Controlled Fusion, vol. 50, no. 6, pp. 065001-065001, Apr. 2008, doi: https://doi.org/10.1088/0741-3335/50/6/065001.

Source code in process/models/physics/bootstrap_current.py
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
@staticmethod
def bootstrap_fraction_andrade(
    beta_poloidal: float,
    core_pressure: float,
    average_pressure: float,
    inverse_aspect: float,
) -> float:
    """Calculate the bootstrap fraction using the Andrade et al formula.

    Parameters
    ----------
    beta_poloidal : float
        Plasma poloidal beta.
    core_pressure : float
        Core plasma pressure.
    average_pressure : float
        Average plasma pressure.
    inverse_aspect : float
        Inverse aspect ratio.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - Based off 350 plasma profiles from Experimento Tokamak Esferico (ETE) spherical tokamak
      with A = 1.5, R_0 = 0.3m, I_p = 200kA, B_0=0.4T, beta = 4-10%.
    - Profiles taken as Gaussian shaped functions.
    - Errors mostly up to the order of 10% are obtained when both expressions are compared with
      the equilibrium estimates for the bootstrap current in ETE.

    References
    ----------
    M. C. R. Andrade and G. O. Ludwig, "Scaling of bootstrap current on equilibrium and plasma profile parameters in tokamak plasmas,"
    Plasma Physics and Controlled Fusion, vol. 50, no. 6, pp. 065001-065001, Apr. 2008,
    doi: https://doi.org/10.1088/0741-3335/50/6/065001.
    """

    # Using the standard variable naming from the Andrade et.al. paper
    c_p = core_pressure / average_pressure

    # Error +- 0.0007
    c_bs = 0.2340

    return c_bs * np.sqrt(inverse_aspect) * beta_poloidal * c_p**0.8

bootstrap_fraction_hoang(beta_poloidal, pressure_index, current_index, inverse_aspect) staticmethod

Calculate the bootstrap fraction using the Hoang et al formula.

Parameters:

Name Type Description Default
beta_poloidal float

Plasma poloidal beta.

required
pressure_index float

Pressure profile index.

required
current_index float

Current profile index.

required
inverse_aspect float

Inverse aspect ratio.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • Based off of TFTR data calculated using the TRANSP plasma analysis code.
  • 170 discharges which was assembled to study the tritium influx and transport in discharges with D-only neutral beam injection (NBI).
  • Contains L-mode, supershots, reversed shear, enhanced reversed shear and increased li discharges.
  • Discharges with monotonic flux profiles with reversed shear are also included.
  • Is applied to circular cross-section plasmas.
References

G. T. Hoang and R. V. Budny, "The bootstrap fraction in TFTR," AIP conference proceedings, Jan. 1997, doi: https://doi.org/10.1063/1.53414.

Source code in process/models/physics/bootstrap_current.py
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
@staticmethod
def bootstrap_fraction_hoang(
    beta_poloidal: float,
    pressure_index: float,
    current_index: float,
    inverse_aspect: float,
) -> float:
    """Calculate the bootstrap fraction using the Hoang et al formula.

    Parameters
    ----------
    beta_poloidal : float
        Plasma poloidal beta.
    pressure_index : float
        Pressure profile index.
    current_index : float
        Current profile index.
    inverse_aspect : float
        Inverse aspect ratio.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - Based off of TFTR data calculated using the TRANSP plasma analysis code.
    - 170 discharges which was assembled to study the tritium influx and transport in discharges
      with D-only neutral beam injection (NBI).
    - Contains L-mode, supershots, reversed shear, enhanced reversed shear and increased li discharges.
    - Discharges with monotonic flux profiles with reversed shear are also included.
    - Is applied to circular cross-section plasmas.

    References
    ----------
    G. T. Hoang and R. V. Budny, "The bootstrap fraction in TFTR," AIP conference proceedings,
    Jan. 1997, doi: https://doi.org/10.1063/1.53414.
    """

    # Using the standard variable naming from the Hoang et.al. paper
    # Hoang et.al uses a different definition for the profile indexes such that
    # alpha_p is defined as the ratio of the central and the volume-averaged values, and the peakedness of the density of the total plasma current
    # (defined as ratio of the central value and I_p), alpha_j$

    # We assume the pressure and current profile is parabolic and use the (profile_index +1) term in lieu
    # The term represents the ratio of the the core to volume averaged value

    # This could lead to large changes in the value depending on interpretation of the profile index

    c_bs = np.sqrt((pressure_index + 1) / (current_index + 1))

    return 0.4 * np.sqrt(inverse_aspect) * beta_poloidal**0.9 * c_bs

bootstrap_fraction_wong(beta_poloidal, density_index, temperature_index, inverse_aspect, elongation) staticmethod

Calculate the bootstrap fraction using the Wong et al formula.

Parameters:

Name Type Description Default
beta_poloidal float

Plasma poloidal beta.

required
density_index float

Density profile index.

required
temperature_index float

Temperature profile index.

required
inverse_aspect float

Inverse aspect ratio.

required
elongation float

Plasma elongation.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • Data is based off of equilibria from Miller et al.
  • A: 1.2 - 3.0 and stable to n ballooning and low n kink modes at a bootstrap fraction of 99% for kappa = 2, 2.5 and 3.
  • The results were parameterized as a function of aspect ratio and elongation.
  • The parametric dependency of beta_p and beta_T are based on fitting of the DIII-D high equivalent DT yield results.
  • Parabolic profiles should be used for best results as the pressure peaking value is calculated as the product of a parabolic temperature and density profile.
References

C.-P. Wong, J. C. Wesley, R. D. Stambaugh, and E. T. Cheng, "Toroidal reactor designs as a function of aspect ratio and elongation," vol. 42, no. 5, pp. 547-556, May 2002, doi: https://doi.org/10.1088/0029-5515/42/5/307.

Miller, R L, "Stable bootstrap-current driven equilibria for low aspect ratio tokamaks". Switzerland: N. p., 1996. Web.https://fusion.gat.com/pubs-ext/MISCONF96/A22433.pdf

Source code in process/models/physics/bootstrap_current.py
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
@staticmethod
def bootstrap_fraction_wong(
    beta_poloidal: float,
    density_index: float,
    temperature_index: float,
    inverse_aspect: float,
    elongation: float,
) -> float:
    """Calculate the bootstrap fraction using the Wong et al formula.

    Parameters
    ----------
    beta_poloidal : float
        Plasma poloidal beta.
    density_index : float
        Density profile index.
    temperature_index : float
        Temperature profile index.
    inverse_aspect : float
        Inverse aspect ratio.
    elongation : float
        Plasma elongation.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - Data is based off of equilibria from Miller et al.
    - A: 1.2 - 3.0 and stable to n ballooning and low n kink modes at a bootstrap fraction of 99%
      for kappa = 2, 2.5 and 3.
    - The results were parameterized as a function of aspect ratio and elongation.
    - The parametric dependency of beta_p and beta_T are based on fitting of the DIII-D high
      equivalent DT yield results.
    - Parabolic profiles should be used for best results as the pressure peaking value is calculated
      as the product of a parabolic temperature and density profile.

    References
    ----------
    C.-P. Wong, J. C. Wesley, R. D. Stambaugh, and E. T. Cheng, "Toroidal reactor designs as a function of aspect ratio and elongation,"
    vol. 42, no. 5, pp. 547-556, May 2002, doi: https://doi.org/10.1088/0029-5515/42/5/307.

    Miller, R L, "Stable bootstrap-current driven equilibria for low aspect ratio tokamaks".
    Switzerland: N. p., 1996. Web.https://fusion.gat.com/pubs-ext/MISCONF96/A22433.pdf
    """
    # Using the standard variable naming from the Wong et.al. paper
    f_peak = 2.0 / scipy.special.beta(0.5, density_index + temperature_index + 1)

    c_bs = 0.773 + 0.019 * elongation

    return c_bs * f_peak**0.25 * beta_poloidal * np.sqrt(inverse_aspect)

bootstrap_fraction_gi_I(beta_poloidal, pressure_index, temperature_index, inverse_aspect, effective_charge, q95, q0) staticmethod

Calculate the bootstrap fraction using the first scaling from the Gi et al formula.

Parameters:

Name Type Description Default
beta_poloidal float

Plasma poloidal beta.

required
pressure_index float

Pressure profile index.

required
temperature_index float

Temperature profile index.

required
inverse_aspect float

Inverse aspect ratio.

required
effective_charge float

Plasma effective charge.

required
q95 float

Safety factor at 95% of the plasma radius.

required
q0 float

Safety factor at the magnetic axis.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • Scaling found by solving the Hirshman-Sigmar bootstrap model using the matrix inversion method.
  • Method was done to put the scaling into parameters compatible with the TPC systems code.
  • Uses the ACCOME code to create bootstrap current fractions without using the iterative calculations of the current drive and equilibrium models in the scan.
  • R = 5.0 m, A = 1.3 - 5.0, kappa = 2, triang = 0.3, alpha_n = 0.1 - 0.8, alpha_t = 1.0 - 3.0, Z_eff = 1.2 - 3.0.
  • Uses parabolic plasma profiles only.
  • Scaling 1 has better accuracy than Scaling 2. However, Scaling 1 overestimated the f_BS value for reversed shear equilibrium.
References

K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study," Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014, doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.

Source code in process/models/physics/bootstrap_current.py
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
@staticmethod
def bootstrap_fraction_gi_I(  # noqa: N802
    beta_poloidal: float,
    pressure_index: float,
    temperature_index: float,
    inverse_aspect: float,
    effective_charge: float,
    q95: float,
    q0: float,
) -> float:
    """Calculate the bootstrap fraction using the first scaling from the Gi et al formula.

    Parameters
    ----------
    beta_poloidal : float
        Plasma poloidal beta.
    pressure_index : float
        Pressure profile index.
    temperature_index : float
        Temperature profile index.
    inverse_aspect : float
        Inverse aspect ratio.
    effective_charge : float
        Plasma effective charge.
    q95 : float
        Safety factor at 95% of the plasma radius.
    q0 : float
        Safety factor at the magnetic axis.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - Scaling found by solving the Hirshman-Sigmar bootstrap model using the matrix inversion method.
    - Method was done to put the scaling into parameters compatible with the TPC systems code.
    - Uses the ACCOME code to create bootstrap current fractions without using the iterative
      calculations of the current drive and equilibrium models in the scan.
    - R = 5.0 m, A = 1.3 - 5.0, kappa = 2, triang = 0.3, alpha_n = 0.1 - 0.8, alpha_t = 1.0 - 3.0,
      Z_eff = 1.2 - 3.0.
    - Uses parabolic plasma profiles only.
    - Scaling 1 has better accuracy than Scaling 2. However, Scaling 1 overestimated the f_BS value
      for reversed shear equilibrium.

    References
    ----------
    K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study,"
    Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014,
    doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.
    """

    # Using the standard variable naming from the Gi et.al. paper

    c_bs = (
        0.474
        * inverse_aspect**-0.1
        * pressure_index**0.974
        * temperature_index**-0.416
        * effective_charge**0.178
        * (q95 / q0) ** -0.133
    )

    return c_bs * np.sqrt(inverse_aspect) * beta_poloidal

bootstrap_fraction_gi_II(beta_poloidal, pressure_index, temperature_index, inverse_aspect, effective_charge) staticmethod

Calculate the bootstrap fraction using the second scaling from the Gi et al formula.

Parameters:

Name Type Description Default
beta_poloidal float

Plasma poloidal beta.

required
pressure_index float

Pressure profile index.

required
temperature_index float

Temperature profile index.

required
inverse_aspect float

Inverse aspect ratio.

required
effective_charge float

Plasma effective charge.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • Scaling found by solving the Hirshman-Sigmar bootstrap model using the matrix inversion method.
  • Method was done to put the scaling into parameters compatible with the TPC systems code.
  • Uses the ACCOME code to create bootstrap current fractions without using the iterative calculations of the current drive and equilibrium models in the scan.
  • R = 5.0 m, A = 1.3 - 5.0, kappa = 2, triang = 0.3, alpha_n = 0.1 - 0.8, alpha_t = 1.0 - 3.0, Z_eff = 1.2 - 3.0.
  • Uses parabolic plasma profiles only.
  • This scaling has the q profile dependence removed to obtain a scaling formula with much more flexible variables than that by a single profile factor for internal current profile.
References

K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study," Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014, doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.

Source code in process/models/physics/bootstrap_current.py
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
@staticmethod
def bootstrap_fraction_gi_II(  # noqa: N802
    beta_poloidal: float,
    pressure_index: float,
    temperature_index: float,
    inverse_aspect: float,
    effective_charge: float,
) -> float:
    """Calculate the bootstrap fraction using the second scaling from the Gi et al formula.

    Parameters
    ----------
    beta_poloidal : float
        Plasma poloidal beta.
    pressure_index : float
        Pressure profile index.
    temperature_index : float
        Temperature profile index.
    inverse_aspect : float
        Inverse aspect ratio.
    effective_charge : float
        Plasma effective charge.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - Scaling found by solving the Hirshman-Sigmar bootstrap model using the matrix inversion method.
    - Method was done to put the scaling into parameters compatible with the TPC systems code.
    - Uses the ACCOME code to create bootstrap current fractions without using the iterative
      calculations of the current drive and equilibrium models in the scan.
    - R = 5.0 m, A = 1.3 - 5.0, kappa = 2, triang = 0.3, alpha_n = 0.1 - 0.8, alpha_t = 1.0 - 3.0,
      Z_eff = 1.2 - 3.0.
    - Uses parabolic plasma profiles only.
    - This scaling has the q profile dependence removed to obtain a scaling formula with much more
      flexible variables than that by a single profile factor for internal current profile.

    References
    ----------
    K. Gi, M. Nakamura, Kenji Tobita, and Y. Ono, "Bootstrap current fraction scaling for a tokamak reactor design study,"
    Fusion Engineering and Design, vol. 89, no. 11, pp. 2709-2715, Aug. 2014,
    doi: https://doi.org/10.1016/j.fusengdes.2014.07.009.
    """

    # Using the standard variable naming from the Gi et.al. paper

    c_bs = (
        0.382
        * inverse_aspect**-0.242
        * pressure_index**0.974
        * temperature_index**-0.416
        * effective_charge**0.178
    )

    return c_bs * np.sqrt(inverse_aspect) * beta_poloidal

bootstrap_fraction_sugiyama_l_mode(eps, beta_poloidal, alphan, alphat, zeff, q95, q0) staticmethod

Calculate the bootstrap fraction using the L-mode scaling from the Sugiyama et al formula.

Parameters:

Name Type Description Default
eps float

Inverse aspect ratio.

required
beta_poloidal float

Plasma poloidal beta.

required
alphan float

Density profile index.

required
alphat float

Temperature profile index.

required
zeff float

Plasma effective charge.

required
q95 float

Safety factor at 95% of the plasma radius.

required
q0 float

Safety factor at the magnetic axis.

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • This scaling is derived for L-mode plasmas.
  • Ion and electron temperature are the same.
  • Z_eff has a uniform profile, with only fully stripped carbon impurity.
References

S. Sugiyama, T. Goto, H. Utoh, and Y. Sakamoto, "Improvement of core plasma power and current balance models for tokamak systems code considering H-mode plasma profiles," Fusion Engineering and Design, vol. 216, p. 115022, Jul. 2025, doi: https://doi.org/10.1016/j.fusengdes.2025.115022.

Source code in process/models/physics/bootstrap_current.py
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
@staticmethod
def bootstrap_fraction_sugiyama_l_mode(
    eps: float,
    beta_poloidal: float,
    alphan: float,
    alphat: float,
    zeff: float,
    q95: float,
    q0: float,
) -> float:
    """Calculate the bootstrap fraction using the L-mode scaling from the Sugiyama et al formula.

    Parameters
    ----------
    eps : float
        Inverse aspect ratio.
    beta_poloidal : float
        Plasma poloidal beta.
    alphan : float
        Density profile index.
    alphat : float
        Temperature profile index.
    zeff : float
        Plasma effective charge.
    q95 : float
        Safety factor at 95% of the plasma radius.
    q0 : float
        Safety factor at the magnetic axis.

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - This scaling is derived for L-mode plasmas.
    - Ion and electron temperature are the same.
    - Z_eff has a uniform profile, with only fully stripped carbon impurity.

    References
    ----------
    S. Sugiyama, T. Goto, H. Utoh, and Y. Sakamoto, "Improvement of core plasma power and
    current balance models for tokamak systems code considering H-mode plasma profiles,"
    Fusion Engineering and Design, vol. 216, p. 115022, Jul. 2025, doi:
    https://doi.org/10.1016/j.fusengdes.2025.115022.
    """

    return (
        0.740
        * eps**0.418
        * beta_poloidal**0.904
        * alphan**0.06
        * alphat**-0.138
        * zeff**0.230
        * (q95 / q0) ** -0.142
    )

bootstrap_fraction_sugiyama_h_mode(eps, beta_poloidal, alphan, alphat, tbeta, zeff, q95, q0, radius_plasma_pedestal_density_norm, nd_plasma_pedestal_electron, n_greenwald, temp_plasma_pedestal_kev) staticmethod

Calculate the bootstrap fraction using the H-mode scaling from the Sugiyama et al formula.

Parameters:

Name Type Description Default
eps float

Inverse aspect ratio.

required
beta_poloidal float

Plasma poloidal beta.

required
alphan float

Density profile index.

required
alphat float

Temperature profile index.

required
tbeta float

Second temperature profile index.

required
zeff float

Plasma effective charge.

required
q95 float

Safety factor at 95% of the plasma radius.

required
q0 float

Safety factor at the magnetic axis.

required
radius_plasma_pedestal_density_norm float

Normalised plasma radius of density pedestal.

required
nd_plasma_pedestal_electron float

Electron number density at the pedestal [m⁻³].

required
n_greenwald float

Greenwald density limit [m⁻³].

required
temp_plasma_pedestal_kev float

Electron temperature at the pedestal [keV].

required

Returns:

Type Description
float

The calculated bootstrap fraction.

Notes
  • This scaling is derived for H-mode plasmas.
  • The temperature and density pedestal positions are the same.
  • Separatrix temperature and density are zero.
  • Ion and electron temperature are the same.
  • Z_eff has a uniform profile, with only fully stripped carbon impurity.
References

S. Sugiyama, T. Goto, H. Utoh, and Y. Sakamoto, "Improvement of core plasma power and current balance models for tokamak systems code considering H-mode plasma profiles," Fusion Engineering and Design, vol. 216, p. 115022, Jul. 2025, doi: https://doi.org/10.1016/j.fusengdes.2025.115022.

Source code in process/models/physics/bootstrap_current.py
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
@staticmethod
def bootstrap_fraction_sugiyama_h_mode(
    eps: float,
    beta_poloidal: float,
    alphan: float,
    alphat: float,
    tbeta: float,
    zeff: float,
    q95: float,
    q0: float,
    radius_plasma_pedestal_density_norm: float,
    nd_plasma_pedestal_electron: float,
    n_greenwald: float,
    temp_plasma_pedestal_kev: float,
) -> float:
    """Calculate the bootstrap fraction using the H-mode scaling from the Sugiyama et al formula.

    Parameters
    ----------
    eps : float
        Inverse aspect ratio.
    beta_poloidal : float
        Plasma poloidal beta.
    alphan : float
        Density profile index.
    alphat : float
        Temperature profile index.
    tbeta : float
        Second temperature profile index.
    zeff : float
        Plasma effective charge.
    q95 : float
        Safety factor at 95% of the plasma radius.
    q0 : float
        Safety factor at the magnetic axis.
    radius_plasma_pedestal_density_norm : float
        Normalised plasma radius of density pedestal.
    nd_plasma_pedestal_electron : float
        Electron number density at the pedestal [m⁻³].
    n_greenwald : float
        Greenwald density limit [m⁻³].
    temp_plasma_pedestal_kev : float
        Electron temperature at the pedestal [keV].

    Returns
    -------
    float
        The calculated bootstrap fraction.

    Notes
    -----
    - This scaling is derived for H-mode plasmas.
    - The temperature and density pedestal positions are the same.
    - Separatrix temperature and density are zero.
    - Ion and electron temperature are the same.
    - Z_eff has a uniform profile, with only fully stripped carbon impurity.

    References
    ----------
    S. Sugiyama, T. Goto, H. Utoh, and Y. Sakamoto, "Improvement of core plasma power and
    current balance models for tokamak systems code considering H-mode plasma profiles,"
    Fusion Engineering and Design, vol. 216, p. 115022, Jul. 2025, doi:
    https://doi.org/10.1016/j.fusengdes.2025.115022.
    """

    return (
        0.789
        * eps**0.606
        * beta_poloidal**0.960
        * alphan**0.0319
        * alphat**0.00822
        * tbeta**-0.0783
        * zeff**0.241
        * (q95 / q0) ** -0.103
        * radius_plasma_pedestal_density_norm**0.367
        * (nd_plasma_pedestal_electron / n_greenwald) ** -0.174
        * temp_plasma_pedestal_kev**0.0552
    )

output_bootstrap_current_information()

Output the calculated bootstrap current information to the output file.

Source code in process/models/physics/bootstrap_current.py
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
def output_bootstrap_current_information(self):
    """Output the calculated bootstrap current information to the output file."""

    po.ovarrf(
        self.outfile,
        "Bootstrap current fraction multiplier",
        "(cboot)",
        current_drive_variables.cboot,
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (ITER 1989)",
        "(f_c_plasma_bootstrap_iter89)",
        current_drive_variables.f_c_plasma_bootstrap_iter89,
        "OP ",
    )

    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Sauter et al)",
        "(f_c_plasma_bootstrap_sauter)",
        current_drive_variables.f_c_plasma_bootstrap_sauter,
        "OP ",
    )
    for point in range(len(physics_variables.j_plasma_bootstrap_sauter_profile)):
        po.ovarrf(
            self.mfile,
            f"Sauter et al bootstrap current density profile at point {point}",
            f"(j_plasma_bootstrap_sauter_profile{point})",
            physics_variables.j_plasma_bootstrap_sauter_profile[point],
            "OP ",
        )

    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Nevins et al)",
        "(f_c_plasma_bootstrap_nevins)",
        current_drive_variables.f_c_plasma_bootstrap_nevins,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Wilson)",
        "(f_c_plasma_bootstrap_wilson)",
        current_drive_variables.f_c_plasma_bootstrap_wilson,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Sakai)",
        "(f_c_plasma_bootstrap_sakai)",
        current_drive_variables.f_c_plasma_bootstrap_sakai,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (ARIES)",
        "(f_c_plasma_bootstrap_aries)",
        current_drive_variables.f_c_plasma_bootstrap_aries,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Andrade)",
        "(f_c_plasma_bootstrap_andrade)",
        current_drive_variables.f_c_plasma_bootstrap_andrade,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Hoang)",
        "(f_c_plasma_bootstrap_hoang)",
        current_drive_variables.f_c_plasma_bootstrap_hoang,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Wong)",
        "(f_c_plasma_bootstrap_wong)",
        current_drive_variables.f_c_plasma_bootstrap_wong,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Gi I)",
        "(bscf_gi_i)",
        current_drive_variables.bscf_gi_i,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Gi II)",
        "(bscf_gi_ii)",
        current_drive_variables.bscf_gi_ii,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Sugiyama L-mode)",
        "(f_c_plasma_bootstrap_sugiyama_l)",
        current_drive_variables.f_c_plasma_bootstrap_sugiyama_l,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (Sugiyama H-mode)",
        "(f_c_plasma_bootstrap_sugiyama_h)",
        current_drive_variables.f_c_plasma_bootstrap_sugiyama_h,
        "OP ",
    )

    po.ovarrf(
        self.outfile,
        "Diamagnetic fraction (Hender)",
        "(f_c_plasma_diamagnetic_hender)",
        current_drive_variables.f_c_plasma_diamagnetic_hender,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Diamagnetic fraction (SCENE)",
        "(f_c_plasma_diamagnetic_scene)",
        current_drive_variables.f_c_plasma_diamagnetic_scene,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Pfirsch-Schlueter fraction (SCENE)",
        "(f_c_plasma_pfirsch_schluter_scene)",
        current_drive_variables.f_c_plasma_pfirsch_schluter_scene,
        "OP ",
    )
    # Error to catch if bootstap fraction limit has been enforced
    if physics_variables.err242 == 1:
        logger.error("Bootstrap fraction upper limit enforced")

    # Error to catch if self-driven current fraction limit has been enforced
    if physics_variables.err243 == 1:
        logger.error(
            "Predicted plasma driven current is more than upper limit on non-inductive fraction"
        )

    if physics_variables.i_bootstrap_current == 0:
        po.ocmmnt(self.outfile, "  (User-specified bootstrap current fraction used)")
    elif physics_variables.i_bootstrap_current == 1:
        po.ocmmnt(
            self.outfile, "  (ITER 1989 bootstrap current fraction model used)"
        )
    elif physics_variables.i_bootstrap_current == 2:
        po.ocmmnt(
            self.outfile,
            "  (Nevins et al bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 3:
        po.ocmmnt(self.outfile, "  (Wilson bootstrap current fraction model used)")
    elif physics_variables.i_bootstrap_current == 4:
        po.ocmmnt(
            self.outfile,
            "  (Sauter et al bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 5:
        po.ocmmnt(
            self.outfile,
            "  (Sakai et al bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 6:
        po.ocmmnt(
            self.outfile,
            "  (ARIES bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 7:
        po.ocmmnt(
            self.outfile,
            "  (Andrade et al bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 8:
        po.ocmmnt(
            self.outfile,
            "  (Hoang et al bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 9:
        po.ocmmnt(
            self.outfile,
            "  (Wong et al bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 10:
        po.ocmmnt(
            self.outfile,
            "  (Gi-I et al bootstrap current fraction model used)",
        )
    elif physics_variables.i_bootstrap_current == 11:
        po.ocmmnt(
            self.outfile,
            "  (Gi-II et al bootstrap current fraction model used)",
        )

    if physics_variables.i_diamagnetic_current == 0:
        po.ocmmnt(self.outfile, "  (Diamagnetic current fraction not calculated)")
        # Error to show if diamagnetic current is above 1% but not used
        if current_drive_variables.f_c_plasma_diamagnetic_scene > 0.01e0:
            logger.error(
                "Diamagnetic fraction is more than 1%, but not calculated. "
                "Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1"
            )

    elif physics_variables.i_diamagnetic_current == 1:
        po.ocmmnt(
            self.outfile, "  (Hender diamagnetic current fraction scaling used)"
        )
    elif physics_variables.i_diamagnetic_current == 2:
        po.ocmmnt(
            self.outfile, "  (SCENE diamagnetic current fraction scaling used)"
        )

    if physics_variables.i_pfirsch_schluter_current == 0:
        po.ocmmnt(self.outfile, "  Pfirsch-Schluter current fraction not calculated")
    elif physics_variables.i_pfirsch_schluter_current == 1:
        po.ocmmnt(
            self.outfile,
            "  (SCENE Pfirsch-Schluter current fraction scaling used)",
        )

    po.ovarrf(
        self.outfile,
        "Bootstrap fraction (enforced)",
        "(f_c_plasma_bootstrap.)",
        current_drive_variables.f_c_plasma_bootstrap,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Diamagnetic fraction (enforced)",
        "(f_c_plasma_diamagnetic.)",
        current_drive_variables.f_c_plasma_diamagnetic,
        "OP ",
    )
    po.ovarrf(
        self.outfile,
        "Pfirsch-Schlueter fraction (enforced)",
        "(f_c_plasma_pfirsch_schluter.)",
        current_drive_variables.f_c_plasma_pfirsch_schluter,
        "OP ",
    )

SauterBootstrapCurrent

Class to calculate the bootstrap current using the Sauter et al formula.

Source code in process/models/physics/bootstrap_current.py
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
class SauterBootstrapCurrent:
    """Class to calculate the bootstrap current using the Sauter et al formula."""

    def bootstrap_fraction_sauter(self, plasma_profile: float) -> float:
        """Calculate the bootstrap current fraction from the Sauter et al scaling.

        Parameters
        ----------
        plasma_profile : PlasmaProfile
            The plasma profile object.

        Returns
        -------
        tuple[float, np.ndarray]
            The bootstrap current fraction and current density profile.

        Notes
        -----
        This function calculates the bootstrap current fraction using the Sauter, Angioni, and
        Lin-Liu scaling.

        References
        ----------
        O. Sauter, C. Angioni, Y. R. Lin-Liu;
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime.
        Phys. Plasmas 1 July 1999; 6 (7): 2834-2839. https://doi.org/10.1063/1.873240

        O. Sauter, C. Angioni, Y. R. Lin-Liu; Erratum:
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime [Phys. Plasmas 6, 2834 (1999)].
        Phys. Plasmas 1 December 2002; 9 (12): 5140. https://doi.org/10.1063/1.1517052

        Note: The code was supplied by Emiliano Fable, IPP Garching (private communication).
        """

        # Radial points from 0 to 1 seperated by 1/profile_size
        roa = plasma_profile.neprofile.profile_x

        # Local circularised minor radius
        rho = np.sqrt(physics_variables.a_plasma_poloidal / np.pi) * roa

        # Square root of local aspect ratio
        sqeps = np.sqrt(roa * (physics_variables.rminor / physics_variables.rmajor))

        # Calculate electron and ion density profiles
        ne = plasma_profile.neprofile.profile_y * 1e-19
        ni = (
            physics_variables.nd_plasma_ions_total_vol_avg
            / physics_variables.nd_plasma_electrons_vol_avg
        ) * ne

        # Calculate electron and ion temperature profiles
        tempe = plasma_profile.teprofile.profile_y
        tempi = (
            physics_variables.temp_plasma_ion_vol_avg_kev
            / physics_variables.temp_plasma_electron_vol_avg_kev
        ) * tempe

        # Flat Zeff profile assumed
        # Return tempi like array object filled with zeff
        zeff = np.full_like(tempi, physics_variables.n_charge_plasma_effective_vol_avg)

        # inverse_q = 1/safety factor
        # Parabolic q profile assumed
        inverse_q = 1 / (
            physics_variables.q0
            + (physics_variables.q95 - physics_variables.q0) * roa**2
        )
        # Create new array of average mass of fuel portion of ions
        amain = np.full_like(inverse_q, physics_variables.m_ions_total_amu)

        # Create new array of average main ion charge
        zmain = np.full_like(inverse_q, 1.0 + physics_variables.f_plasma_fuel_helium3)

        # Calculate total bootstrap current (MA) by summing along profiles
        # Looping from 2 because _calculate_l31_coefficient() etc should return 0 @ j == 1
        radial_elements = np.arange(2, plasma_profile.profile_size)

        # Change in localised minor radius to be used as delta term in derivative
        drho = rho[radial_elements] - rho[radial_elements - 1]

        # Area of annulus, assuming circular plasma cross-section
        da = 2 * np.pi * rho[radial_elements - 1] * drho  # area of annulus

        # Create the partial derivatives using numpy gradient (central differences)
        dlogte_drho = np.gradient(np.log(tempe), rho)[radial_elements - 1]
        dlogti_drho = np.gradient(np.log(tempi), rho)[radial_elements - 1]
        dlogne_drho = np.gradient(np.log(ne), rho)[radial_elements - 1]

        jboot = (
            0.5
            * (
                self._calculate_l31_coefficient(
                    radial_elements,
                    plasma_profile.profile_size,
                    physics_variables.rmajor,
                    physics_variables.b_plasma_toroidal_on_axis,
                    physics_variables.triang,
                    ne,
                    ni,
                    tempe,
                    tempi,
                    inverse_q,
                    rho,
                    zeff,
                    sqeps,
                )
                * dlogne_drho
                + self._calculate_l31_32_coefficient(
                    radial_elements,
                    plasma_profile.profile_size,
                    physics_variables.rmajor,
                    physics_variables.b_plasma_toroidal_on_axis,
                    physics_variables.triang,
                    ne,
                    ni,
                    tempe,
                    tempi,
                    inverse_q,
                    rho,
                    zeff,
                    sqeps,
                )
                * dlogte_drho
                + self._calculate_l34_alpha_31_coefficient(
                    radial_elements,
                    plasma_profile.profile_size,
                    physics_variables.rmajor,
                    physics_variables.b_plasma_toroidal_on_axis,
                    physics_variables.triang,
                    inverse_q,
                    sqeps,
                    tempi,
                    tempe,
                    amain,
                    zmain,
                    ni,
                    ne,
                    rho,
                    zeff,
                )
                * dlogti_drho
            )
            * 1.0e6
            * (
                -physics_variables.b_plasma_toroidal_on_axis
                / (0.2 * np.pi * physics_variables.rmajor)
                * rho[radial_elements - 1]
                * inverse_q[radial_elements - 1]
            )
        )  # A/m2

        return (np.sum(da * jboot, axis=0) / physics_variables.plasma_current), jboot

    @staticmethod
    def _coulomb_logarithm_sauter(
        radial_elements: int, tempe: np.ndarray, ne: np.ndarray
    ) -> np.ndarray:
        """Calculate the Coulomb logarithm used in the arrays for the Sauter bootstrap current scaling.

        This function calculates the Coulomb logarithm, which is valid for e-e collisions (T_e > 0.01 keV)
        and for e-i collisions (T_e > 0.01*Zeff^2) (Alexander, 9/5/1994).

        Parameters
        ----------
        radial_elements : int
            The radial element indexes in the range 1 to nr.
        tempe : np.ndarray
            The electron temperature array.
        ne : np.ndarray
            The electron density array.

        Returns
        -------
        np.ndarray
            The Coulomb logarithm at each array point.

        References
        ----------
        C. A. Ordonez, M. I. Molina;
        Evaluation of the Coulomb logarithm using cutoff and screened Coulomb interaction potentials.
        Phys. Plasmas 1 August 1994; 1 (8): 2515-2518. https://doi.org/10.1063/1.870578

        Y. R. Shen, "Recent advances in nonlinear optics," Reviews of Modern Physics, vol. 48, no. 1,
        pp. 1-32, Jan. 1976, doi: https://doi.org/10.1103/revmodphys.48.1.
        """
        return (
            15.9
            - 0.5 * np.log(ne[radial_elements - 1])
            + np.log(tempe[radial_elements - 1])
        )

    def _electron_collisions_sauter(
        self, radial_elements: np.ndarray, tempe: np.ndarray, ne: np.ndarray
    ) -> np.ndarray:
        """Calculate the frequency of electron-electron collisions used in the arrays for the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            The radial element indexes in the range 1 to nr.
        tempe : np.ndarray
            The electron temperature array.
        ne : np.ndarray
            The electron density array.

        Returns
        -------
        np.ndarray
            The frequency of electron-electron collisions (Hz).

        References
        ----------
        Yushmanov, 25th April 1987 (?), updated by Pereverzev, 9th November 1994 (?)
        """
        return (
            670.0
            * self._coulomb_logarithm_sauter(radial_elements, tempe, ne)
            * ne[radial_elements - 1]
            / (tempe[radial_elements - 1] * np.sqrt(tempe[radial_elements - 1]))
        )

    def _electron_collisionality_sauter(
        self,
        radial_elements: np.ndarray,
        rmajor: float,
        zeff: np.ndarray,
        inverse_q: np.ndarray,
        sqeps: np.ndarray,
        tempe: np.ndarray,
        ne: np.ndarray,
    ) -> np.ndarray:
        """Calculate the electron collisionality used in the arrays for the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            The radial element index in the range 1 to nr.
        rmajor : float
            The plasma major radius (m).
        zeff : np.ndarray
            The effective charge array.
        inverse_q : np.ndarray
            Inverse safety factor profile.
        sqeps : np.ndarray
            The square root of the inverse aspect ratio array.
        tempe : np.ndarray
            The electron temperature array.
        ne : np.ndarray
            The electron density array.

        Returns
        -------
        np.ndarray
            The relative frequency of electron collisions.

        References
        ----------
        Yushmanov, 30th April 1987 (?)
        """
        return (
            self._electron_collisions_sauter(radial_elements, tempe, ne)
            * 1.4
            * zeff[radial_elements - 1]
            * rmajor
            / np.abs(
                inverse_q[radial_elements - 1]
                * (sqeps[radial_elements - 1] ** 3)
                * np.sqrt(tempe[radial_elements - 1])
                * 1.875e7
            )
        )

    @staticmethod
    def _ion_collisions_sauter(
        radial_elements: np.ndarray,
        zeff: np.ndarray,
        ni: np.ndarray,
        tempi: np.ndarray,
        amain: np.ndarray,
    ) -> np.ndarray:
        """Calculate the full frequency of ion collisions used in the arrays for the Sauter bootstrap current scaling.

        This function calculates the full frequency of ion collisions using the Coulomb logarithm of 15.

        Parameters
        ----------
        radial_elements : np.ndarray
            The radial element indexes in the range 1 to nr.
        zeff : np.ndarray
            The effective charge array.
        ni : np.ndarray
            The ion density array.
        tempi : np.ndarray
            The ion temperature array.
        amain : np.ndarray
            The atomic mass of the main ion species array.

        Returns
        -------
        np.ndarray
            The full frequency of ion collisions (Hz).
        """
        return (
            zeff[radial_elements - 1] ** 4
            * ni[radial_elements - 1]
            * 322.0
            / (
                tempi[radial_elements - 1]
                * np.sqrt(tempi[radial_elements - 1] * amain[radial_elements - 1])
            )
        )

    def _ion_collisionality_sauter(
        self,
        radial_elements: np.ndarray,
        rmajor: float,
        inverse_q: np.ndarray,
        sqeps: np.ndarray,
        tempi: np.ndarray,
        amain: np.ndarray,
        zeff: np.ndarray,
        ni: np.ndarray,
    ) -> float:
        """Calculate the ion collisionality to be used in the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            The radial element indexes in the range 1 to nr.
        rmajor : float
            The plasma major radius (m).
        inverse_q : np.ndarray
            Inverse safety factor profile.
        sqeps : np.ndarray
            The square root of the inverse aspect ratio profile.
        tempi : np.ndarray
            The ion temperature profile (keV).
        amain : np.ndarray
            The atomic mass of the main ion species profile.
        zeff : np.ndarray
            The effective charge of the main ion species.
        ni : np.ndarray
            The ion density profile (/m³).

        Returns
        -------
        float
            The ion collisionality.
        """
        return (
            3.2e-6
            * self._ion_collisions_sauter(radial_elements, zeff, ni, tempi, amain)
            * rmajor
            / (
                np.abs(inverse_q[radial_elements - 1] + 1.0e-4)
                * sqeps[radial_elements - 1] ** 3
                * np.sqrt(tempi[radial_elements - 1] / amain[radial_elements - 1])
            )
        )

    def _calculate_l31_coefficient(
        self,
        radial_elements: np.ndarray,
        number_of_elements: int,
        rmajor: float,
        b_plasma_toroidal_on_axis: float,
        triang: float,
        ne: np.ndarray,
        ni: np.ndarray,
        tempe: np.ndarray,
        tempi: np.ndarray,
        inverse_q: np.ndarray,
        rho: np.ndarray,
        zeff: np.ndarray,
        sqeps: np.ndarray,
    ) -> float:
        """L31 coefficient before Grad(ln(ne)) in the Sauter bootstrap scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            Radial element indexes in range 2 to nr.
        number_of_elements : int
            Maximum value of radial_elements.
        rmajor : float
            Plasma major radius (m).
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        triang : float
            Plasma triangularity.
        ne : np.ndarray
            Electron density profile (/m³).
        ni : np.ndarray
            Ion density profile (/m³).
        tempe : np.ndarray
            Electron temperature profile (keV).
        tempi : np.ndarray
            Ion temperature profile (keV).
        inverse_q : np.ndarray
            Inverse safety factor profile.
        rho : np.ndarray
            Normalized minor radius profile.
        zeff : np.ndarray
            Effective charge profile.
        sqeps : np.ndarray
            Square root of inverse aspect ratio profile.

        Returns
        -------
        float
            The coefficient scaling grad(ln(ne)) in the Sauter bootstrap current scaling.

        References
        ----------
        O. Sauter, C. Angioni, Y. R. Lin-Liu;
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime.
        Phys. Plasmas 1 July 1999; 6 (7): 2834-2839. https://doi.org/10.1063/1.873240

        O. Sauter, C. Angioni, Y. R. Lin-Liu; Erratum:
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime [Phys. Plasmas 6, 2834 (1999)].
        Phys. Plasmas 1 December 2002; 9 (12): 5140. https://doi.org/10.1063/1.1517052
        """
        # Prevents first element being 0
        charge_profile = zeff[radial_elements - 1]

        # Calculate trapped particle fraction
        f_trapped = self._trapped_particle_fraction_sauter(
            radial_elements, triang, sqeps
        )

        # Calculated electron collisionality; nu_e*
        electron_collisionality = self._electron_collisionality_sauter(
            radial_elements, rmajor, zeff, inverse_q, sqeps, tempe, ne
        )

        # $f^{31}_{teff}(\nu_{e*})$, Eq.14b
        f31_teff = f_trapped / (
            (1.0 + (1.0 - 0.1 * f_trapped) * np.sqrt(electron_collisionality))
            + (0.5 * (1.0 - f_trapped) * electron_collisionality) / charge_profile
        )

        l31_coefficient = (
            ((1.0 + 1.4 / (charge_profile + 1.0)) * f31_teff)
            - (1.9 / (charge_profile + 1.0) * f31_teff**2)
            + ((0.3 * f31_teff**3 + 0.2 * f31_teff**4) / (charge_profile + 1.0))
        )

        # Corrections suggested by Fable, 15/05/2015
        return l31_coefficient * self._beta_poloidal_total_sauter(
            radial_elements,
            number_of_elements,
            rmajor,
            b_plasma_toroidal_on_axis,
            ne,
            ni,
            tempe,
            tempi,
            inverse_q,
            rho,
        )

    def _calculate_l31_32_coefficient(
        self,
        radial_elements: np.ndarray,
        number_of_elements: int,
        rmajor: float,
        b_plasma_toroidal_on_axis: float,
        triang: float,
        ne: np.ndarray,
        ni: np.ndarray,
        tempe: np.ndarray,
        tempi: np.ndarray,
        inverse_q: np.ndarray,
        rho: np.ndarray,
        zeff: np.ndarray,
        sqeps: np.ndarray,
    ) -> float:
        """L31 & L32 coefficient before Grad(ln(Te)) in the Sauter bootstrap scaling.

        This function calculates the coefficient scaling grad(ln(Te)) in the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            Radial element indexes in range 2 to nr.
        number_of_elements : int
            Maximum value of radial_elements.
        rmajor : float
            Plasma major radius (m).
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        triang : float
            Plasma triangularity.
        ne : np.ndarray
            Electron density profile (/m³).
        ni : np.ndarray
            Ion density profile (/m³).
        tempe : np.ndarray
            Electron temperature profile (keV).
        tempi : np.ndarray
            Ion temperature profile (keV).
        inverse_q : np.ndarray
            Inverse safety factor profile.
        rho : np.ndarray
            Normalized minor radius profile.
        zeff : np.ndarray
            Effective charge profile.
        sqeps : np.ndarray
            Square root of inverse aspect ratio profile.

        Returns
        -------
        float
            The L31 & L32 coefficient scaling grad(ln(Te)) in the Sauter bootstrap current scaling.

        References
        ----------
        O. Sauter, C. Angioni, Y. R. Lin-Liu;
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime.
        Phys. Plasmas 1 July 1999; 6 (7): 2834-2839. https://doi.org/10.1063/1.873240

        O. Sauter, C. Angioni, Y. R. Lin-Liu; Erratum:
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime [Phys. Plasmas 6, 2834 (1999)].
        Phys. Plasmas 1 December 2002; 9 (12): 5140. https://doi.org/10.1063/1.1517052
        """

        # Prevents first element being 0
        charge_profile = zeff[radial_elements - 1]

        # Calculate trapped particle fraction
        f_trapped = self._trapped_particle_fraction_sauter(
            radial_elements, triang, sqeps
        )

        # Calculated electron collisionality; nu_e*
        electron_collisionality = self._electron_collisionality_sauter(
            radial_elements, rmajor, zeff, inverse_q, sqeps, tempe, ne
        )

        # $f^{32\_ee}_{teff}(\nu_{e*})$, Eq.15d
        f32ee_teff = f_trapped / (
            1.0
            + 0.26 * (1.0 - f_trapped) * np.sqrt(electron_collisionality)
            + (
                0.18
                * (1.0 - 0.37 * f_trapped)
                * electron_collisionality
                / np.sqrt(charge_profile)
            )
        )

        # $f^{32\_ei}_{teff}(\nu_{e*})$, Eq.15e
        f32ei_teff = f_trapped / (
            (1.0 + (1.0 + 0.6 * f_trapped) * np.sqrt(electron_collisionality))
            + (
                0.85
                * (1.0 - 0.37 * f_trapped)
                * electron_collisionality
                * (1.0 + charge_profile)
            )
        )

        # $F_{32\_ee}(X)$, Eq.15b
        big_f32ee_teff = (
            (
                (0.05 + 0.62 * charge_profile)
                / charge_profile
                / (1.0 + 0.44 * charge_profile)
                * (f32ee_teff - f32ee_teff**4)
            )
            + (
                (f32ee_teff**2 - f32ee_teff**4 - 1.2 * (f32ee_teff**3 - f32ee_teff**4))
                / (1.0 + 0.22 * charge_profile)
            )
            + (1.2 / (1.0 + 0.5 * charge_profile) * f32ee_teff**4)
        )

        # $F_{32\_ei}(Y)$, Eq.15c
        big_f32ei_teff = (
            (
                -(0.56 + 1.93 * charge_profile)
                / charge_profile
                / (1.0 + 0.44 * charge_profile)
                * (f32ei_teff - f32ei_teff**4)
            )
            + (
                4.95
                / (1.0 + 2.48 * charge_profile)
                * (
                    f32ei_teff**2
                    - f32ei_teff**4
                    - 0.55 * (f32ei_teff**3 - f32ei_teff**4)
                )
            )
            - (1.2 / (1.0 + 0.5 * charge_profile) * f32ei_teff**4)
        )

        # big_f32ee_teff + big_f32ei_teff = L32 coefficient

        # Corrections suggested by Fable, 15/05/2015
        return self._beta_poloidal_sauter(
            radial_elements,
            number_of_elements,
            rmajor,
            b_plasma_toroidal_on_axis,
            ne,
            tempe,
            inverse_q,
            rho,
        ) * (big_f32ee_teff + big_f32ei_teff) + self._calculate_l31_coefficient(
            radial_elements,
            number_of_elements,
            rmajor,
            b_plasma_toroidal_on_axis,
            triang,
            ne,
            ni,
            tempe,
            tempi,
            inverse_q,
            rho,
            zeff,
            sqeps,
        ) * self._beta_poloidal_sauter(
            radial_elements,
            number_of_elements,
            rmajor,
            b_plasma_toroidal_on_axis,
            ne,
            tempe,
            inverse_q,
            rho,
        ) / self._beta_poloidal_total_sauter(
            radial_elements,
            number_of_elements,
            rmajor,
            b_plasma_toroidal_on_axis,
            ne,
            ni,
            tempe,
            tempi,
            inverse_q,
            rho,
        )

    def _calculate_l34_alpha_31_coefficient(
        self,
        radial_elements: np.ndarray,
        number_of_elements: int,
        rmajor: float,
        b_plasma_toroidal_on_axis: float,
        triang: float,
        inverse_q: np.ndarray,
        sqeps: np.ndarray,
        tempi: np.ndarray,
        tempe: np.ndarray,
        amain: float,
        zmain: float,
        ni: np.ndarray,
        ne: np.ndarray,
        rho: np.ndarray,
        zeff: np.ndarray,
    ) -> float:
        """L34, alpha and L31 coefficient before Grad(ln(Ti)) in the Sauter bootstrap scaling.

        This function calculates the coefficient scaling grad(ln(Ti)) in the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            Radial element indexes in range 2 to nr.
        number_of_elements : int
            Maximum value of radial_elements.
        rmajor : float
            Plasma major radius (m).
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        triang : float
            Plasma triangularity.
        inverse_q : np.ndarray
            Inverse safety factor profile.
        sqeps : np.ndarray
            Square root of inverse aspect ratio profile.
        tempi : np.ndarray
            Ion temperature profile (keV).
        tempe : np.ndarray
            Electron temperature profile (keV).
        amain : float
            Atomic mass of the main ion.
        zmain : float
            Charge of the main ion.
        ni : np.ndarray
            Ion density profile (/m³).
        ne : np.ndarray
            Electron density profile (/m³).
        rho : np.ndarray
            Normalized minor radius profile.
        zeff : np.ndarray
            Effective charge profile.

        Returns
        -------
        float
            The L34, alpha and L31 coefficient scaling grad(ln(Ti)) in the Sauter bootstrap current scaling.

        References
        ----------
        O. Sauter, C. Angioni, Y. R. Lin-Liu;
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime.
        Phys. Plasmas 1 July 1999; 6 (7): 2834-2839. https://doi.org/10.1063/1.873240

        O. Sauter, C. Angioni, Y. R. Lin-Liu; Erratum:
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime [Phys. Plasmas 6, 2834 (1999)].
        Phys. Plasmas 1 December 2002; 9 (12): 5140. https://doi.org/10.1063/1.1517052
        """
        # Prevents first element being 0
        charge_profile = zeff[radial_elements - 1]

        # Calculate trapped particle fraction
        f_trapped = self._trapped_particle_fraction_sauter(
            radial_elements, triang, sqeps
        )

        # Calculated electron collisionality; nu_e*
        electron_collisionality = self._electron_collisionality_sauter(
            radial_elements, rmajor, zeff, inverse_q, sqeps, tempe, ne
        )

        # $f^{34}_{teff}(\nu_{e*})$, Eq.16b
        f34_teff = f_trapped / (
            (1.0 + (1.0 - 0.1 * f_trapped) * np.sqrt(electron_collisionality))
            + 0.5 * (1.0 - 0.5 * f_trapped) * electron_collisionality / charge_profile
        )

        # Eq.16a
        l34_coefficient = (
            ((1.0 + (1.4 / (charge_profile + 1.0))) * f34_teff)
            - ((1.9 / (charge_profile + 1.0)) * f34_teff**2)
            + ((0.3 / (charge_profile + 1.0)) * f34_teff**3)
            + ((0.2 / (charge_profile + 1.0)) * f34_teff**4)
        )

        # $\alpha_0$, Eq.17a
        alpha_0 = (-1.17 * (1.0 - f_trapped)) / (
            1.0 - (0.22 * f_trapped) - 0.19 * f_trapped**2
        )

        # Calculate the ion collisionality
        ion_collisionality = self._ion_collisionality_sauter(
            radial_elements, rmajor, inverse_q, sqeps, tempi, amain, zmain, ni
        )

        # $\alpha(\nu_{i*})$, Eq.17b
        alpha = (
            (alpha_0 + (0.25 * (1.0 - f_trapped**2)) * np.sqrt(ion_collisionality))
            / (1.0 + (0.5 * np.sqrt(ion_collisionality)))
            + (0.315 * ion_collisionality**2 * f_trapped**6)
        ) / (1.0 + (0.15 * ion_collisionality**2 * f_trapped**6))

        # Corrections suggested by Fable, 15/05/2015
        # Below calculates the L34 * alpha + L31 coefficient
        return (
            self._beta_poloidal_total_sauter(
                radial_elements,
                number_of_elements,
                rmajor,
                b_plasma_toroidal_on_axis,
                ne,
                ni,
                tempe,
                tempi,
                inverse_q,
                rho,
            )
            - self._beta_poloidal_sauter(
                radial_elements,
                number_of_elements,
                rmajor,
                b_plasma_toroidal_on_axis,
                ne,
                tempe,
                inverse_q,
                rho,
            )
        ) * (l34_coefficient * alpha) + self._calculate_l31_coefficient(
            radial_elements,
            number_of_elements,
            rmajor,
            b_plasma_toroidal_on_axis,
            triang,
            ne,
            ni,
            tempe,
            tempi,
            inverse_q,
            rho,
            zeff,
            sqeps,
        ) * (
            1.0
            - self._beta_poloidal_sauter(
                radial_elements,
                number_of_elements,
                rmajor,
                b_plasma_toroidal_on_axis,
                ne,
                tempe,
                inverse_q,
                rho,
            )
            / self._beta_poloidal_total_sauter(
                radial_elements,
                number_of_elements,
                rmajor,
                b_plasma_toroidal_on_axis,
                ne,
                ni,
                tempe,
                tempi,
                inverse_q,
                rho,
            )
        )

    @staticmethod
    def _beta_poloidal_sauter(
        radial_elements: np.ndarray,
        nr: int,
        rmajor: float,
        b_plasma_toroidal_on_axis: float,
        ne: np.ndarray,
        tempe: np.ndarray,
        inverse_q: np.ndarray,
        rho: np.ndarray,
    ) -> np.ndarray:
        """Calculate the local beta poloidal using only electron profiles for the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            Radial element indexes in range 1 to nr.
        nr : int
            Maximum value of radial_elements.
        rmajor : float
            Plasma major radius (m).
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        ne : np.ndarray
            Electron density profile (/m³).
        tempe : np.ndarray
            Electron temperature profile (keV).
        inverse_q : np.ndarray
            Inverse safety factor profile.
        rho : np.ndarray
            Normalized minor radius profile.

        Returns
        -------
        np.ndarray
            The local beta poloidal.
        """
        return (
            np.where(
                radial_elements != nr,
                1.6e-4
                * np.pi
                * (ne[radial_elements] + ne[radial_elements - 1])
                * (tempe[radial_elements] + tempe[radial_elements - 1]),
                6.4e-4 * np.pi * ne[radial_elements - 1] * tempe[radial_elements - 1],
            )
            * (
                rmajor
                / (
                    b_plasma_toroidal_on_axis
                    * rho[radial_elements - 1]
                    * np.abs(inverse_q[radial_elements - 1] + 1.0e-4)
                )
            )
            ** 2
        )

    @staticmethod
    def _beta_poloidal_total_sauter(
        radial_elements: np.ndarray,
        nr: int,
        rmajor: float,
        b_plasma_toroidal_on_axis: float,
        ne: np.ndarray,
        ni: np.ndarray,
        tempe: np.ndarray,
        tempi: np.ndarray,
        inverse_q: np.ndarray,
        rho: np.ndarray,
    ) -> np.ndarray:
        """Calculate the local beta poloidal including ion pressure for the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            Radial element indexes in range 1 to nr.
        nr : int
            Maximum value of radial_elements.
        rmajor : float
            Plasma major radius (m).
        b_plasma_toroidal_on_axis : float
            Toroidal field on axis (T).
        ne : np.ndarray
            Electron density profile (/m³).
        ni : np.ndarray
            Ion density profile (/m³).
        tempe : np.ndarray
            Electron temperature profile (keV).
        tempi : np.ndarray
            Ion temperature profile (keV).
        inverse_q : np.ndarray
            Inverse safety factor profile.
        rho : np.ndarray
            Normalized minor radius profile.

        Returns
        -------
        np.ndarray
            The local total beta poloidal.
        """
        return (
            np.where(
                radial_elements != nr,
                1.6e-4
                * np.pi
                * (
                    (
                        (ne[radial_elements] + ne[radial_elements - 1])
                        * (tempe[radial_elements] + tempe[radial_elements - 1])
                    )
                    + (
                        (ni[radial_elements] + ni[radial_elements - 1])
                        * (tempi[radial_elements] + tempi[radial_elements - 1])
                    )
                ),
                6.4e-4
                * np.pi
                * (
                    ne[radial_elements - 1] * tempe[radial_elements - 1]
                    + ni[radial_elements - 1] * tempi[radial_elements - 1]
                ),
            )
            * (
                rmajor
                / (
                    b_plasma_toroidal_on_axis
                    * rho[radial_elements - 1]
                    * np.abs(inverse_q[radial_elements - 1] + 1.0e-4)
                )
            )
            ** 2
        )

    @staticmethod
    def _trapped_particle_fraction_sauter(
        radial_elements: np.ndarray, triang: float, sqeps: np.ndarray, fit: int = 0
    ) -> np.ndarray:
        """Calculates the trapped particle fraction to be used in the Sauter bootstrap current scaling.

        Parameters
        ----------
        radial_elements : np.ndarray
            Radial element index in range 1 to nr.
        triang : float
            Plasma triangularity.
        sqeps : np.ndarray
            Square root of local aspect ratio.
        fit : int, optional
            Fit method (0 = ASTRA method, 1 = Sauter 2002, 2 = Sauter 2016).
            Default is 0.

        Returns
        -------
        np.ndarray
            Trapped particle fraction.

        Notes
        -----
        This function calculates the trapped particle fraction at a given radius.

        References
        ----------
        Used in this paper:
        O. Sauter, C. Angioni, Y. R. Lin-Liu;
        Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
        and arbitrary collisionality regime.
        Phys. Plasmas 1 July 1999; 6 (7): 2834-2839. https://doi.org/10.1063/1.873240

        O. Sauter, R. J. Buttery, R. Felton, T. C. Hender, D. F. Howell, and contributors to the E.-J. Workprogramme,
        "Marginal-limit for neoclassical tearing modes in JET H-mode discharges,"
        Plasma Physics and Controlled Fusion, vol. 44, no. 9, pp. 1999-2019, Aug. 2002,
        doi: https://doi.org/10.1088/0741-3335/44/9/315.

        O. Sauter, Geometric formulas for system codes including the effect of negative triangularity,
        Fusion Engineering and Design, Volume 112, 2016, Pages 633-645, ISSN 0920-3796,
        https://doi.org/10.1016/j.fusengdes.2016.04.033.
        """
        # Prevent first element from being zero
        sqeps_reduced = sqeps[radial_elements - 1]
        eps = sqeps_reduced**2

        if fit == 0:
            # ASTRA method, from Emiliano Fable, private communication
            # (Excluding h term which dominates for inverse aspect ratios < 0.5,
            # and tends to take the trapped particle fraction to 1)

            zz = 1.0 - eps
            return 1.0 - zz * np.sqrt(zz) / (1.0 + 1.46 * sqeps_reduced)

        if fit == 1:
            # Equation 4 of Sauter 2002; https://doi.org/10.1088/0741-3335/44/9/315.
            # Similar to, but not quite identical to above

            return 1.0 - (
                ((1.0 - eps) ** 2)
                / ((1.0 + 1.46 * sqeps_reduced) * np.sqrt(1.0 - eps**2))
            )

        if fit == 2:
            # Sauter 2016; https://doi.org/10.1016/j.fusengdes.2016.04.033.
            # Includes correction for triangularity

            epseff = 0.67 * (1.0 - 1.4 * triang * np.abs(triang)) * eps

            return 1.0 - (
                ((1.0 - epseff) / (1.0 + 2.0 * np.sqrt(epseff)))
                * (np.sqrt((1.0 - eps) / (1.0 + eps)))
            )

        raise ProcessValueError(f"fit={fit} is not valid. Must be 0, 1, or 2")

bootstrap_fraction_sauter(plasma_profile)

Calculate the bootstrap current fraction from the Sauter et al scaling.

Parameters:

Name Type Description Default
plasma_profile PlasmaProfile

The plasma profile object.

required

Returns:

Type Description
tuple[float, ndarray]

The bootstrap current fraction and current density profile.

Notes

This function calculates the bootstrap current fraction using the Sauter, Angioni, and Lin-Liu scaling.

References

O. Sauter, C. Angioni, Y. R. Lin-Liu; Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria and arbitrary collisionality regime. Phys. Plasmas 1 July 1999; 6 (7): 2834-2839. https://doi.org/10.1063/1.873240

O. Sauter, C. Angioni, Y. R. Lin-Liu; Erratum: Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria and arbitrary collisionality regime [Phys. Plasmas 6, 2834 (1999)]. Phys. Plasmas 1 December 2002; 9 (12): 5140. https://doi.org/10.1063/1.1517052

Note: The code was supplied by Emiliano Fable, IPP Garching (private communication).

Source code in process/models/physics/bootstrap_current.py
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
def bootstrap_fraction_sauter(self, plasma_profile: float) -> float:
    """Calculate the bootstrap current fraction from the Sauter et al scaling.

    Parameters
    ----------
    plasma_profile : PlasmaProfile
        The plasma profile object.

    Returns
    -------
    tuple[float, np.ndarray]
        The bootstrap current fraction and current density profile.

    Notes
    -----
    This function calculates the bootstrap current fraction using the Sauter, Angioni, and
    Lin-Liu scaling.

    References
    ----------
    O. Sauter, C. Angioni, Y. R. Lin-Liu;
    Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
    and arbitrary collisionality regime.
    Phys. Plasmas 1 July 1999; 6 (7): 2834-2839. https://doi.org/10.1063/1.873240

    O. Sauter, C. Angioni, Y. R. Lin-Liu; Erratum:
    Neoclassical conductivity and bootstrap current formulas for general axisymmetric equilibria
    and arbitrary collisionality regime [Phys. Plasmas 6, 2834 (1999)].
    Phys. Plasmas 1 December 2002; 9 (12): 5140. https://doi.org/10.1063/1.1517052

    Note: The code was supplied by Emiliano Fable, IPP Garching (private communication).
    """

    # Radial points from 0 to 1 seperated by 1/profile_size
    roa = plasma_profile.neprofile.profile_x

    # Local circularised minor radius
    rho = np.sqrt(physics_variables.a_plasma_poloidal / np.pi) * roa

    # Square root of local aspect ratio
    sqeps = np.sqrt(roa * (physics_variables.rminor / physics_variables.rmajor))

    # Calculate electron and ion density profiles
    ne = plasma_profile.neprofile.profile_y * 1e-19
    ni = (
        physics_variables.nd_plasma_ions_total_vol_avg
        / physics_variables.nd_plasma_electrons_vol_avg
    ) * ne

    # Calculate electron and ion temperature profiles
    tempe = plasma_profile.teprofile.profile_y
    tempi = (
        physics_variables.temp_plasma_ion_vol_avg_kev
        / physics_variables.temp_plasma_electron_vol_avg_kev
    ) * tempe

    # Flat Zeff profile assumed
    # Return tempi like array object filled with zeff
    zeff = np.full_like(tempi, physics_variables.n_charge_plasma_effective_vol_avg)

    # inverse_q = 1/safety factor
    # Parabolic q profile assumed
    inverse_q = 1 / (
        physics_variables.q0
        + (physics_variables.q95 - physics_variables.q0) * roa**2
    )
    # Create new array of average mass of fuel portion of ions
    amain = np.full_like(inverse_q, physics_variables.m_ions_total_amu)

    # Create new array of average main ion charge
    zmain = np.full_like(inverse_q, 1.0 + physics_variables.f_plasma_fuel_helium3)

    # Calculate total bootstrap current (MA) by summing along profiles
    # Looping from 2 because _calculate_l31_coefficient() etc should return 0 @ j == 1
    radial_elements = np.arange(2, plasma_profile.profile_size)

    # Change in localised minor radius to be used as delta term in derivative
    drho = rho[radial_elements] - rho[radial_elements - 1]

    # Area of annulus, assuming circular plasma cross-section
    da = 2 * np.pi * rho[radial_elements - 1] * drho  # area of annulus

    # Create the partial derivatives using numpy gradient (central differences)
    dlogte_drho = np.gradient(np.log(tempe), rho)[radial_elements - 1]
    dlogti_drho = np.gradient(np.log(tempi), rho)[radial_elements - 1]
    dlogne_drho = np.gradient(np.log(ne), rho)[radial_elements - 1]

    jboot = (
        0.5
        * (
            self._calculate_l31_coefficient(
                radial_elements,
                plasma_profile.profile_size,
                physics_variables.rmajor,
                physics_variables.b_plasma_toroidal_on_axis,
                physics_variables.triang,
                ne,
                ni,
                tempe,
                tempi,
                inverse_q,
                rho,
                zeff,
                sqeps,
            )
            * dlogne_drho
            + self._calculate_l31_32_coefficient(
                radial_elements,
                plasma_profile.profile_size,
                physics_variables.rmajor,
                physics_variables.b_plasma_toroidal_on_axis,
                physics_variables.triang,
                ne,
                ni,
                tempe,
                tempi,
                inverse_q,
                rho,
                zeff,
                sqeps,
            )
            * dlogte_drho
            + self._calculate_l34_alpha_31_coefficient(
                radial_elements,
                plasma_profile.profile_size,
                physics_variables.rmajor,
                physics_variables.b_plasma_toroidal_on_axis,
                physics_variables.triang,
                inverse_q,
                sqeps,
                tempi,
                tempe,
                amain,
                zmain,
                ni,
                ne,
                rho,
                zeff,
            )
            * dlogti_drho
        )
        * 1.0e6
        * (
            -physics_variables.b_plasma_toroidal_on_axis
            / (0.2 * np.pi * physics_variables.rmajor)
            * rho[radial_elements - 1]
            * inverse_q[radial_elements - 1]
        )
    )  # A/m2

    return (np.sum(da * jboot, axis=0) / physics_variables.plasma_current), jboot