Use of Python in ABAQUS [z]

Source: Internet
Author: User

First, I do not understand ABAQUS. This is just one time to help students deal with mixed programming problems and find these materials and post them on the machine.

There are some chaotic characters in the copy process, and I have not deleted the time relationship. Because I also transferred it from the post, the original source cannot be found.

 

# Start with the comment line. 9 _-m2r; n % H-G
Section 1: Create a modeling environment. In this step, Py will import all the program modules required for modeling from ABAQUS.
From part import *
Next, define the sketch environment.
MDB. Models ['model-1']. Sketch (name = '_ profile _', sheetsize = 200.0)
MDB. models ['model-1']. sketches ['_ profile _']. sketchoptions. setvalues (constructiongeometry = on, decimalplaces = 2, dimensiontextheight = 5.0, grid = on,
Gridfrequency = 2, gridspacing = 5.0, sheetsize = 200.0, viewstyle = axisym );

The size is set to 200*200, the grid spacing is 5, and the text height is 5.5.

MDB. models ['model-1']. sketches ['_ profile _']. obliqueconstructionline (point1 = (0.0,-100.0), point2 = (0.0, 100.0) 5] 7
This statement sets the axis of symmetry of the axial symmetry model.
MDB. models ['model-1']. sketches ['_ profile _']. rectangle (point1 = (0.0, 0.0), point2 = (40.0,-40.0 ))
This statement draws a rectangle from 0 to 40,-40.
Mdb. models ['model-1']. Part (dimensionality = axisypolicric, name = 'boden ', type = DEFORMABLE_BODY)
Define the model as axial symmetry and name it boden. It is a variable shape of 8 \ % M0q ~ 1 H % h; K )\
Mdb. models ['model-1']. parts ['boden ']. baseShell (sketch = mdb. models ['model-1']. sketches ['_ profile _'])
Del mdb. models ['model-1']. sketches ['_ profile _']
Do not forget to reclaim the memory occupied by the Modeling Environment after drawing is complete.

Section 2: material definition
From material import *
From section import *
Import material library and Component Library from interfaces provided by ABAQUS
Mdb. models ['model-1']. Material (name = 'boden ')
Define material name # B6 ~ 9o2] 3r Y4K "U & B
Mdb. models ['model-1']. materials ['boden ']. Density (table = (2000.0 ,),))

Define material density
Mdb. models ['model-1']. materials ['boden ']. Elastic (table = (210546.3, 0.3333 ),))
Defines the linear elastic modulus and Poisson's ratio of materials. other materials, such as elastic-plastic and viscoelastic materials, all correspond to different object functions.
MDB. Models ['model-1']. homogeneoussolidsection (material = 'boden ', name = 'boden', thickness = 1.0)
MDB. models ['model-1']. parts ['boden ']. assignsection (region = region (faces = MDB. models ['model-1']. parts ['boden ']. faces [0: 1]), sectionname = 'boden ')
Sets the component as a coordinate independent material, and the thickness is the unit thickness, and attaches the property to the component used

Section 3 Assembly
From Assembly import *
First, import the objects used by the Assembly.
MDB. models ['model-1']. rootassembly. datumcsysbythreepoints (coord1_ype = cylindrical, origin = (0.0, 0.0, 0.0), point1 = (1.0, 0.0, 0.0), point2 = (0.0, 0.0,-1.0 ));
Define the coordinate type as column coordinate, the origin is 0, 0, and the other two are unit vectors to determine the direction of the coordinate axis.
MDB. models ['model-1']. rootassembly. instance (name = 'boden-1', part = MDB. models ['model-1']. parts ['boden '])
Generate a sketch to a Boden-like entity named Boden-1. No offset inserted

Section 4: Define the analysis step
From step import *! N; O & J-a' {9t. W * U5]
Modules Used in the pilot-in-analysis step, as in other steps
MDB. models ['model-1']. implicitdynamicsstep (initialinc = 0.005, maxnuminc = 1024, name = 'step-1', nostop = OFF, nohaf = OFF, previous = 'initial', timeincrementationmethod = Fixed, timeperiod = 5.12)
Defines an implicit dynamic analysis with a length of 0.005x1024 = 5.12 time units. The previous step is initial7.

MDB. Models ['model-1']. fieldoutputrequests ['f-output-1']. setvalues (variables = ('U ',));
Defines the data output to the ODB file. Here, only the displacement output is defined.
MDB. Models ['model-1']. fieldoutputrequests ['f-output-1']. setvalues (frequency = 1) 6 d,]
Define the frequency of displacement output for each step:

MDB. Models ['model-1']. Steps ['step-1']. Restart (frequency = 1, overlay = on)

Defines the restart analysis. Each step is recorded and only the last correct status is recorded.

Section 5 defines contact
From interaction import *
It is still a pilot module
MDB. models ['model-1']. rootassembly. partitionedgebyparam (edges = (MDB. models ['model-1']. rootassembly. instances ['boden-1']. edges [3],), parameter = 0.975)
Set a point at the top, that is, 3rd of the top, to define the contact 5b3p) C)

MDB. Models ['model-1']. contactproperty ('intprop-1') 7 j) C)
Define contact attribute name # u1n7e; D4 | 6b
MDB. Models ['model-1']. interactionproperties ['intprop-1']. tangentialbehavior (formulation = frictionless)
MDB. models ['model-1']. interactionproperties ['intprop-1']. normalbehavior (allowseparation = OFF, augmentedlagrange = OFF, pressureoverclosure = hard), {1v8r # x0i $ Z. O "}
Define the contact characteristics. Hard contact without friction cannot be separated-M1i # S-W (q0q + f7f! K
MDB. Models ['model-1']. surfacetosurfacecontactstd (adjustmethod = none,
Createstepname = 'initial', interactionproperty = 'intprop-1', Master = region (
Side1edges = MDB. Models ['model-1']. rootassembly. Instances ['fun-1']. Edges [])
, Name = 'int-1', slave = region (
Side1edges = MDB. Models ['model-1']. rootassembly. Instances ['boden-1']. Edges [4: 5])
, Sliding = FINITE) 3] (F! F N7a. K.K & @ 4D1 ~
This sentence establishes a contact pair, which is an edge on both sides. The definition here is determined by ABAQUS. For details, refer to the reference manual.

Section 6 defines the load boundary from load import *
Mdb. models ['model-1']. periodicamplency (a_0 = 1.0, data = (3.0, 1.1), (3.2, 1.7), frequency = 2.454, name = 'fourier ', start = 0.0, timeSpan = STEP)
Define load represented by fourier Series

Mdb. models ['model-1']. pressure (amplure = 'fourier ', createStepName = 'step-1', distribution = UNIFORM, magnplacement = 50.0, name = 'Load-1 ', region = Region (-H2 _ $ J2q6F) G1e
Side1Edges = mdb. models ['model-1']. rootAssembly. instances ['fun-1']. edges [2: 3]), l: ^ 4 @ 7 S! X, j; q
Define the pressure, set the loading analysis step, region, and amplification factor
Mdb. models ['model-1']. displacementBC (ampltion = UNSET, createStepName = 'initial', distribution = UNIFORM, localCsys = None, name = 'bc-1', region = Region (
Edges = mdb. models ['model-1']. rootAssembly. instances ['boden-1']. edges [0: 1] + \ mdb. models ['model-1']. rootAssembly. instances ['boden-1']. edges [2: 3] + \ mdb. models ['model-1']. rootAssembly. instances ['fun-1']. edges [3: 4]), u1 = SET, u2 = UNSET, ur3 = UNSET) 6 j & B + o3 \ * v
Mdb. models ['model-1']. displacementBC (ampltion = UNSET, createStepName = 'initial', distribution = UNIFORM, localCsys = None, name = 'bc-2', region = Region (-y5v3 '2j, W + N $ t5 {
Edges = mdb. models ['model-1']. rootAssembly. instances ['boden-1']. edges []), u1 = UNSET, u2 = SET, ur3 = UNSET) 9 V8w6A's! Z2V: _ 7F # v8f * ^
Set the boundary condition where the boundary displacement is 0. Pay attention to the method of adding objects in the syntax.

Section 7 grid division Control
From mesh import *
Import mesh3 R0B4k4Z4} 9 P % b8D3d1x
Import the grid division module $ f0 \ 0y4K * P6 \ $ {
ElemType1 = mesh. ElemType (elemCode = CAX8, elemLibrary = STANDARD, secondOrderAccuracy = OFF, hourglassControl = STIFFNESS, distortionControl = OFF) 7 a9Y4N * N; d $ R;] 2 W
Elemtype2 = mesh. elemtype (elemcode = cax6m, elemlibrary = standard)
A1 = MDB. Models ['model-1']. rootassembly
F1 = a1.instances ['boden-1']. Faces & N/i9h & K (^ #? % E. Z. T
Faces1 = F1 [0: 1]
Regions = (faces1 ,)
A1.setelementtype (regions = regions, elemtypes = (elemtype1, elemtype2 ))
Defines the mesh of an object as a quadratic eight-node unit. If any of them cannot be divided into a quadrilateral unit, a triangular quadratic six-node unit is used.
Elemtype1 = mesh. elemtype (elemcode = cax4, elemlibrary = standard)
Elemtype2 = mesh. elemtype (elemcode = cax3, elemlibrary = standard) %] 4 h9n5m 'U
A1 = MDB. Models ['model-1']. rootassembly & I # k3c7e, o5s6l g (W
F1 = a1.instances ['fun-1']. faces0
Faces1 = F1 [0: 1]
Regions = (faces1 ,)
A1.setelementtype (regions = regions, elemtypes = (elemtype1, elemtype2) (H "~ A' B, F "W R
Defines the mesh of an object as a 4-node unit at a time. If any of them cannot be divided into a quadrilateral unit, a 3-node unit is used at a time in a triangle.
Mdb. models ['model-1']. rootAssembly. seedPartInstance (regions = (mdb. models ['model-1']. rootAssembly. instances ['fun-1'],), size = 0.5)
Mdb. models ['model-1']. rootAssembly. seedPartInstance (regions = (mdb. models ['model-1']. rootAssembly. instances ['boden-1'],), size = 1) 'i3k $ l2X. j/U6n % O
Define grid partition global unit size.: J)} # R1X-Z2 @/{& L8d
Mdb. models ['model-1']. rootAssembly. generateMesh (regions = (mdb. models ['model-1']. rootAssembly. instances ['boden-1'], mdb. models ['model-1']. rootAssembly. instances ['fun-1'])
Unit Division by definition

Section 8: Task submission and miscellaneous functions
Mdb. models. changeKey (fromName = 'model-1', toName = 'fall-muster ')
Modify model name
Mdb. Model (name = 'fall-015', objectToCopy = mdb. models ['fall-muster'])
Copy Model
Mdb. models ['fall-015']. materials ['boden ']. elastic. setValues (table = (210546.3, 0.15 ),))
Modify material attributes in the model; S9H w7w5t + Q9W (K/z
Mdb. Job (contactPrint = OFF, description = '', echoPrint = OFF, explicitPrecision = 1 {7 T # B" X0W # C % y0}
SINGLE, historyPrint = OFF, model = 'fall-015', modelPrint = OFF,) B * | % {3l H & c d8a7S4t
MultiprocessingMode = THREADS, name = 'job-015', nodalOutputPrecision = SINGLE, + F % a9L: [0V0x7 ^, Z7q8B5z1J
NumCpus = 1, numDomains = 1, parallconfigurationmethodexplicit = LOOP,
Parallconfigurationmethodstandard = TREE, preMemory = 1024.0, scratch = '', 6] $ W3x2I 'g7q3 _ 3?
StandardMemory = 2048.0, standardMemoryPolicy = MODERATE, type = ANALYSIS,
UserSubroutine = '')
Generate task
Mdb. saveAs (pathName = 'd:/temp/FundamentSchwingungStudie '); i9I # l4 ^ + z: d5R) ^
Save Model
Mdb.jobs ['job-015 ']. submit ()
Submit a task

Section 9 about how to submit multiple tasks in python
If you use the following command to submit
Mdb.jobs ['job-01']. Submit ()
Mdb.jobs ['job-02']. Submit () "s8e't & r0n! C4k "f o/Q9 {
Mdb.jobs ['job-03']. Submit ()
You will see that all tasks are submitted at one time, and multiple tasks are run together. This is certainly not the result you want to see. How can you complete one commit after another, in fact, it is very easy to add a sentence after each task
Mdb.jobs ['job-01']. waitforcompletion ()
You can.
Then the preceding statement is changed-

Mdb.jobs ['job-01']. Submit ()
Mdb.jobs ['job-01']. waitforcompletion ())

Mdb.jobs ['job-02']. Submit ()
Mdb.jobs ['job-02']. waitforcompletion ()
Mdb.jobs ['job-03']. Submit ()
Mdb.jobs ['job-03']. waitforcompletion ()
... 0 g7d9c2m -?; H
Everything is okay.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.