Coverage for steam_pysigma\data\DataPySIGMA.py: 100%

181 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-12-16 17:09 +0100

1# STEAM PySigma is a python wrapper of STEAM-SIGMA written in Java. 

2# Copyright (C) 2023, CERN, Switzerland. All rights reserved. 

3# 

4# This program is free software: you can redistribute it and/or modify 

5# it under the terms of the GNU General Public License as published by 

6# the Free Software Foundation, version 3 of the License. 

7# 

8# This program is distributed in the hope that it will be useful, 

9# but WITHOUT ANY WARRANTY; without even the implied warranty of 

10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

11# GNU General Public License for more details. 

12# 

13# You should have received a copy of the GNU General Public License 

14# along with this program. If not, see <https://www.gnu.org/licenses/>. 

15 

16from typing import Dict, List, Union, Literal, Optional 

17 

18from pydantic import BaseModel 

19 

20from steam_pysigma.data.DataRoxieParser import RoxieData 

21 

22 

23class MultipoleMono(BaseModel): 

24 """ 

25 Rutherford cable type 

26 """ 

27 type: Literal['Mono'] 

28 bare_cable_width: Optional[float] = None 

29 bare_cable_height_mean: Optional[float] = None 

30 th_insulation_along_height: Optional[float] = None 

31 th_insulation_along_width: Optional[float] = None 

32 Rc: Optional[float] = None 

33 Ra: Optional[float] = None 

34 bare_cable_height_low: Optional[float] = None 

35 bare_cable_height_high: Optional[float] = None 

36 n_strands: Optional[int] = None 

37 n_strands_per_layers: Optional[int] = None 

38 n_strand_layers: Optional[int] = None 

39 strand_twist_pitch: Optional[float] = None 

40 width_core: Optional[float] = None 

41 height_core: Optional[float] = None 

42 strand_twist_pitch_angle: Optional[float] = None 

43 f_inner_voids: Optional[float] = None 

44 f_outer_voids: Optional[float] = None 

45 

46 

47class MultipoleRibbon(BaseModel): 

48 """ 

49 Rutherford cable type 

50 """ 

51 type: Literal['Ribbon'] 

52 bare_cable_width: Optional[float] = None 

53 bare_cable_height_mean: Optional[float] = None 

54 th_insulation_along_height: Optional[float] = None 

55 th_insulation_along_width: Optional[float] = None 

56 Rc: Optional[float] = None 

57 Ra: Optional[float] = None 

58 bare_cable_height_low: Optional[float] = None 

59 bare_cable_height_high: Optional[float] = None 

60 n_strands: Optional[int] = None 

61 n_strands_per_layers: Optional[int] = None 

62 n_strand_layers: Optional[int] = None 

63 strand_twist_pitch: Optional[float] = None 

64 width_core: Optional[float] = None 

65 height_core: Optional[float] = None 

66 strand_twist_pitch_angle: Optional[float] = None 

67 f_inner_voids: Optional[float] = None 

68 f_outer_voids: Optional[float] = None 

69 

70 

71class MultipoleRutherford(BaseModel): 

72 """ 

73 Rutherford cable type 

74 """ 

75 type: Literal['Rutherford'] 

76 bare_cable_width: Optional[float] = None 

77 bare_cable_height_mean: Optional[float] = None 

78 th_insulation_along_height: Optional[float] = None 

79 th_insulation_along_width: Optional[float] = None 

80 Rc: Optional[float] = None 

81 Ra: Optional[float] = None 

82 bare_cable_height_low: Optional[float] = None 

83 bare_cable_height_high: Optional[float] = None 

84 n_strands: Optional[int] = None 

85 n_strands_per_layers: Optional[int] = None 

86 n_strand_layers: Optional[int] = None 

87 strand_twist_pitch: Optional[float] = None 

88 width_core: Optional[float] = None 

89 height_core: Optional[float] = None 

90 strand_twist_pitch_angle: Optional[float] = None 

91 f_inner_voids: Optional[float] = None 

92 f_outer_voids: Optional[float] = None 

93 

94 

95class MultipoleRoxieGeometry(BaseModel): 

96 """ 

97 Class for FiQuS multipole Roxie data (.geom) 

98 """ 

99 Roxie_Data: RoxieData = RoxieData() 

100 

101 

102class Jc_FitSIGMA(BaseModel): 

103 type: Optional[str] = None 

104 C1_CUDI1: Optional[float] = None 

105 C2_CUDI1: Optional[float] = None 

106 

107 

108class StrandSIGMA(BaseModel): 

109 filament_diameter: Optional[float] = None 

110 diameter: Optional[float] = None 

111 f_Rho_effective: Optional[float] = None 

112 fil_twist_pitch: Optional[float] = None 

113 RRR: Optional[float] = None 

114 T_ref_RRR_high: Optional[float] = None 

115 Cu_noCu_in_strand: Optional[float] = None 

116 

117 

118class MultipoleGeneralSetting(BaseModel): 

119 """ 

120 Class for general information on the case study 

121 """ 

122 I_ref: Optional[List[float]] = None 

123 

124 

125class MultipoleConductor(BaseModel): 

126 """ 

127 Class for conductor type 

128 """ 

129 cable: Union[MultipoleRutherford, MultipoleRibbon, MultipoleMono] = {'type': 'Rutherford'} 

130 strand: StrandSIGMA = StrandSIGMA() 

131 Jc_fit: Jc_FitSIGMA = Jc_FitSIGMA() 

132 

133 

134class MultipoleModelDataSetting(BaseModel): 

135 """ 

136 Class for model data 

137 """ 

138 general_parameters: MultipoleGeneralSetting = MultipoleGeneralSetting() 

139 conductors: Dict[str, MultipoleConductor] = {} 

140 

141 

142class MultipoleSettings(BaseModel): 

143 """ 

144 Class for FiQuS multipole settings (.set) 

145 """ 

146 Model_Data_GS: MultipoleModelDataSetting = MultipoleModelDataSetting() 

147 

148 

149class SourcesClass(BaseModel): 

150 bh_curve_source: Optional[str] = None 

151 

152 

153class GeneralParametersClass(BaseModel): 

154 magnet_name: Optional[str] = None 

155 T_initial: Optional[float] = None 

156 magnetic_length: Optional[float] = None 

157 

158 

159class PowerSupply(BaseModel): 

160 I_initial: Optional[float] = None 

161 

162 

163class SIGMAGeometry(BaseModel): 

164 """ 

165 Class for Roxie data 

166 """ 

167 Roxie_Data: RoxieData = RoxieData() 

168 

169 

170class QuenchHeaters(BaseModel): 

171 N_strips: Optional[int] = None 

172 t_trigger: Optional[List[float]] = None 

173 U0: Optional[List[float]] = None 

174 C: Optional[List[float]] = None 

175 R_warm: Optional[List[float]] = None 

176 w: Optional[List[float]] = None 

177 h: Optional[List[float]] = None 

178 s_ins: Optional[List[float]] = None 

179 type_ins: Optional[List[float]] = None 

180 s_ins_He: Optional[List[float]] = None 

181 type_ins_He: Optional[List[float]] = None 

182 l: Optional[List[float]] = None 

183 l_copper: Optional[List[float]] = None 

184 l_stainless_steel: Optional[List[float]] = None 

185 f_cover: Optional[List[float]] = None 

186 

187 

188class Cliq(BaseModel): 

189 t_trigger: Optional[float] = None 

190 sym_factor: Optional[int] = None 

191 U0: Optional[float] = None 

192 I0: Optional[float] = None 

193 C: Optional[float] = None 

194 R: Optional[float] = None 

195 L: Optional[float] = None 

196 

197 

198class CircuitClass(BaseModel): 

199 R_circuit: Optional[float] = None 

200 L_circuit: Optional[float] = None 

201 R_parallel: Optional[float] = None 

202 

203 

204class QuenchProtection(BaseModel): 

205 Quench_Heaters: QuenchHeaters = QuenchHeaters() 

206 CLIQ: Cliq = Cliq() 

207 

208 

209class TimeVectorSolutionSIGMA(BaseModel): 

210 time_step: List[List[float]] = None 

211 

212 

213class Simulation(BaseModel): 

214 generate_study: Optional[bool] = None 

215 study_type: Optional[str] = None 

216 make_batch_mode_executable: bool = None 

217 nbr_elements_mesh_width: Optional[int] = None 

218 nbr_elements_mesh_height: Optional[int] = None 

219 

220 

221class Physics(BaseModel): 

222 FLAG_M_pers: Optional[int] = None 

223 FLAG_ifcc: Optional[int] = None 

224 FLAG_iscc_crossover: Optional[int] = None 

225 FLAG_iscc_adjw: Optional[int] = None 

226 FLAG_iscc_adjn: Optional[int] = None 

227 tauCC_PE: Optional[int] = None 

228 

229 

230class QuenchInitialization(BaseModel): 

231 PARAM_time_quench: Optional[float] = None 

232 FLAG_quench_all: Optional[int] = None 

233 FLAG_quench_off: Optional[int] = None 

234 num_qh_div: Optional[List[int]] = None 

235 th_coils: Optional[List[float]] = None 

236 quench_init_heat: Optional[float] = None 

237 quench_init_HT: Optional[List[str]] = None 

238 quench_stop_temp: Optional[float] = None 

239 

240 

241class Out2DAtPoints(BaseModel): 

242 coordinate_source: Optional[str] = None 

243 variables: Optional[List[str]] = None 

244 time: Optional[List[List[float]]] = None 

245 map2d: Optional[str] = None 

246 

247 

248class Out1DVsTimes(BaseModel): 

249 variables: Optional[List[str]] = None 

250 time: Optional[List[List[float]]] = None 

251 

252 

253class Out1DVsAllTimes(BaseModel): 

254 variables: Optional[List[str]] = None 

255 

256 

257class Postprocessing(BaseModel): 

258 out_2D_at_points: Out2DAtPoints = Out2DAtPoints() 

259 out_1D_vs_times: Out1DVsTimes = Out1DVsTimes() 

260 out_1D_vs_all_times: Out1DVsAllTimes = Out1DVsAllTimes() 

261 

262 

263class QuenchHeatersSIGMA(BaseModel): 

264 quench_heater_positions: Optional[List[List[int]]] = None 

265 th_coils: Optional[List[float]] = None 

266 

267 

268class SIGMA(BaseModel): 

269 time_vector_solution: TimeVectorSolutionSIGMA = TimeVectorSolutionSIGMA() 

270 simulation: Simulation = Simulation() 

271 physics: Physics = Physics() 

272 quench_initialization: QuenchInitialization = QuenchInitialization() 

273 postprocessing: Postprocessing = Postprocessing() 

274 quench_heaters: QuenchHeatersSIGMA = QuenchHeatersSIGMA() 

275 

276 

277class DataPySIGMA(BaseModel): 

278 Sources: SourcesClass = SourcesClass() 

279 GeneralParameters: GeneralParametersClass = GeneralParametersClass() 

280 Power_Supply: PowerSupply = PowerSupply() 

281 Quench_Protection: QuenchProtection = QuenchProtection() 

282 Options_SIGMA: SIGMA = SIGMA() 

283 Circuit: CircuitClass = CircuitClass()