88. plugins.properties
— General framework for attributing properties to geometrical elements.¶
Properties can really be just about any Python object. Properties can be attributed to a set of geometrical elements.
88.1. Classes defined in module plugins.properties¶
-
class
plugins.properties.
MaterialDB
(data=None, key='name')[source]¶ A class for storing material properties.
- Parameters
data (dict | str, optional) – If a dict, it contains the Database. If a string, it is the filename containing the Database. If an empty string, the configured materials database file is loaded. If not provided, an empty Database is created.
Examples
>>> matDB = MaterialDB('') >>> print(matDB) { "steel": { "name": "steel", "young_modulus": 207000.0, "poisson_ratio": 0.3, "density": 7.85e-09 }, ...
-
class
plugins.properties.
SectionDB
(data=None, key='name')[source]¶ A class for storing section properties
- Parameters
data (dict | str, optional) – If a dict, it contains the Database. If a string, it is the filename containing the Database. If an empty string, the configured materials database file is loaded. If not provided, an empty Database is created.
Examples
>>> secDB = SectionDB('') >>> print(secDB) { "kokerre": { "name": "kokerre", "cross_section": 500, "moment_inertia_11": 1256, "moment_inertia_12": 695, "moment_inertia_22": 365499, "torsional_rigidity": 635256 }, ...
-
class
plugins.properties.
ElemSection
(section=None, material=None, orientation=None, **kargs)[source]¶ Properties related to the section of an element.
An element section property can hold the following sub-properties:
- section
the geometric properties of the section. This can be a dict or a string. If it is a string, its value is looked up in the global section database. The section dict should at least have a key ‘sectiontype’, defining the type of section.
Currently the following sectiontype values are known by module
fe_abq
for export to Abaqus/Calculix:‘solid’ : a solid 2D or 3D section,
‘circ’ : a plain circular section,
‘rect’ : a plain rectangular section,
‘pipe’ : a hollow circular section,
‘box’ : a hollow rectangular section,
‘I’ : an I-beam,
‘general’ : anything else (automatically set if not specified).
‘rigid’ : a rigid body
The other possible (useful) keys in the section dict depend on the sectiontype. Again for
fe_abq
:for sectiontype ‘solid’ : thickness
the sectiontype ‘general’: cross_section, moment_inertia_11, moment_inertia_12, moment_inertia_22, torsional_constant
for sectiontype ‘circ’: radius
for sectiontype ‘rigid’: refnode, density, thickness
- material
the element material. This can be a dict or a string. Currently known keys to fe_abq.py are: young_modulus, shear_modulus, density, poisson_ratio . (see fmtMaterial in fe_abq) It should not be specified for rigid sections.
- orientation
a Dict, or
a list of 3 direction cosines of the first beam section axis.
-
class
plugins.properties.
ElemLoad
(label=None, value=None, dir=None)[source]¶ Distributed loading on an element.
-
class
plugins.properties.
EdgeLoad
(edge=- 1, label=None, value=None)[source]¶ Distributed loading on an element edge.
-
class
plugins.properties.
Amplitude
(data, definition='TABULAR', atime='STEP TIME', smoothing=None)[source]¶ A class for storing an amplitude.
The amplitude is a list of tuples (time,value).
atime (amplitude time) can be either STEP TIME (default in Abaqus) or TOTAL TIME
smoothing (optional) is a float (from 0. to 0.5, suggested value 0.05) representing the fraction of the time interval before and after each time point during which the piecewise linear time variation will be replaced by a smooth quadratic time variation (avoiding infinite accelerations). Smoothing should be used in combination with TABULAR (set 0.05 as default value?)
-
class
plugins.properties.
PropertyDB
(matdb='', secdb='')[source]¶ A database class for all properties.
This class collects all properties that can be set on a geometrical model.
This should allow for storing:
materials
sections
any properties
node properties
elem properties
model properties (current unused: use unnamed properties)
Materials and sections use their own database for storing. They can be specified on creating the property database.
- Parameters
matdb (
MaterialDB
) – The material database to be used. It can be a MaterialDB object, or data to initialize it: a dict with the database contents, or a filename where the MaterialDB can be read. The default empty string will read the configured material database file. Specifying None creates an empty MaterialDB.secdb (
SectionDB
) – The section database to be used. It can be a SectionDB object, or data to initialize it: a dict with the database contents, or a filename where the SectionDB can be read. The default empty string will read the configured section database file. Specifying None creates an empty SectionMaterialDB.
88.2. Functions defined in module plugins.properties¶
-
plugins.properties.
checkIdValue
(values)[source]¶ Check that a variable is a list of (id,value) tuples
id should be convertible to an int, value to a float. If ok, return the values as a list of (int,float) tuples.
-
plugins.properties.
checkArrayOrIdValue
(values)[source]¶ Check that a variable is a list of values or (id,value) tuples
This convenience function checks that the argument is either:
a list of 6 float values (or convertible to it), or
a list of (id,value) tuples where id is convertible to an int, value to a float.
If ok, return the values as a list of (int,float) tuples.
Examples
>>> checkArrayOrIdValue([0,3,4,0,0,0]) [(1, 3.0), (2, 4.0)] >>> checkArrayOrIdValue([(1,3.0),(2,4.0)]) [(1, 3.0), (2, 4.0)] >>> checkArrayOrIdValue([(0,1.0),(2,4.0),(3,5.0),(4,4),(5,3.0),(1,4.0)]) [(0, 1.0), (2, 4.0), (3, 5.0), (4, 4.0), (5, 3.0), (1, 4.0)]
-
plugins.properties.
checkArrayOrIdValueOrEmpty
(values)[source]¶ Check that a variable is a list of values or (id,value) tuples or empty.
This convenience function checks that the argument is either:
a list of 6 float values (or convertible to it), or
a list of (id,value) tuples where id is convertible to an int, value to a float.
something representing an empty list
If ok, return the values as a list of (int,float) tuples.
Examples
>>> checkArrayOrIdValueOrEmpty([0,3,4,0,0,0]) [(1, 3.0), (2, 4.0)] >>> checkArrayOrIdValueOrEmpty([(1,3.0),(2,4.0)]) [(1, 3.0), (2, 4.0)] >>> checkArrayOrIdValueOrEmpty([]) []
-
plugins.properties.
checkString
(a, valid)[source]¶ Check that a string a has one of the valid values.
This is case insensitive, and returns the upper case string if valid. Else, an error is raised.
-
plugins.properties.
FindListItem
(l, p)[source]¶ Find the item p in the list l.
If p is an item in the list (not a copy of it!), this returns its position. Else, -1 is returned.
Matches are found with a ‘is’ function, not an ‘==’. Only the first match will be reported.
-
plugins.properties.
RemoveListItem
(l, p)[source]¶ Remove the item p from the list l.
If p is an item in the list (not a copy of it!), it is removed from the list. Matches are found with a ‘is’ comparison. This is different from the normal Python list.remove() method, which uses ‘==’. As a result, we can find complex objects which do not allow ‘==’, such as ndarrays.