Skip to content

vacuum

Module containing vacuum system routines

Vacuum

Bases: Model

Module containing vacuum system routines

This module contains routines for calculating the parameters of the vacuum system for a fusion power plant.

Source code in process/models/vacuum.py
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 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
class Vacuum(Model):
    """Module containing vacuum system routines

    This module contains routines for calculating the
    parameters of the vacuum system for a fusion power plant.
    """

    def __init__(self):
        self.outfile: int = constants.NOUT

    def output(self):
        """Routine to call the vacuum module and write output to file"""
        self.run(output=True)

    def run(self, output: bool = False):
        """Routine to call the vacuum module
        This routine calls the main vacuum package.

        Parameters
        ----------
        output:
            indicate whether output should be written to the output file, or not

        """
        # (should be) NBI gas load (deuterons/second)

        qtorus = 0.0e0

        #  Total fuel gas load (kg/s)
        #  2 nuclei * nucleus-pairs/sec * mass/nucleus

        # MDK Check this!!
        gasld = (
            2.0e0
            * self.data.physics.molflow_plasma_fuelling_required
            * self.data.physics.m_fuel_amu
            * constants.UMASS
        )

        vp = self.data.vacuum
        bld = self.data.build
        phy = self.data.physics

        if vp.i_vacuum_pumping == "old":
            (
                pumpn,
                vp.n_vv_vacuum_ducts,
                vp.dlscal,
                vp.m_vv_vacuum_duct_shield,
                vp.dia_vv_vacuum_ducts,
            ) = self.vacuum(
                phy.p_fusion_total_mw,
                phy.rmajor,
                phy.rminor,
                0.5e0 * (bld.dr_fw_plasma_gap_inboard + bld.dr_fw_plasma_gap_outboard),
                phy.a_plasma_surface,
                phy.vol_plasma,
                bld.dr_shld_outboard,
                bld.dr_shld_inboard,
                bld.dr_tf_inboard,
                bld.r_shld_inboard_inner
                - bld.dr_shld_vv_gap_inboard
                - bld.dr_vv_inboard,
                self.data.tfcoil.n_tf_coils,
                self.data.times.t_plant_pulse_dwell,
                phy.nd_plasma_electrons_vol_avg,
                self.data.divertor.n_divertors,
                qtorus,
                gasld,
                output=output,
            )
            # MDK pumpn is real: convert to integer by rounding.
            vp.n_vac_pumps_high = math.floor(pumpn + 0.5e0)
        elif vp.i_vacuum_pumping == "simple":
            vp.n_iter_vacuum_pumps = self.vacuum_simple(output=output)
        else:
            logger.error(
                f"i_vacuum_pumping is invalid: {self.data.vacuum.i_vacuum_pumping}"
            )

    def vacuum_simple(self, output) -> float:
        """Simple model of vacuum pumping system

        Parameters
        ----------
        output :
            indicate whether output should be written to the output file, or not

        Returns
        -------
        npump:
            number of pumps for pumpdown and steady-state
        """
        # Steady-state model (super simple)
        # One ITER torus cryopump has a throughput of 50 Pa m3/s = 1.2155e+22 molecules/s
        # Issue #304
        n_iter_vacuum_pumps = (
            self.data.physics.molflow_plasma_fuelling_required
            / self.data.vacuum.molflow_vac_pumps
        )

        # Pump-down:
        # Pumping speed per pump m3/s
        pumpspeed = (
            self.data.vacuum.volflow_vac_pumps_max
            * self.data.vacuum.f_a_vac_pump_port_plasma_surface
            * self.data.vacuum.f_volflow_vac_pumps_impedance
            * self.data.physics.a_plasma_surface
            / self.data.tfcoil.n_tf_coils
        )

        wallarea = (self.data.physics.a_plasma_surface / 1084.0e0) * 2000.0e0
        # Required pumping speed for pump-down
        pumpdownspeed = (
            self.data.vacuum.outgasfactor
            * wallarea
            / self.data.vacuum.pres_vv_chamber_base
        ) * self.data.times.t_plant_pulse_dwell ** (-self.data.vacuum.outgasindex)
        # Number of pumps required for pump-down
        npumpdown = pumpdownspeed / pumpspeed

        # Combine the two (somewhat inconsistent) models
        # Note that 'npump' can be constrained by constraint equation 63
        npump = max(n_iter_vacuum_pumps, npumpdown)

        #  Output section
        if output:
            self._vacuum_simple_output(n_iter_vacuum_pumps, npumpdown, npump)

        return npump

    def _vacuum_simple_output(self, n_iter_vacuum_pumps, npumpdown, npump):
        process_output.oheadr(self.outfile, "Vacuum System")
        process_output.ovarre(
            self.outfile,
            "Switch for vacuum pumping model",
            "(i_vacuum_pumping)",
            f'"{self.data.vacuum.i_vacuum_pumping}"',
        )
        process_output.ocmmnt(
            self.outfile,
            "Simple steady-state model with comparison to ITER cryopumps",
        )
        process_output.ovarre(
            self.outfile,
            "Plasma fuelling rate (nucleus-pairs/s)",
            "(molflow_plasma_fuelling_required)",
            self.data.physics.molflow_plasma_fuelling_required,
            "OP ",
        )

        process_output.ovarre(
            self.outfile,
            "Number of high vacuum pumps, each with the throughput of one ITER cryopump"
            "(n_iter_vacuum_pumps)",
            n_iter_vacuum_pumps,
            "OP ",
        )
        process_output.ocmmnt(
            self.outfile,
            " (50 Pa m3 s-1 = 1.2e+22 molecules/s), all operating at the same time",
        )
        process_output.ovarre(
            self.outfile,
            "Dwell time",
            "(t_plant_pulse_dwell)",
            self.data.times.t_plant_pulse_dwell,
        )
        process_output.ovarre(
            self.outfile,
            "Number of pumps required for pump-down",
            "(npumpdown)",
            npumpdown,
            "OP ",
        )
        process_output.ovarre(
            self.outfile, "Number of pumps required overall", "(npump)", npump, "OP "
        )

    def vacuum(
        self,
        pfusmw,
        r0,
        aw,
        dsol,
        plasma_sarea,
        plasma_vol,
        thshldo,
        thshldi,
        thtf,
        ritf,
        n_tf_coils,
        t_plant_pulse_dwell,
        nplasma,
        ndiv,
        qtorus,
        gasld,
        output,
    ):
        """Routine to calculate the parameters of the vacuum system

        Parameters
        ----------
        pfusmw : float
            Fusion power (MW)
        r0 : float
            Major radius (m)
        aw : float
            Minor radius (m)
        dsol :
            Scrape-off layer average width (m)
        plasma_sarea :
            Plasma surface area (m2)
        plasma_vol :
            Plasma volume (m3)
        thshldo :
            Outboard shield thickness (m)
        thshldi :
            Inboard shield thickness (m)
        thtf :
            TF coil thickness (m)
        ritf :
            Radius of inboard TF leg point nearest plasma (m)
        n_tf_coils :
            Number of TF coils
        t_plant_pulse_dwell :
            Dwell time between pulses (s)
        nplasma :
            Plasma density (m**-3)
        ndiv :
            Number of divertors with pumping (single null = 1, double null = 2 if
            pumping provided at both locations)
        qtorus :
            Gas load  from NBI (deuterons/second)
        gasld :
            Total D-T gas load (kg/s)
        output :
            indicate whether output should be written to the output file, or not


        Returns
        -------
        :
            pumpn (`float`) - Number of high vacuum pumps
            - nduct (`int`) - Number of ducts
            - dlscalc (`float`) - Duct-length equivalent for costing purposes (m)
            - mvdsh (`float`) - Mass of a single vacuum duct shield (kg)
            - dimax (`float`) -  Diameter of passage from divertor to pumping ducts (m)
        """
        k = 1.38e-23  # Boltzmann's constant (J/K)
        densh = 7900.0e0  # Density of shielding material (kg/m2)
        fsolid = 0.9e0  # Fraction of duct shielding that is solid material

        #  Pump type;
        #    i_vacuum_pump_type = 0 for turbomolecular pump (mag. bearing) with a nominal
        #              speed of 2.0 m^3/s (1.95 for N2, 1.8 for He, 1.8 for DT)
        #    i_vacuum_pump_type = 1 for compound cryopump with nominal speed of 10 m^3/s
        #              (9.0 for N2, 5.0 for He and 25. for DT)
        pfus = pfusmw * 1.0e6  # Fusion power (W)
        ntf = int(n_tf_coils)

        #  Feed rate (gas load) of D-T into chamber (pellets + gas puffing +
        #     NBI + ...) = load from fueller + load from NBI
        #  frate (kg/s) = gasld (kg/s) + qtorus (D2/s) * 6.64e-27 (kg/D2)
        frate = gasld + qtorus * 6.64e-27

        #  Set duct shield thickness to zero for no biological shielding
        #  instead of thshldo/3.0e0
        thdsh = 0.0e0

        #  Shielding (m) between duct and TF coils is scaled from inboard shield
        #  thickness
        thcsh = thshldi / 3.0e0

        #  Multiplier to convert conductance from gas species i to nitrogen
        xmult = [1.0e0, 0.423e0, 0.378e0, 0.423e0]
        # nitrogen, D-T, helium, D-T again
        nduct = ntf * ndiv

        #  Speed of high-vacuum pumps (m^3/s)
        # nitrogen, DT, helium, DT again
        sp = (
            [1.95, 1.8, 1.8, 1.8]
            if VacuumPumpType(self.data.vacuum.i_vacuum_pump_type)
            == VacuumPumpType.TURBOMOLECULAR
            else [9.0, 25.0, 5.0, 25.0]
        )

        #  Calculate required pumping speeds
        s = []

        #  Initial pumpdown based on outgassing
        #  s(1) = net pump speed (N2) required for pumpdown to base pressure (m^3/s)
        #  area = vacuum chamber/fw area (m^2)  ;  outgassing area = 10 x area
        #  outgrat_fw = outgassing rate (effective for N2) of plasma chamber surface
        #  (Pa-m/s)
        #  pres_vv_chamber_base = base pressure (Pa)

        #  Old method: area = 4.0e0 * pi*pi * r0 * aw
        #  * sqrt(0.5e0*(1.0e0 + kappa*kappa))
        area = plasma_sarea * (aw + dsol) / aw
        ogas = self.data.vacuum.outgrat_fw * area * 10.0e0  # Outgassing rate (Pa-m^3/s)
        s.append(ogas / self.data.vacuum.pres_vv_chamber_base)

        #  Pumpdown between burns
        #  s(2) = net pump speed (DT) required for pumpdown between burns (m^3/s)
        #  temp_vv_chamber_gas_burn_end = temperature of neutral gas in chamber (K)
        #  t_plant_pulse_dwell = dwell time between burns (s)

        # pressure in plasma chamber after burn (Pa)
        pend = 0.5e0 * nplasma * k * self.data.vacuum.temp_vv_chamber_gas_burn_end
        # pressure in chamber before start of burn (Pa)
        pstart = 0.01e0 * pend

        #  Chamber volume (m^3)
        #  Old method: volume = 2.0e0 * pi*pi * r0 * aw*aw * kappa
        volume = plasma_vol * (aw + dsol) * (aw + dsol) / (aw * aw)

        #  dwell pumping options
        if (self.data.vacuum.i_vac_pump_dwell == 1) or (t_plant_pulse_dwell == 0):
            tpump = self.data.times.t_plant_pulse_coil_precharge
        elif self.data.vacuum.i_vac_pump_dwell == 2:
            tpump = t_plant_pulse_dwell + self.data.times.t_plant_pulse_coil_precharge
        else:
            tpump = t_plant_pulse_dwell

        s.append(volume / tpump * math.log(pend / pstart))

        #  Helium ash removal
        #  s(3) = net pump speed (He) required for helium ash removal (m^3/s)
        #  source = alpha production rate (pa - m^3/s)
        #  fhe = fraction of neutral gas in divertor chamber that is helium
        #  pres_div_chamber_burn = pressure in divertor chamber during burn (Pa)
        source = pfus * 1.47e-09
        fhe = source / (frate * 4.985e5)
        s.extend(
            (
                (source / self.data.vacuum.pres_div_chamber_burn / fhe),
                #  Removal of dt on steady state basis
                #  s(4) = net speed (D-T) required to remove dt at fuelling rate (m^3/s)
                (
                    (frate * 4.985e5 - source)
                    / (self.data.vacuum.pres_div_chamber_burn * (1.0e0 - fhe))
                ),
            ),
        )

        #  Calculate conductance of a single duct
        imax = 1
        cmax = 0.01e0
        pumpn = 1.0e0

        l1 = thshldo + thtf  # Length of passage from divertor to ducts (m)
        l2 = thshldo + 4.0e0  # Length of ducts from divertor passage to elbow (m)
        l3 = 2.0e0  # Length of ducts from elbow to hi-vac pumps (m)
        ltot = l1 + l2 + l3

        # ceff and d require initialising too small positive values; they're not
        # always overwritten in the following loop and can cause div by 0 errors
        # otherwise
        ceff = np.full(4, 1e-6)
        d = np.full(4, 1e-6)

        for i in range(4):
            sss = nduct / (1.0e0 / sp[i] / pumpn + 1.0e0 / cmax * xmult[i] / xmult[imax])
            if sss > s[i]:
                continue
            imax = i

            ccc = 2.0e0 * s[i] / nduct
            pumpn1 = 1.0e0 / (sp[i] * (nduct / s[i] - 1.0e0 / ccc))
            pumpn2 = 1.01e0 * s[i] / (sp[i] * nduct)
            pumpn = max(pumpn, pumpn1, pumpn2)
            ceff[i] = 1.0e0 / (nduct / s[i] - 1.0e0 / (sp[i] * pumpn))

            ceff, nflag, d1max = self._newton_method_duct_diameter(
                d, i, s, xmult, l1, l2, l3, ntf, r0, aw, ritf, thcsh, ceff
            )
            cmax = ceff[i]

        pumpn *= nduct

        #  d[imax]= diameter of passage from divertor to pumping ducts (m)
        #  dout    = diameter of ducts from passage to hi-vac pumps (m)
        dout = d[imax] * 1.2e0

        #  Net pumping speeds provided by vacuum pumping system
        #  snet(1) - net pump speed (N2) provided (m^3/s)
        #  snet(2) - net pump speed (D-T) provided (m^3/s)
        #  snet(3) - net pump speed (He) provided (m^3/s)
        #  snet(4) - snet(2)
        ceff1 = ceff[imax] * nduct
        snet = [
            1 / (1 / (ceff1 * xmult[imax] / xmult[i]) + 1 / sp[i] / pumpn)
            for i in range(4)
        ]

        #  If cryopumps are used then an additional pump is required
        #  for continuous operation with regeneration.
        if (
            VacuumPumpType(self.data.vacuum.i_vacuum_pump_type)
            == VacuumPumpType.COMPOUND_CRYOPUMP
        ):
            pumpn *= 2.0e0

        #  Information for costing routine
        dlscalc = l1 * d[imax] ** 1.4e0 + (ltot - l1) * (d[imax] * 1.2e0) ** 1.4e0

        #  Mass of duct shielding
        arsh = (
            0.25e0 * math.pi * ((d[imax] * 1.2e0 + thdsh) ** 2 - (d[imax] * 1.2e0) ** 2)
        )
        mvdsh = arsh * (ltot - l1) * densh * fsolid

        dimax = d[imax]

        if output:
            self._write_to_outfile(
                ogas,
                s,
                snet,
                volume,
                pend,
                pstart,
                t_plant_pulse_dwell,
                tpump,
                fhe,
                frate,
                nflag,
                d1max,
                nduct,
                dimax,
                imax,
                l1,
                l2,
                l3,
                dout,
                pumpn,
            )

        return pumpn, nduct, dlscalc, mvdsh, dimax

    def _newton_method_duct_diameter(
        self, d, i, s, xmult, l1, l2, l3, ntf, r0, aw, ritf, thcsh, ceff
    ):
        nflag = 0  # Control option if ducts are too small in x-sectional area
        #  = 1 if problem is identified in output, but run continues
        #  = 0 otherwise

        #  Newton's method solution for duct diameter

        while True:
            d[i] = 1.0e0
            for _ in range(100):
                dnew, a1 = self._newton_function(d[i], l1, l2, l3, xmult[i], ceff[i])
                dd = abs((d[i] - dnew) / d[i])
                d[i] = dnew
                if dd <= 0.01:
                    break

            else:
                logger.error(
                    "Newton's method not converging; check "
                    "p_fusion_total_mw and temp_plasma_electron_vol_avg_kev: "
                    f"{self.data.physics.p_fusion_total_mw=}, "
                    f"{self.data.physics.temp_plasma_electron_vol_avg_kev=}"
                )

            theta = math.pi / ntf

            #  Area between adjacent TF coils available for pump ducts
            #  ritf = outer radius of inboard leg of TF coil (m)

            a1max = (r0 + aw - ritf - thcsh / math.tan(theta)) ** 2 * math.tan(theta)
            d1max = math.sqrt(4.0 * a1max / math.pi)  # Equivalent diameter
            if a1 < a1max:
                break

            ceff[i] *= 0.9
            if ceff[i] <= (1.1 * s[i]):
                #  Ducts are not big enough. Flag and continue.
                nflag = 1
                break
        return ceff, nflag, d1max

    @staticmethod
    def _newton_function(d_i, l1, l2, l3, xmult_i, ceff_i):
        a1 = 0.25 * math.pi * d_i * d_i  # Area of aperture and duct (m^2)
        a2 = 1.44 * a1
        a3 = a2
        k1 = 4 / 3 * d_i / (l1 + 4 / 3 * d_i)
        k2 = 4 / 3 * d_i * 1.2 / (l2 + 4 / 3 * d_i * 1.2)
        k3 = 4 / 3 * d_i * 1.2 / (l3 + 4 / 3 * d_i * 1.2)
        cap = 119 * a1 / xmult_i
        dcap = 2 * cap / d_i
        c1 = 119 * a1 * k1 / xmult_i
        dc1 = c1 / d_i * (3 - k1)
        c2 = 119 * a2 * k2 / xmult_i
        dc2 = c2 / d_i / 1.2 * (3 - k2)
        c3 = 119 * a3 * k3 / xmult_i
        dc3 = c3 / d_i / 1.2 * (3 - k3)
        cnew = 1 / (1 / cap + 1 / c1 + 1 / c2 + 1 / c3)
        y = -ceff_i + cnew
        dy = (
            cnew
            * cnew
            * (dcap / cap / cap + dc1 / c1 / c1 + dc2 / c2 / c2 + dc3 / c3 / c3)
        )
        return d_i - y / dy, a1

    def _write_to_outfile(
        self,
        ogas,
        s,
        snet,
        volume,
        pend,
        pstart,
        t_plant_pulse_dwell,
        tpump,
        fhe,
        frate,
        nflag,
        d1max,
        nduct,
        dimax,
        imax,
        l1,
        l2,
        l3,
        dout,
        pumpn,
    ):
        #  Output section

        process_output.oheadr(self.outfile, "Vacuum System")

        process_output.ocmmnt(self.outfile, "Pumpdown to Base Pressure :")
        process_output.oblnkl(self.outfile)
        process_output.ovarre(
            self.outfile,
            "First wall outgassing rate (Pa m/s)",
            "(outgrat_fw)",
            self.data.vacuum.outgrat_fw,
        )
        process_output.ovarre(
            self.outfile, "Total outgassing load (Pa m3/s)", "(ogas)", ogas, "OP "
        )
        process_output.ovarre(
            self.outfile,
            "Base pressure required (Pa)",
            "(pres_vv_chamber_base)",
            self.data.vacuum.pres_vv_chamber_base,
        )
        process_output.ovarre(
            self.outfile, "Required N2 pump speed (m3/s)", "(s(1))", s[0], "OP "
        )
        process_output.ovarre(
            self.outfile,
            "N2 pump speed provided (m3/s)",
            "(snet(1))",
            snet[0],
            "OP ",
        )

        process_output.osubhd(self.outfile, "Pumpdown between Burns :")
        process_output.ovarre(
            self.outfile, "Plasma chamber volume (m3)", "(volume)", volume, "OP "
        )
        process_output.ovarre(
            self.outfile, "Chamber pressure after burn (Pa)", "(pend)", pend, "OP "
        )
        process_output.ovarre(
            self.outfile, "Chamber pressure before burn (Pa)", "(pstart)", pstart
        )
        process_output.ovarre(
            self.outfile,
            "Allowable pumping time switch",
            "(i_vac_pump_dwell)",
            self.data.vacuum.i_vac_pump_dwell,
        )
        process_output.ovarre(
            self.outfile,
            "Dwell time between burns (s)",
            "(t_plant_pulse_dwell.)",
            t_plant_pulse_dwell,
        )
        process_output.ovarre(
            self.outfile,
            "CS ramp-up time burns (s)",
            "(t_plant_pulse_coil_precharge.)",
            self.data.times.t_plant_pulse_coil_precharge,
        )
        process_output.ovarre(
            self.outfile,
            "Allowable pumping time between burns (s)",
            "(tpump)",
            tpump,
        )
        process_output.ovarre(
            self.outfile, "Required D-T pump speed (m3/s)", "(s(2))", s[1], "OP "
        )
        process_output.ovarre(
            self.outfile,
            "D-T pump speed provided (m3/s)",
            "(snet(2))",
            snet[1],
            "OP ",
        )

        process_output.osubhd(self.outfile, "Helium Ash Removal :")
        process_output.ovarre(
            self.outfile,
            "Divertor chamber gas pressure (Pa)",
            "(pres_div_chamber_burn)",
            self.data.vacuum.pres_div_chamber_burn,
        )
        process_output.ovarre(
            self.outfile,
            "Helium gas fraction in divertor chamber",
            "(fhe)",
            fhe,
            "OP ",
        )
        process_output.ovarre(
            self.outfile, "Required helium pump speed (m3/s)", "(s(3))", s[2], "OP "
        )
        process_output.ovarre(
            self.outfile,
            "Helium pump speed provided (m3/s)",
            "(snet(3))",
            snet[2],
            "OP ",
        )

        process_output.osubhd(self.outfile, "D-T Removal at Fuelling Rate :")
        process_output.ovarre(
            self.outfile, "D-T fuelling rate (kg/s)", "(frate)", frate, "OP "
        )
        process_output.ovarre(
            self.outfile, "Required D-T pump speed (m3/s)", "(s(4))", s[3], "OP "
        )
        process_output.ovarre(
            self.outfile,
            "D-T pump speed provided (m3/s)",
            "(snet(4))",
            snet[3],
            "OP ",
        )

        if nflag == 1:
            process_output.oblnkl(self.outfile)
            process_output.ocmmnt(
                self.outfile, "Vacuum pumping ducts are space limited."
            )
            process_output.ocmmnt(
                self.outfile, f"Maximum duct diameter is only {d1max} m"
            )
            process_output.ocmmnt(self.outfile, "Conductance is inadequate.")
            process_output.oblnkl(self.outfile)

        i_fw_blkt_shared_coolant = (
            "cryo"
            if VacuumPumpType(self.data.vacuum.i_vacuum_pump_type)
            == VacuumPumpType.COMPOUND_CRYOPUMP
            else "turbo"
        )

        process_output.oblnkl(self.outfile)
        process_output.ocmmnt(
            self.outfile, "The vacuum pumping system size is governed by the"
        )

        if imax == 1:
            process_output.ocmmnt(
                self.outfile, "requirements for pumpdown to base pressure."
            )
        elif imax == 2:
            process_output.ocmmnt(
                self.outfile, "requirements for pumpdown between burns."
            )
        elif imax == 3:
            process_output.ocmmnt(self.outfile, "requirements for helium ash removal.")
        else:
            process_output.ocmmnt(
                self.outfile, "requirements for D-T removal at fuelling rate."
            )

        process_output.oblnkl(self.outfile)
        process_output.ovarre(
            self.outfile, "Number of large pump ducts", "(nduct)", nduct
        )
        process_output.ovarre(
            self.outfile,
            "Passage diameter, divertor to ducts (m)",
            "(d(imax))",
            dimax,
            "OP ",
        )
        process_output.ovarre(self.outfile, "Passage length (m)", "(l1)", l1, "OP ")
        process_output.ovarre(
            self.outfile, "Diameter of ducts (m)", "(dout)", dout, "OP "
        )

        process_output.ovarre(
            self.outfile, "Duct length, divertor to elbow (m)", "(l2)", l2, "OP "
        )
        process_output.ovarre(
            self.outfile, "Duct length, elbow to pumps (m)", "(l3)", l3
        )
        process_output.ovarre(self.outfile, "Number of pumps", "(pumpn)", pumpn, "OP ")
        process_output.oblnkl(self.outfile)
        process_output.ocmmnt(
            self.outfile,
            f"The vacuum system uses {i_fw_blkt_shared_coolant} pumps.",
        )

outfile = constants.NOUT instance-attribute

output()

Routine to call the vacuum module and write output to file

Source code in process/models/vacuum.py
28
29
30
def output(self):
    """Routine to call the vacuum module and write output to file"""
    self.run(output=True)

run(output=False)

Routine to call the vacuum module This routine calls the main vacuum package.

Parameters:

Name Type Description Default
output bool

indicate whether output should be written to the output file, or not

False
Source code in process/models/vacuum.py
32
33
34
35
36
37
38
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
def run(self, output: bool = False):
    """Routine to call the vacuum module
    This routine calls the main vacuum package.

    Parameters
    ----------
    output:
        indicate whether output should be written to the output file, or not

    """
    # (should be) NBI gas load (deuterons/second)

    qtorus = 0.0e0

    #  Total fuel gas load (kg/s)
    #  2 nuclei * nucleus-pairs/sec * mass/nucleus

    # MDK Check this!!
    gasld = (
        2.0e0
        * self.data.physics.molflow_plasma_fuelling_required
        * self.data.physics.m_fuel_amu
        * constants.UMASS
    )

    vp = self.data.vacuum
    bld = self.data.build
    phy = self.data.physics

    if vp.i_vacuum_pumping == "old":
        (
            pumpn,
            vp.n_vv_vacuum_ducts,
            vp.dlscal,
            vp.m_vv_vacuum_duct_shield,
            vp.dia_vv_vacuum_ducts,
        ) = self.vacuum(
            phy.p_fusion_total_mw,
            phy.rmajor,
            phy.rminor,
            0.5e0 * (bld.dr_fw_plasma_gap_inboard + bld.dr_fw_plasma_gap_outboard),
            phy.a_plasma_surface,
            phy.vol_plasma,
            bld.dr_shld_outboard,
            bld.dr_shld_inboard,
            bld.dr_tf_inboard,
            bld.r_shld_inboard_inner
            - bld.dr_shld_vv_gap_inboard
            - bld.dr_vv_inboard,
            self.data.tfcoil.n_tf_coils,
            self.data.times.t_plant_pulse_dwell,
            phy.nd_plasma_electrons_vol_avg,
            self.data.divertor.n_divertors,
            qtorus,
            gasld,
            output=output,
        )
        # MDK pumpn is real: convert to integer by rounding.
        vp.n_vac_pumps_high = math.floor(pumpn + 0.5e0)
    elif vp.i_vacuum_pumping == "simple":
        vp.n_iter_vacuum_pumps = self.vacuum_simple(output=output)
    else:
        logger.error(
            f"i_vacuum_pumping is invalid: {self.data.vacuum.i_vacuum_pumping}"
        )

vacuum_simple(output)

Simple model of vacuum pumping system

Parameters:

Name Type Description Default
output

indicate whether output should be written to the output file, or not

required

Returns:

Name Type Description
npump float

number of pumps for pumpdown and steady-state

Source code in process/models/vacuum.py
 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
def vacuum_simple(self, output) -> float:
    """Simple model of vacuum pumping system

    Parameters
    ----------
    output :
        indicate whether output should be written to the output file, or not

    Returns
    -------
    npump:
        number of pumps for pumpdown and steady-state
    """
    # Steady-state model (super simple)
    # One ITER torus cryopump has a throughput of 50 Pa m3/s = 1.2155e+22 molecules/s
    # Issue #304
    n_iter_vacuum_pumps = (
        self.data.physics.molflow_plasma_fuelling_required
        / self.data.vacuum.molflow_vac_pumps
    )

    # Pump-down:
    # Pumping speed per pump m3/s
    pumpspeed = (
        self.data.vacuum.volflow_vac_pumps_max
        * self.data.vacuum.f_a_vac_pump_port_plasma_surface
        * self.data.vacuum.f_volflow_vac_pumps_impedance
        * self.data.physics.a_plasma_surface
        / self.data.tfcoil.n_tf_coils
    )

    wallarea = (self.data.physics.a_plasma_surface / 1084.0e0) * 2000.0e0
    # Required pumping speed for pump-down
    pumpdownspeed = (
        self.data.vacuum.outgasfactor
        * wallarea
        / self.data.vacuum.pres_vv_chamber_base
    ) * self.data.times.t_plant_pulse_dwell ** (-self.data.vacuum.outgasindex)
    # Number of pumps required for pump-down
    npumpdown = pumpdownspeed / pumpspeed

    # Combine the two (somewhat inconsistent) models
    # Note that 'npump' can be constrained by constraint equation 63
    npump = max(n_iter_vacuum_pumps, npumpdown)

    #  Output section
    if output:
        self._vacuum_simple_output(n_iter_vacuum_pumps, npumpdown, npump)

    return npump

vacuum(pfusmw, r0, aw, dsol, plasma_sarea, plasma_vol, thshldo, thshldi, thtf, ritf, n_tf_coils, t_plant_pulse_dwell, nplasma, ndiv, qtorus, gasld, output)

Routine to calculate the parameters of the vacuum system

Parameters:

Name Type Description Default
pfusmw float

Fusion power (MW)

required
r0 float

Major radius (m)

required
aw float

Minor radius (m)

required
dsol

Scrape-off layer average width (m)

required
plasma_sarea

Plasma surface area (m2)

required
plasma_vol

Plasma volume (m3)

required
thshldo

Outboard shield thickness (m)

required
thshldi

Inboard shield thickness (m)

required
thtf

TF coil thickness (m)

required
ritf

Radius of inboard TF leg point nearest plasma (m)

required
n_tf_coils

Number of TF coils

required
t_plant_pulse_dwell

Dwell time between pulses (s)

required
nplasma

Plasma density (m**-3)

required
ndiv

Number of divertors with pumping (single null = 1, double null = 2 if pumping provided at both locations)

required
qtorus

Gas load from NBI (deuterons/second)

required
gasld

Total D-T gas load (kg/s)

required
output

indicate whether output should be written to the output file, or not

required

Returns:

Type Description

pumpn (float) - Number of high vacuum pumps - nduct (int) - Number of ducts - dlscalc (float) - Duct-length equivalent for costing purposes (m) - mvdsh (float) - Mass of a single vacuum duct shield (kg) - dimax (float) - Diameter of passage from divertor to pumping ducts (m)

Source code in process/models/vacuum.py
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
def vacuum(
    self,
    pfusmw,
    r0,
    aw,
    dsol,
    plasma_sarea,
    plasma_vol,
    thshldo,
    thshldi,
    thtf,
    ritf,
    n_tf_coils,
    t_plant_pulse_dwell,
    nplasma,
    ndiv,
    qtorus,
    gasld,
    output,
):
    """Routine to calculate the parameters of the vacuum system

    Parameters
    ----------
    pfusmw : float
        Fusion power (MW)
    r0 : float
        Major radius (m)
    aw : float
        Minor radius (m)
    dsol :
        Scrape-off layer average width (m)
    plasma_sarea :
        Plasma surface area (m2)
    plasma_vol :
        Plasma volume (m3)
    thshldo :
        Outboard shield thickness (m)
    thshldi :
        Inboard shield thickness (m)
    thtf :
        TF coil thickness (m)
    ritf :
        Radius of inboard TF leg point nearest plasma (m)
    n_tf_coils :
        Number of TF coils
    t_plant_pulse_dwell :
        Dwell time between pulses (s)
    nplasma :
        Plasma density (m**-3)
    ndiv :
        Number of divertors with pumping (single null = 1, double null = 2 if
        pumping provided at both locations)
    qtorus :
        Gas load  from NBI (deuterons/second)
    gasld :
        Total D-T gas load (kg/s)
    output :
        indicate whether output should be written to the output file, or not


    Returns
    -------
    :
        pumpn (`float`) - Number of high vacuum pumps
        - nduct (`int`) - Number of ducts
        - dlscalc (`float`) - Duct-length equivalent for costing purposes (m)
        - mvdsh (`float`) - Mass of a single vacuum duct shield (kg)
        - dimax (`float`) -  Diameter of passage from divertor to pumping ducts (m)
    """
    k = 1.38e-23  # Boltzmann's constant (J/K)
    densh = 7900.0e0  # Density of shielding material (kg/m2)
    fsolid = 0.9e0  # Fraction of duct shielding that is solid material

    #  Pump type;
    #    i_vacuum_pump_type = 0 for turbomolecular pump (mag. bearing) with a nominal
    #              speed of 2.0 m^3/s (1.95 for N2, 1.8 for He, 1.8 for DT)
    #    i_vacuum_pump_type = 1 for compound cryopump with nominal speed of 10 m^3/s
    #              (9.0 for N2, 5.0 for He and 25. for DT)
    pfus = pfusmw * 1.0e6  # Fusion power (W)
    ntf = int(n_tf_coils)

    #  Feed rate (gas load) of D-T into chamber (pellets + gas puffing +
    #     NBI + ...) = load from fueller + load from NBI
    #  frate (kg/s) = gasld (kg/s) + qtorus (D2/s) * 6.64e-27 (kg/D2)
    frate = gasld + qtorus * 6.64e-27

    #  Set duct shield thickness to zero for no biological shielding
    #  instead of thshldo/3.0e0
    thdsh = 0.0e0

    #  Shielding (m) between duct and TF coils is scaled from inboard shield
    #  thickness
    thcsh = thshldi / 3.0e0

    #  Multiplier to convert conductance from gas species i to nitrogen
    xmult = [1.0e0, 0.423e0, 0.378e0, 0.423e0]
    # nitrogen, D-T, helium, D-T again
    nduct = ntf * ndiv

    #  Speed of high-vacuum pumps (m^3/s)
    # nitrogen, DT, helium, DT again
    sp = (
        [1.95, 1.8, 1.8, 1.8]
        if VacuumPumpType(self.data.vacuum.i_vacuum_pump_type)
        == VacuumPumpType.TURBOMOLECULAR
        else [9.0, 25.0, 5.0, 25.0]
    )

    #  Calculate required pumping speeds
    s = []

    #  Initial pumpdown based on outgassing
    #  s(1) = net pump speed (N2) required for pumpdown to base pressure (m^3/s)
    #  area = vacuum chamber/fw area (m^2)  ;  outgassing area = 10 x area
    #  outgrat_fw = outgassing rate (effective for N2) of plasma chamber surface
    #  (Pa-m/s)
    #  pres_vv_chamber_base = base pressure (Pa)

    #  Old method: area = 4.0e0 * pi*pi * r0 * aw
    #  * sqrt(0.5e0*(1.0e0 + kappa*kappa))
    area = plasma_sarea * (aw + dsol) / aw
    ogas = self.data.vacuum.outgrat_fw * area * 10.0e0  # Outgassing rate (Pa-m^3/s)
    s.append(ogas / self.data.vacuum.pres_vv_chamber_base)

    #  Pumpdown between burns
    #  s(2) = net pump speed (DT) required for pumpdown between burns (m^3/s)
    #  temp_vv_chamber_gas_burn_end = temperature of neutral gas in chamber (K)
    #  t_plant_pulse_dwell = dwell time between burns (s)

    # pressure in plasma chamber after burn (Pa)
    pend = 0.5e0 * nplasma * k * self.data.vacuum.temp_vv_chamber_gas_burn_end
    # pressure in chamber before start of burn (Pa)
    pstart = 0.01e0 * pend

    #  Chamber volume (m^3)
    #  Old method: volume = 2.0e0 * pi*pi * r0 * aw*aw * kappa
    volume = plasma_vol * (aw + dsol) * (aw + dsol) / (aw * aw)

    #  dwell pumping options
    if (self.data.vacuum.i_vac_pump_dwell == 1) or (t_plant_pulse_dwell == 0):
        tpump = self.data.times.t_plant_pulse_coil_precharge
    elif self.data.vacuum.i_vac_pump_dwell == 2:
        tpump = t_plant_pulse_dwell + self.data.times.t_plant_pulse_coil_precharge
    else:
        tpump = t_plant_pulse_dwell

    s.append(volume / tpump * math.log(pend / pstart))

    #  Helium ash removal
    #  s(3) = net pump speed (He) required for helium ash removal (m^3/s)
    #  source = alpha production rate (pa - m^3/s)
    #  fhe = fraction of neutral gas in divertor chamber that is helium
    #  pres_div_chamber_burn = pressure in divertor chamber during burn (Pa)
    source = pfus * 1.47e-09
    fhe = source / (frate * 4.985e5)
    s.extend(
        (
            (source / self.data.vacuum.pres_div_chamber_burn / fhe),
            #  Removal of dt on steady state basis
            #  s(4) = net speed (D-T) required to remove dt at fuelling rate (m^3/s)
            (
                (frate * 4.985e5 - source)
                / (self.data.vacuum.pres_div_chamber_burn * (1.0e0 - fhe))
            ),
        ),
    )

    #  Calculate conductance of a single duct
    imax = 1
    cmax = 0.01e0
    pumpn = 1.0e0

    l1 = thshldo + thtf  # Length of passage from divertor to ducts (m)
    l2 = thshldo + 4.0e0  # Length of ducts from divertor passage to elbow (m)
    l3 = 2.0e0  # Length of ducts from elbow to hi-vac pumps (m)
    ltot = l1 + l2 + l3

    # ceff and d require initialising too small positive values; they're not
    # always overwritten in the following loop and can cause div by 0 errors
    # otherwise
    ceff = np.full(4, 1e-6)
    d = np.full(4, 1e-6)

    for i in range(4):
        sss = nduct / (1.0e0 / sp[i] / pumpn + 1.0e0 / cmax * xmult[i] / xmult[imax])
        if sss > s[i]:
            continue
        imax = i

        ccc = 2.0e0 * s[i] / nduct
        pumpn1 = 1.0e0 / (sp[i] * (nduct / s[i] - 1.0e0 / ccc))
        pumpn2 = 1.01e0 * s[i] / (sp[i] * nduct)
        pumpn = max(pumpn, pumpn1, pumpn2)
        ceff[i] = 1.0e0 / (nduct / s[i] - 1.0e0 / (sp[i] * pumpn))

        ceff, nflag, d1max = self._newton_method_duct_diameter(
            d, i, s, xmult, l1, l2, l3, ntf, r0, aw, ritf, thcsh, ceff
        )
        cmax = ceff[i]

    pumpn *= nduct

    #  d[imax]= diameter of passage from divertor to pumping ducts (m)
    #  dout    = diameter of ducts from passage to hi-vac pumps (m)
    dout = d[imax] * 1.2e0

    #  Net pumping speeds provided by vacuum pumping system
    #  snet(1) - net pump speed (N2) provided (m^3/s)
    #  snet(2) - net pump speed (D-T) provided (m^3/s)
    #  snet(3) - net pump speed (He) provided (m^3/s)
    #  snet(4) - snet(2)
    ceff1 = ceff[imax] * nduct
    snet = [
        1 / (1 / (ceff1 * xmult[imax] / xmult[i]) + 1 / sp[i] / pumpn)
        for i in range(4)
    ]

    #  If cryopumps are used then an additional pump is required
    #  for continuous operation with regeneration.
    if (
        VacuumPumpType(self.data.vacuum.i_vacuum_pump_type)
        == VacuumPumpType.COMPOUND_CRYOPUMP
    ):
        pumpn *= 2.0e0

    #  Information for costing routine
    dlscalc = l1 * d[imax] ** 1.4e0 + (ltot - l1) * (d[imax] * 1.2e0) ** 1.4e0

    #  Mass of duct shielding
    arsh = (
        0.25e0 * math.pi * ((d[imax] * 1.2e0 + thdsh) ** 2 - (d[imax] * 1.2e0) ** 2)
    )
    mvdsh = arsh * (ltot - l1) * densh * fsolid

    dimax = d[imax]

    if output:
        self._write_to_outfile(
            ogas,
            s,
            snet,
            volume,
            pend,
            pstart,
            t_plant_pulse_dwell,
            tpump,
            fhe,
            frate,
            nflag,
            d1max,
            nduct,
            dimax,
            imax,
            l1,
            l2,
            l3,
            dout,
            pumpn,
        )

    return pumpn, nduct, dlscalc, mvdsh, dimax

VacuumVessel

Bases: Model

Class containing vacuum vessel routines

Source code in process/models/vacuum.py
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
class VacuumVessel(Model):
    """Class containing vacuum vessel routines"""

    def __init__(self):
        self.outfile = constants.NOUT

    def run(self):
        """Routine to calculate the parameters of the vacuum vessel"""
        self.data.blanket.dz_vv_half = self.calculate_vessel_half_height(
            z_tf_inside_half=self.data.build.z_tf_inside_half,
            dz_shld_vv_gap=self.data.build.dz_shld_vv_gap,
            dz_vv_lower=self.data.build.dz_vv_lower,
            n_divertors=self.data.divertor.n_divertors,
            dz_blkt_upper=self.data.build.dz_blkt_upper,
            dz_shld_upper=self.data.build.dz_shld_upper,
            z_plasma_xpoint_upper=self.data.build.z_plasma_xpoint_upper,
            dr_fw_plasma_gap_inboard=self.data.build.dr_fw_plasma_gap_inboard,
            dr_fw_plasma_gap_outboard=self.data.build.dr_fw_plasma_gap_outboard,
            dr_fw_inboard=self.data.build.dr_fw_inboard,
            dr_fw_outboard=self.data.build.dr_fw_outboard,
        )
        # D-shaped blanket and shield
        if (
            self.data.physics.itart == 1
            or self.data.fwbs.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED
        ):
            (
                self.data.blanket.vol_vv_inboard,
                self.data.blanket.vol_vv_outboard,
                self.data.fwbs.vol_vv,
            ) = self.calculate_dshaped_vessel_volumes(
                r_shld_inboard_inner=self.data.build.r_shld_inboard_inner,
                r_shld_outboard_outer=self.data.build.r_shld_outboard_outer,
                dz_vv_half=self.data.blanket.dz_vv_half,
                dr_vv_inboard=self.data.build.dr_vv_inboard,
                dr_vv_outboard=self.data.build.dr_vv_outboard,
                dz_vv_upper=self.data.build.dz_vv_upper,
                dz_vv_lower=self.data.build.dz_vv_lower,
            )
        else:
            (
                self.data.blanket.vol_vv_inboard,
                self.data.blanket.vol_vv_outboard,
                self.data.fwbs.vol_vv,
            ) = self.calculate_elliptical_vessel_volumes(
                rmajor=self.data.physics.rmajor,
                rminor=self.data.physics.rminor,
                triang=self.data.physics.triang,
                r_shld_inboard_inner=self.data.build.r_shld_inboard_inner,
                r_shld_outboard_outer=self.data.build.r_shld_outboard_outer,
                dz_vv_half=self.data.blanket.dz_vv_half,
                dr_vv_inboard=self.data.build.dr_vv_inboard,
                dr_vv_outboard=self.data.build.dr_vv_outboard,
                dz_vv_upper=self.data.build.dz_vv_upper,
                dz_vv_lower=self.data.build.dz_vv_lower,
            )

        # Apply vacuum vessel coverage factor
        # moved from dshaped_* and elliptical_* to keep coverage factor
        # changes in the same location.
        self.data.fwbs.vol_vv = self.data.fwbs.fvoldw * self.data.fwbs.vol_vv

        # Vacuum vessel mass (kg)
        self.data.fwbs.m_vv = self.data.fwbs.vol_vv * self.data.fwbs.den_steel

    @staticmethod
    def calculate_vessel_half_height(
        z_tf_inside_half: float,
        dz_shld_vv_gap: float,
        dz_vv_lower: float,
        n_divertors: int,
        dz_blkt_upper: float,
        dz_shld_upper: float,
        z_plasma_xpoint_upper: float,
        dr_fw_plasma_gap_inboard: float,
        dr_fw_plasma_gap_outboard: float,
        dr_fw_inboard: float,
        dr_fw_outboard: float,
    ) -> float:
        """Calculate vacuum vessel internal half-height (m)

        Parameters
        ----------
        z_tf_inside_half:

        dz_shld_vv_gap:

        dz_vv_lower:

        n_divertors: int :

        dz_blkt_upper:

        dz_shld_upper:

        z_plasma_xpoint_upper:

        dr_fw_plasma_gap_inboard:

        dr_fw_plasma_gap_outboard:

        dr_fw_inboard:

        dr_fw_outboard:

        """
        z_bottom = z_tf_inside_half - dz_shld_vv_gap - dz_vv_lower

        # Calculate component internal upper half-height (m)
        # If a double null machine then symmetric
        if n_divertors == 2:
            z_top = z_bottom
        else:
            z_top = z_plasma_xpoint_upper + 0.5 * (
                dr_fw_plasma_gap_inboard
                + dr_fw_plasma_gap_outboard
                + dr_fw_inboard
                + dr_fw_outboard
            )

            z_top = z_top + dz_blkt_upper + dz_shld_upper

        # Average of top and bottom (m)
        return 0.5 * (z_top + z_bottom)

    @staticmethod
    def calculate_dshaped_vessel_volumes(
        r_shld_inboard_inner: float,
        r_shld_outboard_outer: float,
        dz_vv_half: float,
        dr_vv_inboard: float,
        dr_vv_outboard: float,
        dz_vv_upper: float,
        dz_vv_lower: float,
    ) -> tuple[float, float, float]:
        """Calculate volumes of D-shaped vacuum vessel segments

        Parameters
        ----------
        r_shld_inboard_inner:

        r_shld_outboard_outer:

        dz_vv_half:

        dr_vv_inboard:

        dr_vv_outboard:

        dz_vv_upper:

        dz_vv_lower:

        """
        r_1 = r_shld_inboard_inner
        r_2 = r_shld_outboard_outer - r_1

        (
            vol_vv_inboard,
            vol_vv_outboard,
            vol_vv,
        ) = dshellvol(
            rmajor=r_1,
            rminor=r_2,
            zminor=dz_vv_half,
            drin=dr_vv_inboard,
            drout=dr_vv_outboard,
            dz=(dz_vv_upper + dz_vv_lower) / 2,
        )

        return vol_vv_inboard, vol_vv_outboard, vol_vv

    @staticmethod
    def calculate_elliptical_vessel_volumes(
        rmajor: float,
        rminor: float,
        triang: float,
        r_shld_inboard_inner: float,
        r_shld_outboard_outer: float,
        dz_vv_half: float,
        dr_vv_inboard: float,
        dr_vv_outboard: float,
        dz_vv_upper: float,
        dz_vv_lower: float,
    ) -> tuple[float, float, float]:
        """Calculate volumes of elliptical vacuum vessel segments

        Parameters
        ----------
        rmajor:

        rminor:

        triang:

        r_shld_inboard_inner:

        r_shld_outboard_outer:

        dz_vv_half:

        dr_vv_inboard:

        dr_vv_outboard:

        dz_vv_upper:

        dz_vv_lower:

        """
        # Major radius to centre of inboard and outboard ellipses (m)
        # (coincident in radius with top of plasma)
        r_1 = rmajor - rminor * triang

        # Calculate distance between r1 and outer edge of inboard ...
        # ... section (m)
        r_2 = r_1 - r_shld_inboard_inner
        r_3 = r_shld_outboard_outer - r_1

        (
            vol_vv_inboard,
            vol_vv_outboard,
            vol_vv,
        ) = eshellvol(
            r_1,
            r_2,
            r_3,
            dz_vv_half,
            dr_vv_inboard,
            dr_vv_outboard,
            (dz_vv_upper + dz_vv_lower) / 2,
        )
        return vol_vv_inboard, vol_vv_outboard, vol_vv

    def output(self):
        """Output shield areas and volumes to log."""
        po.oheadr(self.outfile, "Vacuum Vessel Areas and Volumes")

        po.ovarre(
            self.outfile,
            "Volume of inboard vacuum vessel (m^3)",
            "(vol_vv_inboard)",
            self.data.blanket.vol_vv_inboard,
            "OP ",
        )
        po.ovarre(
            self.outfile,
            "Volume of outboard vacuum vessel (m^3)",
            "(vol_vv_outboard)",
            self.data.blanket.vol_vv_outboard,
            "OP ",
        )
        po.ovarre(
            self.outfile,
            "Total volume of vacuum vessel (m^3)",
            "(vol_vv)",
            self.data.fwbs.vol_vv,
            "OP ",
        )

outfile = constants.NOUT instance-attribute

run()

Routine to calculate the parameters of the vacuum vessel

Source code in process/models/vacuum.py
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
def run(self):
    """Routine to calculate the parameters of the vacuum vessel"""
    self.data.blanket.dz_vv_half = self.calculate_vessel_half_height(
        z_tf_inside_half=self.data.build.z_tf_inside_half,
        dz_shld_vv_gap=self.data.build.dz_shld_vv_gap,
        dz_vv_lower=self.data.build.dz_vv_lower,
        n_divertors=self.data.divertor.n_divertors,
        dz_blkt_upper=self.data.build.dz_blkt_upper,
        dz_shld_upper=self.data.build.dz_shld_upper,
        z_plasma_xpoint_upper=self.data.build.z_plasma_xpoint_upper,
        dr_fw_plasma_gap_inboard=self.data.build.dr_fw_plasma_gap_inboard,
        dr_fw_plasma_gap_outboard=self.data.build.dr_fw_plasma_gap_outboard,
        dr_fw_inboard=self.data.build.dr_fw_inboard,
        dr_fw_outboard=self.data.build.dr_fw_outboard,
    )
    # D-shaped blanket and shield
    if (
        self.data.physics.itart == 1
        or self.data.fwbs.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED
    ):
        (
            self.data.blanket.vol_vv_inboard,
            self.data.blanket.vol_vv_outboard,
            self.data.fwbs.vol_vv,
        ) = self.calculate_dshaped_vessel_volumes(
            r_shld_inboard_inner=self.data.build.r_shld_inboard_inner,
            r_shld_outboard_outer=self.data.build.r_shld_outboard_outer,
            dz_vv_half=self.data.blanket.dz_vv_half,
            dr_vv_inboard=self.data.build.dr_vv_inboard,
            dr_vv_outboard=self.data.build.dr_vv_outboard,
            dz_vv_upper=self.data.build.dz_vv_upper,
            dz_vv_lower=self.data.build.dz_vv_lower,
        )
    else:
        (
            self.data.blanket.vol_vv_inboard,
            self.data.blanket.vol_vv_outboard,
            self.data.fwbs.vol_vv,
        ) = self.calculate_elliptical_vessel_volumes(
            rmajor=self.data.physics.rmajor,
            rminor=self.data.physics.rminor,
            triang=self.data.physics.triang,
            r_shld_inboard_inner=self.data.build.r_shld_inboard_inner,
            r_shld_outboard_outer=self.data.build.r_shld_outboard_outer,
            dz_vv_half=self.data.blanket.dz_vv_half,
            dr_vv_inboard=self.data.build.dr_vv_inboard,
            dr_vv_outboard=self.data.build.dr_vv_outboard,
            dz_vv_upper=self.data.build.dz_vv_upper,
            dz_vv_lower=self.data.build.dz_vv_lower,
        )

    # Apply vacuum vessel coverage factor
    # moved from dshaped_* and elliptical_* to keep coverage factor
    # changes in the same location.
    self.data.fwbs.vol_vv = self.data.fwbs.fvoldw * self.data.fwbs.vol_vv

    # Vacuum vessel mass (kg)
    self.data.fwbs.m_vv = self.data.fwbs.vol_vv * self.data.fwbs.den_steel

calculate_vessel_half_height(z_tf_inside_half, dz_shld_vv_gap, dz_vv_lower, n_divertors, dz_blkt_upper, dz_shld_upper, z_plasma_xpoint_upper, dr_fw_plasma_gap_inboard, dr_fw_plasma_gap_outboard, dr_fw_inboard, dr_fw_outboard) staticmethod

Calculate vacuum vessel internal half-height (m)

Parameters:

Name Type Description Default
z_tf_inside_half float
required
dz_shld_vv_gap float
required
dz_vv_lower float
required
n_divertors int
required
dz_blkt_upper float
required
dz_shld_upper float
required
z_plasma_xpoint_upper float
required
dr_fw_plasma_gap_inboard float
required
dr_fw_plasma_gap_outboard float
required
dr_fw_inboard float
required
dr_fw_outboard float
required
Source code in process/models/vacuum.py
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
@staticmethod
def calculate_vessel_half_height(
    z_tf_inside_half: float,
    dz_shld_vv_gap: float,
    dz_vv_lower: float,
    n_divertors: int,
    dz_blkt_upper: float,
    dz_shld_upper: float,
    z_plasma_xpoint_upper: float,
    dr_fw_plasma_gap_inboard: float,
    dr_fw_plasma_gap_outboard: float,
    dr_fw_inboard: float,
    dr_fw_outboard: float,
) -> float:
    """Calculate vacuum vessel internal half-height (m)

    Parameters
    ----------
    z_tf_inside_half:

    dz_shld_vv_gap:

    dz_vv_lower:

    n_divertors: int :

    dz_blkt_upper:

    dz_shld_upper:

    z_plasma_xpoint_upper:

    dr_fw_plasma_gap_inboard:

    dr_fw_plasma_gap_outboard:

    dr_fw_inboard:

    dr_fw_outboard:

    """
    z_bottom = z_tf_inside_half - dz_shld_vv_gap - dz_vv_lower

    # Calculate component internal upper half-height (m)
    # If a double null machine then symmetric
    if n_divertors == 2:
        z_top = z_bottom
    else:
        z_top = z_plasma_xpoint_upper + 0.5 * (
            dr_fw_plasma_gap_inboard
            + dr_fw_plasma_gap_outboard
            + dr_fw_inboard
            + dr_fw_outboard
        )

        z_top = z_top + dz_blkt_upper + dz_shld_upper

    # Average of top and bottom (m)
    return 0.5 * (z_top + z_bottom)

calculate_dshaped_vessel_volumes(r_shld_inboard_inner, r_shld_outboard_outer, dz_vv_half, dr_vv_inboard, dr_vv_outboard, dz_vv_upper, dz_vv_lower) staticmethod

Calculate volumes of D-shaped vacuum vessel segments

Parameters:

Name Type Description Default
r_shld_inboard_inner float
required
r_shld_outboard_outer float
required
dz_vv_half float
required
dr_vv_inboard float
required
dr_vv_outboard float
required
dz_vv_upper float
required
dz_vv_lower float
required
Source code in process/models/vacuum.py
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
@staticmethod
def calculate_dshaped_vessel_volumes(
    r_shld_inboard_inner: float,
    r_shld_outboard_outer: float,
    dz_vv_half: float,
    dr_vv_inboard: float,
    dr_vv_outboard: float,
    dz_vv_upper: float,
    dz_vv_lower: float,
) -> tuple[float, float, float]:
    """Calculate volumes of D-shaped vacuum vessel segments

    Parameters
    ----------
    r_shld_inboard_inner:

    r_shld_outboard_outer:

    dz_vv_half:

    dr_vv_inboard:

    dr_vv_outboard:

    dz_vv_upper:

    dz_vv_lower:

    """
    r_1 = r_shld_inboard_inner
    r_2 = r_shld_outboard_outer - r_1

    (
        vol_vv_inboard,
        vol_vv_outboard,
        vol_vv,
    ) = dshellvol(
        rmajor=r_1,
        rminor=r_2,
        zminor=dz_vv_half,
        drin=dr_vv_inboard,
        drout=dr_vv_outboard,
        dz=(dz_vv_upper + dz_vv_lower) / 2,
    )

    return vol_vv_inboard, vol_vv_outboard, vol_vv

calculate_elliptical_vessel_volumes(rmajor, rminor, triang, r_shld_inboard_inner, r_shld_outboard_outer, dz_vv_half, dr_vv_inboard, dr_vv_outboard, dz_vv_upper, dz_vv_lower) staticmethod

Calculate volumes of elliptical vacuum vessel segments

Parameters:

Name Type Description Default
rmajor float
required
rminor float
required
triang float
required
r_shld_inboard_inner float
required
r_shld_outboard_outer float
required
dz_vv_half float
required
dr_vv_inboard float
required
dr_vv_outboard float
required
dz_vv_upper float
required
dz_vv_lower float
required
Source code in process/models/vacuum.py
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
@staticmethod
def calculate_elliptical_vessel_volumes(
    rmajor: float,
    rminor: float,
    triang: float,
    r_shld_inboard_inner: float,
    r_shld_outboard_outer: float,
    dz_vv_half: float,
    dr_vv_inboard: float,
    dr_vv_outboard: float,
    dz_vv_upper: float,
    dz_vv_lower: float,
) -> tuple[float, float, float]:
    """Calculate volumes of elliptical vacuum vessel segments

    Parameters
    ----------
    rmajor:

    rminor:

    triang:

    r_shld_inboard_inner:

    r_shld_outboard_outer:

    dz_vv_half:

    dr_vv_inboard:

    dr_vv_outboard:

    dz_vv_upper:

    dz_vv_lower:

    """
    # Major radius to centre of inboard and outboard ellipses (m)
    # (coincident in radius with top of plasma)
    r_1 = rmajor - rminor * triang

    # Calculate distance between r1 and outer edge of inboard ...
    # ... section (m)
    r_2 = r_1 - r_shld_inboard_inner
    r_3 = r_shld_outboard_outer - r_1

    (
        vol_vv_inboard,
        vol_vv_outboard,
        vol_vv,
    ) = eshellvol(
        r_1,
        r_2,
        r_3,
        dz_vv_half,
        dr_vv_inboard,
        dr_vv_outboard,
        (dz_vv_upper + dz_vv_lower) / 2,
    )
    return vol_vv_inboard, vol_vv_outboard, vol_vv

output()

Output shield areas and volumes to log.

Source code in process/models/vacuum.py
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
def output(self):
    """Output shield areas and volumes to log."""
    po.oheadr(self.outfile, "Vacuum Vessel Areas and Volumes")

    po.ovarre(
        self.outfile,
        "Volume of inboard vacuum vessel (m^3)",
        "(vol_vv_inboard)",
        self.data.blanket.vol_vv_inboard,
        "OP ",
    )
    po.ovarre(
        self.outfile,
        "Volume of outboard vacuum vessel (m^3)",
        "(vol_vv_outboard)",
        self.data.blanket.vol_vv_outboard,
        "OP ",
    )
    po.ovarre(
        self.outfile,
        "Total volume of vacuum vessel (m^3)",
        "(vol_vv)",
        self.data.fwbs.vol_vv,
        "OP ",
    )