Abaqus Scripting Seminar Oct1st

Share Embed Donate


Short Description

Abaqus Scripting Seminar...

Description

3DS.COM © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Enhance your productivity by using Abaqus Scripting

Shikta Mishra Technical Specialist, Simulia Central

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Agenda

2

Motivation Python Basics Abaqus Python Abaqus Object Model Plug-ins Demonstration: RSG Dialog Builder

3

 Automate

repetitive tasks



Model building



Job submission and monitoring



Postprocessing



Prescribe default behavior

 Extend

functionality

 Enhance

the interface



Graphical



Nongraphical

Provides automated environment for experienced analysts Customized versions of Abaqus provide an effective analysis tool for a wide range of user expertise …

Customized application

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Motivation: why customize Abaqus?

Provides advanced analysis functionality to non-FEA users

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Why Python?

4

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Scripting Language v/s Programming Language

5

Scripting Language

Programming Language

High Level (# Instr/Stmnt)

Low Level (# Instr/Stmnt)

Weakly Typed

Strongly Typed

Rapid Development

Rapid Run-Time

Examples: Python, Tcl, Perl, etc

Examples: C, C++, Fortran, etc

This information is taken from Scripting: Higher Level Programming for the 21st Century by Ousterhout J.K.

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Python Syntax

6

Example using common syntax rules: Comments start with # and continue to the end of the line # simple example max = 5; i = 0 x, y, z = 1, 2, 3 Indentation delimits blocks (such as loops) The amount of indentation is arbitrary but must be consistent for a block

Semicolon for two statements

blank lines ignored while i >>

import sys >>> sys.version '2.7.3 (default, May

1 2014, 02:56:01) [MSC v.1600 64 bit (AMD64)]'

To quit python interpreter from a command prompt use: Ctrl Z – Enter (for windows) Or Ctrl D ( for unix) 9

3DS.COM © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Running Python abaqus cae startup = myscript.py abaqus cae script = myscript.py abaqus viewer startup = myscript.py

Running Python

You may not bypass the Abaqus/CAE kernel like this: abaqus python myscript.py abaqus script myscript.py

10

Abaqus Scripting Interface Basics 3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Abaqus/CAE

1 GUI

2

command line interface (CLI) commands Python interpreter

Abaqus/CAE kernel input file Abaqus/Standard Abaqus/Explicit

output database file

11

3 script

replay files

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Building Scripts

12

Macro Manager Abaqus Replay(.rpy) File

abaqus.rpy

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Replay File Example

13

Creating a script that rotates the model in current display Steps: 1) In Abaqus/CAE rotate the model by a specifying an increment in the dialog box. session.currentViewportName.view.rotate(xAngle=10, yAngle=0,zAngle=0,mode=MODEL)

2) Cut and paste this command into a new text file. Add a Python statement to loop over the command: for x in range(36): session.currentViewportName.view.rotate(xAngle=10, yAngle=0,zAngle=0, mode=MODEL)

3) Save the script as rotate.py.

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Replay File Example

14

4) Run Script

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Integrated Development Environment : Abaqus PDE

15



The IDE built into Abaqus is known as Abaqus Python Development Environment (PDE)  Separate application  Accessible from  Step through a

within Abaqus/CAE or independently

Python script running in the Abaqus/CAE

kernel or GUI  Debug Python script

or plug-in

Abaqus Object Model

Object 2

Object 1

Object 3

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Object 4

16

 The Abaqus  The

Object 5

Scripting Interface extends Python with new types of objects.

hierarchy and the relationship between these objects is called the Abaqus Object model.

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Abaqus Object Model  The

object model describes the relationships between objects. A Part owns features, datums, etc.

A Model owns parts

 Use commands

to access objects by stepping through the hierarchy of objects in the

object model cell4 = mdb.models['block'].parts['crankcase'].cells[4] Variable cell4 Model database mdb

17

model named block

part named crankcase

cell with index 4

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Abaqus Object Model  Object Attributes : Members and Methods

 Identifying Constructors and Repositories p = mdb.models['Model-1'].Part(name='Part-1', dimensionality=THREE_D, type=DEFORMABLE_BODY)

The path to the constructor is mdb.models['Model-1'].Part

The new Part object is placed into the parts repository mdb.models['Model-1'].parts['Part-1']

18

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Postprocessing with Abaqus Scripting  Output Database Object Model  Contains  Results  The

data in the ODB are categorized as Field Data or History Data.

Odb object is normally available from inside or outside of Abaqus/Viewer or Abaqus/CAE.

Field Data

History Data 19

model data and results data

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Postprocessing with Abaqus Scripting Interface

20



In this example a kernel script has been developed to interact with an output database file through the Abaqus Scripting Interface



The script searches for the maximum value of von Mises stress on a certain model component.

Job Submission 3DS.COM © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

 Example: Auto submit three Abaqus jobs, one-at-a-time

21

 Method

#1: Run stand-alone script from the system command line

# scr_auto_run1.py import os

Same behavior

jobs=['auto_job1', 'auto_job2', 'auto_job3'] path = 'C:\\Abaqus6\\Commands\\abq6141' #path = r'C:\Abaqus6\Commands\abq6141' #path = 'C:/Abaqus6/Commands/abq6141' for job in jobs: print 'job:', job cmd = '%s job=%s inter' % (path, job) os.system(cmd)

Job Submission 3DS.COM © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

 Example: Auto submit three Abaqus jobs, one-at-a-time (cont’d)

22

 Method

#2: Run stand-alone script from the Abaqus/CAE CLI.

# scr_auto_run2.py import job jobs=['auto_job1', 'auto_job2', 'auto_job3'] for job in jobs: job = mdb.JobFromInputFile( name = job, inputFileName = job + '.inp', type = ANALYSIS) job.submit() job.waitForCompletion()

Setting Abaqus Defaults 3DS.COM © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

 Abaqus Environment file (abaqus_v6.env) can contain abaqus scripting interface

commands  onCaeStartup() 

function

Example: Auto create materials upon opening a CAE session def onCaeStartup(): # Material properties - read them from a file execfile('my_material_library.py')

 onJobStartup()

function def onJobStartup(): print 'The job is starting'

 onJobCompletion()

function

def onJobCompletion (): print 'The result files have been copied to workdir'

23

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Plug-ins

24

What is a plug-in? An Abaqus plug-in is a piece of software that is automatically installed into Abaqus/CAE to extend its functionality. Kernel Plug-in

GUI Plug-in

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Resources

25

 Knowledge Base Article QA00000008694 (DSx.Client Care:

www.3ds.com/support/knowledge-base) contains a list of SIMULIA supplied plugins.

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

Really Simple GUI

26

 It

is an Abaqus/CAE plug-in



Plug-ins → Abaqus → RSG Dialog Builder

 Interactive

 Includes

 Layout

tool for building a Graphical User Interface (GUI)

widgets (controls)

managers for controlling the look of the dialog box

3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

RSG Demonstration

27

Text entry boxes for dimensions and load

Diagram showing definitions

Hit OK to build model, analyze, and display results, this executes the kernel script

Next steps … 3DS.COM/SIMULIA © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014



28

• • • • •

Find all the upcoming eSeminars from SIMULIA home page eSeminar Replay: Watch for email with details Register for a Training Class 3ds.com/simulia-training Find all eSeminar replay since 2014 in 3ds.com/slc Register and Attend RUMs 3ds.com/simulia/ Follow us on Social Media: @3DS_SIMULIA

29

3DS.COM © Dassault Systèmes | Confidential Information | 10/6/2015 | ref.: 3DS_Document_2014

View more...

Comments

Copyright ©2017 KUPDF Inc.