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

44 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2025-10-25 01:35 +0000

1from pydantic import BaseModel, Field, ConfigDict 

2from typing import Dict, List, Optional, Union 

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[float] = Field( 

16 None, 

17 description="Boundary layer thickness in meters", 

18 examples=1e-6, 

19 ) # Thickness of the boundary 

20 BoundaryMaterial: Optional[str] = Field( 

21 None, 

22 description="Material of the boundary", 

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

24 ) 

25 Layer: Optional[int] = Field( 

26 None, 

27 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.", 

28 ) 

29 LayerIndex: Optional[int] = Field( 

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

31 ) 

32 

33# ========== GEOMETRY YAML CLASSES ========== # 

34class Material(BaseModel): 

35 Type: Optional[str] = Field( 

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

37 ) 

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

39 T_ref_RRR_high: Optional[float] = Field( 

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

41 ) 

42 T_ref_RRR_low: Optional[float] = Field( 

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

44 ) 

45 

46 Resistivity: Optional[float] = Field(None, description="Resistivity of the material") 

47 model_config = ConfigDict(frozen=True) 

48 

49 

50class Point(BaseModel): 

51 Coordinates: List[float] = [] 

52 

53 

54class Curve(BaseModel): 

55 Type: str 

56 Points: List[int] = [] 

57 

58 Contact: Optional[str] = Field( 

59 None, 

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

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

62 ) 

63 Thickness: Optional[float] = Field( 

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

65 ) 

66 Material: Optional[str] = Field( 

67 None, 

68 description="Material of the contact layer", 

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

70 ) 

71 

72 

73class GeometryParameters(BaseModel): 

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

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

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

77 

78class DataDiffusionBarriers(BaseModel): 

79 FilamentResistances: List[float] = [] 

80 DiffusionBarrierAreas: List[float] = [] 

81 

82class DataGlobalDiffusionBarrier(BaseModel): 

83 RegionTag: Optional[int] = Field(None) 

84 InternalRegionTag: Optional[int] = Field(None) 

85 ContactResistivity: Optional[float] = Field(None) 

86 

87class SolutionParameters(BaseModel): 

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

89 DiffusionBarriers: DataDiffusionBarriers = DataDiffusionBarriers() 

90 Surfaces_excluded_from_TI: List[int] = [] 

91 GlobalDiffusionBarrier: DataGlobalDiffusionBarrier = DataGlobalDiffusionBarrier() 

92 

93class Conductor(BaseModel): 

94 Geometry: GeometryParameters = GeometryParameters() 

95 Solution: SolutionParameters = SolutionParameters() 

96 

97