Skip to content

numerics

ipnvars = 177 module-attribute

total number of variables available for iteration

ipeqns = 92 module-attribute

number of constraint equations available

ipnfoms = 19 module-attribute

number of available figures of merit

ipvlam = ipeqns + 2 * ipnvars + 1 module-attribute

iptnt = ipeqns * (3 * ipeqns + 13) / 2 module-attribute

ipvp1 = ipnvars + 1 module-attribute

ioptimz = None module-attribute

Code operation switch: * -2 for evaluation mode (i.e. no optimisation) * 1 for optimisation mode (e.g. via VMCON)

minmax = None module-attribute

Switch for figure-of-merit (see lablmm for descriptions) negative => maximise, positive => minimise

lablmm = None module-attribute

lablmm(ipnfoms) : labels describing figures of merit:

    * ( 1) major radius * ( 2) not used * ( 3) neutron wall load * ( 4) P_tf + P_pf * ( 5) fusion gain Q * ( 6) cost of electricity * ( 7) capital cost (direct cost if ireactor=0, constructed cost otherwise) * ( 8) aspect ratio * ( 9) divertor heat load * (10) toroidal field * (11) total injected power * (12) hydrogen plant capital cost OBSOLETE * (13) hydrogen production rate OBSOLETE * (14) pulse length * (15) plant availability factor (N.B. requires i_plant_availability=1 to be set) * (16) linear combination of major radius (minimised) and pulse length (maximised) note: FoM should be minimised only! * (17) net electrical output * (18) Null Figure of Merit * (19) linear combination of big Q and pulse length (maximised) note: FoM should be minimised only!

n_constraints = None module-attribute

Total number of constraints (neqns + nineqns)

ncalls = None module-attribute

number of function calls during solution

neqns = None module-attribute

number of equality constraints to be satisfied

nfev1 = None module-attribute

number of calls to FCNHYB (HYBRD function caller) made

nfev2 = None module-attribute

number of calls to FCNVMC1 (VMCON function caller) made

nineqns = None module-attribute

number of inequality constraints VMCON must satisfy (leave at zero for now)

nvar = None module-attribute

number of iteration variables to use

nviter = None module-attribute

number of optimisation iterations performed

icc = None module-attribute

active_constraints = True module-attribute

Logical array showing which constraints are active

lablcc = None module-attribute

Labels describing constraint equations (corresponding itvs)

    * ( 1) Beta (consistency equation) (itv 5) * ( 2) Global power balance (consistency equation) (itv 10,1,2,3,4,6,11) * ( 3) Ion power balance DEPRECATED (itv 10,1,2,3,4,6,11) * ( 4) Electron power balance DEPRECATED (itv 10,1,2,3,4,6,11) * ( 5) Density upper limit (itv 9,1,2,3,4,5,6) * ( 6) (Epsilon x beta poloidal) upper limit (itv 8,1,2,3,4,6) * ( 7) Beam ion density (NBI) (consistency equation) (itv 7) * ( 8) Neutron wall load upper limit (itv 14,1,2,3,4,6) * ( 9) Fusion power upper limit (itv 26,1,2,3,4,6) * (10) Toroidal field 1/R (consistency equation) (itv 12,1,2,3,13 ) * (11) Radial build (consistency equation) (itv 3,1,13,16,29,42,61) * (12) Volt second lower limit (STEADY STATE) (itv 15,1,2,3) * (13) Burn time lower limit (PULSE) (itv 21,1,16,17,29,42,44,61) (itv 19,1,2,3,6) * (14) Neutral beam decay lengths to plasma centre (NBI) (consistency equation) * (15) LH power threshold limit (itv 103) * (16) Net electric power lower limit (itv 25,1,2,3) * (17) Radiation fraction upper limit (itv 28) * (18) Divertor heat load upper limit (itv 27) * (19) MVA upper limit (itv 30) * (20) Neutral beam tangency radius upper limit (NBI) (itv 33,31,3,13) * (21) Plasma minor radius lower limit (itv 32) * (22) Divertor collisionality upper limit (itv 34,43) * (23) Conducting shell to plasma minor radius ratio upper limit (itv 104,1,74) * (24) Beta upper limit (itv 36,1,2,3,4,6,18) * (25) Peak toroidal field upper limit (itv 35,3,13,29) * (26) Central solenoid EOF current density upper limit (i_pf_conductor=0) (itv 38,37,41,12) * (27) Central solenoid BOP current density upper limit (i_pf_conductor=0) (itv 39,37,41,12) * (28) Fusion gain Q lower limit (itv 45,47,40) * (29) Inboard radial build consistency (itv 3,1,13,16,29,42,61) * (30) Injection power upper limit (itv 46,47,11) * (31) TF coil case stress upper limit (SCTF) (itv 48,56,57,58,59,60,24) * (32) TF coil conduit stress upper limit (SCTF) (itv 49,56,57,58,59,60,24) * (33) I_op / I_critical (TF coil) (SCTF) (itv 50,56,57,58,59,60,24) * (34) Dump voltage upper limit (SCTF) (itv 51,52,56,57,58,59,60,24) * (35) J_winding pack/J_protection upper limit (SCTF) (itv 53,56,57,58,59,60,24) * (36) TF coil temperature margin lower limit (SCTF) (itv 54,55,56,57,58,59,60,24) * (37) Current drive gamma upper limit (itv 40,47) * (38) First wall coolant temperature rise upper limit (itv 62) * (39) First wall peak temperature upper limit (itv 63) * (40) Start-up injection power lower limit (PULSE) (itv 64) * (41) Plasma current ramp-up time lower limit (PULSE) (itv 66,65) * (42) Cycle time lower limit (PULSE) (itv 17,67,65) * (43) Average centrepost temperature (TART) (consistency equation) (itv 13,20,69,70) * (44) Peak centrepost temperature upper limit (TART) (itv 68,69,70) * (45) Edge safety factor lower limit (TART) (itv 71,1,2,3) * (46) Equation for Ip/Irod upper limit (TART) (itv 72,2,60) * (47) NOT USED * (48) Poloidal beta upper limit (itv 79,2,3,18) * (49) NOT USED * (50) IFE repetition rate upper limit (IFE) * (51) Startup volt-seconds consistency (PULSE) (itv 16,29,3,1) * (52) Tritium breeding ratio lower limit (itv 89,90,91) * (53) Neutron fluence on TF coil upper limit (itv 92,93,94) * (54) Peak TF coil nuclear heating upper limit (itv 95,93,94) * (55) Vacuum vessel helium concentration upper limit i_blanket_type =2 (itv 96,93,94) * (56) Pseparatrix/Rmajor upper limit (itv 97,1,3) * (57) NOT USED * (58) NOT USED * (59) Neutral beam shine-through fraction upper limit (NBI) (itv 105,6,19,4 ) * (60) Central solenoid temperature margin lower limit (SCTF) (itv 106) * (61) Minimum availability value (itv 107) * (62) f_alpha_energy_confinement the ratio of particle to energy confinement times (itv 110) * (63) The number of ITER-like vacuum pumps n_iter_vacuum_pumps < tfno (itv 111) * (64) Zeff less than or equal to zeff_max (itv 112) * (65) Dump time set by VV loads (itv 56, 113) * (66) Limit on rate of change of energy in poloidal field (Use iteration variable 65(t_plant_pulse_plasma_current_ramp_up), 115) * (67) Simple Radiation Wall load limit (itv 116, 4,6) * (68) Psep * Bt / qAR upper limit (itv 117) * (69) ensure separatrix power = the value from Kallenbach divertor (itv 118) * (70) ensure that teomp = separatrix temperature in the pedestal profile, (itv 119 (temp_plasma_separatrix_kev)) * (71) ensure that neomp = separatrix density (nd_plasma_separatrix_electron) x neratio * (72) central solenoid shear stress limit (Tresca yield criterion) * (73) Psep >= Plh + Paux * (74) TFC quench < temp_croco_quench_max * (75) TFC current/copper area < Maximum * (76) Eich critical separatrix density * (77) TF coil current per turn upper limit * (78) Reinke criterion impurity fraction lower limit * (79) Peak CS field upper limit * (80) Divertor power lower limit p_plasma_separatrix_mw * (81) Ne(0) > ne(ped) constraint * (82) toroidalgap > dx_tf_inboard_out_toroidal constraint * (83) Radial build consistency for stellarators * (84) Lower limit for beta (itv 173 fbeta_min) * (85) Constraint for CP lifetime * (86) Constraint for TF coil turn dimension * (87) Constraint for cryogenic power * (88) Constraint for TF coil strain absolute value * (89) Constraint for CS coil quench protection * (90) Lower Limit on number of stress load cycles for CS * (91) Checking if the design point is ECRH ignitable * (92) D/T/He3 ratio in fuel sums to 1

ixc = None module-attribute

Array defining which iteration variables to activate (see lablxc for descriptions)

lablxc = None module-attribute

Labels describing iteration variables

    * ( 1) aspect * ( 2) b_plasma_toroidal_on_axis * ( 3) rmajor * ( 4) temp_plasma_electron_vol_avg_kev * ( 5) beta_total_vol_avg * ( 6) nd_plasma_electrons_vol_avg * ( 7) f_nd_beam_electron * ( 8) NOT USED * ( 9) NOT USED * (10) hfact * (11) p_hcd_primary_extra_heat_mw * (12) oacdcp * (13) dr_tf_inboard (NOT RECOMMENDED) * (14) NOT USED * (15) NOT USED * (16) dr_cs * (17) t_plant_pulse_dwell * (18) q * (19) e_beam_kev * (20) temp_cp_average * (21) NOT USED * (22) NOT USED * (23) fcoolcp * (24) NOT USED * (25) NOT USED * (26) NOT USED * (27) NOT USED * (28) NOT USED * (29) dr_bore * (30) NOT USED * (31) gapomin * (32) NOT USED * (33) NOT USED * (34) NOT USED * (35) NOT USED * (36) NOT USED * (37) j_cs_flat_top_end * (38) NOT USED * (39) NOT USED * (40) NOT USED * (41) f_j_cs_start_pulse_end_flat_top * (42) dr_cs_tf_gap * (43) NOT USED * (44) f_c_plasma_non_inductive * (45) NOT USED * (46) NOT USED * (47) feffcd * (48) NOT USED * (49) NOT USED * (50) NOT USED * (51) NOT USED * (52) NOT USED * (53) NOT USED * (54) NOT USED * (55) NOT USED * (56) t_tf_superconductor_quench * (57) dr_tf_nose_case * (58) dx_tf_turn_steel * (59) f_a_tf_turn_cable_copper * (60) c_tf_turn * (61) dr_shld_vv_gap_inboard * (62) NOT USED * (63) NOT USED * (64) NOT USED * (65) t_plant_pulse_plasma_current_ramp_up * (66) NOT USED * (67) NOT USED * (68) NOT USED * (69) radius_cp_coolant_channel * (70) vel_cp_coolant_midplane * (71) NOT USED * (72) NOT USED * (73) dr_fw_plasma_gap_inboard * (74) dr_fw_plasma_gap_outboard * (75) f_dr_tf_outboard_inboard * (76) NOT USED * (77) NOT USED * (78) NOT USED * (79) NOT USED * (80) NOT USED * (81) edrive * (82) drveff * (83) tgain * (84) chrad * (85) pdrive * (86) NOT USED * (87) NOT USED * (88) NOT USED * (89) NOT USED * (90) blbuith * (91) blbuoth * (92) NOT USED * (93) dr_shld_inboard * (94) dr_shld_outboard * (95) NOT USED * (96) NOT USED * (97) NOT USED * (98) f_blkt_li6_enrichment * (99) NOT USED * (100) NOT USED * (101) NOT USED * (102) f_nd_impurity_electronsvar # OBSOLETE * (103) NOT USED * (104) NOT USED * (105) NOT USED * (106) NOT USED * (107) NOT USED * (108) breeder_f: Volume of Li4SiO4 / (Volume of Be12Ti + Li4SiO4) * (109) f_nd_alpha_electron: thermal alpha density / electron density * (110) NOT USED * (111) NOT USED * (112) NOT USED * (113) NOT USED * (114) len_fw_channel: Length of a single first wall channel * (115) NOT USED * (116) NOT USED * (117) NOT USED * (119) temp_plasma_separatrix_kev: separatrix temperature calculated by the Kallenbach divertor model * (120) ttarget: Plasma temperature adjacent to divertor sheath [eV] * (121) neratio: ratio of mean SOL density at OMP to separatrix density at OMP * (122) f_a_cs_turn_steel : streel fraction of Central Solenoid * (123) NOT USED * (124) qtargettotal : Power density on target including surface recombination [W/m2] * (125) f_nd_impurity_electrons(3) : Beryllium density fraction relative to electron density * (126) f_nd_impurity_electrons(4) : Carbon density fraction relative to electron density * (127) f_nd_impurity_electrons(5) : Nitrogen fraction relative to electron density * (128) f_nd_impurity_electrons(6) : Oxygen density fraction relative to electron density * (129) f_nd_impurity_electrons(7) : Neon density fraction relative to electron density * (130) f_nd_impurity_electrons(8) : Silicon density fraction relative to electron density * (131) f_nd_impurity_electrons(9) : Argon density fraction relative to electron density * (132) f_nd_impurity_electrons(10) : Iron density fraction relative to electron density * (133) f_nd_impurity_electrons(11) : Nickel density fraction relative to electron density * (134) f_nd_impurity_electrons(12) : Krypton density fraction relative to electron density * (135) f_nd_impurity_electrons(13) : Xenon density fraction relative to electron density * (136) f_nd_impurity_electrons(14) : Tungsten density fraction relative to electron density * (137) NOT USED * (138) dx_hts_tape_rebco : thickness of REBCO layer in tape (m) * (139) dx_hts_tape_copper : thickness of copper layer in tape (m) * (140) dr_tf_wp_with_insulation : radial thickness of TFC winding pack (m) * (141) NOT USED * (142) nd_plasma_separatrix_electron : electron density at separatrix [m-3] * (143) f_copperA_m2 : TF coil current / copper area < Maximum value * (144) NOT USED * (145) f_nd_plasma_pedestal_greenwald : fraction of Greenwald density to set as pedestal-top density * (146) NOT USED * (147) NOT USED * (148) fzactual : fraction of impurity at SOL with Reinke detachment criterion * (149) NOT USED * (150) NOT USED * (151) NOT USED * (152) f_nd_plasma_separatrix_greenwald : Ratio of separatrix density to Greenwald density * (153) NOT USED * (154) NOT USED * (155) pfusife : IFE input fusion power (MW) (ifedrv=3 only) * (156) rrin : Input IFE repetition rate (Hz) (ifedrv=3 only) * (157) NOT USED * (158) dx_croco_strand_copper : Thickness of CroCo copper tube (m) * (159) NOT USED * (160) NOT USED * (161) NOT USED * (162) r_cp_top : Top outer radius of the centropost (ST only) (m) * (163) NOT USED * (164) NOT USED * (165) NOT USED * (166) NOT USED * (167) NOT USED * (168) NOT USED * (169) te0_ecrh_achievable: Max. achievable electron temperature at ignition point * (170) deg_div_field_plate : field line angle wrt divertor target plate (degrees) * (171) casths_fraction : TF side case thickness as fraction of toridal case thickness * (172) dx_tf_side_case_min : TF side case thickness [m] * (173) f_plasma_fuel_deuterium : Deuterium fraction in fuel * (174) NOT USED * (175) NOT USED

name_xc = None module-attribute

sqsumsq = None module-attribute

sqrt of the sum of the square of the constraint residuals

objf_name = None module-attribute

Description of the objective function

norm_objf = None module-attribute

Normalised objective function (figure of merit)

epsfcn = None module-attribute

Finite difference step length for calculating derivatives

epsvmc = None module-attribute

Error tolerance for optimiser

boundl = None module-attribute

Lower bounds used on ixc variables during optimisation runs

boundu = None module-attribute

Upper bounds used on ixc variables

itv_scaled_lower_bounds = None module-attribute

Lower bound of the ixc variables scaled to (divided by) the initial value of the corresponding ixc

itv_scaled_upper_bounds = None module-attribute

Upper bound of the ixc variables scaled to (divided by) the initial value of the corresponding ixc

rcm = None module-attribute

resdl = None module-attribute

scafc = None module-attribute

The initial value of each ixc variable

scale = None module-attribute

The reciprocal of the initial value of each ixc variable

xcm = None module-attribute

xcs = None module-attribute

vlam = None module-attribute

force_vmcon_inequality_satisfication = None module-attribute

If 1, adds an additional convergence criteria to the VMCON solver that enforces a margin on the inequality constraints. I.e. VMCON cannot converge until all inequality constraints are satisfied to within a tolerance of force_vmcon_inequality_tolerance.

Default is 1 (enabled).

NOTE: this only affects the VMCON solver.

force_vmcon_inequality_tolerance = None module-attribute

The relative tolerance for the additional VMCON convergence criteria that forces inequality constraints to be satisfied within a tolerance.

Default is 1e-8.

NOTE: has no effect if force_vmcon_inequality_satisfication is 0 NOTE: this only affects the VMCON solver.

init_numerics()

Source code in process/data_structure/numerics.py
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
def init_numerics():
    global \
        ipnvars, \
        ipeqns, \
        ipnfoms, \
        ipvlam, \
        iptnt, \
        ipvp1, \
        ioptimz, \
        minmax, \
        lablmm, \
        n_constraints, \
        ncalls, \
        neqns, \
        nfev1, \
        nfev2, \
        nineqns, \
        nvar, \
        nviter, \
        icc, \
        active_constraints, \
        lablcc, \
        ixc, \
        lablxc, \
        name_xc, \
        sqsumsq, \
        objf_name, \
        norm_objf, \
        epsfcn, \
        epsvmc, \
        factor, \
        ftol, \
        boundl, \
        boundu, \
        itv_scaled_lower_bounds, \
        itv_scaled_upper_bounds, \
        rcm, \
        resdl, \
        scafc, \
        scale, \
        xcm, \
        xcs, \
        vlam, \
        force_vmcon_inequality_satisfication, \
        force_vmcon_inequality_tolerance
    """Initialise module variables"""
    ioptimz = 1
    minmax = 7
    lablmm = [
        "major radius          ",
        "not used              ",
        "neutron wall load     ",
        "P_tf + P_pf           ",
        "fusion gain           ",
        "cost of electricity   ",
        "capital cost          ",
        "aspect ratio          ",
        "divertor heat load    ",
        "toroidal field        ",
        "total injected power  ",
        "H plant capital cost  ",
        "H production rate     ",
        "pulse length          ",
        "plant availability    ",
        "min R0, max tau_burn  ",
        "net electrical output ",
        "Null figure of merit  ",
        "max Q, max t_plant_pulse_burn     ",
    ]

    ncalls = 0
    neqns = -1
    nfev1 = 0
    nfev2 = 0
    nineqns = 0
    nvar = 0
    n_constraints = 0
    nviter = 0
    icc = np.array([0] * ipeqns)
    active_constraints = [False] * ipeqns

    lablcc = [
        "Beta consistency                 ",
        "Global power balance consistency ",
        "Ion power balance                ",
        "Electron power balance           ",
        "Density upper limit              ",
        "(Epsilon x beta-pol) upper limit ",
        "Beam ion density consistency     ",
        "Neutron wall load upper limit    ",
        "Fusion power upper limit         ",
        "Toroidal field 1/R consistency   ",
        "Radial build consistency         ",
        "Volt second lower limit          ",
        "Burn time lower limit            ",
        "NBI decay lengths consistency    ",
        "L-H power threshold limit        ",
        "Net electric power lower limit   ",
        "Radiation fraction upper limit   ",
        "Divertor heat load upper limit   ",
        "MVA upper limit                  ",
        "Beam tangency radius upper limit ",
        "Plasma minor radius lower limit  ",
        "Divertor collisionality upper lim",
        "Conducting shell radius upper lim",
        "Beta upper limit                 ",
        "Peak toroidal field upper limit  ",
        "CS coil EOF current density limit",
        "CS coil BOP current density limit",
        "Fusion gain Q lower limit        ",
        "Inboard radial build consistency ",
        "Injection power upper limit      ",
        "TF coil case stress upper limit  ",
        "TF coil conduit stress upper lim ",
        "I_op / I_critical (TF coil)      ",
        "Dump voltage upper limit         ",
        "J_winding pack/J_protection limit",
        "TF coil temp. margin lower limit ",
        "Current drive gamma limit        ",
        "1st wall coolant temp rise limit ",
        "First wall peak temperature limit",
        "Start-up inj. power lower limit  ",
        "Plasma curr. ramp time lower lim ",
        "Cycle time lower limit           ",
        "Average centrepost temperature   ",
        "Peak centrepost temp. upper limit",
        "Edge safety factor lower limit   ",
        "Ip/Irod upper limit              ",
        "TF coil tor. thickness upper lim ",
        "Poloidal beta upper limit        ",
        "RFP reversal parameter < 0       ",
        "IFE repetition rate upper limit  ",
        "Startup volt-seconds consistency ",
        "Tritium breeding ratio lower lim ",
        "Neutron fluence on TF coil limit ",
        "Peak TF coil nucl. heating limit ",
        "Vessel helium concentration limit",
        "Psep / R upper limit             ",
        "TF coil leg rad width lower limit",
        "TF coil leg rad width lower limit",
        "NB shine-through frac upper limit",
        "CS temperature margin lower limit",
        "Minimum availability value       ",
        "f_alpha_energy_confinement       ",
        "number of ITER-like vacuum pumps ",
        "Zeff limit                       ",
        "Dump time set by VV stress       ",
        "Rate of change of energy in field",
        "Upper Lim. on Radiation Wall load",
        "Upper Lim. on Psep * Bt / q A R  ",
        "p_sep < psep_kallenbach divertor ",
        "Separatrix temp consistency      ",
        "Separatrix density consistency   ",
        "CS Tresca yield criterion        ",
        "Psep >= Plh + Paux               ",
        "TFC quench <temp_croco_quench_max",
        "TFC current/copper area < Max    ",
        "Eich critical separatrix density ",
        "TFC current per turn upper limit ",
        "Reinke criterion fZ lower limit  ",
        "Peak CS field upper limit        ",
        "p_sep lower limit                ",
        "nd_plasma_electron_on_axis > nd_plasma_pedestal_electron                      ",
        "toroidalgap > dx_tf_inboard_out_t",
        "available_space > required_space ",
        "beta > beta_vol_avg_min                  ",
        "CP lifetime                      ",
        "TFC turn dimension               ",
        "Cryogenic plant power            ",
        "TF coil strain absolute value    ",
        "CS current/copper area < Max     ",
        "CS stress load cycles            ",
        "ECRH ignitability                ",
        "Fuel composition consistency     ",
    ]

    ixc = np.array([0] * ipnvars)

    # WARNING These labels are used as variable names by write_new_in_dat.py, and possibly
    # other python utilities, so they cannot easily be changed.
    lablxc = [""] * ipnvars

    sqsumsq = 0.0
    objf_name = ""
    norm_objf = 0.0
    epsfcn = 1.0e-3
    epsvmc = 1.0e-6
    factor = 0.1e0
    ftol = 1.0e-4

    boundl = np.array([9.0e-99] * ipnvars)
    boundu = np.array([9.0e99] * ipnvars)

    itv_scaled_lower_bounds = np.array([0.0] * ipnvars)
    itv_scaled_upper_bounds = np.array([0.0] * ipnvars)
    rcm = np.array([0.0] * ipnvars)
    resdl = np.array([0.0] * ipnvars)
    scafc = np.array([0.0] * ipnvars)
    scale = np.array([0.0] * ipnvars)
    xcm = np.array([0.0] * ipnvars)
    xcs = np.array([0.0] * ipnvars)
    vlam = np.array([0.0] * ipnvars)
    name_xc = [""] * ipnvars
    force_vmcon_inequality_satisfication = 1
    force_vmcon_inequality_tolerance = 1e-8