The relevant properties to explore are: materials, sections and profiles, stored in the respective repositories:
mdb.models[modelname].materials
mdb.models[modelname].profiles
mdb.models[modelname].sections
A new material is created by the constructor mdb.models[modelname].Material(...)
Example: creating a new model and a new material:
>>> mod = mdb.Model(name='M1')
>>> mat = mod.Material(name = 'Mat-1')
The new material has currently only a minimum of properties:
>>> print mat
({'description': '', 'materialIdentifier': '', 'name': 'Mat-1'})
Exploring the possible types of material behaviors that can be added:
>>> [i for i in dir(mat) if i[0].isupper()]
[..., 'Damping', ..., 'Density', ..., 'Elastic', ..., 'Expansion', ..., 'Plastic', ...]
Note: the list printed was edited and limited to some common items for mechanical engineering.
Adding density (temperature independent):
>>> mat.Density(table=((2000.0E-12, ), ))
The script shall take only the model name as argument, and add some typical materials to the model. Included properties are density, as well as elastic properties and thermal expansion.
from abaqus import *
from abaqusConstants import *
def standard_materials(modelname):
mod = mdb.models[modelname]
mat = mod.Material(name='Stainless Steel 316 A')
mat.Density(table=((8000E-12, ), ))
mat.Elastic(table=((193000.0, 0.31), ))
mat.Expansion(table=((16e-06, ), ))
mat = mod.Material(name='Aluminum Generic')
mat.Density(table=((2700E-12, ), ))
mat.Elastic(table=((70000.0, 0.34), ))
mat.Expansion(table=((23.0E-06, ), ))
mat = mod.Material(name='GFRP A')
mat.Density(table=((2000.0E-12, ), ))
mat.Elastic(type=ENGINEERING_CONSTANTS, table=((40000.0, 10000.0, 10000.0, 0.3, 0.3, 0.45, 5000.0, 5000.0, 3450),))
mat.Expansion(type=ORTHOTROPIC, table=((8.0E-06, 30.0e-06, 30.0E-06), ))
standard_materials('M1')
table
¶Most of the properties can be temperature dependent. For instance, if the density is NOT temperature dependent but a constant (1000), the syntax is
mat.Density( table = ( (1000, ), ))
Let the density be temperature dependent, somehow decreasing from 0 degrees to 300 degrees. The syntax written in a format resembling a table is now
mat.Density(temperatureDependency=ON, table=((1000.0, 0.0),
( 900.0, 100.0),
( 750.0, 200.0),
( 500.0, 300.0) ) )
The modulus (E) of a steel is temperature dependent given the function
$$E(T) = 200000 - 0.1 \cdot T^2$$(which is just made-up) while the Poisson's ratio is constant. With 11 datapoint and support from numpy and matplotlib:
import numpy as np
import matplotlib.pyplot as plt
T = np.linspace(0, 500, 11)
E = 200000 - 0.1*T**2
v = 0.3
plt.plot(T,E)
plt.show()
The table is
table = tuple( [(round(Ei), v, round(Ti)) for Ei, Ti in zip(E, T)] )
for row in table:
print(row)
Corresponding Abaqus script:
from abaqus import *
from abaqusConstants import *
def temp_dep_steel(modelname):
import numpy as np
T = np.linspace(0, 500, 11)
E = 200000 - 0.1*T**2
v = 0.3
table = tuple( [(round(Ei), v, round(Ti)) for Ei, Ti in zip(E, T)] )
mod = mdb.models[modelname]
mat = mod.Material(name='Steel-temp-dep')
mat.Elastic(temperatureDependency=ON, table=table)
temp_dep_steel('M1')
Profiles are used as properties of beams and trusses.
Access:
mdb.models[modelname].profiles
Examples:
mdb.models[modelname].RectangularProfile(name='Profile-1', a=100.0, b=50.0)
mdb.models[modelname].BoxProfile(name='Profile-2', a=100.0, b=59.0, t1=5.0)
Other profiles:
>>> [item for item in dir(mod) if 'Profile' in item and item[0].isupper()]
['ArbitraryProfile', 'BoxProfile', 'CircularProfile', 'GeneralizedProfile', 'HexagonalProfile', 'IProfile', 'LProfile',
'PipeProfile', 'Profile', 'RectangularProfile', 'TProfile', 'TrapezoidalProfile']
>>>
Access:
mdb.models[modelname].sections
Examples:
mdb.models[modelname].HomogeneousSolidSection(...)
mdb.models[modelname].HomogeneousShellSection(...)
The different types of sections:
>>> mod = mdb.models['Model-1']
>>> [item for item in dir(mod) if 'Section' in item and item[0].isupper()]
['AcousticInfiniteSection', 'AcousticInterfaceSection', 'BeamSection', 'CohesiveSection', 'CompositeShellSection',
'CompositeSolidSection', 'ConnectorSection', 'ElectromagneticSolidSection', 'EulerianSection', 'FluidPipeSection',
'GasketSection', 'GeneralStiffnessSection', 'HomogeneousFluidSection', 'HomogeneousShellSection',
'HomogeneousSolidSection', 'IntegratedOutputSection', 'MPCSection', 'MembraneSection', 'PEGSection',
'PartFromSection3DMeshByPlane', 'PointSection', 'PorousFluidSection', 'Section', 'SurfaceSection', 'TrussSection']
# Assumes materials from previous script are available.
from abaqus import *
from abaqusConstants import *
def solidSection_Steel(modelname):
mod = mdb.models[modelname]
mod.HomogeneousSolidSection(name='Sec-Sol-Steel', material='Stainless Steel 316 A')
def shellSection_GFRP(modelname, t):
mod = mdb.models[modelname]
mod.HomogeneousShellSection(name='Sec-She-GRFP', material='GFRP A', thickness=t)
def beamSection_Alu(modelname, a, b, t):
mod = mdb.models[modelname]
mod.BoxProfile(name='Profile-Box', a=a, b=b, t1=t, uniformThickness=ON)
mod.BeamSection(name='Sec-Beam-Alu', profile='Profile-Box', material='Aluminum Generic', integration=DURING_ANALYSIS)
modelname='M1'
solidSection_Steel(modelname)
shellSection_GFRP(modelname, t=5)
beamSection_Alu(modelname, a=100, b=50, t=5)
Access (from part):
mdb.models[modelname].parts[partname].SectionAssignment(...)
The following example is based on the script for a plate with a hole and material and section from the current page.
More about regionToolset
, see Selection methods.
from abaqus import *
from abaqusConstants import *
from regionToolset import Region # Required to create a region for section assignment
def plateWithHole(modelname, L, b, h, r, cx, cy):
mod = mdb.Model(name=modelname)
ske = mod.ConstrainedSketch(name='__profile__', sheetSize=200.0)
ske.rectangle(point1=(0.0, 0.0), point2=(L, b))
ske.CircleByCenterPerimeter(center=(cx, cy), point1=(cx+r, cy))
prt = mod.Part(name='P1', dimensionality=THREE_D, type=DEFORMABLE_BODY)
prt.BaseSolidExtrude(sketch=ske, depth=h)
del ske
session.viewports['Viewport: 1'].setValues(displayedObject=prt)
# Partitions
id1 = prt.DatumPlaneByPrincipalPlane(principalPlane=YZPLANE, offset=cx).id
id2 = prt.DatumPlaneByPrincipalPlane(principalPlane=XZPLANE, offset=cy).id
prt.PartitionCellByDatumPlane(cells=prt.cells, datumPlane=prt.datums[id1])
prt.PartitionCellByDatumPlane(cells=prt.cells, datumPlane=prt.datums[id2])
# Material and section
mat = mod.Material(name='Stainless Steel 316 A')
mat.Density(table=((8000E-12, ), ))
mat.Elastic(table=((193000.0, 0.31), ))
mat.Expansion(table=((16e-06, ), ))
mod.HomogeneousSolidSection(name='Sec-Sol-Steel', material='Stainless Steel 316 A')
# Section assignment
region = Region(cells=prt.cells)
prt.SectionAssignment(region=region, sectionName='Sec-Sol-Steel')
plateWithHole(modelname='M1', L=100.0, b=50.0, h=5.0, r=10.0, cx=30.0, cy=20.0)