forked from gt-frc/gt3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gt3.py
87 lines (79 loc) · 3.08 KB
/
gt3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
"""
import sys
from neutpy_prep import Neutrals
from iol import IOL
from sol import Sol
from read_infile import ReadInfile
from imp_rad import ImpRad
from core import Core
from beamdep import BeamDeposition
from dens_lim import DensityLimit
from marfe import Marfe
from radial_transport import RadialTransport
class gt3:
"""GT3 calculates various tokamak-related quantities
Methods:
allthethings
justneutrals
plotstuff
Attributes:
External Dependencies:
Triangle: Used to create the triangular mesh for neutpy. Source
code and documentation can be found at
https://www.cs.cmu.edu/~quake/triangle.html. Can be
installed from Ubuntu repositories as well.
Neutpy:
nbeams:
adpack:
"""
def __init__(self, shotlabel=None, mode=None):
sys.dont_write_bytecode = True
# Create shotlabel as an attribute of plasma class
self.shotlabel = shotlabel
self.inp = ReadInfile(self.shotlabel)
self.core = Core(self.inp)
if mode == 'coreonly':
pass
if mode == 'coreandsol':
self.sol = Sol(self.inp, self.core)
elif mode == 'thermaliol':
self.iol = IOL(self.inp, self.core)
elif mode == 'fulliol':
self.iol = IOL(self.inp, self.core)
elif mode == 'imp':
self.imp = ImpRad(core=self.core)
elif mode == 'ntrls':
self.ntrl = Neutrals(self.inp, self.core)
elif mode == 'ntrlsandiol':
self.nbi = BeamDeposition(self.inp, self.core)
self.iol = IOL(self.inp, self.core)
self.ntrl = Neutrals(self.inp, self.core)
elif mode == 'nbi':
self.nbi = BeamDeposition(self.inp, self.core)
elif mode == 'marfe_denlim':
self.nbi = BeamDeposition(self.inp, self.core)
self.ntrl = Neutrals(self.inp, self.core)
self.imp = ImpRad(core=self.core)
self.dl = DensityLimit(self.core, self.nbi)
self.mar = Marfe(core=self.core)
elif mode == 'marfe':
self.nbi = BeamDeposition(self.inp, self.core)
self.ntrl = Neutrals(self.inp, self.core)
self.imp = ImpRad(core=self.core)
self.mar = Marfe(core=self.core)
elif mode == 'allthethings':
self.nbi = BeamDeposition(self.inp, self.core)
self.iol = IOL(self.inp, self.core)
self.ntrl = Neutrals(self.inp, self.core)
self.imp = ImpRad(core=self.core)
self.dl = DensityLimit(self.inp, self.core, self.nbi, self.imp, self.ntrl)
self.mar = Marfe(self.inp, self.core, self.imp)
elif mode == 'radialtrans':
self.iol = IOL(self.inp, self.core)
self.nbi = BeamDeposition(self.inp, self.core)
self.ntrl = Neutrals(self.inp, self.core)
# self.imp = ImpRad(z=None, core=self.core)
self.rtrans = RadialTransport(self.inp, self.core, self.iol, self.nbi)