41. fe_abq — Exporting finite element models in Abaqus™ input file format.
Exporting finite element models in Abaqus™ input file format.
This module provides functions and classes to export finite element models
from pyFormex in the Abaqus™ input format (.inp).
The exporter handles the mesh geometry as well as model, node and element
properties gathered in a PropertyDB database (see module
properties).
While this module provides only a small part of the Abaqus input file format,
it suffices for most standard jobs. While we continue to expand the interface,
depending on our own necessities or when asked by third parties, we do not
intend to make this into a full implementation of the Abaqus input
specification. If you urgently need some missing function, there is always
the possibility to edit the resulting text file or to import it into the
Abaqus environment for further processing.
The module provides two levels of functionality: on the lowest level, there
are functions that just generate a part of an Abaqus input file, conforming
to the Abaqus™ Keywords manual.
Then there are higher level functions that read data from the property module
and write them to the Abaqus input file and some data classes to organize all
the data involved with the finite element model.
Classes defined in module fe_abq
-
class fe_abq.Step(analysis='STATIC', time=[0.0, 0.0, 0.0, 0.0], nlgeom='NO', tags=None, inc=None, sdi=None, timeinc=None, buckle='SUBSPACE', incr=0.10000000000000001, name=None, bulkvisc=None, out=None, res=None)
The basic logical unit in the simulation history.
In Abaqus, a step is the smallest logical entity in the simulation
history. It is typically a time step in a dynamic simulation, but it
can also describe different loading states in a (quasi-)static simulation.
Our Step class holds all the data describing the global step parameters.
It combines the Abaqus ‘STEP’, ‘STATIC’, ‘DYNAMIC’ and ‘BUCKLE’ keyword
commands (and even some more global parameter setting commands).
Parameters:
- analysis: the analysis type, one of: ‘STATIC’, ‘DYNAMIC’, ‘EXPLICIT’,
‘PERTURBATION’, ‘BUCKLE’, ‘RIKS’
- time: either
- a single float value specifying the step time,
- a list of 4 values: time inc, step time, min. time inc, max. time inc
- for LANCZOS: a list of 5 values
- for RIKS: a list of 8 values
In most cases, only the step time should be specified.
- nlgeom: ‘YES’ ot ‘NO’ (default)
If ‘YES’, the analysis will be geometrically non-linear. Analysis type
‘RIKS’ always sets nlgeom to ‘YES’, ‘BUCKLE’ sets it to ‘NO’,
‘PERTURBATION’ ignores nlgeom.
- tags: a list of property tags to include in this step.
If specified, only the property records having one of the listed values
as their tag attribute will be included in this step.
- inc: the maximum number of increments in a step (the default is 100)
- sdi: determines how severe discontinuities are accounted for
- timeinc:
- buckle: specifies the BUCKLE type: ‘SUBSPACE’ or ‘LANCZOS’
- incr: the increment in ‘RIKS’ type
- bulkvisc: a list of two floats (default: [0.06,1.2]), only used
in Explicit steps.
- out and res: specific output/result records for this step. They
come in addition to the global ones.
Methods
-
write(fil, propDB, out=[], res=[], resfreq=1, timemarks=False)
Write a load step.
propDB is the properties database to use.
Except for the step data itself, this will also write the passed
output and result requests.
out is a list of Output-instances.
res is a list of Result-instances.
resfreq and timemarks are global values only used by Explicit
-
class fe_abq.Output(kind=None, keys=None, set=None, type='FIELD', variable='PRESELECT', extra='', **options)
A request for output to .odb and history.
Parameters:
- type: ‘FIELD’ or ‘HISTORY’
- kind: None, ‘NODE’, or ‘ELEMENT’ (first character suffices)
- extra: an extra string to be added to the command line. This
allows to add Abaqus options not handled by this constructor.
The string will be appended to the command line preceded by a comma.
For kind==’‘:
- variable: ‘ALL’, ‘PRESELECT’ or ‘’
For kind==’NODE’ or ‘ELEMENT’:
- keys: a list of output identifiers (compatible with kind type)
- set: a single item or a list of items, where each item is either
a property number or a node/element set name for which the results
should be written. If no set is specified, the default is ‘Nall’
for kind==’NODE’ and ‘Eall’ for kind=’ELEMENT’
Methods
-
fmt()
Format an output request.
Return a string with the formatted output command.
-
class fe_abq.Result(kind, keys, set=None, output='FILE', freq=1, time=False, **kargs)
A request for output of results on nodes or elements.
Parameters:
- kind: ‘NODE’ or ‘ELEMENT’ (first character suffices)
- keys: a list of output identifiers (compatible with kind type)
- set: a single item or a list of items, where each item is either
a property number or a node/element set name for which the results
should be written. If no set is specified, the default is ‘Nall’
for kind==’NODE’ and ‘Eall’ for kind=’ELEMENT’
- output is either FILE (for .fil output) or PRINT (for .dat
output)(Abaqus/Standard only)
- freq is the output frequency in increments (0 = no output)
Extra keyword arguments are available: see the writeNodeResults and
writeElemResults methods for details.
Methods
-
class fe_abq.AbqData(model, prop, nprop=None, eprop=None, steps=[], res=[], out=[], bound=None)
Contains all data required to write the Abaqus input file.
- model : a Model instance.
- prop : the Property database.
- steps : a list of Step instances.
- res : a list of Result instances.
- out : a list of Output instances.
- bound : a tag or alist of the initial boundary conditions.
The default is to apply ALL boundary conditions initially.
Specify a (possibly non-existing) tag to override the default.
Methods
-
write(jobname=None, group_by_eset=True, group_by_group=False, header='', create_part=False)
Write an Abaqus input file.
- jobname : the name of the inputfile, with or without ‘.inp’
extension. If None is specified, the output is written to sys.stdout
An extra header text may be specified.
- create_part : if True, the model will be created as an Abaqus Part,
followed by and assembly of that part.
Functions defined in module fe_abq
-
fe_abq.abqInputNames(job)
Returns corresponding Abq jobname and input filename.
job can be either a jobname or input file name, with or without
directory part, with or without extension (.inp)
The Abq jobname is the basename without the extension.
The abq filename is the abspath of the job with extension ‘.inp’
-
fe_abq.nsetName(p)
Determine the name for writing a node set property.
-
fe_abq.esetName(p)
Determine the name for writing an element set property.
-
fe_abq.fmtCmd(cmd='*')
Format a command.
-
fe_abq.fmtData1D(data, npl=8, sep=', ', linesep='\n')
Format numerical data in lines with maximum npl items.
data is a numeric array. The array is flattened and then the data are
formatted in lines with maximum npl items, separated by sep.
Lines are separated by linesep.
-
fe_abq.fmtData(data, npl=8, sep=', ', linesep='\n')
Format numerical data in lines with maximum npl items.
data is a numeric array, which is coerced to be a 2D array, either by
adding a first axis or by collapsing the first ndim-1 axies.
Then the data are formatted in lines with maximum npl items, separated
by sep. Lines are separated by linesep.
-
fe_abq.fmtHeading(text='')
Format the heading of the Abaqus input file.
-
fe_abq.fmtPart(name='Part-1')
Start a new Part.
-
fe_abq.fmtMaterial(mat)
Write a material section.
mat is the property dict of the material. The following keys are
recognized and output accordingly:
- name: if specified, and a material with this name has already been
written, this function does nothing.
- elasticity: one of ‘LINEAR’, ‘HYPERELASTIC’, ‘ANISOTROPIC HYPERELASTIC’,
‘USER’. Default is ‘LINEAR’. Defines the elastic behavior class of the
material. The requirements for the other keys depend on this type.
- LINEAR:
- required:
- young_modulus
- shear_modulus
- optional:
- poisson_ratio: calculated if None
-
fe_abq.fmtTransform(setname, csys)
Write transform command for the given set.
- setname is the name of a node set
- csys is a CoordSystem.
-
fe_abq.fmtFrameSection(el, setname)
Write a frame section for the named element set.
Recognized data fields in the property record:
- sectiontype GENERAL:
- cross_section
- moment_inertia_11
- moment_inertia_12
- moment_inertia_22
- torsional_constant
- sectiontype CIRC:
- sectiontype RECT:
- all sectiontypes:
- young_modulus
- shear_modulus
- optional:
- density: density of the material
- yield_stress: yield stress of the material
- orientation: a vector specifying the direction cosines of the 1 axis
-
fe_abq.fmtGeneralBeamSection(el, setname)
Write a general beam section for the named element set.
To specify a beam section when numerical integration over the section is not required.
Recognized data fields in the property record:
- sectiontype GENERAL:
- cross_section
- moment_inertia_11
- moment_inertia_12
- moment_inertia_22
- torsional_constant
- sectiontype CIRC:
- sectiontype RECT:
- all sectiontypes:
- young_modulus
- shear_modulus or poisson_ration
- optional:
- density: density of the material (required in Abaqus/Explicit)
-
fe_abq.fmtBeamSection(el, setname)
Write a beam section for the named element set.
To specify a beam section when numerical integration over the section is required.
Recognized data fields in the property record:
- all sectiontypes: material
- sectiontype GENERAL:
- cross_section
- moment_inertia_11
- moment_inertia_12
- moment_inertia_22
- torsional_constant
- sectiontype CIRC:
- radius
- intpoints1 (number of integration points in the first direction) optional
- intpoints2 (number of integration points in the second direction) optional
- sectiontype RECT:
- width, height
- intpoints1 (number of integration points in the first direction) optional
- intpoints2 (number of integration points in the second direction) optional
-
fe_abq.fmtConnectorSection(el, setname)
Write a connector section.
Optional data:
- behavior : connector behavior name
- orient : connector orientation
-
fe_abq.fmtSurface(prop)
Format the surface definitions.
Required:
- set: the elements/nodes in the surface, either numbers or a set name.
- name: the surface name
- surftype: ‘ELEMENT’ or ‘NODE’
- label: face or edge identifier (only required for surftype = ‘NODE’)
-
fe_abq.fmtSurfaceInteraction(prop)
Format the interactions.
Optional:
- cross_section (for node based interaction)
- friction : friction coeff
-
fe_abq.fmtGeneralContact(prop)
Format the general contact.
Only implemented on model level
Required:
- interaction: interaction properties : name or Dict
-
fe_abq.fmtContactPair(prop)
Format the contact pair.
Required:
- master: master surface
- slave: slave surface
- interaction: interaction properties : name or Dict
-
fe_abq.fmtOrientation(prop)
Format the orientation.
Optional:
- definition
- system: coordinate system
- a: a first point
- b: a second point
-
fe_abq.writeNodes(fil, nodes, name='Nall', nofs=1)
Write nodal coordinates.
The nodes are added to the named node set.
If a name different from ‘Nall’ is specified, the nodes will also
be added to a set named ‘Nall’.
The nofs specifies an offset for the node numbers.
The default is 1, because Abaqus numbering starts at 1.
-
fe_abq.writeElems(fil, elems, type, name='Eall', eid=None, eofs=1, nofs=1)
Write element group of given type.
elems is the list with the element node numbers.
The elements are added to the named element set.
If a name different from ‘Eall’ is specified, the elements will also
be added to a set named ‘Eall’.
The eofs and nofs specify offsets for element and node numbers.
The default is 1, because Abaqus numbering starts at 1.
If eid is specified, it contains the element numbers increased with eofs.
-
fe_abq.writeSet(fil, type, name, set, ofs=1)
Write a named set of nodes or elements (type=NSET|ELSET)
set : an ndarray. set can be a list of node/element numbers,
in which case the ofs value will be added to them,
or a list of names the name of another already defined set.
-
fe_abq.writeSection(fil, prop)
Write an element section.
prop is a an element property record with a section and eltype attribute
-
fe_abq.writeBoundaries(fil, prop, op='MOD')
Write nodal boundary conditions.
prop is a list of node property records that should be scanned for
bound attributes to write.
By default, the boundary conditions are applied as a modification of the
existing boundary conditions, i.e. initial conditions and conditions from
previous steps remain in effect.
The user can set op=’NEW’ to remove the previous conditions.
This will also remove initial conditions!
-
fe_abq.writeDisplacements(fil, prop, op='MOD')
Write boundary conditions of type BOUNDARY, TYPE=DISPLACEMENT
prop is a list of node property records that should be scanned for
displ attributes to write.
By default, the boundary conditions are applied as a modification of the
existing boundary conditions, i.e. initial conditions and conditions from
previous steps remain in effect.
The user can set op=’NEW’ to remove the previous conditions.
This will also remove initial conditions!
-
fe_abq.writeCloads(fil, prop, op='NEW')
Write cloads.
prop is a list of node property records that should be scanned for
displ attributes to write.
By default, the loads are applied as new values in the current step.
The user can set op=’MOD’ to add the loads to already existing ones.
-
fe_abq.writeDloads(fil, prop, op='NEW')
Write Dloads.
prop is a list property records having an attribute dload
By default, the loads are applied as new values in the current step.
The user can set op=’MOD’ to add the loads to already existing ones.
-
fe_abq.writeDsloads(fil, prop, op='NEW')
Write Dsloads.
prop is a list property records having an attribute dsload
By default, the loads are applied as new values in the current step.
The user can set op=’MOD’ to add the loads to already existing ones.
-
fe_abq.writeNodeOutput(fil, kind, keys, set='Nall')
Write a request for nodal result output to the .odb file.
- keys: a list of NODE output identifiers
- set: a single item or a list of items, where each item is either
a property number or a node set name for which the results should
be written
-
fe_abq.writeNodeResult(fil, kind, keys, set='Nall', output='FILE', freq=1, globalaxes=False, lastmode=None, summary=False, total=False)
Write a request for nodal result output to the .fil or .dat file.
- keys: a list of NODE output identifiers
- set: a single item or a list of items, where each item is either
a property number or a node set name for which the results should
be written
- output is either FILE (for .fil output) or PRINT (for .dat
output)(Abaqus/Standard only)
- freq is the output frequency in increments (0 = no output)
Extra arguments:
- globalaxes: If ‘YES’, the requested output is returned in the global
axes. Default is to use the local axes wherever defined.
Extra arguments for output=``PRINT``:
- summary: if True, a summary with minimum and maximum is written
- total: if True, sums the values for each key
Remark: the kind argument is not used, but is included so that we can
easily call it with a Results dict as arguments
-
fe_abq.writeElemOutput(fil, kind, keys, set='Eall')
Write a request for element output to the .odb file.
- keys: a list of ELEMENT output identifiers
- set: a single item or a list of items, where each item is either
a property number or an element set name for which the results should
be written
-
fe_abq.writeElemResult(fil, kind, keys, set='Eall', output='FILE', freq=1, pos=None, summary=False, total=False)
Write a request for element result output to the .fil or .dat file.
- keys: a list of ELEMENT output identifiers
- set: a single item or a list of items, where each item is either
a property number or an element set name for which the results should
be written
- output is either FILE (for .fil output) or PRINT (for .dat
output)(Abaqus/Standard only)
- freq is the output frequency in increments (0 = no output)
Extra arguments:
Extra arguments for output=’PRINT’:
- summary: if True, a summary with minimum and maximum is written
- total: if True, sums the values for each key
Remark: the kind argument is not used, but is included so that we can
easily call it with a Results dict as arguments
-
fe_abq.writeFileOutput(fil, resfreq=1, timemarks=False)
Write the FILE OUTPUT command for Abaqus/Explicit
-
fe_abq.writeModelProps(fil, prop)
Write model props for this step
-
fe_abq.exportMesh(filename, mesh, eltype=None, header='')
Export a finite element mesh in Abaqus .inp format.
This is a convenience function to quickly export a mesh to Abaqus
without having to go through the whole setup of a complete
finite element model.
This just writes the nodes and elements specified in the mesh to
the file with the specified name. The resulting file can then be
imported in Abaqus/CAE or manual be edited to create a full model.
If an eltype is specified, it will oerride the value stored in the mesh.
This should be used to set a correct Abaqus element type matchin the mesh.