-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrift.py
57 lines (49 loc) · 1.69 KB
/
drift.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
from material import Material
from subregion import SubRegion
from sregion import SRegion
from icool_composite import ICoolComposite
from icoolobject import ICoolObject
from nofield import NoField
class CylVacDrift(ICoolComposite):
"""
Drift region.
By default will generate a vacuum drift region with cylindrical geometry.
"""
begtag = ''
endtag = ''
num_params = 10
command_params = {
'slen': {'desc': 'SRegion length',
'doc': '',
'type': 'Float',
'req': True,
'pos': None},
'zstep': {'desc': 'Z step',
'doc': '',
'type': 'Float',
'req': True,
'pos': None},
'rhigh': {'desc': 'R high',
'doc': '',
'type': 'Float',
'req': True,
'pos': None},
'outstep': {'desc': 'Output stepping (Meter)',
'doc': 'Increment for output steps for constant B Field region',
'type': 'Float',
'req': True,
'pos': None},
}
def __init__(self, **kwargs):
ICoolObject.__init__(self, kwargs)
material = Material(geom='CBLOCK', mtag='VAC')
nf = NoField()
sr = SubRegion(material=material, rlow=0, rhigh=self.rhigh, irreg=1, field=nf)
self.sreg = SRegion(zstep=self.zstep, nrreg=1, slen=self.slen)
self.sreg.add_enclosed_command(sr)
def __call__(self, **kwargs):
ICoolObject.__call__(self, kwargs)
def __str__(self):
return 'CylVacDrift'
def gen_for001(self, file):
self.sreg.gen_for001(file)