42. fe_abq — Exporting finite element models in Abaqus™ input file format. — pyFormex 0.9.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex 0.9.1 documentation >
- pyFormex reference manual >

# 42. `fe_abq` — 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.` `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’
  `fmt`()

    Format an output request.

    Return a string with the formatted output command.

  `update`(data={}, **kargs)

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

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.

  `update`(data={}, **kargs)

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

class `fe_abq.` `Interaction`(name=None, cross_section=1, friction=0.0, surfacebehavior=None, noseparation=False, pressureoverclosure=None)

  A Dict for setting surface interactions pressureoverclosure is an array = [‘hard’/’soft’,’linear’/’nonlinear’/’exponential’/’tabular’/.., value1,value2,value3,... ] Leave empty for default hard contact ‘hard’ will set penalty contact, either ‘linear’ or ‘nonlinear’ ‘soft’ will set soft pressure-overclosure, combine with ‘linear’/’exponential’/’tabular’/’scale factor’ for needed values on dataline: see abaqus keyword manual

  `update`(data={}, **kargs)

    Add a dictionary to the Dict object.

    The data can be a dict or Dict type object.

  `get`(key, default)

    Return the value for key or a default.

    This is the equivalent of the dict get method, except that it returns only the default value if the key was not found in self, and there is no _default_ method or it raised a KeyError.

  `setdefault`(key, default)

    Replaces the setdefault function of a normal dictionary.

    This is the same as the get method, except that it also sets the default value if get found a KeyError.

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.
  - nprop : the node property numbers to be used for by-prop properties.
  - eprop : the element property numbers to be used for by-prop properties.
  - steps : a list of Step instances.
  - res : a list of Result instances (deprecated: set inside Step).
  - out : a list of Output instances (deprecated: set inside Step).
  - 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.
  `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 an 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.` `fmtOptions`(options)

  Format the options of an Abaqus command line.

  - options: a dict with ABAQUS command keywords and values. If the keyword does not take any value, the value in the dict should be an empty string.

  Returns a comma-separated string of ‘keyword’ or ‘keyword=value’ fields. The string includes an initial comma.

`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. The fields labeled (opt) are optional.

  - ‘LINEAR’:

    - young_modulus
    - shear_modulus
    - (opt) poisson_ratio: it is calculated if None

  - ‘HYERELASTIC’:

    required:

    - model: one of ‘ogden’, ‘polynomial’ or ‘reduced polynomial’
    - constants: list of all parameter required for the model (see Abaqus documentation)

    optional:

    - order: order of the model. If blank will be automatically calculated from the len of the constants list

      example:

          intimaMat = {
            'name': 'intima',
            'density': 0.1, # Not Used, but Abaqus does not like a material without
            'elasticity':'hyperelastic',
            'type':'reduced polynomial',
            'constants': [6.79E-03, 5.40E-01, -1.11, 10.65, -7.27, 1.63, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
          }

  - ‘ANISOTROPIC HYPERELASTIC’:

  - ‘USER’:

`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:
    - radius
  - sectiontype RECT:
    - width
    - height
  - 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:
    - radius
  - sectiontype RECT:
    - width, height
  - 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.

  Required:

  - sectiontype: JOIN, HINGE, ...

  Optional data:

  - behavior : connector behavior name
  - orient : connector orientation

`fe_abq.` `fmtConnectorBehavior`(prop)

  Write a connector behavior. Implemented: Elasticity, Stop Examples: Elasticity P.Prop(name=’connbehavior1’,ConnectorBehavior=’‘,Elasticity=dict( component=[1,2,3,4,5,6],value=[1,1,1,1,1,1])) Stop: P.Prop(name=’connbehavior3’,ConnectorBehavior=’‘,Stop=dict( component=[1,2,3,4,5,6],lowerlimit=[1,1,1,1,1,1], upperlimit=[2, 2, 2, 2,2,2]))

`fe_abq.` `fmtSpring`(el, setname)

  Write a spring of type spring.

  Optional data:

  - springstiffness : spring stiffness (force (S11) per relative displacement (E11))

`fe_abq.` `fmtDashpot`(el, setname)

  Write a dashpot.

  Optional data:

  - dashpotcoefficient : dashpot coefficient (force (S11) per relative velocity (ER11, only produced in Standard))

`fe_abq.` `fmtSolidSection`(el, setname, matname)

  Format the SOLID SECTION keyword.

  Required:

  - setname
  - matname

  Optional:

  - orientation
  - controls

  controls is a dict with name, options and data keys. Options is a string which is added as is to the command. Data are added below the command. All other items besides name, options and data are formatted as extra command options.

  Example:

      P.elemProp(set='STENT',eltype='C3D8R',section=ElemSection(section=stentSec,material=steel,controls=dict(name='StentControl',hourglass='enhanced'))

`fe_abq.` `fmtShellSection`(el, setname, matname)

  Format the shell SHELL SECTION keyword.

  Required:

  - setname
  - matname

  Optional:

  - transverseshearstiffness
  - offset (for contact surface SPOS or 0.5, SNEG or -0.5)

`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 = ‘ELEMENT’)

  This label can be a string, or a list of strings. This allows to use different identifiers for the different elements in the surface. Thus:

      Prop(name='mysurf',set=[0,1,2,6],surftype='element',label=['S1','S2','S1','S3')

  will get exported to Abaqus as:

      *SURFACE, NAME=mysurf, TYPE=element
      1, S1
      2, S2,
      3, S1
      7, S3

`fe_abq.` `fmtAnalyticalSurface`(prop)

  Format the analytical surface rigid body.

  Required:

  - nodeset: refnode.
  - name: the surface name
  - surftype: ‘ELEMENT’ or ‘NODE’
  - label: face or edge identifier (only required for surftype = ‘NODE’)

  Example:

      >>> P.Prop(name='AnalySurf', nodeset = 'REFNOD', analyticalsurface='')

`fe_abq.` `fmtSurfaceInteraction`(prop)

  Format the interactions.

  Required:

  -name

  Optional:

  - cross_section (for node based interaction)
  - friction : friction coeff or ‘rough’
  - surface behavior: no separation
  - surface behavior: pressureoverclosure

`fe_abq.` `fmtGeneralContact`(prop)

  Format the general contact.

  Only implemented on model level

  Required:

  - interaction: interaction properties: name or Dict

  Optional:

  - Exclusions (exl)

  - Extra (extra). Example

        extra = "*CONTACT CONTROLS ASSIGNMENT, TYPE=SCALE PENALTY\n, , 1.e3\n"

  Example:

      >>> P.Prop(generalinteraction=Interaction(name ='contactprop1'),exl =[
      ['surf11', 'surf12'],['surf21',surf22]])

`fe_abq.` `fmtContactPair`(prop)

  Format the contact pair.

  Required:

  - master: master surface
  - slave: slave surface
  - interaction: interaction properties : name or Dict

  Example:

      >>> P.Prop(name='contact0',interaction=Interaction(name ='contactprop',
      surfacebehavior=True, pressureoverclosure=['hard','linear',0.0, 0.0, 0.001]),
      master ='quadtubeINTSURF1',  slave='hexstentEXTSURF', contacttype='NODE TO SURFACE')

`fe_abq.` `fmtConstraint`(prop)

  Format Tie constraint

  Required:

  -name -adjust (yes or no) -slave -master

  Optional:

  -type (surf2surf, node2surf) -positiontolerance -no rotation -tiednset (it cannot be used in combination with positiontolerance)

  Example:

      >>> P.Prop(constraint='1', name = 'constr1', adjust = 'no',
      master = 'hexstentbarSURF', slave = 'hexstentEXTSURF',type='NODE TO SURFACE')

`fe_abq.` `fmtInitialConditions`(prop)

  Format initial conditions

  Required:

  -type -nodes -data

  Example:

      P.Prop(initialcondition='', nodes ='Nall', type = 'TEMPERATURE', data = 37.)

`fe_abq.` `fmtOrientation`(prop)

  Format the orientation.

  Optional:

  - definition
  - system: coordinate system
  - a: a first point
  - b: a second point

`fe_abq.` `fmtEquation`(prop)

  Format multi-point constraint using an equation

  Required:

  - equation

  Equation should be a list, which contains the different terms of the equation. Each term is again a list with three values:

  - First value: node number
  - Second value: degree of freedom
  - Third value: coefficient

  Example:

      P.nodeProp(equation=[[209,1,1],[32,1,-1]])

  This forces the displacement in Y-direction of nodes 209 and 32 to be equal.

`fe_abq.` `fmtMass`(prop)

  Format mass

  Required:

  - mass : mass magnitude
  - set : name of the element set on which mass is applied

`fe_abq.` `fmtInertia`(prop)

  Format rotary inertia

  Required:

  - inertia : inertia tensor i11, i22, i33, i12, i13, i23
  - set : name of the element set on which inertia is applied

`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.` `writeDisplacements`(fil, prop, dtype='DISPLACEMENT')

  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)

  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.` `writeCommaList`(fil, *args)

  Write a list of values comma-separated to fil

`fe_abq.` `writeDloads`(fil, prop)

  Write Dloads.

  prop is a list of elem 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)

  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 that 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:

  - pos: Position of the points in the elements at which the results are written. Should be one of:

    - ‘INTEGRATION POINTS’ (default)
    - ‘CENTROIDAL’
    - ‘NODES’
    - ‘AVERAGED AT NODES’

    Non-default values are only available for ABAQUS/Standard.

  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.` `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.

### Navigation

- index
- modules |
- next |
- previous |
- pyFormex 0.9.1 documentation >
- pyFormex reference manual >