@@ -20,6 +20,11 @@ class Motion(Enum):
20
20
DISPLACEMENT = 2
21
21
22
22
23
+ class RWMotion (Enum ):
24
+ VELOCITY = 0
25
+ DISPLACEMENT = 1
26
+
27
+
23
28
class DOF (Enum ):
24
29
X_TRANSLATIONAL = 1
25
30
Y_TRANSLATIONAL = 2
@@ -140,12 +145,27 @@ class Function:
140
145
141
146
def __init__ (self , Function = None ):
142
147
self .function = Function
148
+ self .tabulated = False
149
+
150
+ def set_tabulated (self , heading = "" , function = "" , x = [], y = []):
151
+ self .tabulated = True
152
+ self .heading = heading
153
+ self .function_name = function
154
+ self .x = x
155
+ self .y = y
143
156
144
157
def create (self , stub ):
145
158
"""Create function."""
159
+ if self .tabulated :
160
+ ret = stub .CreateDefineFunctionTabulated (
161
+ DefineFunctionTabulatedRequest (
162
+ heading = self .heading , function = self .function_name , abscissa = self .x , ordinate = self .y
163
+ )
164
+ )
146
165
ret = stub .CreateDefineFunction (DefineFunctionRequest (function = self .function ))
147
166
self .id = ret .id
148
167
logging .info (f"Function { self .id } defined..." )
168
+
149
169
return self .id
150
170
151
171
@@ -763,7 +783,7 @@ def create_general_keyword(self, opcode, keyworddata):
763
783
\$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
764
784
765
785
opcode = "INITIAL_VELOCITY"
766
- keyworddata = "0\\ n1.480E+01,0.000E+00,0.000E+00,0.000E+00,0.000E+00,0.000E+00"
786
+ keyworddata = "0\n 1.480E+01,0.000E+00,0.000E+00,0.000E+00,0.000E+00,0.000E+00"
767
787
create_general_keyword(opcode = opcode,keyworddata=keyworddata)
768
788
"""
769
789
ret = self .stub .CreateGeneralKWD (GeneralKWDRequest (opcode = opcode , keyworddata = keyworddata ))
@@ -2224,6 +2244,7 @@ def __init__(self):
2224
2244
self .spclist = []
2225
2245
self .imposedmotionlist = []
2226
2246
self .templist = []
2247
+ self .convectionlist = []
2227
2248
2228
2249
def create_spc (
2229
2250
self ,
@@ -2305,6 +2326,39 @@ def create_temperature(
2305
2326
param = [nodeset , curve , scalefactor ]
2306
2327
self .templist .append (param )
2307
2328
2329
+ def create_convection (
2330
+ self ,
2331
+ segmentset = None ,
2332
+ convection_heat_transfer_coefficient = None ,
2333
+ convection_heat_transfer_coefficient_multiplier = 0.0 ,
2334
+ environment_temperature = None ,
2335
+ environment_temperature_multiplier = 0.0 ,
2336
+ ):
2337
+ """Apply a convection boundary condition on SEGMENT_SET for a thermal analysis.
2338
+
2339
+ Parameters
2340
+ ----------
2341
+ segmentset : SegmentSet.
2342
+ Segment set.
2343
+ convection_heat_transfer_coefficient : Curve
2344
+ Convection heat transfer coefficient.
2345
+ convection_heat_transfer_coefficient_multiplier : float
2346
+ Curve multiplier for convection heat transfer coefficient.
2347
+ environment_temperature : Curve
2348
+ Environment temperature.
2349
+ environment_temperature_multiplier : float
2350
+ Curve multiplier for environment temperature.
2351
+
2352
+ """
2353
+ param = [
2354
+ segmentset ,
2355
+ convection_heat_transfer_coefficient ,
2356
+ convection_heat_transfer_coefficient_multiplier ,
2357
+ environment_temperature ,
2358
+ environment_temperature_multiplier ,
2359
+ ]
2360
+ self .convectionlist .append (param )
2361
+
2308
2362
def create (self ):
2309
2363
"""Create a boundary condition."""
2310
2364
for obj in self .imposedmotionlist :
@@ -2399,7 +2453,7 @@ def create(self):
2399
2453
nid = nodeset .create (self .stub )
2400
2454
option = "SET"
2401
2455
if curve is not None :
2402
- cid = curve .id
2456
+ cid = curve .create ( self . stub )
2403
2457
else :
2404
2458
cid = 0
2405
2459
self .stub .CreateBdyTemp (
@@ -2411,6 +2465,19 @@ def create(self):
2411
2465
)
2412
2466
)
2413
2467
logging .info ("Boundary Temperature Created..." )
2468
+ for obj in self .convectionlist :
2469
+ ss , hlc , hmult , tlc , tmult = obj [0 ], obj [1 ], obj [2 ], obj [3 ], obj [4 ]
2470
+ ssid , hlcid , tlcid = 0 , 0 , 0
2471
+ if ss is not None :
2472
+ ssid = ss .create (self .stub )
2473
+ if hlc is not None :
2474
+ hlcid = hlc .create (self .stub )
2475
+ if tlc is not None :
2476
+ tlcid = tlc .create (self .stub )
2477
+ self .stub .CreateBdyConvection (
2478
+ BdyConvectionRequest (ssid = ssid , pserod = 0 , hlcid = hlcid , hmult = hmult , tlcid = tlcid , tmult = tmult , loc = 0 )
2479
+ )
2480
+ logging .info ("Boundary Convection Created..." )
2414
2481
2415
2482
2416
2483
class InitialCondition :
@@ -2528,13 +2595,11 @@ def __init__(self, tail=Point(0, 0, 0), head=Point(0, 0, 0), radius=1, length=10
2528
2595
self .lcid = 0
2529
2596
self .dir = Direction (1 , 0 , 0 )
2530
2597
2531
- def set_motion (self , curve , motion = Motion .VELOCITY , dir = Direction (1 , 0 , 0 )):
2598
+ def set_motion (self , curve , motion = RWMotion .VELOCITY , dir = Direction (1 , 0 , 0 )):
2532
2599
"""Set the prescribed motion."""
2533
2600
curve .create (self .stub )
2534
2601
self .lcid = curve .id
2535
2602
self .motion = motion .value
2536
- if self .motion == Motion .DISPLACEMENT :
2537
- self .motion = 1
2538
2603
self .dir = dir
2539
2604
2540
2605
def create (self ):
@@ -2589,13 +2654,11 @@ def __init__(self, center=Point(0, 0, 0), orient=Point(0, 0, 0), radius=1):
2589
2654
self .lcid = 0
2590
2655
self .dir = Direction (1 , 0 , 0 )
2591
2656
2592
- def set_motion (self , curve , motion = Motion .VELOCITY , dir = Direction (1 , 0 , 0 )):
2657
+ def set_motion (self , curve , motion = RWMotion .VELOCITY , dir = Direction (1 , 0 , 0 )):
2593
2658
"""Set the prescribed motion."""
2594
2659
curve .create (self .stub )
2595
2660
self .lcid = curve .id
2596
2661
self .motion = motion .value
2597
- if self .motion == Motion .DISPLACEMENT :
2598
- self .motion = 1
2599
2662
self .dir = dir
2600
2663
2601
2664
def create (self ):
0 commit comments