inpRW Utility Introduction¶
inpRW is a collection of Python modules for parsing, modifying, and writing Abaqus input files.
Requires: Python 3.7+, numpy, scipy
Project Overview¶
The module will parse the data in an Abaqus input file to Python objects, which allows a script to recognize values in an input file.
For example, keyword blocks, comments, and data lines are treated separately rather than as a large block of text.
There are several functions built in to modify the input file data. Here are some examples of functions built-in to inpRW:
Reorganize step data so multiple nonlinear steps can be reconfigured to a *MANIFEST simulation.
Generate dictionaries containing all the nodes and elements in a model, allowing a script to quickly look up their properties.
Insert, delete, and replace keyword blocks.
Find a keyword block using the keyword name and specific parameters.
Find all references to nodes and elements
Envisioned uses:
Powerful keywords editor for 3DEXPERIENCE input files, or any input file that needs changes not supported by a GUI.
Intended Users:
Field engineers or customers with Python scripting experience.
Availability:
inpRW is distributed through the SIMULIA Community, specifically the inpRW Main Page.
Project Goals¶
Parse an input file to make the data contained therein usable to Python, while storing the original formatting.
Be able to parse every Abaqus keyword type
- Write out an input file from the inp object that is identical to the original input file, except for any changes the user makes
Optional, can be disabled for better performance.
Add functions to help the user find data in the input file.
Add functions to help the user modify data in the input file.
Provide the user the same flexibility Abaqus provides (case-insensitivity, space-insensitivity) without modifying the data.
Give users the ability to easily extend the
inpRWclass with their own functions.
Important Limitations¶
inpRW is meant to parse every Abaqus keyword type. However, it does not yet meet this lofty goal. It has focused on parsing input files 3DEXPERIENCE can write. If inpRW cannot fully parse a keyword, it will still read and write those keywords accurately, it just does not take the appropriate actions when it encounters some keywords. The following is a partial list of the most notable keyword blocks which are not fully supported:
- *SYSTEM
Nodal coordinates won’t be reported transformed into the active system.
- *NGEN, *ELGEN, *NFILL, etc.
The entities created by these keywords won’t be accessible.
These limitations will most likely be addressed in the future. For now, you can work around them by utilizing flattened input files, which will remove the preceding keywords and generate an equivalent input file. To create and save a flattened input file, you can add the following code to an abaqus_v6.env file prior to running a datacheck or full analysis on the input file:
print_flattened_file=ON
def onJobCompletion():
from os import path, system, lstat, listdir
import osutils
if path.exists('%s_f.inp' % id):
src='%s_f.inp'%(id)
dest=savedir
osutils.copy(src,dest)
The preceding code will create a input file named “JOBNAME_f.inp”. This will be the flattened input file, which removes the above problematic keywords for inpRW.
For more information on modifying the Abaqus environment files, see section Using the Abaqus environment files of the Abaqus Installation, Licensing & Configuration guide.
Projects Which Used inpRW¶
Convert step data to *MANIFEST input files
Convert *RELEASE to connector element equivalent
Generate hydro-dynamic load fields
Integrate with new Keyword Edit feature of 3DEXPERIENCE
Cut an input file by keeping only the nodes corresponding to a particular nodeset, deleting all features that reference deleted nodes.
Data Structure¶
When an input file is parsed, it creates an inpRW instance. An inpRW instance contains many attributes
and functions, all of which are fully documented in the API Reference section. Here’s an outline of how inpRW
organizes the parsed keyword blocks. This only shows select attributes of the class.
inp (inpRW)├── keywords (inpKeywordSequence)│ ├── keyword (inpKeyword)│ │ ├── name (str)│ │ ├── parameter (csid)│ │ ├── comments (list)│ │ ├── path (str)│ │ └── suboptions (inpKeywordSequence)│ │ └── keyword (inpKeyword)│ │ └── ...│ └── keyword (inpKeyword)│ └── ...├── nd (TotalNodeMesh)├── ed (TotalElementMesh)├── kwg (csid)├── steps (csid)├── jobSuffix (str)├── inputFolder (str)├── inpKeywordArgs (dict)└── outputFolder (str)Project Structure¶
inpRWis composed of the following sub-modules:There are several other modules used by this class, but are not directly part of the class:
Documentation Conventions¶
Functions and attributes which start with “_” are hidden and are mainly used as internal functions of
inpRW. They are not meant to be called by the end-user. They are documented here for completion and in case they might prove useful for some workflow.Italics will refer to a parameter[1] of a Python function.
For a term that can have multiple definitions, ‘[#]’ refers to the entry to which the term is referring.
Abaqus keyword names will be displayed as such: *STEP. Similarly, Abaqus keyword parameters[2] will be in all caps (i.e. NLGEOM).
The term “inp” will almost always be shorthand to refer to an instance of
inpRW.