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

34 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2025-05-04 03:30 +0200

1from pydantic import BaseModel, Field, ConfigDict 

2from typing import Dict, List, Optional 

3 

4 

5class Area(BaseModel): 

6 Material: Optional[str] = Field( 

7 None, description="Material of the area", examples=["Cu", "NbTi", "Nb3Sn"] 

8 ) 

9 Boundary: List[int] = ( 

10 [] 

11 ) # List of curves that define the closed boundary of the area 

12 InnerBoundaries: List[List[int]] = ( 

13 [] 

14 ) # List of lists of curves that define the closed boundaries of the holes in the area 

15 BoundaryThickness: Optional[Optional[float]] = None # Thickness of the boundary 

16 BoundaryMaterial: Optional[str] = Field( 

17 None, 

18 description="Material of the boundary", 

19 examples=["steel", "Cu", "direct", "etc."], 

20 ) 

21 Layer: Optional[int] = Field( 

22 None, 

23 description="Filaments in the strand-model must be assigned to a layer. A layer is a collection of all filaments with the same radius from the center.", 

24 ) 

25 LayerIndex: Optional[int] = Field( 

26 None, description="Index of the filament in the layer." 

27 ) 

28 

29# ========== GEOMETRY YAML CLASSES ========== # 

30class Material(BaseModel): 

31 Type: Optional[str] = Field( 

32 None, description="Type of material", examples=["NbTi", "Nb3Sn", "Cu"] 

33 ) 

34 RRR: Optional[float] = Field(None, description="Residual resistivity ratio") 

35 T_ref_RRR_high: Optional[float] = Field( 

36 None, description="High reference temperature for RRR" 

37 ) 

38 T_ref_RRR_low: Optional[float] = Field( 

39 None, description="Low reference temperature for RRR" 

40 ) 

41 model_config = ConfigDict(frozen=True) 

42 

43 

44class Point(BaseModel): 

45 Coordinates: List[float] = [] 

46 

47 

48class Curve(BaseModel): 

49 Type: str 

50 Points: List[int] = [] 

51 

52 Contact: Optional[str] = Field( 

53 None, 

54 description="If the curve is a contact layer between two surfaces this represents the contact type of strands", 

55 examples=["crossing", "parallel"], 

56 ) 

57 Thickness: Optional[float] = Field( 

58 None, description="Thickness of the contact layer" 

59 ) 

60 Material: Optional[str] = Field( 

61 None, 

62 description="Material of the contact layer", 

63 examples=["steel", "direct", "Cu"], 

64 ) 

65 

66 

67 

68 

69class GeometryParameters(BaseModel): 

70 Points: Dict[int, Point] = {} 

71 Curves: Dict[int, Curve] = {} 

72 Areas: Dict[int, Area] = {} 

73 

74 

75class SolutionParameters(BaseModel): 

76 Materials: Dict[str, Material] = {} 

77 Surfaces_excluded_from_TI: List[int] = [] 

78 

79 

80class Conductor(BaseModel): 

81 Geometry: GeometryParameters = GeometryParameters() 

82 Solution: SolutionParameters = SolutionParameters() 

83 

84