This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/
AmplitudeOdb.py
571 lines (494 loc) · 18.6 KB
/
AmplitudeOdb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
import typing
from abaqusConstants import *
from .ActuatorAmplitude import ActuatorAmplitude
from .DecayAmplitude import DecayAmplitude
from .EquallySpacedAmplitude import EquallySpacedAmplitude
from .ModulatedAmplitude import ModulatedAmplitude
from .PeriodicAmplitude import PeriodicAmplitude
from .PsdDefinition import PsdDefinition
from .SmoothStepAmplitude import SmoothStepAmplitude
from .SolutionDependentAmplitude import SolutionDependentAmplitude
from .SpectrumAmplitude import SpectrumAmplitude
from .TabularAmplitude import TabularAmplitude
from ..Odb.OdbBase import OdbBase
class AmplitudeOdb(OdbBase):
"""The Odb object is the in-memory representation of an output database (ODB) file.
Notes
-----
This object can be accessed by:
.. code-block:: python
import odbAccess
session.odbs[name]
"""
def ActuatorAmplitude(
self, name: str, timeSpan: SymbolicConstant = STEP
) -> ActuatorAmplitude:
"""This method creates a ActuatorAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].ActuatorAmplitude
session.odbs[name].ActuatorAmplitude
Parameters
----------
name
A String specifying the repository key.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
An ActuatorAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = ActuatorAmplitude(name, timeSpan)
return amplitude
def DecayAmplitude(
self,
name: str,
initial: float,
maximum: float,
start: float,
decayTime: float,
timeSpan: SymbolicConstant = STEP,
) -> DecayAmplitude:
"""This method creates a DecayAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].DecayAmplitude
session.odbs[name].DecayAmplitude
Parameters
----------
name
A String specifying the repository key.
initial
A Float specifying the constant A0A0.
maximum
A Float specifying the coefficient AA.
start
A Float specifying the starting time t0t0. Possible values are non-negative numbers.
decayTime
A Float specifying the decay time tdtd. Possible values are non-negative numbers.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
A DecayAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = DecayAmplitude(
name, initial, maximum, start, decayTime, timeSpan
)
return amplitude
def EquallySpacedAmplitude(
self,
name: str,
fixedInterval: float,
data: tuple,
begin: float = 0,
smooth: typing.Union[SymbolicConstant, float] = SOLVER_DEFAULT,
timeSpan: SymbolicConstant = STEP,
) -> EquallySpacedAmplitude:
"""This method creates an EquallySpacedAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].EquallySpacedAmplitude
session.odbs[name].EquallySpacedAmplitude
Parameters
----------
name
A String specifying the repository key.
fixedInterval
A Float specifying the fixed time interval at which the amplitude data are given.
Possible values are positive numbers.
data
A sequence of Floats specifying the amplitude values.
begin
A Float specifying the time at which the first amplitude data are given. Possible values
are non-negative numbers. The default value is 0.0.
smooth
The SymbolicConstant SOLVER_DEFAULT or a Float specifying the degree of smoothing.
Possible float values are 0 ≤≤ *smoothing* ≤≤ 0.5. If *smooth*=SOLVER_DEFAULT, the
default degree of smoothing will be determined by the solver. The default value is
SOLVER_DEFAULT.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
An EquallySpacedAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = EquallySpacedAmplitude(
name, fixedInterval, data, begin, smooth, timeSpan
)
return amplitude
def ModulatedAmplitude(
self,
name: str,
initial: float,
magnitude: float,
start: float,
frequency1: float,
frequency2: float,
timeSpan: SymbolicConstant = STEP,
) -> ModulatedAmplitude:
"""This method creates a ModulatedAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].ModulatedAmplitude
session.odbs[name].ModulatedAmplitude
Parameters
----------
name
A String specifying the repository key.
initial
A Float specifying the constant A0A0.
magnitude
A Float specifying the coefficient AA.
start
A Float specifying the starting time t0t0. Possible values are non-negative numbers.
frequency1
A Float specifying the circular frequency 1 (ω1ω1). Possible values are positive
numbers.
frequency2
A Float specifying the circular frequency 2 (ω2ω2). Possible values are positive
numbers.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
A ModulatedAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = ModulatedAmplitude(
name, initial, magnitude, start, frequency1, frequency2, timeSpan
)
return amplitude
def PeriodicAmplitude(
self,
name: str,
frequency: float,
start: float,
a_0: float,
data: tuple,
timeSpan: SymbolicConstant = STEP,
) -> PeriodicAmplitude:
"""This method creates a PeriodicAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].PeriodicAmplitude
session.odbs[name].PeriodicAmplitude
Parameters
----------
name
A String specifying the repository key.
frequency
A Float specifying the circular frequency ωω. Possible values are positive numbers.
start
A Float specifying the starting time t0t0. Possible values are positive numbers.
a_0
A Float specifying the constant A0A0.
data
A sequence of pairs of Floats specifying AiAi and BiBi pairs.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
A PeriodicAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = PeriodicAmplitude(
name, frequency, start, a_0, data, timeSpan
)
return amplitude
def PsdDefinition(
self,
name: str,
data: tuple,
unitType: SymbolicConstant = FORCE,
referenceGravityAcceleration: float = 1,
referenecePower: float = 0,
user: Boolean = OFF,
timeSpan: SymbolicConstant = STEP,
amplitude: str = "",
) -> PsdDefinition:
"""This method creates a PsdDefinition object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].PsdDefinition
session.odbs[name].PsdDefinition
Parameters
----------
name
A String specifying the repository key.
data
A sequence of sequences of Floats specifying the real part of the frequency function,
the imaginary part of the frequency function, and the frequency or frequency band number
values, depending on the value of *unitType*.
unitType
A SymbolicConstant specifying the type of units for specifying the frequency function.
FORCE implies power units. BASE implies gravity used to define base motion. DB implies
decibel units. Possible values are FORCE, BASE, and DB. The default value is FORCE.
referenceGravityAcceleration
A Float specifying the reference gravity acceleration. This argument applies when
*unitType* = BASE. The default value is 1.0.
referenecePower
A Float specifying the reference power value, in load units squared. This argument
applies when *unitType* = DB. The default value is 0.0.
user
A Boolean specifying whether the frequency function is defined in user subroutine UPSD.
If specified, then *data* is not applicable, and the *unitType* value must not be DB.
The default value is OFF.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
amplitude
A String specifying the name of the amplitude that describes the dynamic event used to
define the cross-spectral density frequency function. The default value is an empty
string.
Returns
-------
A PsdDefinition object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = PsdDefinition(
name,
data,
unitType,
referenceGravityAcceleration,
referenecePower,
user,
timeSpan,
amplitude,
)
return amplitude
def SmoothStepAmplitude(
self, name: str, data: tuple, timeSpan: SymbolicConstant = STEP
) -> SmoothStepAmplitude:
"""This method creates a SmoothStepAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].SmoothStepAmplitude
session.odbs[name].SmoothStepAmplitude
Parameters
----------
name
A String specifying the repository key.
data
A sequence of pairs of Floats specifying time/frequency and amplitude pairs. Possible
values for time/frequency are positive numbers.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
A SmoothStepAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = SmoothStepAmplitude(name, data, timeSpan)
return amplitude
def SolutionDependentAmplitude(
self,
name: str,
initial: float = 1,
minimum: float = 0,
maximum: float = 1000,
timeSpan: SymbolicConstant = STEP,
) -> SolutionDependentAmplitude:
"""This method creates a SolutionDependentAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].SolutionDependentAmplitude
session.odbs[name].SolutionDependentAmplitude
Parameters
----------
name
A String specifying the repository key.
initial
A Float specifying the initial amplitude value. Possible values are those between
*minimum* and *maximum*. The default value is 1.0.
minimum
A Float specifying the minimum amplitude value. Possible values are those smaller than
*maximum* and *initial*. The default value is 0.1.
maximum
A Float specifying the maximum amplitude value. Possible values are those larger than
*minimum* and *initial*. The default value is 1000.0.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
A SolutionDependentAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = SolutionDependentAmplitude(
name, initial, minimum, maximum, timeSpan
)
return amplitude
def SpectrumAmplitude(
self,
name: str,
method: SymbolicConstant,
data: tuple,
specificationUnits: SymbolicConstant = ACCELERATION,
eventUnits: SymbolicConstant = EVENT_ACCELERATION,
solution: SymbolicConstant = ABSOLUTE_VALUE,
timeIncrement: float = 0,
gravity: float = 1,
criticalDamping: Boolean = OFF,
timeSpan: SymbolicConstant = STEP,
amplitude: str = "",
) -> SpectrumAmplitude:
"""This method creates a SpectrumAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].SpectrumAmplitude
session.odbs[name].SpectrumAmplitude
Parameters
----------
name
A String specifying the repository key.
method
A SymbolicConstant specifying the method for specifying the spectrum. Possible values
are DEFINE and CALCULATE.
data
A sequence of sequences of Floats specifying the magnitude, frequency, and damping
values.
specificationUnits
A SymbolicConstant specifying the units used for specifying the spectrum. Possible
values are DISPLACEMENT, VELOCITY, ACCELERATION, and GRAVITY. The default value is
ACCELERATION.
eventUnits
A SymbolicConstant specifying the units used to describe the dynamic event in the
amplitude used for the calculation. Possible values are EVENT_DISPLACEMENT,
EVENT_VELOCITY, EVENT_ACCELERATION, and EVENT_GRAVITY. The default value is
EVENT_ACCELERATION.
solution
A SymbolicConstant specifying the solution method for the dynamic equations. Possible
values are ABSOLUTE_VALUE and RELATIVE_VALUE. The default value is ABSOLUTE_VALUE.
timeIncrement
A Float specifying the implicit time increment used to calculate the spectrum. This
argument is required when the *method* = CALCULATE. The default value is 0.0.
gravity
A Float specifying the acceleration due to gravity. This argument applies only when
*specificationUnits* = GRAVITY or*eventUnits* = GRAVITY. The default value is 1.0.
criticalDamping
A Boolean specifying whether to calculate the spectrum for only the specified range of
critical damping values or a list of values. If *criticalDamping* = ON, the spectrum is
calculated only for the specified range of critical damping values. If *criticalDamping*
= OFF, the spectrum is calculated for a list of damping values. The default value is
OFF.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
amplitude
A String specifying the name of the amplitude that describes the dynamic event used to
calculate the spectrum. The default value is an empty string.
Returns
-------
A SpectrumAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = SpectrumAmplitude(
name,
method,
data,
specificationUnits,
eventUnits,
solution,
timeIncrement,
gravity,
criticalDamping,
timeSpan,
amplitude,
)
return amplitude
def TabularAmplitude(
self,
name: str,
data: tuple,
smooth: typing.Union[SymbolicConstant, float] = SOLVER_DEFAULT,
timeSpan: SymbolicConstant = STEP,
) -> TabularAmplitude:
"""This method creates a TabularAmplitude object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].TabularAmplitude
session.odbs[name].TabularAmplitude
Parameters
----------
name
A String specifying the repository key.
data
A sequence of pairs of Floats specifying time/frequency and amplitude pairs. Possible
values for time/frequency are positive numbers.
smooth
The SymbolicConstant SOLVER_DEFAULT or a Float specifying the degree of smoothing.
Possible float values are between 0 and 0.5. If *smooth*=SOLVER_DEFAULT, the default
degree of smoothing will be determined by the solver. The default value is
SOLVER_DEFAULT.
timeSpan
A SymbolicConstant specifying the time span of the amplitude. Possible values are STEP
and TOTAL. The default value is STEP.
Returns
-------
A TabularAmplitude object.
Raises
------
InvalidNameError
RangeError
"""
self.amplitudes[name] = amplitude = TabularAmplitude(
name, data, smooth, timeSpan
)
return amplitude