当前位置:网站首页>Learn ABAQUS script programming script in an hour
Learn ABAQUS script programming script in an hour
2022-07-28 16:34:00 【CaeCoder】
List of articles
Scan the QR code below to follow my wechat official account - CAE Second development of software Lab, See more great articles !

This paper is about Learn Abaqus script in one hour Translation , Please click here download .
Introduce
Scripting is a powerful tool , It allows you to Abaqus The graphical user interface (GUI) Function and programming language Python Combined with the powerful functions of . This manual does not mean a complete Abaqus Script manual . This is an introduction from the perspective of practice Abaqus Script , And try to explain a simple 、 Quick script startup method . If you do not use Abaqus GUI or FEM Experience , You should Get experience in this area first . If you are not familiar with the input file , You should be able to read this introduction in two hours . This manual is used to illustrate the author's views on the power and simplicity of scripts .
This manual will cover the following topics :
- Use GUI Create a simple model
- For model database (mdb) Create the first script file
- Use GUI Create output
- For output database (odb) Create the first script file
- Examples of adjusting script files for different purposes
- Continue to use some instructions of the script
The basic idea of creating scripts is in the following order :
- stay GUI Create a model in and save the model
- Use Abaqus Generated rpy Create script files based on files
- Create output
- Recalculate by running the generated script file
- Adjust the script to create different models or outputs
As you know ,Abaqus GUI An input file will be generated when the simulation is run (an input file
). The same is true of script files , The script file creates an input file , And send it to the solver for calculation .
Use GUI Creating a simple model
I use Abaqus cae The version is 6.8-2, But the script is Abaqus A later or earlier version of may also be used .
chart 1 Abaqus CAE 6.8-2 GUI main window
First start Abaqus CAE. To make sure we are talking about the same menu , chart 1 Shows Abaqus GUI Environmental Science . I added some descriptions of menu and button names , It will be explained later . Set the correct working directory , We will create some files we will use later , Make sure you can find them . Before starting to create the model , We will enter a line of command in the script window . First , Click on the graph 1 What I mean by Script button Button to Script Window.; Enter the following command :
session.journalOptions.setValues(replayGeometry=COORDINATE, recoverGeometry=COORDINATE)
Enter the script window , Then press enter key . Nothing visible will appear after running this command , But this line of code allows us to create the collection later (sets)、 Surfaces (surfaces)、 Select area (region) Waiting python Scripts are more readable . Now let's start by creating the model , Follow these steps :
- Create part : Two dimensional deformable plane shell , Approximate size :20
- Draw the first point as (-5,-1)、 The second point is (5,1) The rectangular
- Create materials : Linear elasticity ,E=1e9、ν=0.3
- Create sections : Solid 、 Homogenization , Use the material just created
- Assign the newly created section to the part
- Create set (set): Left edge (left edge)
- Create surface : Top edge (top edge)
- grid (Mesh): Control the grid (mesh control) Set to structured ( structured) And quadrilateral ( quad)
- grid (Mesh): Set the unit type (element type) Set to standard (Standard)、 secondary (quadratic) Plane stress (Plane Stress)
- grid (Mesh): Set mesh seeds for the part (seed), The global size is about 0.5, Divide the part mesh
- assembly (Assembly): Create part instances (part instance)
- Analysis step (Step): Create a generic static (General Static ) Analysis step , Turn on geometric nonlinearity (Nlgeom) Options , Set the initial / The maximum increment size is 0.1
- The border : Create displacement boundary , Select the left edge (left edge), Put it U1,U2 and UR3 Set to 0
- load : At the top edge (top edge) Create pressure loads on surfaces , And set the amplitude to -1e-5
- Homework (Job): Use the name EXAMPLE Create a job and submit
- Save as : The name is EXAMPLE.cae
You have created the model . Make sure your working directory contains files EXAMPLE.jnl(.jnl The suffix is the script file automatically recorded by the previous version ,abaqus6.10 And later .rpy suffix )
For model database (mdb) Create the first script file
Let's start by creating a script file . open EXAMPLE.rpy File and save this file as EXAMPLE_MDB.py file . In the appendix EXAMPLE_MDB.py The full content of the document . At this time python The file still looks messy , Adding some structures to it is a good practice and habit . Let me show you the code , And point out which part each line of the script belongs to . It takes some experience and practice to fully understand these commands . however , You can recognize from it that you are GUI Some operating steps taken in .
# -*- coding: mbcs -*-
This line is a comment . So it's not important , Even though we know python Comment order # It is useful to .
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
Although we are in a python Working in an environment , But it does not include Abaqus All functions of . therefore , The above line commands will import some... Used in this script file Abaqus modular (modulus).
mdb.models[’Model-1’].ConstrainedSketch(name=’__profile__’, sheetSize=20.0)
mdb.models[’Model-1’].sketches[’__profile__’].rectangle(point1=(-5.0, -1.0),
point2=(5.0, 1.0))
mdb.models[’Model-1’].Part(dimensionality=TWO_D_PLANAR, name=’Part-1’, type=
DEFORMABLE_BODY)
mdb.models[’Model-1’].parts[’Part-1’].BaseShell(sketch=
mdb.models[’Model-1’].sketches[’__profile__’])
del mdb.models[’Model-1’].sketches[’__profile__’]
Use these commands to create sketches and parts .
mdb.models[’Model-1’].Material(name=’Material-1’)
mdb.models[’Model-1’].materials[’Material-1’].Elastic(table=((1000000000.0,
0.3), ))
mdb.models[’Model-1’].HomogeneousSolidSection(material=’Material-1’, name=
’Section-1’, thickness=None)
mdb.models[’Model-1’].parts[’Part-1’].SectionAssignment(offset=0.0,
offsetField=’’, offsetType=MIDDLE_SURFACE, region=Region(
faces=mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667,
-0.333333, 0.0), (0.0, 0.0, 1.0)), )), sectionName=’Section-1’)
material 、 Section and section allocation are completed with the above command .
mdb.models[’Model-1’].parts[’Part-1’].Set(edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-5.0, -0.5, 0.0), )),
name=’Set-1’)
mdb.models[’Model-1’].parts[’Part-1’].Surface(name=’Surf-1’, side1Edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-2.5, 1.0, 0.0), )))
Here we create sets and surfaces . Pay attention to the findAt command . Used findAt instead of getSequenceFromMask( It is Abaqus A numbering system used ), Because before creating the model , We are GUI The line of command entered in the script window in .
mdb.models[’Model-1’].parts[’Part-1’].setMeshControls(elemShape=QUAD, regions=
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667, -0.333333,
0.0), )), technique=STRUCTURED)
mdb.models[’Model-1’].parts[’Part-1’].setElementType(elemTypes=(ElemType(
elemCode=CPS8R, elemLibrary=STANDARD), ElemType(elemCode=CPS6M,
elemLibrary=STANDARD)), regions=(
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667, -0.333333,
0.0), )), ))
mdb.models[’Model-1’].parts[’Part-1’].seedPart(deviationFactor=0.1, size=0.5)
mdb.models[’Model-1’].parts[’Part-1’].generateMesh()
These line commands will create grid controls 、 Cell type and grid .
mdb.models[’Model-1’].rootAssembly.DatumCsysByDefault(CARTESIAN)
mdb.models[’Model-1’].rootAssembly.Instance(dependent=ON, name=’Part-1-1’,
part=mdb.models[’Model-1’].parts[’Part-1’])
mdb.models[’Model-1’].rootAssembly.regenerate()
The assembly process is described above . Please note that , It's used here rootAssembly The word" , You don't have to give the name of the assembly . This is of course because there is only one assembly (Assembly).
mdb.models[’Model-1’].StaticStep(initialInc=0.1, maxInc=0.1, name=’Step-1’,
previous=’Initial’)
mdb.models[’Model-1’].DisplacementBC(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, fieldName=’’, fixed=OFF, localCsys=None, name=
’BC-1’, region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].sets[’Set-1’], u1=
0.0, u2=0.0, ur3=0.0)
mdb.models[’Model-1’].Pressure(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, field=’’, magnitude=-100000.0, name=’Load-1’,
region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].surfaces[’Surf-1’])
The above command line defines the analysis step 、 The border 、 load .
mdb.Job(contactPrint=OFF, description=’’, echoPrint=OFF, explicitPrecision=
SINGLE, historyPrint=OFF, memory=90, memoryUnits=PERCENTAGE, model=
’Model-1’, modelPrint=OFF, multiprocessingMode=DEFAULT, name=’EXAMPLE’,
nodalOutputPrecision=SINGLE, numCpus=1, numDomains=1,
parallelizationMethodExplicit=DOMAIN, scratch=’’, type=ANALYSIS,
userSubroutine=’’)
mdb.jobs[’EXAMPLE’].submit(consistencyChecking=OFF)
The above command creates a job (job) And submit the homework for analysis . The code after the last line above is irrelevant . You can delete . The final script EXAMPLE_MDB.py The file can be found in the attachment .
Before running this script , Please delete from your work directory except “EXAMPLE” Other files . If your Abaqus GUI The user interface is still open , Please start a new model without saving anything . Now run the script file , Please go to the top menu , single click File( file ), Then click Run script (Run script), Then select the script file . If everything is done right , Your model should run without any problems . At this point, generate files in your working directory EXAMPLE.odb. If you don't want to delete the files in your working directory ,abaqus These files will be overwritten . That's fine , But in this manual , You need to check whether the file has been created .
Use GUI Create output
Close and open Abaqus CAE To restart the recording of the script . Through the top menu File, And then click Open Select under the working directory EXAMPLE.odb file . We will use the same method as creating a script file for the model . The most important difference is that what you do is recorded in Abaqus.rpy Files, not Abaqus.jnl, Let's create a stress diagram in a deformed state . Follow these steps :
- Draw the stress under deformation . Now through the... In the top menu File People on the menu Print Save the picture as EXAMPLE, The format of the picture is tiff.
You don't have to save odb file . If it's starting Abaqus CAE In the initial working directory of , You cannot find Abaqus.rpy, Then look in your working directory .
Create the first script for the output database
Save the file Abaqus.rpy by EXAMPLE.py. See the attachment for the contents of this script . The following is a short sort of script files .
from abaqus import *
from abaqusConstants import *
session.Viewport(name=’Viewport: 1’, origin=(0.0, 0.0), width=268.952117919922,
height=154.15299987793)
session.viewports[’Viewport: 1’].makeCurrent()
session.viewports[’Viewport: 1’].maximize()
executeOnCaeStartup()
o1 = session.openOdb(name=’/home/overveld/ScriptManual/EXAMPLE.odb’)
session.viewports[’Viewport: 1’].setValues(displayedObject=o1)
These commands import some modules , Create a viewport and open odb.
session.viewports[’Viewport: 1’].odbDisplay.display.setValues(plotState=(
CONTOURS_ON_DEF, ))
session.printToFile(fileName=’EXAMPLE’, format=TIFF, canvasObjects=(
session.viewports[’Viewport: 1’], ))
These commands will display the stress set to the deformed shape , And save the image . See the attachment for the final script file output .
Examples of adjusting script files for different purposes
I will give an example of adjusting the script . I will adjust :
- Do not use fixed values to create parts , I will define the shape by changing the two constants at the beginning of the script file .
- I will merge mdb and odb Script files .
I will add files to the attachment and highlight the differences . I will not explain in detail the differences I have made . Knowing this is part of your training .
I won't pass this time GUI Run script , I will run it directly from the terminal . We can use two different commands :
abaqus cae script=EXAMPLE MDB.py
abaqus cae noGUI=EXAMPLE MDB.py
The first line opens abaqus cae, You will be able to see how it works . The last line will be at no GUI In the case of abaqus, You will only get results .
Continue to use the instructions of the script
By now you should be familiar with the working methods : Give Way Abaqus Finish all the difficult work , Organize files and re run . I also hope I didn't lie , It has taken you an hour or less to get here . I want to end this manual with some useful tips :
- If you use python Languages and scripts , You will get used to it . This is the best way to learn it . I spent it. 2.5 I wrote a manual in six months .
- You can find a lot about python Information about . Google is a useful tool . You will find that there is less about scripting , But please try to visit the following website :http://abaqusdoc.ucalgary.ca/v6.9/. You can find complete references to all script commands .
- Try from MATLAB call Abaqus CAE. This will add a big math toolbox for you . Try the following command :
– unix([abaqus cae script=EXAMPLE MDB.py])
– system([abaqus cae script=EXAMPLE MDB.py])
The attachment
first EXAMPLE_MDB.py
# -*- coding: mbcs -*-
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
mdb.models[’Model-1’].ConstrainedSketch(name=’__profile__’, sheetSize=20.0)
mdb.models[’Model-1’].sketches[’__profile__’].rectangle(point1=(-5.0, -1.0),
point2=(5.0, 1.0))
mdb.models[’Model-1’].Part(dimensionality=TWO_D_PLANAR, name=’Part-1’, type=
DEFORMABLE_BODY)
mdb.models[’Model-1’].parts[’Part-1’].BaseShell(sketch=
mdb.models[’Model-1’].sketches[’__profile__’])
del mdb.models[’Model-1’].sketches[’__profile__’]
mdb.models[’Model-1’].Material(name=’Material-1’)
mdb.models[’Model-1’].materials[’Material-1’].Elastic(table=((1000000000.0,
0.3), ))
mdb.models[’Model-1’].HomogeneousSolidSection(material=’Material-1’, name=
’Section-1’, thickness=None)
mdb.models[’Model-1’].parts[’Part-1’].SectionAssignment(offset=0.0,
offsetField=’’, offsetType=MIDDLE_SURFACE, region=Region(
faces=mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667,
-0.333333, 0.0), (0.0, 0.0, 1.0)), )), sectionName=’Section-1’)
mdb.models[’Model-1’].parts[’Part-1’].Set(edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-5.0, -0.5, 0.0), )),
name=’Set-1’)
mdb.models[’Model-1’].parts[’Part-1’].Surface(name=’Surf-1’, side1Edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-2.5, 1.0, 0.0), )))
mdb.models[’Model-1’].parts[’Part-1’].setMeshControls(elemShape=QUAD, regions=
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667, -0.333333,
0.0), )), technique=STRUCTURED)
mdb.models[’Model-1’].parts[’Part-1’].setElementType(elemTypes=(ElemType(
elemCode=CPS8R, elemLibrary=STANDARD), ElemType(elemCode=CPS6M,
elemLibrary=STANDARD)), regions=(
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667, -0.333333,
0.0), )), ))
mdb.models[’Model-1’].parts[’Part-1’].seedPart(deviationFactor=0.1, size=0.5)
mdb.models[’Model-1’].parts[’Part-1’].generateMesh()
mdb.models[’Model-1’].rootAssembly.DatumCsysByDefault(CARTESIAN)
mdb.models[’Model-1’].rootAssembly.Instance(dependent=ON, name=’Part-1-1’,
part=mdb.models[’Model-1’].parts[’Part-1’])
mdb.models[’Model-1’].rootAssembly.regenerate()
mdb.models[’Model-1’].StaticStep(initialInc=0.1, maxInc=0.1, name=’Step-1’,
previous=’Initial’)
mdb.models[’Model-1’].DisplacementBC(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, fieldName=’’, fixed=OFF, localCsys=None, name=
’BC-1’, region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].sets[’Set-1’], u1=
0.0, u2=0.0, ur3=0.0)
mdb.models[’Model-1’].Pressure(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, field=’’, magnitude=-100000.0, name=’Load-1’,
region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].surfaces[’Surf-1’])
mdb.Job(contactPrint=OFF, description=’’, echoPrint=OFF, explicitPrecision=
SINGLE, historyPrint=OFF, memory=90, memoryUnits=PERCENTAGE, model=
’Model-1’, modelPrint=OFF, multiprocessingMode=DEFAULT, name=’EXAMPLE’,
nodalOutputPrecision=SINGLE, numCpus=1, numDomains=1,
parallelizationMethodExplicit=DOMAIN, scratch=’’, type=ANALYSIS,
userSubroutine=’’)
mdb.jobs[’EXAMPLE’].submit(consistencyChecking=OFF)
mdb.jobs[’EXAMPLE’]._Message(STARTED, {
’phase’: BATCHPRE_PHASE,
’clientHost’: ’wumpus.seas.harvard.edu’, ’handle’: 0,
’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(WARNING, {
’phase’: BATCHPRE_PHASE,
’message’: ’DEGREE OF FREEDOM 6 IS NOT ACTIVE IN THIS MODEL AND CAN NOT BE RESTRAINED’,
’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(ODB_FILE, {
’phase’: BATCHPRE_PHASE,
’file’: ’/home/overveld/ScriptManual/EXAMPLE.odb’, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(COMPLETED, {
’phase’: BATCHPRE_PHASE,
’message’: ’Analysis phase complete’, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STARTED, {
’phase’: STANDARD_PHASE,
’clientHost’: ’wumpus.seas.harvard.edu’, ’handle’: 0,
’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STEP, {
’phase’: STANDARD_PHASE, ’stepId’: 1,
’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 0, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.0, ’attempts’: 0,
’timeIncrement’: 0.1, ’increment’: 0, ’stepTime’: 0.0, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 0,
’phase’: STANDARD_PHASE, ’equilibrium’: 0})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 1, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.1, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 1, ’stepTime’: 0.1, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 2, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.2, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 2, ’stepTime’: 0.2, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 3, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.3, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 3, ’stepTime’: 0.3, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 4, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.4, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 4, ’stepTime’: 0.4, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 5, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.5, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 5, ’stepTime’: 0.5, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 6, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.6, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 6, ’stepTime’: 0.6, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 7, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.7, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 7, ’stepTime’: 0.7, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 8, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.8, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 8, ’stepTime’: 0.8, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 9, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 0.9, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 9, ’stepTime’: 0.9, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(ODB_FRAME, {
’phase’: STANDARD_PHASE, ’step’: 0,
’frame’: 10, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(STATUS, {
’totalTime’: 1.0, ’attempts’: 1,
’timeIncrement’: 0.1, ’increment’: 10, ’stepTime’: 1.0, ’step’: 1,
’jobName’: ’EXAMPLE’, ’severe’: 0, ’iterations’: 1,
’phase’: STANDARD_PHASE, ’equilibrium’: 1})
mdb.jobs[’EXAMPLE’]._Message(END_STEP, {
’phase’: STANDARD_PHASE, ’stepId’: 1,
’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(COMPLETED, {
’phase’: STANDARD_PHASE,
’message’: ’Analysis phase complete’, ’jobName’: ’EXAMPLE’})
mdb.jobs[’EXAMPLE’]._Message(JOB_COMPLETED, {
’time’: ’Wed Nov 17 21:09:11 2010’, ’jobName’: ’EXAMPLE’})
# Save by overveld on Wed Nov 17 21:09:48 2010
The final EXAMPLE_MDB.py
#load modulus
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
### PART ###
mdb.models[’Model-1’].ConstrainedSketch(name=’__profile__’, sheetSize=20.0)
mdb.models[’Model-1’].sketches[’__profile__’].rectangle(point1=(-5.0, -1.0),
point2=(5.0, 1.0))
mdb.models[’Model-1’].Part(dimensionality=TWO_D_PLANAR, name=’Part-1’, type=
DEFORMABLE_BODY)
mdb.models[’Model-1’].parts[’Part-1’].BaseShell(sketch=
mdb.models[’Model-1’].sketches[’__profile__’])
del mdb.models[’Model-1’].sketches[’__profile__’]
### MATERIAL & SECTION ###
mdb.models[’Model-1’].Material(name=’Material-1’)
mdb.models[’Model-1’].materials[’Material-1’].Elastic(table=((1000000000.0,
0.3), ))
mdb.models[’Model-1’].HomogeneousSolidSection(material=’Material-1’, name=
’Section-1’, thickness=None)
mdb.models[’Model-1’].parts[’Part-1’].SectionAssignment(offset=0.0,
offsetField=’’, offsetType=MIDDLE_SURFACE, region=Region(
faces=mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667,
-0.333333, 0.0), (0.0, 0.0, 1.0)), )), sectionName=’Section-1’)
### SET & SURFACE ###
mdb.models[’Model-1’].parts[’Part-1’].Set(edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-5.0, -0.5, 0.0), )),
name=’Set-1’)
mdb.models[’Model-1’].parts[’Part-1’].Surface(name=’Surf-1’, side1Edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-2.5, 1.0, 0.0), )))
### MESH ###
mdb.models[’Model-1’].parts[’Part-1’].setMeshControls(elemShape=QUAD, regions=
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667, -0.333333,
0.0), )), technique=STRUCTURED)
mdb.models[’Model-1’].parts[’Part-1’].setElementType(elemTypes=(ElemType(
elemCode=CPS8R, elemLibrary=STANDARD), ElemType(elemCode=CPS6M,
elemLibrary=STANDARD)), regions=(
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((-1.666667, -0.333333,
0.0), )), ))
mdb.models[’Model-1’].parts[’Part-1’].seedPart(deviationFactor=0.1, size=0.5)
mdb.models[’Model-1’].parts[’Part-1’].generateMesh()
### ASSEMBLY ###
mdb.models[’Model-1’].rootAssembly.DatumCsysByDefault(CARTESIAN)
mdb.models[’Model-1’].rootAssembly.Instance(dependent=ON, name=’Part-1-1’,
part=mdb.models[’Model-1’].parts[’Part-1’])
mdb.models[’Model-1’].rootAssembly.regenerate()
### STEP, BC & LOAD ###
mdb.models[’Model-1’].StaticStep(initialInc=0.1, maxInc=0.1, name=’Step-1’,
previous=’Initial’)
mdb.models[’Model-1’].DisplacementBC(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, fieldName=’’, fixed=OFF, localCsys=None, name=
’BC-1’, region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].sets[’Set-1’], u1=
0.0, u2=0.0, ur3=0.0)
mdb.models[’Model-1’].Pressure(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, field=’’, magnitude=-100000.0, name=’Load-1’,
region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].surfaces[’Surf-1’])
### JOB & CALCULATE ###
mdb.Job(contactPrint=OFF, description=’’, echoPrint=OFF, explicitPrecision=
SINGLE, historyPrint=OFF, memory=90, memoryUnits=PERCENTAGE, model=
’Model-1’, modelPrint=OFF, multiprocessingMode=DEFAULT, name=’EXAMPLE’,
nodalOutputPrecision=SINGLE, numCpus=1, numDomains=1,
parallelizationMethodExplicit=DOMAIN, scratch=’’, type=ANALYSIS,
userSubroutine=’’)
mdb.jobs[’EXAMPLE’].submit(consistencyChecking=OFF)
first EXAMPLE_ODB.py
# -*- coding: mbcs -*-
#
# Abaqus/CAE Version 6.8-2 replay file
# Internal Version: 2008_07_21-07.21.56 87172
# Run by overveld on Wed Nov 17 23:00:22 2010
#
# from driverUtils import executeOnCaeGraphicsStartup
# executeOnCaeGraphicsStartup()
#: Executing "onCaeGraphicsStartup()" in the site directory ...
from abaqus import *
from abaqusConstants import *
session.Viewport(name=’Viewport: 1’, origin=(0.0, 0.0), width=268.952117919922,
height=154.15299987793)
session.viewports[’Viewport: 1’].makeCurrent()
session.viewports[’Viewport: 1’].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
o1 = session.openOdb(name=’/home/overveld/EXAMPLE.odb’)
session.viewports[’Viewport: 1’].setValues(displayedObject=o1)
#: Model: /home/overveld/EXAMPLE.odb
#: Number of Assemblies: 1
#: Number of Assembly instances: 0
#: Number of Part instances: 1
#: Number of Meshes: 1
#: Number of Element Sets: 2
#: Number of Node Sets: 2
#: Number of Steps: 1
session.viewports[’Viewport: 1’].odbDisplay.display.setValues(plotState=(
CONTOURS_ON_DEF, ))
session.printToFile(fileName=’EXAMPLE’, format=TIFF, canvasObjects=(
session.viewports[’Viewport: 1’], ))
The final EXAMPLE_ODB.py
#open modulus, create viewport and open odb
from abaqus import *
from abaqusConstants import *
session.Viewport(name=’Viewport: 1’, origin=(0.0, 0.0), width=268.952117919922,
height=154.15299987793)
session.viewports[’Viewport: 1’].makeCurrent()
session.viewports[’Viewport: 1’].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
o1 = session.openOdb(name=’/home/overveld/EXAMPLE.odb’)
session.viewports[’Viewport: 1’].setValues(displayedObject=o1)
### CREATE OUTPUT ###
session.viewports[’Viewport: 1’].odbDisplay.display.setValues(plotState=(
CONTOURS_ON_DEF, ))
session.printToFile(fileName=’EXAMPLE’, format=TIFF, canvasObjects=(
session.viewports[’Viewport: 1’], ))
Adjusted EXAMPLE_MDB.py
#load modulus
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
height=0.2 ####################change
width=0.1 ####################change
### PART ###
mdb.models[’Model-1’].ConstrainedSketch(name=’__profile__’, sheetSize=20.0)
mdb.models[’Model-1’].sketches[’__profile__’].rectangle(point1=(-width/2.0, -height/2.0),
point2=(width/2.0, height/2.0)) ####################change
mdb.models[’Model-1’].Part(dimensionality=TWO_D_PLANAR, name=’Part-1’, type=
DEFORMABLE_BODY)
mdb.models[’Model-1’].parts[’Part-1’].BaseShell(sketch=
mdb.models[’Model-1’].sketches[’__profile__’])
del mdb.models[’Model-1’].sketches[’__profile__’]
### MATERIAL & SECTION ###
mdb.models[’Model-1’].Material(name=’Material-1’)
mdb.models[’Model-1’].materials[’Material-1’].Elastic(table=((1000000000.0,
0.3), ))
mdb.models[’Model-1’].HomogeneousSolidSection(material=’Material-1’, name=
’Section-1’, thickness=None)
mdb.models[’Model-1’].parts[’Part-1’].SectionAssignment(offset=0.0,
offsetField=’’, offsetType=MIDDLE_SURFACE, region=Region(
faces=mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((0.0,
0.0, 0.0), (0.0, 0.0, 1.0)), )), sectionName=’Section-1’) #####################change
### SET & SURFACE ###
mdb.models[’Model-1’].parts[’Part-1’].Set(edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-width/2.0, -height/4.0, 0.0), )),
name=’Set-1’) ####################change
mdb.models[’Model-1’].parts[’Part-1’].Surface(name=’Surf-1’, side1Edges=
mdb.models[’Model-1’].parts[’Part-1’].edges.findAt(((-width/4.0, height/2.0, 0.0), ))) ####################change
### MESH ###
mdb.models[’Model-1’].parts[’Part-1’].setMeshControls(elemShape=QUAD, regions=
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((0.0, 0.0,
0.0), )), technique=STRUCTURED) ####################change
mdb.models[’Model-1’].parts[’Part-1’].setElementType(elemTypes=(ElemType(
elemCode=CPS8R, elemLibrary=STANDARD), ElemType(elemCode=CPS6M,
elemLibrary=STANDARD)), regions=(
mdb.models[’Model-1’].parts[’Part-1’].faces.findAt(((0.0, 0.0,
0.0), )), )) ####################change
mdb.models[’Model-1’].parts[’Part-1’].seedPart(deviationFactor=0.1, size=height/4) ####################change
mdb.models[’Model-1’].parts[’Part-1’].generateMesh()
### ASSEMBLY ###
mdb.models[’Model-1’].rootAssembly.DatumCsysByDefault(CARTESIAN)
mdb.models[’Model-1’].rootAssembly.Instance(dependent=ON, name=’Part-1-1’,
part=mdb.models[’Model-1’].parts[’Part-1’])
mdb.models[’Model-1’].rootAssembly.regenerate()
### STEP, BC & LOAD ###
mdb.models[’Model-1’].StaticStep(initialInc=0.1, maxInc=0.1, name=’Step-1’,
previous=’Initial’)
mdb.models[’Model-1’].DisplacementBC(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, fieldName=’’, fixed=OFF, localCsys=None, name=
’BC-1’, region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].sets[’Set-1’], u1=
0.0, u2=0.0, ur3=0.0)
mdb.models[’Model-1’].Pressure(amplitude=UNSET, createStepName=’Step-1’,
distributionType=UNIFORM, field=’’, magnitude=-100000.0, name=’Load-1’,
region=
mdb.models[’Model-1’].rootAssembly.instances[’Part-1-1’].surfaces[’Surf-1’])
### JOB & CALCULATE ###
mdb.Job(contactPrint=OFF, description=’’, echoPrint=OFF, explicitPrecision=
SINGLE, historyPrint=OFF, memory=90, memoryUnits=PERCENTAGE, model=
’Model-1’, modelPrint=OFF, multiprocessingMode=DEFAULT, name=’EXAMPLE’,
nodalOutputPrecision=SINGLE, numCpus=1, numDomains=1,
parallelizationMethodExplicit=DOMAIN, scratch=’’, type=ANALYSIS,
userSubroutine=’’)
mdb.jobs[’EXAMPLE’].submit(consistencyChecking=OFF)
mdb.jobs[’EXAMPLE’].waitForCompletion() ####################change
### OUPUT ###
execfile(’EXAMPLE_ODB.py’) ####################change
边栏推荐
猜你喜欢

软件问题修复跟踪系统实战开发教程(上篇)

小程序中的分页查询

动态规划 --- 数位统计DP

我在上海偶遇数字凤凰#坐标徐汇美罗城

LabVIEW Linx toolkit controls Arduino equipment (expansion-1)

深入理解Istio流量管理的熔断配置

Zhengda cup hacker marathon data analysis competition

Paging query in applet

I can only sell the company after the capital has been "cut off" for two years

leetcode 题目
随机推荐
PHP about problems such as memory overflow timeout caused by large amount of data exporting or traversing data
Leetcode topic
HyperMesh运行脚本文件的几种方法
"Wei Lai Cup" 2022 Niuke summer multi school training camp 3 j.journey 0-1 shortest path
Reentrant and non reentrant
Li Hongyi, machine learning 5. Tips for neural network design
学会使用MySQL的Explain执行计划,SQL性能调优从此不再困难
nowcode-学会删除链表中重复元素两题(详解)
HM二次开发 - Data Names及其使用
QT QString详解
leetcode 题目
KubeEdge发布云原生边缘计算威胁模型及安全防护技术白皮书
5 亿用户,比微信还早四年……这个运营了 15 年的 APP 即将永久停服
信号屏蔽与处理
Numpy ndarray learning < II > miscellaneous records
Deeply understand the fusing configuration of istio traffic management
在abaqus中使用PyQt设计GUI
配置web服务器步骤详细记录(多有借鉴)
Sort 5-count sort
el-input限制只能输入规定的数