Coverage for fiqus/data/DataConductor.py: 100%

159 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-12-27 02:39 +0100

1from pydantic import BaseModel, Field 

2from typing import Union, Literal, Optional 

3 

4# ------------------- Jc fits ---------------------------# 

5class ConstantJc(BaseModel): 

6 """ 

7 Level 3: Class for setting constant Jc 

8 """ 

9 

10 type: Literal["Constant Jc"] 

11 Jc_constant: Optional[float] = None # [A/m^2] 

12 

13 

14class Ic_A_NbTi(BaseModel): 

15 """ 

16 Level 3: Class for setting IcNbTi fit 

17 """ 

18 

19 type: Literal["Ic_A_NbTi"] 

20 Jc_5T_4_2K: Optional[float] = None # [A/m^2] 

21 

22 

23class Bottura(BaseModel): 

24 """ 

25 Level 3: Class for setting Bottura fit 

26 """ 

27 

28 type: Literal["Bottura"] 

29 Tc0_Bottura: Optional[float] = None # [K] 

30 Bc20_Bottura: Optional[float] = None # [T] 

31 Jc_ref_Bottura: Optional[float] = None # [A/m^2] 

32 C0_Bottura: Optional[float] = None # [-] 

33 alpha_Bottura: Optional[float] = None # [-] 

34 beta_Bottura: Optional[float] = None # [-] 

35 gamma_Bottura: Optional[float] = None # [-] 

36 

37 

38class CUDI1(BaseModel): 

39 """ 

40 Level 3: Class for Nb-Ti fit based on "Fit 1" in CUDI manual 

41 """ 

42 

43 type: Literal["CUDI1"] 

44 Tc0_CUDI1: Optional[float] = None # [K] 

45 Bc20_CUDI1: Optional[float] = None # [T] 

46 C1_CUDI1: Optional[float] = None # [A] 

47 C2_CUDI1: Optional[float] = None # [A/T] 

48 

49 

50class CUDI3(BaseModel): 

51 """ 

52 Level 3: Class for Nb-Ti fit based on "Fit 3" in CUDI manual 

53 """ 

54 

55 type: Literal["CUDI3"] 

56 Tc0_CUDI3: Optional[float] = None # [K] 

57 Bc20_CUDI3: Optional[float] = None # [T] 

58 c1_CUDI3: Optional[float] = None # [-] 

59 c2_CUDI3: Optional[float] = None # [-] 

60 c3_CUDI3: Optional[float] = None # [-] 

61 c4_CUDI3: Optional[float] = None # [-] 

62 c5_CUDI3: Optional[float] = None # [-] 

63 c6_CUDI3: Optional[float] = None # [-] 

64 

65 

66class Summers(BaseModel): 

67 """ 

68 Level 3: Class for cable Summer's Nb3Sn fit 

69 """ 

70 

71 type: Literal["Summers"] 

72 Tc0_Summers: Optional[float] = None # [K] 

73 Bc20_Summers: Optional[float] = None # [T] 

74 Jc0_Summers: Optional[float] = None # [A*T^0.5/m^2] 

75 

76 

77class Bordini(BaseModel): 

78 """ 

79 Level 3: Class for cable Bordini's Nb3Sn fit 

80 """ 

81 

82 type: Literal["Bordini"] 

83 Tc0_Bordini: Optional[float] = None # [K] 

84 Bc20_Bordini: Optional[float] = None # [T] 

85 C0_Bordini: Optional[float] = None # [A*T/m^2] 

86 alpha_Bordini: Optional[float] = None # [-] 

87 

88 

89class BSCCO_2212_LBNL(BaseModel): 

90 """ 

91 Level 3: Class for cable Bi-2212 fit developed in LBNL 

92 """ 

93 

94 # only ad-hoc fit [T. Shen, D. Davis, E. Ravaioli with LBNL, Berkeley, CA] 

95 type: Literal["BSCCO_2212_LBNL"] 

96 f_scaling_Jc_BSCCO2212: Optional[float] = None # [-] used for the ad-hoc fit 

97 

98 

99# ------------------- Cable types ---------------------------# 

100class Mono(BaseModel): 

101 """ 

102 Mono cable type: This is basically type of cable consisting of one strand - not really a cable 

103 """ 

104 

105 type: Literal["Mono"] 

106 bare_cable_width: Optional[float] = None 

107 bare_cable_height_low: Optional[float] = None 

108 bare_cable_height_high: Optional[float] = None 

109 bare_cable_height_mean: Optional[float] = None 

110 th_insulation_along_width: Optional[float] = None 

111 th_insulation_along_height: Optional[float] = None 

112 # Fractions given with respect to the insulated conductor 

113 f_superconductor: Optional[float] = None 

114 f_stabilizer: Optional[float] = None # (related to CuFraction in ProteCCT) 

115 f_insulation: Optional[float] = None 

116 f_inner_voids: Optional[float] = None 

117 f_outer_voids: Optional[float] = None 

118 # Available materials depend on the component and on the selected program 

119 material_insulation: Optional[str] = None 

120 material_inner_voids: Optional[str] = None 

121 material_outer_voids: Optional[str] = None 

122 

123 

124class Rutherford(BaseModel): 

125 """ 

126 Rutherford cable type: for example LHC MB magnet cable 

127 """ 

128 

129 type: Literal["Rutherford"] 

130 n_strands: Optional[int] = None 

131 n_strand_layers: Optional[int] = None 

132 n_strands_per_layers: Optional[int] = None 

133 bare_cable_width: Optional[float] = None 

134 bare_cable_height_low: Optional[float] = None 

135 bare_cable_height_high: Optional[float] = None 

136 bare_cable_height_mean: Optional[float] = None 

137 th_insulation_along_width: Optional[float] = None 

138 th_insulation_along_height: Optional[float] = None 

139 width_core: Optional[float] = None 

140 height_core: Optional[float] = None 

141 strand_twist_pitch: Optional[float] = None 

142 strand_twist_pitch_angle: Optional[float] = None 

143 Rc: Optional[float] = None 

144 Ra: Optional[float] = None 

145 # Fractions given with respect to the insulated conductor 

146 f_superconductor: Optional[float] = None 

147 f_stabilizer: Optional[float] = None # (related to CuFraction in ProteCCT) 

148 f_insulation: Optional[float] = None 

149 f_inner_voids: Optional[float] = None 

150 f_outer_voids: Optional[float] = None 

151 f_core: Optional[float] = None 

152 # Available materials depend on the component and on the selected program 

153 material_insulation: Optional[str] = None 

154 material_inner_voids: Optional[str] = None 

155 material_outer_voids: Optional[str] = None 

156 material_core: Optional[str] = None 

157 

158 

159class Ribbon(BaseModel): 

160 """ 

161 Mono cable type: This is basically type of cable consisting of one strand - not really a cable 

162 """ 

163 

164 type: Literal["Ribbon"] 

165 n_strands: Optional[int] = ( 

166 None # This defines the number of "strands" in the ribbon cable, which are physically glued but electrically in series 

167 ) 

168 bare_cable_width: Optional[float] = None 

169 bare_cable_height_low: Optional[float] = None 

170 bare_cable_height_high: Optional[float] = None 

171 bare_cable_height_mean: Optional[float] = None 

172 th_insulation_along_width: Optional[float] = ( 

173 None # This defines the thickness of the insulation around each strand (DIFFERENT FROM ROXIE CADATA FILE) 

174 ) 

175 th_insulation_along_height: Optional[float] = ( 

176 None # This defines the thickness of the insulation around each strand (DIFFERENT FROM ROXIE CADATA FILE) 

177 ) 

178 # Fractions given with respect to the insulated conductor 

179 f_superconductor: Optional[float] = None 

180 f_stabilizer: Optional[float] = None # (related to CuFraction in ProteCCT) 

181 f_insulation: Optional[float] = None 

182 f_inner_voids: Optional[float] = None 

183 f_outer_voids: Optional[float] = None 

184 f_core: Optional[float] = None 

185 # Available materials depend on the component and on the selected program 

186 material_insulation: Optional[str] = None 

187 material_inner_voids: Optional[str] = None 

188 material_outer_voids: Optional[str] = None 

189 material_core: Optional[str] = None 

190 

191 

192# ------------------- Conductors ---------------------------# 

193 

194# class MaterialSuperconductor(BaseModel): 

195# """ 

196# Level 3: Class for strand superconductor material parameters 

197# """ 

198# material: Optional[str] = Field(default=None, description="Material of the superconductor. E.g. NbTi, Nb3Sn, etc.") 

199# n_value: Optional[float] = Field(default=None, description="n value of the superconductor (for power law fit).") 

200# ec: Optional[float] = Field(default=None, description="Critical electric field of the superconductor.") 

201# Cv_material: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the superconductor.") 

202 

203# class MaterialStabilizer(BaseModel): 

204# """ 

205# Level 3: Class for strand stabilizer material parameters 

206# """ 

207 

208# rho_material: Optional[Union[str, float]] = Field(default=None, description="Material function for resistivity of the stabilizer. Constant resistivity can be given as float.") 

209# RRR: Optional[float] = Field(default=None, description="Residual resistivity ratio of the stabilizer.") 

210# T_ref_RRR_high: Optional[float] = Field(default=None, description="Upper reference temperature for RRR measurements.") 

211# T_ref_RRR_low: Optional[float] = Field(default=None, description="Lower reference temperature for RRR measurements.") 

212# k_material: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the stabilizer.") 

213# Cv_material: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the stabilizer.") 

214 

215 

216class Round(BaseModel): 

217 """ 

218 Level 2: Class for strand parameters 

219 """ 

220 

221 type: Literal["Round"] 

222 fil_twist_pitch: Optional[float] = None # Strand twist pitch 

223 diameter: Optional[float] = None # ds_inGroup (LEDET), DConductor (BBQ), DStrand (ProteCCT) 

224 diameter_core: Optional[float] = None # dcore_inGroup (LEDET) 

225 diameter_filamentary: Optional[float] = None # dfilamentary_inGroup (LEDET) 

226 filament_diameter: Optional[float] = None # df_inGroup (LEDET) 

227 number_of_filaments: Optional[int] = None # nf_inGroup (LEDET) 

228 f_Rho_effective: Optional[float] = None 

229 Cu_noCu_in_strand: Optional[float] = None 

230 

231 # -- Superconductor parameters -- # 

232 material_superconductor: Optional[str] = Field(default=None, description="Material of the superconductor. E.g. Nb-Ti, Nb3Sn, etc.") 

233 n_value_superconductor: Optional[float] = Field(default=None, description="n value of the superconductor (for power law fit).") 

234 ec_superconductor: Optional[float] = Field(default=None, description="Critical electric field of the superconductor.") 

235 k_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the superconductor.") 

236 Cv_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the superconductor.") 

237 # -- Stabilizer parameters -- # 

238 material_stabilizer: Optional[str] = Field(default=None, description="Material of the stabilizer.") 

239 rho_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for resistivity of the stabilizer. Constant resistivity can be given as float.") 

240 RRR: Optional[float] = Field(default=None, description="Residual resistivity ratio of the stabilizer.") 

241 T_ref_RRR_high: Optional[float] = Field(default=None, description="Upper reference temperature for RRR measurements.") 

242 T_ref_RRR_low: Optional[float] = Field(default=None, description="Lower reference temperature for RRR measurements.") 

243 k_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the stabilizer.") 

244 Cv_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the stabilizer.") 

245 

246 # superconductor: MaterialSuperconductor = MaterialSuperconductor() 

247 # stabilizer: MaterialStabilizer = MaterialStabilizer() 

248 

249 

250class Rectangular(BaseModel): 

251 """ 

252 Level 2: Class for strand parameters 

253 """ 

254 

255 type: Literal["Rectangular"] 

256 bare_width: Optional[float] = None 

257 bare_height: Optional[float] = None 

258 Cu_noCu_in_strand: Optional[float] = None 

259 filament_diameter: Optional[float] = None # df_inGroup (LEDET) 

260 f_Rho_effective: Optional[float] = None 

261 fil_twist_pitch: Optional[float] = None 

262 bare_corner_radius: Optional[float] = None 

263 

264 # -- Superconductor parameters -- # 

265 material_superconductor: Optional[str] = Field(default=None, description="Material of the superconductor. E.g. NbTi, Nb3Sn, etc.") 

266 n_value_superconductor: Optional[float] = Field(default=None, description="n value of the superconductor (for power law fit).") 

267 ec_superconductor: Optional[float] = Field(default=None, description="Critical electric field of the superconductor.") 

268 k_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the superconductor.") 

269 Cv_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the superconductor.") 

270 # -- Stabilizer parameters -- # 

271 material_stabilizer: Optional[str] = Field(default=None, description="Material of the stabilizer.") 

272 rho_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for resistivity of the stabilizer. Constant resistivity can be given as float.") 

273 RRR: Optional[float] = Field(default=None, description="Residual resistivity ratio of the stabilizer.") 

274 T_ref_RRR_high: Optional[float] = Field(default=None, description="Upper reference temperature for RRR measurements.") 

275 T_ref_RRR_low: Optional[float] = Field(default=None, description="Lower reference temperature for RRR measurements.") 

276 k_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the stabilizer.") 

277 Cv_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the stabilizer.") 

278 

279 # superconductor: MaterialSuperconductor = MaterialSuperconductor() 

280 # stabilizer: MaterialStabilizer = MaterialStabilizer() 

281 

282 

283 

284# ------------------- Conductors ---------------------------# 

285 

286 

287class Conductor(BaseModel): 

288 """ 

289 Level 1: Class for conductor parameters 

290 """ 

291 

292 version: Optional[str] = None 

293 case: Optional[str] = None 

294 state: Optional[str] = None 

295 cable: Union[Rutherford, Mono, Ribbon] = { 

296 "type": "Rutherford" 

297 } # TODO: Busbar, Rope, Roebel, CORC, TSTC, CICC 

298 strand: Union[Round, Rectangular] = {"type": "Round"} # TODO: Tape, WIC 

299 Jc_fit: Union[ConstantJc, Bottura, CUDI1, CUDI3, Summers, Bordini, BSCCO_2212_LBNL, Ic_A_NbTi] = { 

300 "type": "CUDI1" 

301 } # TODO: CUDI other numbers? , Roxie?