1616from PySolverInterface import *
1717
1818class Adapter :
19-
20- precice = None
21- numInterfaces = 0
22- interfaces = []
23- LOADS = []
24- MESH = None
25- MODEL = None
26- MAT = None
27- isNonLinear = False
28-
19+
2920 def __init__ (self , precice , participantName , config , MESH , MODEL , MAT , isNonLinear = False ):
21+ self .interfaces = []
3022 self .numInterfaces = len (config )
3123 self .precice = precice
3224 self .MESH = MESH
3325 self .MODEL = MODEL
3426 self .MAT = MAT
27+ self .LOADS = []
3528 self .isNonLinear = isNonLinear
3629 self .participantName = participantName
3730 self .configure (config )
@@ -61,68 +54,60 @@ def receiveCouplingData(self):
6154 for interface in self .interfaces :
6255 interface .readAndUpdateBCs ()
6356
57+
6458class Interface :
65-
66- precice = None
6759
68- mesh = None
69-
70- groupName = ""
71- groupName = ""
72-
73- facesMeshName = ""
74- nodesMeshName = ""
75-
76- nodes = []
77- faces = []
78- connectivity = []
79- nodeCoordinates = []
80- faceCenterCoordinates = []
81- normals = None
82-
83- isNonLinear = False
84- conductivity = None
85- isConductivityInitialized = False
86- delta = 1e-5
87-
88- preciceNodeIndices = []
89- preciceFaceCenterIndices = []
90-
91- preciceFaceCentersMeshID = 0
92- preciceNodesMeshID = 0
93-
94- readHCoeffDataID = 0
95- readTempDataID = 0
96- writeHCoeffDataID = 0
97- writeTempDataID = 0
98-
99- readTemp = []
100- readHCoeff = []
101- writeTemp = []
102- writeHCoeff = []
103-
104- readDataSize = 0
105- writeDataSize = 0
106-
107- MESH = None
108- MODEL = None
109- LOAD = None
110- LOADS = []
111-
112- # Shifted mesh (contains only the interface, and is shifted by delta in the direction opposite to the normal)
113- SHMESH = None
114-
11560 def __init__ (self , precice , participantName , names , MESH , SHMESH , MODEL , MAT , isNonLinear = False ):
61+
11662 self .precice = precice
11763 self .participantName = participantName
64+
65+ self .groupName = ""
66+ self .facesMeshName = ""
67+ self .nodesMeshName = ""
68+
69+ self .nodes = []
70+ self .faces = []
71+ self .connectivity = []
72+ self .nodeCoordinates = []
73+ self .faceCenterCoordinates = []
74+ self .normals = None
75+
76+ self .isNonLinear = isNonLinear
77+ self .conductivity = None
78+ self .isConductivityInitialized = False
79+ self .delta = 1e-5
80+
81+ self .preciceNodeIndices = []
82+ self .preciceFaceCenterIndices = []
83+
84+ self .preciceFaceCentersMeshID = 0
85+ self .preciceNodesMeshID = 0
86+
87+ self .readHCoeffDataID = 0
88+ self .readTempDataID = 0
89+ self .writeHCoeffDataID = 0
90+ self .writeTempDataID = 0
91+
92+ self .readTemp = []
93+ self .readHCoeff = []
94+ self .writeTemp = []
95+ self .writeHCoeff = []
96+
97+ self .readDataSize = 0
98+ self .writeDataSize = 0
99+
118100 self .MESH = MESH
101+ # Shifted mesh (contains only the interface, and is shifted by delta in the direction opposite to the normal)
119102 self .SHMESH = SHMESH
120103 self .MODEL = MODEL
121104 self .MAT = MAT
105+ self .LOAD = None
106+ self .LOADS = []
122107 self .mesh = MAIL_PY ()
123108 self .mesh .FromAster (MESH )
109+
124110 self .configure (names )
125- self .isNonLinear = isNonLinear
126111
127112 def configure (self , names ):
128113
@@ -153,7 +138,6 @@ def configure(self, names):
153138 self .readHCoeff = np .zeros (self .readDataSize )
154139 self .readTemp = np .zeros (self .readDataSize )
155140
156-
157141 def computeNormals (self ):
158142 # Get normals at the nodes
159143 DUMMY = AFFE_MODELE (
@@ -163,7 +147,7 @@ def computeNormals(self):
163147 'PHENOMENE' : 'THERMIQUE' ,
164148 'MODELISATION' : '3D' ,
165149 },
166- );
150+ )
167151 N = CREA_CHAMP (
168152 MODELE = DUMMY ,
169153 TYPE_CHAM = 'NOEU_GEOM_R' ,
@@ -229,8 +213,7 @@ def createBCs(self):
229213 for j in range (len (self .faces ))
230214 ]
231215 return BCs
232-
233-
216+
234217 def updateBCs (self , temp , hCoeff ):
235218
236219 self .LOAD .sdj .CHTH .T_EXT .VALE .changeJeveuxValues (len (temp ),
@@ -264,7 +247,7 @@ def getBoundaryValues(self, T):
264247 # Heat transfer coefficient
265248 self .updateConductivity (writeTemp )
266249 writeHCoeff = np .array (self .conductivity ) / self .delta
267-
250+
268251 return writeTemp , writeHCoeff
269252
270253 def setLoad (self , LOAD ):
0 commit comments