# 43. `plugins.fe_abq` — Export 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.

## 43.1. Classes defined in module plugins.fe_abq

class `plugins.fe_abq.``Command`(cmd, *args, **kargs)

  A class to format a keyword block in an INP file.

  Parameters (all are optional, except for cmd):

  - cmd: string, starting with an Abaqus keyword. The cmd string may include already formatted options. It will be converted to upper case and put as is after the initial ‘*’ character.
  - options: string. String to be added to the command line after any other args and kargs keyword options have been formatted (even those added later with the `add()` method). If the string does not start with a comma, a ‘, ‘ will be interposed.
  - data: list-like or list of tuple. Specifies the data to be put below the command line. A list of tuples will be formatted with one tuple per line. Any other data type will be transformed to a flat sequence and be formatted with maximum 8 values per line. Each individual item is converted to str type, so the data sequence may contain numerical (float or int) as well as string data.
  - extra: string: will be added as is below the command and data. This may be a multiline string and can be used to add complete preformatted sections to the output.
  - args: any other non-keyword arguments are added as options to the command line, after conversion to string and upper case.
  - kargs: any other keyword arguments are added to the command line as options of the form ‘KEY=value’. The keys are converted to upper case, the values not.

  After initial construction, the `add()` method can be used to add more parts to the command.

  Remark: there is no check whether a certain option contains multiple
    occurrences of the same option.

  Examples

      >>> cmd1 = Command('Key','material=plastic',options='material=steel',data=[1,2,3,4.0,'last'],extra='*AnotherKey, opt=optionalSet1,\n 1, 4.7')
      >>> cmd1.add(material='wood')
      >>> print(cmd1)
      *KEY, MATERIAL=PLASTIC, MATERIAL=wood, material=steel
      1, 2, 3, 4.0, last
      *AnotherKey, opt=optionalSet1,
       1, 4.7
      <BLANKLINE>

  `add`(*args, **kargs)

    Add more parts to the Command.

    This method takes all the parameters as the initializer, except for cmd. Specifying data will overwrite any previously defined data for the command. All other parameters will be added to the already existing.

  `out`

    The formatted command as a string

class `plugins.fe_abq.``Output`(kind='', vars='PRESELECT', set=None, typeset=None, type='FIELD', options='', extra='', variable=None, keys=None, *args, **kargs)

  A request for output to .odb.

  Parameters:

  - type: ‘FIELD’ (default), ‘HISTORY’ or ‘’.
  - kind: string: one of ‘’, ‘N’, ‘NODE’, ‘E’, ‘ELEMENT’, ‘ENERGY’, ‘CONTACT’. ‘N’ and ‘E’ are abbreviations for ‘NODE’, ‘ELEMENT’, respectively.
  - vars: ‘ALL’, ‘PRESELECT’ or, if kind != None, a list of output identifiers compatible with the specified kind.
  - set: a single set name or a list of node/element set names. This can not be specified for kind==’‘. If no set is specified, the default is ‘Nall’ for kind==’NODE’ and ‘Eall’ for kind==’ELEMENT’
  - typeset: string: it is equal to the corresponding abaqus parameter to identify the kind of set. If not specified, the default is the default is ‘NSET’ for kind==’NODE’ , ‘CONTACT’ and ‘ELSET’ for kind==’ELEMENT’ , ‘ENERGY’
  - options: (opt) options string to be added to the keyword line.
  - extra: (opt) extra string to be added below the keyword line and optional data.

  Examples:

      >>> out1 = Output(type='field')
      >>> print(out1.fmt())
      *OUTPUT, FIELD, VARIABLE=PRESELECT

      >>> out0 = Output(vars=None)
      >>> out2 = Output(type='field', kind='e', vars=['S','SP'])
      >>> print(out0.fmt()+out2.fmt())
      *OUTPUT, FIELD
      *ELEMENT OUTPUT, ELSET=Eall
      S, SP

      >>> out3 = Output(type='field', kind='e', vars=['S','SP'], set=['set1','set2'])
      >>> print(out0.fmt()+out3.fmt())
      *OUTPUT, FIELD
      *ELEMENT OUTPUT, ELSET=set1
      S, SP
      *ELEMENT OUTPUT, ELSET=set2
      S, SP

      >>> out4 = Output(type='',diagnostic='yes')
      >>> print(out4.fmt())
      *OUTPUT, DIAGNOSTIC=yes

  `fmt`()

    Format an output request.

    Return a string with the formatted output command.

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

class `plugins.fe_abq.``AbqData`(model, prop, nprop=None, eprop=None, steps=[], res=[], out=[], initial=None, eofs=1, nofs=1, extra='')

  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 to be applied on all steps.
  - out : a list of Output instances to be applied on all steps.
  - initial : a tag or alist of the initial data, such as boundary conditions. The default is to apply ALL boundary conditions initially. Specify a (possibly non-existing) tag to override the default.
  - eofs : integer defining the element offset for the abaqus numbering. Default value is 1.
  - nofs : integer defining the node offset for the abaqus numbering. Default value is 1.
  - extra : string to be added at model level.
  `write`(jobname=None, group_by_eset=True, group_by_group=False, subsets=True, comment=None, header='', create_part=False)

    Write an Abaqus input (INP) file.

    - jobname: relative or absolute path name of the exported Abaqus INP file. If the name does not end in ‘.inp’, this extension will be appended. If no name is specified, the output is written to sys.stdout.
    - comment: A text to be included at the top of the INP file, right after the ‘created by pyFormex’ line. The text can be a multiline string or a function returning such string. Any other object will be dumped to a string in JSON format. All lines of the resulting text are prepended with ‘** ‘ before inclusion in the INP file, so Abaqus will recognize them as comments.
    - header: A text like comments, but this one will be inserted in the header section of the INP file, and not marked as comments. This is commonly used to add information that should appear in the result files.
    - create_part : if True, the model will be created as an Abaqus Part, followed by an assembly of that part.

## 43.2. Functions defined in module plugins.fe_abq

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

`plugins.fe_abq.``nsetName`(p)

  Determine the name for writing a node set property.

`plugins.fe_abq.``esetName`(p)

  Determine the name for writing an element set property.

`plugins.fe_abq.``fmtData2d`(data, linesep='\n')

  Format 2D data.

  data: list.

  Each item of data is formatted using fmtData1D and the resulting strings are joined with linesep.

  Examples

      >>> print(fmtData2d([('set0',1,5.0),('set1',2,10.0)]))
      set0, 1, 5.0
      set1, 2, 10.0

`plugins.fe_abq.``fmtData`(data, linesep='\n')

  Format the data section

  If data is a list of tuples, or data is a 2D array, each item/row of data will be formatted on a separate line. Any other data will be formatted as a 1D sequence with 8 items per line. Lines are separated with linesep.

  Examples:

      >>> print(fmtData([1,2,3,4.0,'last']))
      1, 2, 3, 4.0, last
      >>> print(fmtData([(1,2),(3,4.0,'last')]))
      1, 2
      3, 4.0, last

`plugins.fe_abq.``fmtKeyword`(keyword, options='', data=None, extra='', *args, **kargs)

  Format any keyword block in INP file.

  - keyword: string, keyword command, possibly including options
  - options: string or Options. The argument is first converted to str. If the result starts with a comma, it is added as is to the command line; otherwise it is added with interposition of ‘, ‘.
  - data: numerical data: will be formatted with maximum 8 values per line, or a list of tuples: each tuple will be formatted on a line
  - extra: string: will be added as is below the command and data

  All other arguments will be formatted with fmtOptions on the command line, between keyword and options.

  Examples:

`plugins.fe_abq.``fmtOption`(key, value)

  Format a single option.

`plugins.fe_abq.``fmtOptions`(**kargs)

  Format the options of an Abaqus command line.

  Each key,value pair in the argument list is formated into s string ‘KEY=value’, or just ‘KEY’ if the value is an empty string. The key is always converted to upper case, and any underscore in the key is replaced with a space. The resulting strings are joined with ‘, ‘ between them.

  Returns a comma-separated string of ‘keyword’ or ‘keyword=value’ fields. The string has a leading but no trailing comma.

  Note that if you specified two arguments whose keyword only differs by case, both will appear in the output with the same keyword. Also note that the order in which the options appear is unspecified.

  Examples

      >>> print(fmtOptions(var_a = 123., var_B = '123.', Var_C = ''))
      , VAR C, VAR B=123., VAR A=123.0

`plugins.fe_abq.``fmtWatermark`()

  Format the pyFormex watermark.

  The pyFormex watermark contains the version used to create the output. This should always be the first line of the output file.

      >>> print(fmtWatermark())
      ** Abaqus input file created by pyFormex 1.0.5 (http://pyformex.org)
      **
      <BLANKLINE>

`plugins.fe_abq.``fmtComment`(text=None)

  Format the initial comment section.

      >>> print(fmtComment("This is a comment\n of two lines."))
      **This is a comment
      ** of two lines.
      <BLANKLINE>

`plugins.fe_abq.``fmtHeading`(text='')

  Format the heading section.

  Any specified text will be included in the heading section.

      >>> print(fmtHeading("This is the heading"))
      **
      *HEADING
      This is the heading
      <BLANKLINE>

`plugins.fe_abq.``fmtSectionHeading`(text='')

  Format a section heading of the Abaqus input file.

`plugins.fe_abq.``fmtPart`(name='Part-1')

  Start a new Part.

`plugins.fe_abq.``fmtMaterial`(mat)

  Write a material section.

  mat is the property dict of the material. The following keys are recognized and output accordingly. The keys labeled (opt) are optional.

  - 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’ or another string specifying a valid material command. Default is ‘LINEAR’. Defines the elastic behavior class of the material. The required and recognized keys depend on this parameter (see below).
  - constants : list of floats or None. The material constants to be used in the model. For ‘LINEAR’ elasticity, these may alternatively be specified by other keywords (see below).
  - options (opt): string: will be added to the material command as is.
  - extra (opt): (multiline) string: will be added to the material data as is.
  - plastic (opt): arraylike, float, shape (N,2). Definition of the material plasticity law. Each row contains a tuple of a yield stress value and the corresponding equivalent plastic strain.
  - damping (opt): tuple (alpha,beta). Adds damping into the material. See Abaqus manual for the meaning of alpha and beta. Either of them can be a float or None.
  - field (opt): boolean. If True, a keyword “USER DEFINED FIELD” is added.

  Recognized keys depending on model:

  ‘LINEAR’: allows the specification of the material constants using the following keys:

  - young_modulus: float
  - shear_modulus (opt): float
  - poisson_ratio (opt): float: if not specified, it is calculated from the above two values.

  ‘HYPERELASTIC’: has a required key ‘model’:

  - model: one of ‘OGDEN’, ‘POLYNOMIAL’ or ‘REDUCED POLYNOMIAL’. The number of constants to be specified depends on the model and the order. The temperature should not be included in the temperature.
  - order (opt): order of the model. If omitted, it is calculated from the number of constants specified.
  - temp (opt): temperature at which these constants are valid. If omitted, temperature is set to 0.0 degrees.
  - testdata:

  ‘ANISOTROPIC HYPERELASTIC’: has a required key ‘model’:

  - model: one of ‘FUNG-ANISOTROPIC’, ‘FUNG-ORTHOTROPIC’, ‘HOLZAPFEL’ or ‘USER’.
  - depvar (opt): see below (‘USER’)
  - localdir (opt): int: number of local directions.

  ‘USER’:

  - depvar (opt): list. The first item in the list is the number of solution dependent variables. Further items are optional and are to specify output names for (some of) solution dependent state variables. Each item is a tuple of a variable number and the corresponding variable name. See the examples below.

  Example:

      >>> steel = {
      ...      'name': 'steel',
      ...      'young_modulus': 207000,
      ...      'poisson_ratio': 0.3,
      ...      'density': 7.85e-9,
      ...      'plastic': [(200.,0.), (900.,0.5)],
      ...      }
      >>> from pyformex.attributes import Attributes
      >>> print(fmtMaterial(Attributes(steel)))
      *MATERIAL, NAME=steel
      *ELASTIC
      207000.0, 0.3
      *DENSITY
      7.85e-09
      *PLASTIC
      200.0, 0.0
      900.0, 0.5
      <BLANKLINE>

      >>> intima = {
      ...      'name': 'intima',
      ...      'density': 0.1,
      ...      'elasticity':'hyperelastic',
      ...      'model':'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]
      ...      }
      >>> print(fmtMaterial(Attributes(intima)))
      *MATERIAL, NAME=intima
      *HYPERELASTIC, REDUCED POLYNOMIAL, N=6
      0.00679, 0.54, -1.11, 10.65, -7.27, 1.63, 0.0, 0.0
      0.0, 0.0, 0.0, 0.0, 0.0
      *DENSITY
      0.1
      <BLANKLINE>

      >>> nitinol = {
      ...     'name': 'ABQ_SUPER_ELASTIC_N3D',
      ...     'elasticity': 'user',
      ...     'density': 6.5e-9,
      ...     'depvar' : [24, (1,'VAR1'), (3,'DAMAGE')],
      ...     'constants' : [10000., 0.3, 5000, 0.3, 0.03, 6.5, 200., 300.,
      ...                    0.0, 6.5, 260., 100.,0., 0.03,  ]
      ...     }
      >>> print(fmtMaterial(Attributes(nitinol)))
      *MATERIAL, NAME=ABQ_SUPER_ELASTIC_N3D
      *DEPVAR
      24
      1, VAR1
      3, DAMAGE
      *USER MATERIAL, CONSTANTS=14
      10000.0, 0.3, 5000, 0.3, 0.03, 6.5, 200.0, 300.0
      0.0, 6.5, 260.0, 100.0, 0.0, 0.03
      *DENSITY
      6.5e-09
      <BLANKLINE>

`plugins.fe_abq.``fmtConnectorElasticity`(elas)

  Format connector elasticity behavior.

`plugins.fe_abq.``fmtConnectorStop`(stop)

  Format connector stop behavior.

`plugins.fe_abq.``elementClass`(eltype)

  Find the general element class for Abaqus eltype

`plugins.fe_abq.``fmtSolidSection`(section, setname)

  Format a solid section for the named element set.

  Parameters:

  - section: dict: section properties
  - setname: string: element set name for which these section properties are to be applied.

  Recognized keys in the section dict:

  - orientation
  - thickness

  See also class:Command for accepted parameters.

  Examples

      >>> sec1 = dict(matname='steel',thickness=0.12)
      >>> from pyformex.attributes import Attributes
      >>> print(fmtSolidSection(Attributes(sec1),'section1'))
      *SOLID SECTION, ELSET=section1, MATERIAL=steel
      0.12
      <BLANKLINE>

`plugins.fe_abq.``fmtSolid2dSection`(section, setname)

  Format a solid section for the named element set.

  Parameters:

  - section: dict: section properties
  - setname: string: element set name for which these section properties are to be applied.

  Recognized keys in the section dict:

  - orientation
  - thickness

  See also class:Command for accepted parameters.

  Examples

      >>> sec1 = dict(matname='steel',thickness=0.12)
      >>> from pyformex.attributes import Attributes
      >>> print(fmtSolidSection(Attributes(sec1),'section1'))
      *SOLID SECTION, ELSET=section1, MATERIAL=steel
      0.12
      <BLANKLINE>

`plugins.fe_abq.``fmtSolid3dSection`(section, setname)

  Format a solid section for the named element set.

  Parameters:

  - section: dict: section properties
  - setname: string: element set name for which these section properties are to be applied.

  Recognized keys in the section dict:

  - orientation
  - thickness

  See also class:Command for accepted parameters.

  Examples

      >>> sec1 = dict(matname='steel',thickness=0.12)
      >>> from pyformex.attributes import Attributes
      >>> print(fmtSolidSection(Attributes(sec1),'section1'))
      *SOLID SECTION, ELSET=section1, MATERIAL=steel
      0.12
      <BLANKLINE>

`plugins.fe_abq.``fmtShellSection`(section, setname)

  Format a SHELL SECTION keyword.

  Parameters: see func:fmtSolidSection.

  Recognized keys in the section dict:

  - thickness
  - offset (opt): for contact surface SPOS or 0.5, SNEG or -0.5
  - transverseshearstiffness (opt):
  - poisson (opt): ?? CLASH WITH MATERIAL ??
  - thicknessmodulus (opt):

`plugins.fe_abq.``fmtMembraneSection`(section, setname)

  Format a MEMBRANE SECTION keyword.

  Parameters: see func:fmtSolidSection.

  Recognized keys in the section dict:

  - thickness: float

`plugins.fe_abq.``fmtSurfaceSection`(section, setname)

  Format a SURFACE SECTION keyword.

  Parameters: see func:fmtSolidSection.

  Recognized keys in the section dict:

  - density (opt): float

`plugins.fe_abq.``fmtBeamSection`(section, setname)

  Format a beam section for the named element set.

  Note that there are two Beam section keywords:

  - BEAM SECTION
  - BEAM GENERAL SECTION: this is formatted by a separate function, currently selected if no material name is specified

  Parameters: see func:fmtSolidSection.

  The following holds for the BEAM SECTION:

  Recognized keys:

  - sectiontype: ‘ARBITRARY’, ‘BOX’, ‘CIRC’, ‘HEX’, ‘I’, ‘L’, ‘PIPE’, ‘RECT’, ‘TRAPEZOID’ or ‘ELBOW’
  - material:
  - data: list of tuples: data corresponding with the sectiontype. See Abaqus manual.
  - transverseshearstiffness (opt):

`plugins.fe_abq.``fmtGeneralBeamSection`(section, setname)

  Format a general beam section for the named element set.

  This specifies a beam section when numerical integration over the section is not required and the material constants are specified directly. See also func:fmtBeamSection.

  Parameters: see func:fmtSolidSection.

  Recognized keys:

  - all sectiontypes:
    - sectiontype (opt): ‘GENERAL’ (default), ‘CIRC’ or ‘RECT’
    - data (opt): list of tuples: section data (see Abaqus Manual). For some sections, the data may be specified by other arguments instead (see below).
    - density (opt): density of the material (required in Abaqus/Explicit)
    - transverseshearstiffness (opt):

  Data specifying keys (only used if ‘data’ is not specified):

  - sectiontype GENERAL:
    - cross_section
    - moment_inertia_11
    - moment_inertia_12
    - moment_inertia_22
    - torsional_constant
  - sectiontype CIRC:
    - radius
  - sectiontype RECT:
    - width, height
  - sectiontype GENERAL, CIRC or RECT: - orientation (opt): a vector with the direction cosines of the 1 axis - young_modulus - shear_modulus or poisson_ratio

`plugins.fe_abq.``fmtFrameSection`(section, setname)

  Format a frame section for the named element set.

  Parameters: see func:fmtSolidSection.

  Recognized keys:

  - all sectiontypes:
    - sectiontype (opt): ‘GENERAL’ (default), ‘CIRC’ or ‘RECT’
    - young_modulus
    - shear_modulus
    - density (opt): density of the material
    - yield_stress (opt): yield stress of the material
    - orientation (opt): a vector with the direction cosines of the 1 axis
  - sectiontype GENERAL:
    - cross_section
    - moment_inertia_11
    - moment_inertia_12
    - moment_inertia_22
    - torsional_constant
  - sectiontype CIRC:
    - radius
  - sectiontype RECT:
    - width
    - height

`plugins.fe_abq.``fmtTrussSection`(section, setname)

  Format a truss section for the named element set.

  Parameters: see func:fmtSolidSection.

  Recognized keys:

  - all sectiontypes:
    - sectiontype (opt): ‘GENERAL’ (default), ‘CIRC’ or ‘RECT’
    - material
  - sectiontype GENERAL:
    - cross_section
  - sectiontype CIRC:
    - radius
  - sectiontype RECT:
    - width
    - height

`plugins.fe_abq.``fmtConnectorSection`(section, setname)

  Format a connector section.

  Parameters: see func:fmtSolidSection.

  Recognized keys:

  - sectiontype: ‘JOIN’, ‘HINGE’, …
  - behavior (opt): connector behavior name
  - orientation (opt): connector orientation
  - elimination (opt): ‘NO’ (default), ‘YES’

`plugins.fe_abq.``fmtSpringOrDashpot`(eltype, section, setname)

  Format a section of type spring or dashpot.

  Parameters (see also func:fmtSolidSection):

  - eltype: ‘SPRING’ or ‘DASHPOT’

  Recognized keys:

  - stiffness: float: spring or dashpot stiffness. For SPRING type, this is the force per relative displacement; for DASHPOT type, the force per relative velocity.

`plugins.fe_abq.``fmtSpringSection`(section, setname)

  Shorthand for fmtSpringOrDashpot(“SPRING”, section, setname)

`plugins.fe_abq.``fmtDashpotSection`(section, setname)

  Shorthand for fmtSpringOrDashpot(“SPRING”, section, setname)

`plugins.fe_abq.``fmtMassSection`(section, setname)

  Format a section of type mass.

  Parameters: see func:fmtSolidSection

  Recognized keys:

  - mass: float: mass magnitude

`plugins.fe_abq.``fmtInertiaSection`(section, setname)

  Format a section of type inertia.

  Parameters: see func:fmtSolidSection

  Recognized keys:

  - inertia: list of six floats: [I11, I22, I33, I12, I13, I23]

`plugins.fe_abq.``fmtRigidSection`(section, setname)

  Format rigid body sectiontype.

  Parameters: see func:fmtSolidSection

  Recognized keys:

  - refnode: string (set name) or integer (node number)
  - density (opt): float:
  - density (opt): float:

`plugins.fe_abq.``fmtTransform`(csys, setname)

  Format a coordinate transfor for the given set.

  - setname is the name of a node set
  - csys is a CoordSystem.

`plugins.fe_abq.``fmtOrientation`(prop)

  Format the orientation.

  Optional:

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

`plugins.fe_abq.``fmtSurface`(prop)

  Format the surface definitions.

  Parameters:

  - prop: a property record containing the key surftype.

  Recognized keys:

  - set: string, list of strings or list of integers.

    > - string : name of an existing set.
    > - list of integers: list of elements/nodes of the surface.
    > - list of strings: list of existing set names.

  - name: string. The surface name.

  - surftype: string. Can assume values ‘ELEMENT’ or ‘NODE’ , other abaqus

      surface types or an empty string for special cases that do not need a

  - label (opt): string, or a list of strings storing the abaqus face or edge identifier

      It is only required for surftype == ‘ELEMENT’.

  - options (opt): string that is added as is to the command line.

  Example:

      # This allow specifying a surface from an existing set of surface elements
      P.Prop(set='quad_set'  ,name='quad_surface',surftype='element',label='SPOS')

      # This allow specifying a surface from already existing sets of brick elements
      # using different label identifiers per each set

      P.Prop(set=['hex_set1, 'hex_set2']  ,name='quad_surface',surftype='element',label=['S1','S2'])

       #This allows to use different identifiers for the different elements in the surface
       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

`plugins.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='')

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

`plugins.fe_abq.``fmtContact`(prop)

  Format a contact property record.

  Parameters:

  - prop: a Property record having a key ‘contact’

  Recognized keys:

  - contact: string, one of ‘GENERAL’ or ‘PAIR’
  - interaction: string, the name of a surface interaction

  For ‘GENERAL’ contact:

  - include: tuple or list of tuples (surf1,surf2). surf1 and surf2 are the names of defined surfaces or an empty string. If surf1 is empty, a surface containing all exterior surfaces defined in the model is used. If surf2 is empty, it is equal to surf1 a case of self-contact results. If both are empty, self contact between all surfaces is modeled.
  - exclude (opt): tuple or list of tuples (surf1,surf2). Specifies names of surfaces on which no contact is to be modeled.

  For ‘PAIR’ contact:

  - include: tuple or list of tuples (slave,master). slave and master are the names of defined surfaces. Each tuple can optionally contain one or two more values, with the orientation of the tangential slip directions for the slave, resp. master surface. They are strings with the name of defined orientations.

  Examples

      >>> PDB = PropertyDB()
      >>> p1 = PDB.Prop(contact='pair',include=('s1','m1'),interaction='i1')
      >>> print(fmtContact(p1))
      *CONTACT PAIR, INTERACTION=I1
      s1, m1
      <BLANKLINE>

      >>> p2 = PDB.Prop(contact='pair',include=[('s1','m1'),('s2','m2')],interaction='i1')
      >>> print(fmtContact(p2))
      *CONTACT PAIR, INTERACTION=I1
      s1, m1
      s2, m2
      <BLANKLINE>

      >>> g1 = PDB.Prop(contact='general',include=('s1','m1'),interaction='i1')
      >>> print(fmtContact(g1))
      *CONTACT
      *CONTACT INCLUSIONS
      s1, m1
      *CONTACT PROPERTY ASSIGNMENT
      s1, m1, i1
      <BLANKLINE>

      >>> g2 = PDB.Prop(contact='general',include=[('s1','m1'),('s2','m2')],interaction='i1')
      >>> print(fmtContact(g2))
      *CONTACT
      *CONTACT INCLUSIONS
      s1, m1
      s2, m2
      *CONTACT PROPERTY ASSIGNMENT
      s1, m1, i1
      s2, m2, i1
      <BLANKLINE>

`plugins.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')

`plugins.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')

`plugins.fe_abq.``fmtInitialConditions`(prop)

  Format initial conditions

  Required:

  - type
  - nodes
  - data

  Example:

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

`plugins.fe_abq.``fmtEquation`(prop)

  Format multi-point constraint using an equation

  Required:

  - equation: list of tuples (node,dof,coeff), where
    - node: is a node number or node set name
    - dof: is the number of the degree of freedom (0 based)
    - coeff: is the coefficient for this variable in the equation

  Example:

      >>> P = PropertyDB()
      >>> eq1 = P.Prop(equation=[(9,1,1.),(32,2,-1.)])
      >>> eq2 = P.Prop(equation=[('seta',0,1)])

      The first equation forces the Z-displacement of node 32 to be equal
      to the Y-displacement of node 9. The second forces the sum of the
      X-displacement of all nodes in node set 'seta' to be equal to zero.

      >>> print(fmtEquation(eq1)+fmtEquation(eq2))
      *EQUATION
      2
      10, 2, 1.0
      33, 3, -1.0
      *EQUATION
      1
      seta, 1, 1

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

`plugins.fe_abq.``fmtBoundary`(prop)

  Format nodal boundary conditions.

  prop is a node property record having the ‘bound’ key.

  Recognized keys:

  - bound : either of:
    - a string, representing a standard set of boundary conditions
    - a list of 6 integer values (0 or 1) corresponding with the 6 degrees of freedom UX,UY,UZ,RX,RY,RZ. The dofs corresponding to the 1’s will be restrained (given a value 0.0).
    - a list of tuples (dofid, value) : this allows for nonzero boundary values to be specified. NOTE: this can also be achieved by a ‘displ’ keyword (see writeDisplacements) and that is the prefered way of specifying nonzero boundary conditions.
  - op (opt): ‘MOD’ (default) or ‘NEW’. 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 remove ALL conditions of the same type.
  - ampl (opt): string: specifies the name of an amplitude that is to be multiplied with the values to have the time history of the variable. Only relevant if bound specifies nonzero values. Its use is discouraged (see above).
  - options (opt): string that is added as is to the command line.

  Examples:

      # The following are quivalent
      P.nodeProp(tag='init',set='setA',name='pinned_nodes',bound='pinned')
      P.nodeProp(tag='init',set='setA',name='pinned_nodes',bound=[1,1,1,0,0,0])

      # this is possible, but discouraged
      P.nodeProp(tag='init',set='setB',name='forced_displ',bound=[(1,3.0)])
      # it is better to use:
      P.nodeProp(tag='step0',set='setB',name='forced_displ',displ=[(1,3.0)])

`plugins.fe_abq.``writeSection`(fil, prop)

  Write an element section.

  prop is an element property record with a section and eltype attribute

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

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

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

`plugins.fe_abq.``writeDistribution`(fil, prop)

  Write a distribution table.

  Parameters:

  - prop: a Property record having with the key distribution.

  Recognized keys:

  - distribution: string. Name of the distribution.
  - location:string. can assume values ‘ELEMENT’,’NODE’ or ‘NONE’
  - table: arraylike. The array needs to be passed as should be written in the
      abaqus data line. Every row is a new line and it is in the form [element_or_node_number,data1,data2, …]. NB For the first line used in Abaqus as default, the element_or_node_number should be an empty string.
  - format: list of strings. Every string is an abaqus word to be used in the distribution table.
      See Abaqus documentation for allowed words.
  - options (opt): string that is added as is to the command line.

  The name of the distribution table (required) is derived from the name of the distribution.

`plugins.fe_abq.``writeDisplacements`(fil, prop, btype)

  Write prescribed displacements, velocities or accelerations

  Parameters:

  - prop is a list of node property records containing one (or more) of the keys ‘displ’, ‘veloc’ ‘accel’.
  - btype is the boundary type: one of ‘displacement’, ‘velocity’ or ‘acceleration’

  Recognized property keys:

  - displ, veloc, accel: each is optional and is a list of tuples (dofid, value), for respectively the displacement, velocity or acceleration. A special value ‘reset’ may also be specified to reset the prescribed condition for these variables.
  - op (opt): ‘MOD’ (default) or ‘NEW’. 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 remove ALL conditions of the same type.
  - ampl (opt): string: specifies the name of an amplitude that is to be multiplied with the values to have the time history of the variable.
  - options (opt): string that is added to the command line.

`plugins.fe_abq.``fmtLoad`(key, prop)

  Format a load input block.

  Parameters:

  - key: load type, one of: ‘cload’, ‘dload’ or ‘dsload’
  - prop: a node property record containing the specified key.

  Recognized keys: - op (opt): string: ‘MOD’ or ‘NEW’. See func:writeDisplacements. - ampl (opt): string: amplitude name. See func:writeDisplacements. - options (opt): string: see func:fmtKeyWord - extra (opt): string: see func:fmtKeyWord

  For load type ‘cload’:

  - set: node set on which to apply the load
  - cload: list of tuples (dofid, magnitude)

  For load type ‘dload’:

  - set: element set on which to apply the load
  - dload: ElemLoad or data

  For load type ‘dsload’:

  - surface: string: name of surface on which to apply the load
  - dsload: ElemLoad or data

`plugins.fe_abq.``writeAmplitude`(fil, prop)

  Write Amplitude.

  Parameters:

  -prop: list of property records having an attribute amplitude.

  Recognized keys:

  - name: string. The name of the amplitude.
  - amplitude: class Amplitude (see plugins.property).
  - options (opt): string that is added as is to the command line.

  Examples:

  P=PropertyDB() t=[0,1] a=[0,0.5] amp = Amplitude(data=column_stack([t,a])) P.Prop(amplitude=amp,name=’ampl1’,options=’definition=TABULAR,smooth=0.1’)

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

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

`plugins.fe_abq.``writeFileOutput`(fil, resfreq=1, timemarks=False)

  Write the FILE OUTPUT command for Abaqus/Explicit

`plugins.fe_abq.``exportMesh`(filename, mesh, eltype, 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. If the mesh has different properties, the elements with the same properties, will be grouped in the same element set. 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 override the value stored in the mesh. This should be used to set a correct Abaqus element type matching the mesh.