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
A request for output to .odb and history.
Parameters:
For kind==’‘:
For kind==’NODE’ or ‘ELEMENT’:
Format an output request.
Return a string with the formatted output command.
Add a dictionary to the Dict object.
The data can be a dict or Dict type object.
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.
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.
A request for output of results on nodes or elements.
Parameters:
Extra keyword arguments are available: see the writeNodeResults and writeElemResults methods for details.
Add a dictionary to the Dict object.
The data can be a dict or Dict type object.
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.
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.
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
Add a dictionary to the Dict object.
The data can be a dict or Dict type object.
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.
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.
Contains all data required to write the Abaqus input file.
Write an Abaqus input file.
Functions defined in module fe_abq
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’
Determine the name for writing a node set property.
Determine the name for writing an element set property.
Format a command.
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.
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.
Format the options of an Abaqus command line.
Returns a comma-separated string of ‘keyword’ or ‘keyword=value’ fields. The string includes an initial comma.
Format the heading of the Abaqus input file.
Start a new Part.
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’:
‘HYERELASTIC’:
required:
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’:
Write transform command for the given set.
Write a frame section for the named element set.
Recognized data fields in the property record:
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:
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:
Write a connector section.
Required:
Optional data:
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]))
Write a spring of type spring.
Optional data:
Write a dashpot.
Optional data:
Format the SOLID SECTION keyword.
Required:
Optional:
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'))
Format the shell SHELL SECTION keyword.
Required:
Optional:
Format the surface definitions.
Required:
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
Format the analytical surface rigid body.
Required:
Example:
>>> P.Prop(name='AnalySurf', nodeset = 'REFNOD', analyticalsurface='')
Format the interactions.
Required:
-name
Optional:
Format the general contact.
Only implemented on model level
Required:
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]])
Format the contact pair.
Required:
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')
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')
Format initial conditions
Required:
-type -nodes -data
Example:
P.Prop(initialcondition='', nodes ='Nall', type = 'TEMPERATURE', data = 37.)
Format the orientation.
Optional:
Format multi-point constraint using an equation
Required:
Equation should be a list, which contains the different terms of the equation. Each term is again a list with three values:
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.
Format mass
Required:
Format rotary inertia
Required:
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.
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.
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.
Write an element section.
prop is a an element property record with a section and eltype attribute
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!
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.
Write a list of values comma-separated to fil
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.
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.
Write a request for nodal result output to the .odb file.
Write a request for nodal result output to the .fil or .dat file.
Extra arguments:
Extra arguments for output=``PRINT``:
‘Remark that the kind argument is not used, but is included so that we can easily call it with a Results dict as arguments.’
Write a request for element output to the .odb file.
Write a request for element result output to the .fil or .dat file.
Extra arguments:
pos: Position of the points in the elements at which the results are written. Should be one of:
Non-default values are only available for ABAQUS/Standard.
Extra arguments for output=’PRINT’:
Remark: the kind argument is not used, but is included so that we can easily call it with a Results dict as arguments
Write the FILE OUTPUT command for Abaqus/Explicit
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.