forked from svalinn/parastell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExampleScript.py
153 lines (149 loc) · 4.79 KB
/
ExampleScript.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
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
import parastell
import logging
# Define plasma equilibrium VMEC file
plas_eq = 'plas_eq.nc'
# Define radial build
build = {
'phi_list': [0.0, 22.5, 45.0, 67.5, 90.0],
'theta_list': [0.0, 5.0, 90.0, 175.0, 180.0, 185.0, 270.0, 355.0, 360.0],
'wall_s': 1.2,
'radial_build': {
'first_wall': {
'thickness_matrix': [
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5]
]
},
'breeder': {
'thickness_matrix': [
[100, 100, 30, 10, 10, 10, 30, 100, 100],
[30, 30, 10, 5, 5, 5, 20, 30, 30],
[25, 25, 25, 5, 5, 5, 25, 25, 25],
[30, 30, 20, 5, 5, 5, 10, 30, 30],
[100, 100, 30, 10, 10, 10, 30, 100, 100]
]
},
'back_wall': {
'thickness_matrix': [
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5]
]
},
'shield': {
'thickness_matrix': [
[25, 25, 25, 25, 25, 25, 25, 25, 25],
[25, 25, 25, 25, 25, 25, 25, 25, 25],
[25, 25, 25, 25, 25, 25, 25, 25, 25],
[25, 25, 25, 25, 25, 25, 25, 25, 25],
[25, 25, 25, 25, 25, 25, 25, 25, 25]
]
},
'manifolds': {
'thickness_matrix': [
[50, 50, 15, 5, 5, 5, 15, 50, 50],
[20, 20, 5, 5, 5, 5, 15, 20, 20],
[15, 15, 15, 5, 5, 5, 15, 15, 15],
[20, 20, 15, 5, 5, 5, 5, 20, 20],
[50, 50, 15, 5, 5, 5, 15, 50, 50]
]
},
'gap': {
'thickness_matrix': [
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5],
[5, 5, 5, 5, 5, 5, 5, 5, 5]
],
'h5m_tag': 'Vacuum'
},
# Note that some neutron transport codes (such as OpenMC) will interpret
# materials with "vacuum" in the name as void material
'vacuum_vessel': {
'thickness_matrix': [
[15, 15, 15, 15, 15, 15, 15, 15, 15],
[15, 15, 15, 15, 15, 15, 15, 15, 15],
[15, 15, 15, 15, 15, 15, 15, 15, 15],
[15, 15, 15, 15, 15, 15, 15, 15, 15],
[15, 15, 15, 15, 15, 15, 15, 15, 15]
],
'h5m_tag': 'vac_vessel'
}
}
}
# Define number of periods in stellarator plasma
num_periods = 4
# Define number of periods to generate
gen_periods = 1
# Define number of toroidal cross-sections to make
num_phi = 60
# Define number of poloidal points to include in each toroidal cross-section
num_theta = 60
# Define magnet coil parameters
magnets = {
'file': 'coils.txt',
'cross_section': ['circle', 20],
'start': 3,
'stop': None,
'sample': 6,
'name': 'magnet_coils',
'h5m_tag': 'magnets',
'meshing': True
}
# Define source mesh parameters
source = {
'num_s': 11,
'num_theta': 81,
'num_phi': 241
}
# Define export parameters
export = {
'exclude': ['plasma'],
'graveyard': False,
'step_export': True,
'h5m_export': 'Cubit',
'plas_h5m_tag': 'Vacuum',
'sol_h5m_tag': 'Vacuum',
# Note the following export parameters are used only for Cubit H5M exports
'facet_tol': 1,
'len_tol': 5,
'norm_tol': None,
# Note the following export parameters are used only for Gmsh H5M exports
'min_mesh_size': 5.0,
'max_mesh_size': 20.0,
'volume_atol': 0.00001,
'center_atol': 0.00001,
'bounding_box_atol': 0.00001
}
# Define logger. Note that this is identical to the default logger instatiated
# by log.py. If no logger is passed to parametric_stellarator, this is the
# logger that will be used.
logger = logging.getLogger('log')
# Configure base logger message level
logger.setLevel(logging.INFO)
# Configure stream handler
s_handler = logging.StreamHandler()
# Configure file handler
f_handler = logging.FileHandler('stellarator.log')
# Define and set logging format
format = logging.Formatter(
fmt = '%(asctime)s: %(message)s',
datefmt = '%H:%M:%S'
)
s_handler.setFormatter(format)
f_handler.setFormatter(format)
# Add handlers to logger
logger.addHandler(s_handler)
logger.addHandler(f_handler)
# Create stellarator
parastell.parastell(
plas_eq, num_periods, build, gen_periods, num_phi, num_theta,
magnets = magnets, source = source,
export = export, logger = logger
)