This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/
JobMdb.py
396 lines (370 loc) · 17 KB
/
JobMdb.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
from abaqusConstants import *
from .JobFromInputFile import JobFromInputFile
from .ModelJob import ModelJob
from .OptimizationProcess import OptimizationProcess
from ..Mdb.MdbBase import MdbBase
class JobMdb(MdbBase):
"""The Mdb object is the high-level Abaqus model database. A model database stores models
and analysis controls.
Notes
-----
This object can be accessed by:
.. code-block:: python
mdb
"""
def Job(
self,
name: str,
model: str,
description: str = "",
type: SymbolicConstant = ANALYSIS,
queue: str = "",
waitHours: int = 0,
waitMinutes: int = 0,
atTime: str = "",
echoPrint: Boolean = OFF,
contactPrint: Boolean = OFF,
modelPrint: Boolean = OFF,
historyPrint: Boolean = OFF,
scratch: str = "",
userSubroutine: str = "",
numCpus: int = 1,
memory: int = 90,
memoryUnits: SymbolicConstant = PERCENTAGE,
explicitPrecision: SymbolicConstant = SINGLE,
nodalOutputPrecision: SymbolicConstant = SINGLE,
parallelizationMethodExplicit: SymbolicConstant = DOMAIN,
numDomains: int = 1,
activateLoadBalancing: Boolean = OFF,
multiprocessingMode: SymbolicConstant = DEFAULT,
licenseType: SymbolicConstant = DEFAULT,
*args,
**kwargs
) -> ModelJob:
"""This method creates an analysis job using a model on a model database (MDB) for the
model definition.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.Job
Parameters
----------
name
A String specifying the name of the new job. The name must be a valid Abaqus/CAE object
name.
model
A String specifying the name of the model to be analyzed or a Model object specifying
the model to be analyzed.
description
A String specifying a description of the job.
type
A SymbolicConstant specifying the type of job. Possible values are ANALYSIS,
SYNTAXCHECK, RECOVER, and RESTART. The default value is ANALYSIS.If the object has the
type JobFromInputFile, *type*=RESTART is not available.
queue
A String specifying the name of the queue to which to submit the job. The default value
is an empty string.Note:You can use the *queue* argument when creating a Job object on a
Windows workstation; however, remote queues are available only on Linux platforms.
waitHours
An Int specifying the number of hours to wait before submitting the job. This argument
is ignored if *queue* is set. The default value is 0.This argument works in conjunction
with *waitMinutes*. *waitHours* and *atTime* are mutually exclusive.
waitMinutes
An Int specifying the number of minutes to wait before submitting the job. This argument
is ignored if *queue* is set. The default value is 0.This argument works in conjunction
with *waitHours*. *waitMinutes* and *atTime* are mutually exclusive.
atTime
A String specifying the time at which to submit the job. If *queue* is empty, the string
syntax must be valid for the Linux `at` command. If *queue* is set, the syntax must be
valid according to the system administrator. The default value is an empty
string.Note:You can use the *atTime* argument when creating a Job object on a Windows
workstation; however, the `at` command is available only on Linux platforms.
echoPrint
A Boolean specifying whether an echo of the input data is printed. The default value is
OFF.
contactPrint
A Boolean specifying whether contact constraint data are printed. The default value is
OFF.
modelPrint
A Boolean specifying whether model definition data are printed. The default value is
OFF.
historyPrint
A Boolean specifying whether history data are printed. The default value is OFF.
scratch
A String specifying the location of the scratch directory. The default value is an empty
string.
userSubroutine
A String specifying the file containing the user's subroutine definitions. The default
value is an empty string.
numCpus
An Int specifying the number of CPUs to use for this analysis if parallel processing is
available. Possible values are *numCpus* >> 0. The default value is 1.
memory
An Int specifying the amount of memory available to Abaqus analysis. The value should be
expressed in the units supplied in *memoryUnits*. The default value is 90.
memoryUnits
A SymbolicConstant specifying the units for the amount of memory used in an Abaqus
analysis. Possible values are PERCENTAGE, MEGA_BYTES, and GIGA_BYTES. The default value
is PERCENTAGE.
explicitPrecision
A SymbolicConstant specifying whether to use the double precision version of
Abaqus/Explicit. Possible values are SINGLE, FORCE_SINGLE, DOUBLE,
DOUBLE_CONSTRAINT_ONLY, and DOUBLE_PLUS_PACK. The default value is SINGLE.
nodalOutputPrecision
A SymbolicConstant specifying the precision of the nodal output written to the output
database. Possible values are SINGLE and FULL. The default value is SINGLE.
parallelizationMethodExplicit
A SymbolicConstant specifying the parallelization method for Abaqus/Explicit. This value
is ignored for Abaqus/Standard. Possible values are DOMAIN and LOOP. The default value
is DOMAIN.
numDomains
An Int specifying the number of domains for parallel execution in Abaqus/Explicit. When
*parallelizationMethodExplicit*=DOMAIN, *numDomains* must be a multiple of *numCpus*.
The default value is 1.
activateLoadBalancing
A Boolean specifying whether to activate dyanmic load balancing for jobs running on
multiple processors with multiple domains in Abaqus/Explicit. The default value is OFF.
multiprocessingMode
A SymbolicConstant specifying whether an analysis is decomposed into threads or into
multiple processes that communicate through a message passing interface (MPI). Possible
values are DEFAULT, THREADS, and MPI. The default value is DEFAULT.
licenseType
A SymbolicConstant specifying the type of license type being used in the case of the
DSLS SimUnit license model. Possible values are DEFAULT, TOKEN, and CREDIT. The default
value is DEFAULT.If the license model is not the DSLS SimUnit, the licenseType is not
available.
Returns
-------
A ModelJob object.
Raises
------
AbaqusException.
"""
self.jobs[name] = job = ModelJob(
name,
model,
description,
type,
queue,
waitHours,
waitMinutes,
atTime,
echoPrint,
contactPrint,
modelPrint,
historyPrint,
scratch,
userSubroutine,
numCpus,
memory,
memoryUnits,
explicitPrecision,
nodalOutputPrecision,
parallelizationMethodExplicit,
numDomains,
activateLoadBalancing,
multiprocessingMode,
licenseType,
*args,
**kwargs
)
return job
def JobFromInputFile(
self,
name: str,
inputFileName: str,
type: SymbolicConstant = ANALYSIS,
queue: str = "",
waitHours: int = 0,
waitMinutes: int = 0,
atTime: str = "",
scratch: str = "",
userSubroutine: str = "",
numCpus: int = 1,
memory: int = 90,
memoryUnits: SymbolicConstant = PERCENTAGE,
explicitPrecision: SymbolicConstant = SINGLE,
nodalOutputPrecision: SymbolicConstant = SINGLE,
parallelizationMethodExplicit: SymbolicConstant = DOMAIN,
numDomains: int = 1,
activateLoadBalancing: Boolean = OFF,
multiprocessingMode: SymbolicConstant = DEFAULT,
licenseType: SymbolicConstant = DEFAULT,
) -> JobFromInputFile:
"""This method creates an analysis job using an input file for the model definition.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.JobFromInputFile
Parameters
----------
name
A String specifying the name of the new job. The name must be a valid Abaqus/CAE object
name.
inputFileName
A String specifying the input file to read. Possible values are any valid file name. If
the .inp extension is not included in the value of the argument, the system will append
it for the user.
type
A SymbolicConstant specifying the type of job. Possible values are ANALYSIS,
SYNTAXCHECK, and RECOVER. The default value is ANALYSIS.For theJobFromInputFile object,
*type*=RESTART is not currently supported.
queue
A String specifying the name of the queue to which to submit the job. The default value
is an empty string.Note: You can use the *queue* argument when creating a Job object on
a Windows workstation; however, remote queues are available only on Linux platforms.
waitHours
An Int specifying the number of hours to wait before submitting the job. This argument
is ignored if *queue* is set. The default value is 0.This argument works in conjunction
with *waitMinutes*. *waitHours* and *atTime* are mutually exclusive.
waitMinutes
An Int specifying the number of minutes to wait before submitting the job. This argument
is ignored if *queue* is set. The default value is 0.This argument works in conjunction
with *waitHours*. *waitMinutes* and *atTime* are mutually exclusive.
atTime
A String specifying the time at which to submit the job. If *queue* is empty, the string
syntax must be valid for the Linux `at` command. If *queue* is set, the syntax must be
valid according to the system administrator. The default value is an empty string.Note:
You can use the *atTime* argument when creating a Job object on a Windows workstation;
however, the `at` command is available only on Linux platforms.
scratch
A String specifying the location of the scratch directory. The default value is an empty
string.
userSubroutine
A String specifying the file containing the user's subroutine definitions. The default
value is an empty string.
numCpus
An Int specifying the number of CPUs to use for this analysis if parallel processing is
available. Possible values are *numCpus* >> 0. The default value is 1.
memory
An Int specifying the amount of memory available to Abaqus analysis. The value should be
expressed in the units supplied in *memoryUnits*. The default value is 90.
memoryUnits
A SymbolicConstant specifying the units for the amount of memory used in an Abaqus
analysis. Possible values are PERCENTAGE, MEGA_BYTES, and GIGA_BYTES. The default value
is PERCENTAGE.
explicitPrecision
A SymbolicConstant specifying whether to use the double precision version of
Abaqus/Explicit. Possible values are SINGLE, FORCE_SINGLE, DOUBLE,
DOUBLE_CONSTRAINT_ONLY, and DOUBLE_PLUS_PACK. The default value is SINGLE.
nodalOutputPrecision
A SymbolicConstant specifying the precision of the nodal output written to the output
database. Possible values are SINGLE and FULL. The default value is SINGLE.
parallelizationMethodExplicit
A SymbolicConstant specifying the parallelization method for Abaqus/Explicit. This value
is ignored for Abaqus/Standard. Possible values are DOMAIN and LOOP. The default value
is DOMAIN.
numDomains
An Int specifying the number of domains for parallel execution in Abaqus/Explicit. When
*parallelizationMethodExplicit*=DOMAIN, *numDomains* must be a multiple of *numCpus*.
The default value is 1.
activateLoadBalancing
A Boolean specifying whether to activate dyanmic load balancing for jobs running on
multiple processors with multiple domains in Abaqus/Explicit. The default value is OFF.
multiprocessingMode
A SymbolicConstant specifying whether an analysis is decomposed into threads or into
multiple processes that communicate through a message
"""
self.jobs[name] = jobFromInputFile = JobFromInputFile(
name,
inputFileName,
type,
queue,
waitHours,
waitMinutes,
atTime,
scratch,
userSubroutine,
numCpus,
memory,
memoryUnits,
explicitPrecision,
nodalOutputPrecision,
parallelizationMethodExplicit,
numDomains,
activateLoadBalancing,
multiprocessingMode,
licenseType,
)
return jobFromInputFile
def OptimizationProcess(
self,
name: str,
model: str,
task: str,
prototypeJob: str,
description: str = "",
maxDesignCycle: int = 15,
dataSaveFrequency: str = OPT_DATASAVE_SPECIFY_CYCLE,
saveInitial: Boolean = True,
saveFirst: Boolean = True,
saveLast: Boolean = True,
saveEvery: int = None,
) -> OptimizationProcess:
"""This method creates an OptimizationProcess object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.OptimizationProcess
Parameters
----------
name
A String specifying name of the optimization process.
model
A String specifying name of the model to be used for the optimization process.
task
A String specifying name of the optimization task to be used for the optimization
process.
prototypeJob
A String specifying name of the job to be used as the prototype for all analysis jobs
run by the optimization process.
description
A String specifying a description of the optimization process.
maxDesignCycle
An Int specifying the maximum number of allowed design cycles for the optimization
process. The default value is 15.
dataSaveFrequency
An Enum specifying whether Abaqus should save every iteration file in the optimization
process or a selection of iteration files saved at a user-specified frequency. If you
set *dataSaveFrequency*=OPT_DATASAVE_EVERY_CYCLE, Abaqus saves every iteration file; if
you set *dataSaveFrequency*=OPT_DATASAVE_SPECIFY_CYCLE, Abaqus saves iteration files
according to the frequency defined by the *saveEvery* parameter. The default value is
OPT_DATASAVE_SPECIFY_CYCLE.
saveInitial
A Boolean specifying whether the initial cycle should be saved when *dataSaveFrequency*
is OPT_DATASAVE_SPECIFY_CYCLE. The default value is True.
saveFirst
A Boolean specifying whether the first cycle should be saved when *dataSaveFrequency* is
OPT_DATASAVE_SPECIFY_CYCLE. The default value is True.
saveLast
A Boolean specifying whether the last cycle should be saved when *dataSaveFrequency* is
OPT_DATASAVE_SPECIFY_CYCLE. The default value is True.
saveEvery
An Int specifying every nth cycle iterations to be saved when *dataSaveFrequency* is
OPT_DATASAVE_SPECIFY_CYCLE. Abaqus saves file iterations for every nth iteration after
iteration 1; if you set *saveEvery*=3, Abaqus saves file iterations for cycles 1, 4, 7,
and so on. The default value is None.
Returns
-------
An OptimizationProcess object.
Raises
------
AbaqusException.
"""
self.optimizationProcesses[name] = optimizationProcess = OptimizationProcess(
name,
model,
task,
prototypeJob,
description,
maxDesignCycle,
dataSaveFrequency,
saveInitial,
saveFirst,
saveLast,
saveEvery,
)
return optimizationProcess