2. Simples Class Reference
2.1. Model
Model
is the Simples top-level class: It
opens or creates a database. If the database exists all data except
solution fields are loaded or referenced. When the model is closed
with close()
all references to objects, such as
meshes, boundary conditions, cases, etc. are removed.
Branch
contains all relevant mesh information
of a branch of a B2000++ unstructured mesh, the structured mesh support
being in preparation.
Model
automatically loads all branches of an
existing B2000++ FE model when the model database is opened. You get the
reference to the branch with the get_branch()
or
the get_branches()
methods of
Model
.
A wide range of functions allow for accessing and processing of mesh
data. Solutions are not addressed by Model
,
except for the solution field meta-data provided by the
simples.Case
objects.
Note
In the present version only B2000++ unstructured meshes are supported. It is planned to add block-structured 3-dimensional meshes.
2.1.1. Model Class
- class Model(name, mode='o', verbose=0, msgout=None, fail=False, load_mesh=True, load_matprop=True, load_cases=True)
Creates a Model object. If the database
name
exists it is loaded. If not, Model will create an empty database to be populated by the B2000++ input processor or the B2000++ solver.- Parameters:
name (str) – B2000++ model name (required). A B2000++ model name requires the suffix
.b2m
.mode (str) – Open mode (required).
n
creates a new model and associated database.nd
removes an existing database and creates a new one.o
opens an existing model and associated database in read/write mode.or
opens an existing model and associated database in readonly mode. Default iso
(readonly). New model databases are always write enabled.verbose (int) – Logger information level flag. A value of 0 prints no logging information (default). 1 prints moderate logging information, such as timing information. Values of 2 and more prints extensive information and test output.
fail (bool) – Is a temporary fix for preventing material load errors that are not relevant for most runs, (specifically tests).
msgout (function) – Message output function. Default is sys.stderr.
- Raise:
Exceptions in case of error, see messages.
Note
If a Model object is not closed with the
close()
method, further Model declarations may causeMemcomIOError
errors.- property b2version
Get B2000++ version string that has been used for this model.
- property Cases
Get all defined cases objects associated to this Model.
- property db
Get MemCom (pymemcom) database object.
- property readonly
Return True if database is readonly and False else.
- property name
Get Model database name “xxx.b2m”.
- property model_name
Get Model database name “xxx.b2m”.
- property fullname
Get model database full name “path/xxx.b2m”
- property model_fullname
Get model database full name “path/xxx.b2m”.
- property model_path
Get model database path.
- property modeler
Get modeler object associated to current model.
- property verbose
Get or set verbose level.
- property colwidth
Get or set output column width. Default is 12. If width is < 8 or > 22 it is set to 12.
- close(save=True)
Save (default) data and close the database. Deletes any reference to the database. If you want to save the database without closing it, call the save() method.
- Parameters:
save (bool) – Save all data to database if set to True (default: True).
- save()
Saves all data, except solution fields, to the current model database.
- set_column_decimals(decimals)
Specifies the number of decimals of the mantissa of floating point numbers as rendered by the formatdb module or the b2browser data browser. No check is made if the column width and the size of the mantissa are consistent!
- Parameters:
decimals (int) – Size of the mantissa of floating point numbers. Default is 4.
- set_column_float_format(frepr)
Specifies the floating point format
- Parameters:
frepr (str) – Floating point format: Must be ‘g’ or ‘f’. Default is ‘g’.
- get_num_branches()
Get the number of branches.
- Returns:
Number of branches (int).
- get_case(eid)
Returns the
Case
object identified by the integer identifiereid
or None if the case is not defined in the Model case list.- Parameters:
eid (int) – Case identifier (a positive integer).
- Returns:
Case
object.
- set_case(case)
Add the
Case
object to the Model. If a case with the identifierCase.eid
already exists, an exception is produced. Note: When creating a Case object it will automatically be added to the Model if add=True (seeCase
). To check if a case does not exist in the list check for None returned when callingget_case()
.- Parameters:
Case (Case) – Case object to be added to Model.
- get_cases(solved=True)
Get a list of all :class:Case` objects. If
solved
is True (default) the list of all case objects containing solutions is returned. Else, the list of all case objects is returned.- Parameters:
solved (bool) – Solved cases flag.
- Returns:
List of :class:Case` objects. List is empty if no cases found.
- get_cases_list(solved=True)
Get a list of all case identifiers. If
solved
is True (default) tthe list of all case identifiers containing solutions. Else, the list of all case identifiers is returned.- Parameters:
solved (bool) – Solved cases flag.
- Returns:
Integer list of all case identifiers. List is empty if no cases found.
- get_case_identifiers(solved=True)
Get a list of all case identifiers. If
solved
is True (default) tthe list of all case identifiers containing solutions. Else, the list of all case identifiers is returned.- Parameters:
solved (bool) – Solved cases flag.
- Returns:
Integer list of all case identifiers. List is empty if no cases found.
- remove_case(eid)
Removes the case (object) from cases list and from the database (if any). The object itself is not deleted. Removed object will no be saved to the database.
- Parameters:
eid (int) – Case identifier (a positive integer).
- Raise:
KeyError if the case is not defined.
- get_nbc(eid, branch=1)
Returns the NBC object identified by the natural boundary condition (NBC) set identifier
eid
.- Parameters:
eid (int) – Natural boundary condition set identifier (a positive integer).
branch (int) – Branch to searched (default is 1).
- Returns:
The boundary condition (NBC) object or
None
if not found. To get the boundary condition object type, call get_nbc_type.
- get_nbc_type(eid, branch=1)
Returns the NBC boundary condition type of the natural boundary condition (NBC) set identifier
eid
.- Parameters:
eid (int) – Natural boundary condition set identifier (a positive integer).
branch (int) – Branch identifier (default is 1).
- Returns:
The boundary condition type string or
None
if not found.
- get_nbcs(branch=1)
Returns a dictionary with all defined NBC boundary condition objects of a specific mesh (branch). The dictionary is empty if no NBC conditions are defined for the mesh.
- Parameters:
branch (int) – Mesh (branch) identifier (default is 1).
- get_elem(eid, branch=1)
Get
branch.Element
object. An exception is raised if the branch and/or the element is not defined.- Parameters:
eid (int) – External element identifier.
branch (int) – Branch identifier. Default is 1.
- Returns:
Element object.
- get_elem_i(iid, branch=1)
Get
branch.Element
element object. An exception is raised if the branch and/or the element is not defined.- Parameters:
eid (int) – Internal element identifier.
branch (int) – Branch identifier. Default is 1.
- Returns:
Element object.
- get_elem_edge_length(eid, edgeid, branch=1)
Compute element edge length given branch an element external identifiers and edge number. An exception is raised if the branch and/or the element is not defined.
Note
RIGHT NOW ONLY OPERATIVE FOR BEAMS!
- Parameters:
eid (int) – External element identifier.
edge (int) – Edge number (1,.2,.,3…).
branch (int) – Branch identifier. Default is 1.
- Returns:
Tuple
a, b, c
, wherea
is the element edge length (float),b
the element edge start point coordinate (array of 3 floats), andc
the element edge end point coordinate (array of 3 floats).
- get_elem_eid(iid, branch=1)
Given the internal element id of a specific branch, the function returns the external element identifier. An exception is raised if the branch and/or the element is not defined.
- get_elem_face_conn(eid, iface, branch=1)
Extracts the Simples internal element face node identifiers of an element face of an element given by its external element identfier. An exception is raised if the branch and/or the element is not defined.
- Parameters:
eid (int) – External element identifier.
iface (int) – Element face identifier (1,2,3…).
branch (int) – Branch identifier of element face to be extracted. Default is 1.
- Returns:
Tuple``conn,family``, where
conn
is anumpy
int array containing the connectivities of the face (internal node identifiers). The coordinate identifiers point directly to the coordinate in the branch coordinate array.familym
is the element family member of the face, see constants.py. If the face is not found,None
is returned.
- get_elem_face_conn_i(iid, iface, branch=1)
Extracts the Simples internal element face node identifiers of an element face of an element given by its Simples internal element identifier. An exception is raised if the branch and/or the element is not defined.
- Parameters:
iid (int) – Internal element identifier The Internal Identifier.
(int) (iface) – Element face identifier (1,2,3…).
branch (int) – Branch identifier of element face to be extracted. Default is 1.
- Returns:
Tuple
conn,family
, whereconn
is anumpy
int array containing the connectivities of the face (internal node identifiers). The coordinate identifiers point directly to the coordinate in the branch coordinate array.familym
is the element family member of the face, see constants.py. If the face is not found,None
is returned.
- get_elem_family(eid, branch=1)
Returns the element family identifier of external element
eid
of a branch. An exception is raised if the branch and/or the element is not defined.- Parameters:
eid (int) – External element identifier.
branch (int) – Branch identifier. Default is 1.
- Returns:
Element family name (str). See constants.py.
- get_elem_family_i(iid, branch=1)
Returns the element family identifier of internal element
iid
of a branch. An exception is raised if the branch and/or the element is not defined.- Parameters:
iid (int) – Internal element identifier.
branch (int) – Branch identifier. Default is 1.
- Returns:
Element family identifier (positive int).
- get_elem_iid(eid, branch=1)
Given the external element id of a specific branch, the function returns the internal element identifier. An exception is raised if the branch and/or the element is not defined.
- get_elem_nearest(xyz)
Get the nearest element to a given point.
Is not an efficient implementation!
- Parameters:
xyz (array) – Point array (x,y,z).
- Returns:
Branch with nearest element and external element identifier of branch nearest element or -1, -1.
- get_elem_types()
Get all B2000++ element type identifiers (ityp) defined in this model.
- Returns:
A list of int containing the B2000++ element type identifiers ityp.
- get_elem_type_names()
Get all names of B2000++ elements defined in this model.
- Returns:
A list of strings containing the element names.
- get_elem_set_names()
Get the names of all element sets defined for this model.
- Returns:
A list with the names of all element sets.
- get_elem_set(name, branch=1, iid=False)
Get array of element identifiers of an element set. An exception is raised if the branch and/or the name is not defined.
- Parameters:
name (str) – Node set name.
branch (int) – Branch identifier of the element set to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
numpy int32 array containing ref:external <eid> or internal element identifiers of element set.
- get_elem_face_set_names()
Get the names of all face sets defined for this model.
- Returns:
A list with the names of all face sets.
- get_elem_face_set(name, branch=1, iid=False)
Get array of element and face identifiers of an element face set. An exception is raised if the branch and/or the name is not defined.
- Parameters:
name (str) – Element face set name.
branch (int) – Branch identifier of the element face set to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
numpy int32 array (n,2) containing ref:external <eid> or internal element identifiers and face idenfifiers of element face set.
- get_elem_edge_set_names()
Get the names of all edge sets defined for this model.
- Returns:
A list with the names of all edge sets.
- get_elem_edge_set(name, branch=1, iid=False)
Get the mesh element and edge identifiers of an element edge set of a branch. An exception is raised if the branch and/or the name is not defined.
- Parameters:
name (str) – Element edge set name.
branch (int) – Branch identifier of the element face set to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
numpy int32 array (n,2) containing ref:external <eid> or internal element identifiers and edge idenfifiers of element edge set.
- get_num_elements(branch=1)
Get the number of elements of branch. Note that branch can be omitted if there is only one branch defined. An exception is raised if the branch is not defined.
- Parameters:
branch (int) – Branch identifier. Default is 1.
- Returns:
Number of elements (int).
- Raise:
Key error if branch not defined.
- get_epar(eltype)
Get the B2000++ element parameter object
simples.epar.Epar
of a specific element type or None if not defined.- Parameters:
eltype (int/str) – B2000++ element type number (1, 2, …) if
eltype
is anint
, or element type name ifeltype
is astr
.- Returns:
The
epar.Epar
object of element typeeltype
or None if not found. Ifeltype
is of wrong type an exception is thown.
- get_epar_name(ityp)
Get the element type name of the element type number
ityp
.- Parameters:
ityp (int) – Element type number.
- Returns:
Element type name (str) or None if not found.
- get_epar_ityp(name)
Get the element type number of the element type
name
.- Parameters:
name (str) – Element type name, such as “Q4.S.MITC”, “B2.S.RS”, etc.
- Returns:
Element type (int) or 0 if not found.
- get_node_nearest(xyz)
Get the mesh node identifier nearest to a given coordinate tuple(x,y,z) formulated in the global system.
Is not an efficient implementation!
- Parameters:
xyz (array) – Array defining point (x,y,z)formulated in the global system.
- Returns:
Branch identifier with nearest node and node identifier of nearest external node or -1, -1.
- get_node_coordinates_array(branch=1)
Get mesh node coordinates array
xyz[nn,3]
, wherenn
is the number of mesh nodes.- Parameters:
branch (int) – Branch identifier from which the coordinates of the mesh node are extracted. This parameter can be omitted if branch 1 is requested.
- Returns:
A
numpy
array of[nn, 3]
floats containing the x-, y-, and z-coordinates of all node of the branch orNone
(see comment). All values are floats.
- get_node_coordinates(eid, branch=1)
Get mesh node coordinates of node
eid
. An exception is raised if the branch and/or the node is not defined.- Parameters:
eid (int) – External node identifier.
branch (int) – Branch identifier from which the coordinates of the mesh node are extracted. Default is 1.
- Returns:
A
numpy
array of 3 floats containing the x-, y-, and z-coordinates.- Raise:
KeyError if branch or eid not defined.
- get_node_coordinates_i(iid, branch=1)
Get mesh node coordinates of internal node
iid
. An exception is raised if the branch and/or the node is not defined.- Parameters:
iid (int) – Internal node identifier.
branch (int) – Branch identifier from which the coordinates of the mesh node are extracted. Default is 1.
- Returns:
A
numpy
array of 3 floats containing the x-, y-, and z-coordinates orNone
(see comment) ifeid
orbranch
are out of range.
- get_num_nodes(branch=1)
Get the number of mesh nodes of branch. Note that branch can be omitted if there is only one branch defined. An exception is raised if the branch is not defined.
- Parameters:
branch (int) – Branch identifier.
- Returns:
Number of nodes (int).
- Raise:
Key error if branch not defined.
- get_node(eid, branch=1)
Get
Node
object of branch.Node
contains all parameters of the node identified byeid
. An exception is raised if the branch and/or the node is not defined.- Parameters:
eid (int) – External node identifier.
branch (int) – Branch identifier. Can be omitted if there is only one branch defined or if branch 1 is requested.
- Returns:
branch.Node
object.
- get_node_i(iid, branch=1)
Get
branch.Node
object of branch. An exception is raised if the branch and/or the node is not defined.- Parameters:
iid (int) – Internal node identifier.
branch (int) – Branch identifier. Can be omitted if there is only one branch defined or if branch 1 is requested.
- Returns:
branch.Node
object.
- get_num_coor(branch=1)
Same as get_num_nodes.
- get_node_set_names()
Get the names of all node sets defined for this model.
- Returns:
A list with the names of all node sets.
- get_node_set(name, branch=1, iid=False)
Get array with node identifiers of a node set. An exception is raised if the branch and/or the node set name not defined.
- Parameters:
name (str) – Node set name.
branch (int) – Branch identifier of the node set to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
numpy int32 array containing ref:external <eid> node identifiers of element set.
- property num_materials
Get the number of materials (MATERIAL) defined in the current model.
- get_material(mid)
Returns the material object of material
mid
or None if not defined.- Parameters:
int (name) – Material identifier.
- Returns:
Material object.
- get_materials()
Returns the material dictionary.
- Returns:
Material dictionary (empty of no materials defined).
- property materials
Get the materials dictionary (MATERIAL).
- get_num_eprops()
Returns the number
matandprop.Eprop
objects defined in the current model. Element properties objects are Simples objects for adding element attributes to the Modeler, specifically the FE mesh generator.
- get_eprops()
Returns the element property dictionary containing
matandprop.Eprop
objects. Element properties objects are Simples objects for adding element attributes to the Modeler, specifically the FE mesh generator.- Returns:
Material property dictionary (empty of no element properties defined).
- get_eprop(name)
Returns the
matandprop.Eprop
objectname
. Element properties objects are Simples objects for adding element attributes to the Modeler, specifically the FE mesh generator.- Parameters:
int (str name) – Element property name.
- Returns:
matandprop.Eprop
object or None if not defined.
- set_eprop(eprop, replace=True)
Adds an new
matandprop.Eprop
object to the model. Element properties objects are Simples objects for adding element attributes to the Modeler, specifically the FE mesh generator.- Parameters:
prop (kwargs) – Element properties in the form key=values. No check made for key validity at this stage.
replace (bool) – Replace flag. If set to True (default), any existing element property object with the property name
name
will be replaced. If set to False an exception is raised if an existing element property object with the property namename
is found.
- get_num_properties()
Returns the number of properties (
matandprop.Property
objects) defined in the current model.
- get_properties()
Returns the dictionary containing
matandprop.Property
objects.- Returns:
Dictionary containing
pid: Property
pairs, wherepid
is the property identifier (int).
- get_property(pid)
Returns the property object
matandprop.Property
object belonging to the identifierpid
. :param pid int: Property name.- Returns:
matandprop.Property
or None if not defined.
- set_property(prop, replace=True)
Adds an new
matandprop.Property
object to the model.
- get_num_steps(case=1)
Get the number of load or time steps (cycles) of a case’.
- Parameters:
case (int) – Case identifier (default is 1).
- Returns:
number of load or time steps (cycles) of a case.
- get_num_cycles(case=1)
Same as
get_num_steps()
.
- get_steps(key='TIME', case=1, scale=1.0)
Extracts the solution step time (or load factor) values for all solution steps (cycles) of a case (non-linear analysis only). The solution step is the value of
key
of the dataset descriptorSOLUTION-STEP.0.*.0.case
i.e time, load factor etc.- Parameters:
key (str) – Value key to be extracted. Default is ‘TIME’.
case (int) – Solution case to be processed. Default is 1.
scale (float) – Scale value. Default is 1.0.
- Returns:
A
numpy
float array containing values ofkey
of all steps. Values scaled byscale
.
- get_steps_info(case=1)
Extracts the solution step attributes for all defined cycles or None and returns a list with StepInfo named tuples.
- Parameters:
case (int) – Solution case identifier.
- Returns:
A list with StepInfo named tuples.
- get_dof_value_of_steps(name, node=1, dof=0, case=1, branch=1, system='bg', scale=1.0)
Extracts DOF(s) of a specific node for all solution steps (cycles) of a DOF (node) field
field.branch.<cycle>.0.case
. If the analysis was linear, a single value is returned.- Parameters:
name (str) – Name of DOF field.
node (int) – FE model node identifier or modeler point name of node. The node identifier is external.
dof (int) – DOF index (1,2,3…) of field node to be extracted. If set to 0 all DOFs are extracted (default).
case (int) – Solution case to be processed. Default is 1.
branch (int) – Branch identifier. Default is 1.
system (str) – Reference system in which dof’s are returned. ‘bg’ means branch-global (default). ‘nl’ means node-local (if a node-local system is defined at that node in the FE model!).
scale (float) – Scale value. Default is 1.0.
- Returns:
A
numpy
array containing one value per step (dof>0) or all values (dof=0).
- get_force_nonzero_ebc(eid, case=1, cycle=0)
Computes the sum of all forces of nodes with non-zero essential boundary conditions values of set
eid
them up.- Parameters:
eid (int) – Essential Boundary Conditions identifier.
case (int) – Solution case. Default is 1.
cycle (int) – Reaction force solution cycle (default is 0).
- Returns:
A
numpy
array with the resulting 3 force components [Fx,Fy,Fz] or a zero value array if not found. The forces are defined in the branch global system.
- get_force_nonzero_nbc(nbc, case=1, cycle=0)
Extracts all forces of the Natural Boundary Conditions set
nbc
and sums them up.- Parameters:
eid (int) – Natural boundary conditions identifier.
case (int) – Solution case (default is 1).
cycle (int) – Solution cycle (default is 0).
- Returns:
A
numpy
array with the 3 force components [Fx,Fy,Fz] or a zero value array if not found. The forces are defined in the branch global system.
- get_reaction_force_of_steps(case=1, what='rcfo_restrict', eid=1, scale=1.0)
Extracts the sum of all reaction forces of all steps of a non-linear analysis.
- Parameters:
what (str) – Reaction force extraction type. rcfo_restrict extracts all forces of node sets defined by the rcfo_restrict specification of case (default). ebc extracts all forces of non-zero entries of Essential Boundary Conditions set eid. You then must specify eid.
case (int) – Solution case to be processed.
eid (int) – Identifier of rcfo_restrict Essential Boundary Conditions dataset.
scale (float) – Scale factor. Default is 1.
- Returns:
A
numpy
array containing, for each step, the total reaction force amplitudes of the reaction forces of all nodes defined either by the node setsrcfo_restrict
or by all non-zero entries of Essential Boundary Conditions seteid
.
- get_dof_value_along_line(name, nodes, dof=1, case=1, cycle=0, subcycle=0, branch=1)
Extracts DOF values of a DOF field for a given list of nodes defining a single connected line. Can be used to plot DOF solution values along edges generated by Simples.
- Parameters:
name (str) – DOF field name, such as ‘displacements’, ‘temperatures’.
nodes (list) – List, tuple, or numpy array containing the external node identifiers defining the continuous line. The node list can be obtained with the node list extraction function
get_node_set()
.dof (int) – DOF number to be extracted. DOFs are numbered 1,2,3… Default is 1
case (int) – Solution case to be processed. Default is 1.
branch (int) – Branch identifier of field to be extracted. Default is 1.
- Returns:
The helper class ArrayN2 containing the array
values[n, 2]
, wherevalues[:,0]
contains the arc length for the station andvalues[:,1]
the DOF value at the station.
- get_eigenfrequencies(case=1, cycle=0)
Returns the eigenfrequencies of a free vibration analysis of a solution case.
- Parameters:
case (int) – Solution case to be processed. Default is 1.
cycle (int) – Solution cycle to be processed. Default is 0.
- Returns:
The helper class Eigenfrequencies containing the mode numbers and their frequencies as well as the modal stiffness and the modal mass of a case.
- get_buckling_load(case=1, cycle=0, ebc=None, nbc=None)
Returns the critical loads of a buckling analysis of case ‘case’ by scanning Essential Boundary Conditions and Natural Boundary Conditions.
- Parameters:
case (int) – Solution case. Default is 1.
cycle (int) – Solution cycle (non-linear analysis). Default is 0.
ebc (int) – Essential Boundary Conditions set identifiers to be considered when calculating reaction forces from the reaction force set of
case
. By default, all Essential Boundary Conditions sets found for the case are considered (non-zero values only!).nbc (int) – Natural Boundary Conditions set identifiers to be considered when calculating reaction forces from the force set (right-hand side) set of
case
. By default, all Natural Boundary Conditions sets found for the case are considered.
- Returns:
The helper class BucklingLoad containing the eigenvalues and the buckling loads.
- compute_rayleigh_damping_coefficients(mode1, mode2, z1=0.001, z2=0.001, case=1)
Compute the Rayleigh damping coefficients \({alpha}\) and \({beta}\).
- Parameters:
case (int) – Solution case to be processed. Default is 1.
mode1 (int) – First mode to be processed.
mode2 (int) – Second mode to be processed.
z1 (float) – Damping coefficient for mode 1. Range is 0<=z1<=1. Default is 0.001.
z2 (float) – Damping coefficient for mode 2 Range is 0<=z1<=1. Default is 0.001.
- Returns:
Tuple of floats
alfa, beta
Rayleigh damping coefficients \({alpha}\) and \({beta}\).- Raise:
Exception if modes cannot be extracted.
- get_node_eid(iid, branch=1)
Given the internal node id of as specific branch, the function returns the external node identifier. The internal node identifiers are numbered 0, 1, 2, 3, …
- get_node_eids(branch=1)
Return all external node identifiers of branch (default is branch 1).
- Returns:
Numpy int array with all external node identifiers of the branch.
- Raise:
Exception if branch not found.
- get_node_iid(eid, branch=1)
Given the external node id of as specific branch, the function returns the internal node identifier.
- get_node_field1(name, nodeid, branch=1, case=1, cycle=0, subcycle=0, mode=None, subcase=None)
Given the node field
name
the function returns the field values at the nodenodeid
. This function is a shortcut to the NodeField class: It does not load the complete field of all nodes but it loads only the values of the given node.- Parameters:
name (str) – Node field name.
nodeid (int) – External node identifier.
branch (int) – Branch identifier of field. Default is 1.
case (int) – Solution case to be processed. Default is 1.
cycle (int) – Solution cycle to be processed. Default is 0.
subcycle (int) – Solution subcycle to be processed. Default is 0.
mode (int) – Solution mode number to be processed. Default is None.
subcase (int) – Solution subcase to be processed. Default is None.
- Returns:
Array containing field values.
- get_branch(branch=1)
Get the branch object of branch branch. This function can also be used to check if a branch exists: If not, None is returned.
- Parameters:
branch (int) – Branch identifier (int). Default is 1.
- Returns:
The branch object.
- get_branches()
Get a list containing all branch (mesh) objects.
- Returns:
List containing all branch objects. List is empty if no branches are defined.
- get_branches_list()
Get the list of all external branch (mesh) identifiers.
- Returns:
List of int containing all external branch identifiers sorted in ascending order. List is empty if no branches are defined.
- get_field_type(name, branch=1, case=1, cycle=0, subcycle=0, subcase=None, mode=None)
Loads a solution field. Depending on the type of field, a
NodeField
,ElementField
, orSamplingPointField
will be loaded and returned.- Parameters:
model (Model) – :Model object containing the field.
name (str) – Field name. Field names depend on the B2000++ solver. Some predefined names and aliases are available, see Solution field names.
branch (int) – Branch identifier of field. Default is 1.
case (int) – Solution case. Default is 1.
cycle (int) – Load or time increment cycle. Default is 0.
subcycle (int) – Load or time increment subcycle. Default is 0.
subcase (int) – Solution subcase. Default is None.
mode (int) – Buckling or vibration analysis mode. Default is None. Alias to subcase.
- Returns:
A string:
DOF
if the field is a DOF field (defined at mesh nodes),SPF
if the field is a sampling point field (defined at mesh elements) andNone
else.
- get_field(name, branch=1, case=1, cycle=0, subcycle=0, subcase=None, mode=None, ftype=None)
Loads a solution field. Depending on the type of field, a
NodeField
,ElementField
, orSamplingPointField
will be loaded and returned.- Parameters:
model (Model) – :Model object containing the field.
name (str) – Field name. Field names depend on the B2000++ solver. Some predefined names and aliases are available, see Solution field names.
branch (int) – Branch identifier of field. Default is 1.
case (int) – Solution case. Default is 1.
cycle (int) – Load or time increment cycle. Default is 0.
subcycle (int) – Load or time increment subcycle. Default is 0.
subcase (int) – Solution subcase. Default is None.
mode (int) – Buckling or vibration analysis mode. Default is None. Alias to subcase.
- Returns:
The field object.
Note
get_field
can only load fields defined by the ‘AT’ (array table) orF
orI
dataset types.
- has_branch(eid)
Check if branch identifier
eid
belongs to a branch.- Parameters:
branch (int) – Branch identifier (int) to be checked.
- Returns:
True if
eid
is a branch, False else.
- has_case(eid)
Checks if case
eid
exists. :return: True ifeid
is a case, False else.
- get_epatch_point_node(epatchid, point, branch=1, iid=False)
Extracts the node identifier of a vertex point of a B2000++ EPATCH.
- Parameters:
epatchid (int) – B2000++ EPATCH identifier.
point (int) – B2000++ EPATCH point index. Note that epatch points are numbered 1,2, etc., corresponding to points “P1”, “P2”, etc. Example: To get the node identifier of vertex point “P3”, set
point
to 3. Ifpoint
is set to 0, the function returns all vertex points.branch (int) – Branch identifier of epatch to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
A
numpy
int containing the external or internal node number(s).
- get_epatch_body_node_set(epatchid, branch=1, iid=False)
Extracts the list of node identifiers of all body nodes of a B2000++ EPATCH.
- Parameters:
epatchid (int) – B2000++ EPATCH identifier.
branch (int) – Branch identifier of epatch to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
A
numpy
int array containing the external or internal node identifiers of the EPATCH vertices.
- get_epatch_body_elem_set(epatchid, branch=1, iid=False)
Extracts the list of element identifiers of all body elements of a B2000++ EPATCH.
- Parameters:
epatchid (int) – B2000++ EPATCH identifier.
branch (int) – Branch identifier of epatch to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
A
numpy
int array containing the external or internal element identifiers of the EPATCH body elements.
- get_epatch_edge_node_set(epatchid, edgeid, branch=1, iid=False)
Extracts the list of node identifiers of the points defining an edge of a B2000++ EPATCH. The nodes are sorted in i- and j-axes increasing order.
- Parameters:
epatchid (int) – B2000++ EPATCH identifier.
edgeid (int) – B2000++ EPATCH edge number (1,2,3…).
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
A
numpy
int array containing the external or internal node identifiers.
- get_epatch_edge_elem_set(epatchid, edgeid, branch=1, iid=False)
Extracts the list of element identifiers and face numbers of the elements defining an edge of a B2000++ EPATCH. An element list contains entries in a EPATCH-specific order. Note: Internal element numbers are numbered starting from 0.
- Parameters:
epatchid (int) – B2000++ EPATCH identifier.
edgeid (int) – B2000++ EPATCH edge number (1,2,3…).
branch (int) – Branch identifier of epatch to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
A
numpy
int array [n,2] of int’s containing the external or internal element identifier and the face identifier for all n elements of the list .
- get_epatch_face_node_set(epatchid, faceid, branch=1, iid=False)
Extracts the list of node identifiers of the points defining an face of a B2000++ EPATCH. A node list contains entries in a EPATCH-specific order.
- Parameters:
epatchid (int) – B2000++ EPATCH identifier.
faceid (int) – B2000++ EPATCH face number (1,2,3…).
branch (int) – Branch identifier of epatch to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
A
numpy
int array containing the external (default) or internal node numbers.
- get_epatch_face_elem_set(epatchid, faceid, branch=1, iid=False)
Extracts the list of element identifiers and their face numbers of the elements defining a face of a B2000++ EPATCH. An element list contains entries in a EPATCH-specific order. Note: Internal element numbers are numbered starting from 0.
- Parameters:
epatchid (int) – B2000++ EPATCH identifier.
faceid (int) – B2000++ EPATCH face number (1,2,3…).
branch (int) – Branch identifier of epatch to be extracted. Default is 1.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
A
numpy
int array [n,2] containing the external or internal element identifier and the element’s face identifier for all n elements of the list.
2.1.2. Element Parameters
Epar
contains the element type information of a
:class:Simples ~simples.Model. It is managed by
:class:Model
and the element parameter information
:class:can be retrieved with the Model
methods
:class:get_epar()
,
get_epar_name()
and
get_epar_ityp()
.
- class Epar(epar)
Internal Simples element type parameters object. Is derived from the
ELEMENT-PARAMETER
dataset.- Parameters:
epar (dict) –
ELEMENT-PARAMETER
table to be decoded.
The
Epar
object defines the following properties:add6dof
(int): Can contribute to “add 6 dof”.family
(str): Element family,B
(beams),Q
(quads), etc.familym
(str): Element family member, such asB2
,Q4
, etc.ityp
(int): B2000++ element type identifier.ltemp
(int): Size of temperature array at nodesname
(str): Element name, such asQ4.S.MITC
,B2.S.RS
, …nne
(int): Number of nodes defining element (if applicable).ntypes
(int array): Node types of each element node.sclass
(str): Problem solution class (S
,HEAT
,).
For node types, see NODE-PARAMETERS.
- show()
Print epar parameters.
- class Epars(model)
Internal class to store element type information, reflecting the dataset ELEMENT-PARAMETERS. Element parameters are stored in an array of
Epar
objects addressed by the indexityp
(= 1, 2, 3,…).ityp
is the B2000++ internal element type number (stored as keywordELNO
in the ELEMENT-PARAMETERS database object.Epars is automatically created by
simples.model.Model
and accessed through theModel
methods :class:get_epar()
,get_epar_name()
andget_epar_ityp()
.- load()
Load epar table from current database.
- save()
Saves epar tables.
- Parameters:
close (bool) – Close the database if set to True (default is False).
- create()
Create epar table from module epartables.py
- get_byname(name)
Return Epar object of the element type
name
.- Parameters:
name (str) – Element type name. Lower characters are converter to upper.
- Returns:
The Epar object of
name
or None if not found.
Example
Get element parameter table of element ‘Q4.S.MITC’ and print number of nodes per element
nne
:epar = model.get_byname('Q4.S.MITC') if epar: print('nne=', epar.nne)
2.2. FE Mesh Classes
2.2.1. Branch
- class Branch(eid, Model, incsize=1000)
Creates a B2000++ unstructured FE mesh object of a branch or subdomain. The Branch object is usually never created by the user, it is created by the Model object.
- Parameters:
eid (int) – Branch (external) identifier (a positive int).
Model (Model) – Parent Model object.
incsize (int) – Buffer increment size (used only when generating nodes or elements).
- property eid
Get (external) identifier of the branch (a positive int).
- property ident
Get (external) identifier of mesh (or branch), a positive int.
- property elements
Get list containing all FE mesh element objects.
- property nodes
Get list containing all FE mesh node objects.
- property model
Get the Model object assigned to this branch (mesh).
- property modeler
Get the Modeler object associated to this branch (mesh).
- get_node(eid)
Get node object of external identifier eid.
- Parameters:
eid (int) – External node identifier.
- Returns:
Node object.
- Raise:
Exception if wrong eid.
- get_node_i(iid)
Get node object of internal identifier iid.
- Parameters:
iid (int) – Internal node identifier.
- Returns:
Node object.
- Raise:
Exception if identifier not found
- set_node(eid, xyz, dofref=0, nodetype=0, point=None)
Creates (adds) a new FE mesh node
eid
. Ifeid
is defined an exception is raised. To replace node attributes, make use ofget_node()
.- Parameters:
eid (int) – External identifier of new mesh node.
xyz (array) – Array (numpy array, list, tuple) of 3 floats defining mesh node coordinates.
dofref (int) – If specified, it defines the DOF transformation identifier of the corresponding transformation or 0 if no transformation is to be appled for the node (default).
nodetype (int) – Node type, see NODE-PARAMETERS. Default is 0.
point (str) – Optional modeler point name of node. Default is None.
- Returns:
The
Node
object.- Raise:
Exception if identifier not found
- get_node_dof_transformation(eid)
Get mesh node DOF coordinate transformation identifier.
- Parameters:
eid (int) – External node identifier.
- Returns:
DOF coordinate transformation matrix
tm[3,3]
(a numpy float array).- Raise:
Exception if identifier not found
- get_node_coordinates_array()
Get mesh node coordinates array of branch.
- Returns:
Numpy array of [nn, 3] floats containing the x-, y-, and z-coordinates of all nn nodes of the branch.
- Raise:
Exception if identifier not found
- get_node_coordinates(eid)
Get mesh node coordinates of a node of the branch. Since
eid
is the external identifier only one mesh node can be retrieved at the time.- Parameters:
eid (int) – External node identifier.
- Returns:
Numpy array of 3 floats containing the x-, y-, and z-coordinates.
- Raise:
Exception if identifier not found
- get_node_coordinates_i(iid)
Get mesh node coordinates of the internal node
iid
. An alternative method is to get the reference of the node coordinate array withget_node_coordinates_array()
and to address the rowiid
.- Parameters:
iid (int) – Internal node identifier.
- Returns:
Numpy array of 3 floats containing the x-, y-, and z-coordinates.
- Raise:
Exception if identifier not found.
- get_node_eid(iid)
Get the external node identifier given the internal one.
- Parameters:
iid (int) – Internal node identifier (0, 1, 2, …).
- Returns:
ref:External <eid> node identifier (int).
- Raise:
Exception if identifier not found.
- get_node_iid(eid)
Get the internal node identifier given the external one.
- get_node_eids()
Get all external node identifiers of branch.
- Returns:
Numpy array with all node identifiers of branch.
- get_node_set_obj(name)
Get the node set object by name.
- Parameters:
name (str) – Node set name.
- Returns:
Node set object.
- Raise:
Exception if identifier not found.
- get_node_set(name, iid=False)
Get the node identifiers of node set.
- Parameters:
name (str) – Node set name.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
numpy int32 array containing mesh external or internal node identifiers.
- Raise:
Exception if identifier not found.
- has_node_set(name)
Checks if node set exists.
- Parameters:
name (str) – Node set name.
- Returns:
True or False.
- set_elem(eid, familym, conn, **kwargs)
Creates a new FE mesh element identified by
eid
. Ifeid
is defined an exception is raised. To replace element attributes, make use ofreplace_elem()
.- Parameters:
eid (int) – External identifier of new mesh element.
familym (str) – Family member, such as ‘self._model.get_epar_name(i)}’, self._mesh.elements_ityp_iids[i])
kwargs (kwargs) – Any other key=value information to be stored with the element.
- Returns:
The
Element
object.- Raise:
Exception if identifier not found.
- modify_elem(eid, familym=None, conn=None)
Modifies attributes of a FE mesh element.
- Parameters:
eid (int) – External element identifier.
familym (str) – Family member to be replaced, such as ‘B2’, ‘Q4’, ‘T3’.
conn (array) – Element node connectivity array to be replaced (int).
conn
must correspond to the family member’s element type. Contains Simples internal node identifiers defining element (see generic elements.
:return modified element object. :raise: Exception if identifier not found.
- get_elem(eid)
Get element object, see
Element
.- Parameters:
eid (int) – External element identifier.
- Returns:
Element object.
- Raise:
Exception if identifier not found.
- get_elem_i(iid)
Get element object, see
Element
.- Parameters:
iid (int) – Internal element identifier.
branch (int) – Branch identifier. Default is 1.
- Returns:
Element object.
- Raise:
Exception if identifier not found.
- get_elem_etab_key_i(iid, key)
General-purpose function for extracting a specific element attribute
key
from the database for internal elementiid
. If found, the values are returned.
- get_elem_etab_key(eid, key)
General-purpose function for extracting a specific element attribute
key
from the database for external elementeid
.
- get_elem_etab_i(iid)
Returns the database ETAB table of internal element
iid
.- Parameters:
iid (int) – Internal element identifier.
- Returns:
ETAB table (dict).
- Raise:
Exception if identifier not found.
- get_elem_etab(eid)
Returns the database ETAB table of external element
eid
.- Parameters:
eid (int) – External element identifier.
- Returns:
ETAB table(dict).
- Raise:
Exception if identifier not found.
- get_elem_conn_i(iid)
Given the internal element identifier, the function returns the element to node connectivity array.
The element to node connectivity array elements. i.e the row number of the corresponding mesh node coordinate array, are internal node identifiers (0, 1, 2, …).
- Parameters:
iid (int) – Internal element identifier.
- Returns:
Element to node connectivity array.
- Raise:
Exception if identifier not found.
- get_elem_conn(eid)
Given the external element identifier, the function returns the element to node connectivity array containing external node identifiers.
- Parameters:
eid (int) – External element identifier.
- Returns:
Element to node connectivity array (exernal node identifiers).
- Raise:
Exception if identifier not found.
- get_elem_eid(iid)
Given the internal element identifier, the function returns the external element identifier.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
External element identifier (int).
- Raise:
Exception if identifier not found.
- get_elem_eids()
Get all element identifiers.
- Returns:
Numpy array with all external element identifiers.
- get_elem_face_conn_i(iid, iface)
Extracts the Simples internal element face node identifiers of an element face of an element given by its Simples internal element identifier.
- Parameters:
iid (int) – Internal element identifier.
iface (int) – Element face identifier (1,2,3…).
- Returns:
conn, familym
, whereconn
is a numpy int array containing the connectivities of the face internal node identifiers. The coordinate identifiers point directly to the coordinate array.familym
is the element family member of the face, see constants.py.- Raise:
Exception if identifier not found.
- get_elem_face_conn(eid, iface)
Given the external elemen identifier the function extracts the Simples internal element face node identifiers of a face if the element.
- Parameters:
eid (int) – External element identifier.
iface (int) – Element face identifier (1,2,3…).
- Returns:
conn, family
, whereconn
is a numpy int array containing the connectivities of the face internal node identifiers. The coordinate identifiers point directly to the coordinate array.familym
is the element family member of the face, see constants.py.- Raise:
Exception if identifiers not found.
- get_elem_family_member_i(iid)
Returns the element family member identifier of internal element iid.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
Element family member (str): “Lx” for line elements (rods, beams), “Qx” “Tx” for shell and other 2-dimensional elements, “HEx” “TEx”, “PRx” for continuum elements.
- Raise:
Exception if identifier not found.
- get_elem_family_member(eid)
Returns the element family member identifier of external element eid.
- Parameters:
eid (int) – External element identifier.
- Returns:
Element family member (str): “Lx” for line elements (rods, beams), “Qx” “Tx” for shell and other 2-dimensional elements, “HEx” “TEx”, “PRx” for continuum elements.
- Raise:
Exception if identifier not found.
- get_elem_family_i(iid)
Returns the element family identifier of internal element iid.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
Element family (str): “Lx” for line elements (rods, beams), “Qx” “Tx” for shell and other 2-dimensional elements, “HEx” “TEx”, “PRx” for continuum elements.
- Raise:
Exception if identifier not found.
- get_elem_family(eid)
Returns the element family identifier of external element eid.
- Parameters:
eid (int) – External element identifier.
- Returns:
Element family (str): “L” for line elements (rods, beams), “Q” “T” for shell and other 2-dimensional elements, “HE” “TE”, “PR” for continuum elements.
- Raise:
Exception if identifier not found.
- get_elem_iid(eid)
Given the external element identifier, the function returns the internal element identifier.
- Parameters:
eid (int) – External element identifier.
- Returns:
Internal element identifier (int).
- Raise:
Exception if identifier not found.
- get_elem_ityp_i(iid)
Given the internal element identifier, the function returns the element type (a positive int).
- Parameters:
iid (int) – Internal element identifier.
- Returns:
Element type (int).
- Raise:
Exception if identifier not found.
- get_elem_ityp(eid)
Given the external element identifier, the function returns the element type (a positive int).
- Parameters:
eid (int) – External element identifier.
- Returns:
Element type (int).
- Raise:
Exception if identifier not found.
- get_elem_itypes()
Returns the list with all element types (ityp) found in this branch.
:return:List of all element types (int) of this model.
- get_elem_mid_i(iid)
Returns the material identifier of internal element
iid
.- Parameters:
iid (int) – Internal element identifier.
- Returns:
External element material identifier (int).
- Raise:
Exception if identifier not found.
- get_elem_mid(eid)
Returns the material identifier of external element
eid
.- Parameters:
eid (int) – External element identifier.
- Returns:
External element material identifier (int).
- Raise:
Exception if identifier not found.
- get_elem_material_i(iid)
Returns the element material object of internal element
iid
.- Parameters:
iid (int) – Internal element identifier.
- Returns:
Material object.
- Raise:
Exception if identifier not found.
- get_elem_material(eid)
Returns the element material object of external element
eid
.- Parameters:
eid (int) – External element identifier.
- Returns:
Material object.
- Raise:
Exception if identifier not found.
- get_elem_eprop_i(iid)
Returns the
Eprop
element property object of internal elementiid
.- Parameters:
iid (int) – Internal element identifier.
- Returns:
class:Eprop object.
- Raise:
Exception if identifier not found.
- get_elem_eprop(eid)
Returns the
Eprop
element property object of external elementeid
.- Parameters:
eid (int) – External element identifier.
- Returns:
Eprop
object.- Raise:
Exception if identifier not found.
- get_elem_prop_i(iid)
Returns the
Eprop
property object of internal elementiid
.- Parameters:
iid (int) – Internal element identifier.
- Returns:
class:~matandprop.Eprop object.
- Raise:
Exception if identifier not found.
- get_elem_prop(eid)
Returns the
Eprop
property object of external elementeid
.- Parameters:
eid (int) – External element identifier.
- Returns:
Eprop
object.- Raise:
Exception if identifier not found.
- get_elem_pid_i(iid)
Returns the element property identifier of internal element
iid
.- Parameters:
iid (int) – Internal element identifier.
- Returns:
Internal element property identifier of None if not defined.
- get_elem_pid(eid)
Returns the element property identifier of external element
eid
.- Parameters:
eid (int) – External element identifier.
- Returns:
External element property identifier.
- Raise:
Exception if identifier not found.
- get_elem_set_obj(name)
Get the ElementSet object by name.
- Parameters:
name (str) – ElementSet name.
- Returns:
ElementSet object.
- Raise:
Exception if identifier not found.
- get_elem_set(name, iid=False)
Get the element identifiers of an element set.
- Parameters:
name (str) – Element set name.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
numpy int32 array containing external or internal element identifiers of element set.
- Raise:
Exception if identifier not found.
- has_elem_set(name)
Check if element sets exists.
- Parameters:
name (str) – Element set name.
- Returns:
True or False.
- has_elem_family(family)
Check if ‘family’ is in model.
- Parameters:
family (str) – Element family (‘Q’, ‘T’, …) name.
- Returns:
Number of elements of family or None.
- get_elem_edge_set_obj(name)
Get the ElementEdgeSet object identified by name.
- Parameters:
name (str) – ElementEdgeSet name.
- Returns:
ElementEdgeSet object.
- Raise:
Exception if identifier not found.
- get_elem_edge_set(name, iid=False)
Get the element and edge identifiers of an element edge set.
- Parameters:
name (str) – Element edge set name.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
numpy int32 array (n,2). The first column contains the element identifier (external or internal) and the second column the edge identifier (1, 2,..).
- Raise:
Exception if identifier not found.
- has_elem_edge_set(name)
Check if element edge sets exists.
- Parameters:
name (str) – Element edge set name.
- Returns:
True or False.
- get_et_elem_face_set_obj(name, iid=False)
Get element face set object identified by name.
- Parameters:
name (str) – ElementFaceSet name.
iid (bool) – Return internal identifiers if set to True. Default is False, i.e return external identifiers.
- Returns:
ElementFaceSet object.
- Raise:
Exception if identifier not found.
- get_elem_face_set(name, iid=False)
Get the (element, face) pairs of an element face set.
- Parameters:
name (str) – Element face set name.
iid (bool) – Returns internal element identifiers if set to True.
- Returns:
numpy int32 array (n,2). The first column contains the element identifier (external or internal) and the second column the face identifier (1, 2,..).)
- Raise:
Exception if identifier not found.
- has_elem_face_set(name)
Check if element face sets exists.
- Parameters:
name (str) – Element face set name.
- Returns:
True or False.
- elem_compute_centroid_i(iid)
Computes the centroid of the element
iid
.This is not the very most efficient way of computing the element centroid: A c++ function is faster.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
numpy array with centroid coordinates in branch global system.
- Raise:
Exception if identifier not found.
- has_elem(eid)
Check if element with external element identifier
eid
exists.- Returns:
True or False (bool).
- has_node(eid)
Check if node with external node identifier
eid
exists.- Returns:
True or False (bool).
- get_num_nodes()
Returns the number of nodes of branch.
- Returns:
Number of nodes of branch (int)).
- get_num_elements()
Returns the number of elements of branch.
- Returns:
Number of elements of branch (int).
- get_ebc(eid)
Get object of EBC set
eid
.- Parameters:
eid (int) – EBC set identifier.
- Returns:
EbcSet.
- Raise:
Exception if identifier not found.
- get_nbc(eid)
Get NBC object identified by
eid
.- Parameters:
eid (int) – NBC set identifier.
- Returns:
NBC object.
- Raise:
Exception if identifier not found.
- load()
Load B2000++ mesh form current branch
- save()
Save data modified data to database. Do not close.
2.2.2. Node Class
- class Node(branch, eid, iid)
Stores node attributes of a node. Coordinates are stored separately in a numpy array for efficiency reasons.
Additional attributes defined with property:
dofref (int): Node DOF transformation identifier or 0 if not defined. Default is 0.
nodetype (int): Node type (see NODE-PARAMETERS). Default is 0. Set by B2000++ input processor (add6dof).
name (str): Optional point name (such as modeler point name) or None (default).
- property dofref
Node DOF transformation identifier or 0 if not defined (int). 0 means no transformation defined for the node (default.
- property nlcs
Node local DOF orientation transformation matrix tm[3,3] or None (default).
- property name
Name of modeler point, if any (str). Default is None.
- property eid
Defines the external node number (a positive int)
- property iid
Defines the internal node number (a positive int or 0, numbering starts at 0).
- property coordinates
Defines the node coordinates (array of 3 floats).
- property nodetype
Defines the node type (int). See NODE-PARAMETERS dataset.
2.2.3. Element Class
- class Element(branch, eid, iid, familym, conn)
Stores the (most) common attributes of an element. Element-type dependent attributes must be retrieved directly from the database.
- Parameters:
All other attributes are initialized to 0 or None and are set when known. Loading from database sets all parameters.
The string representation of the object __str__ formats all attributes.
- property branch
Return the branch object of element.
- property conn_i
Element internal node connectivity array (a numpy int array).
- property conn
Element external node connectivity array (a numpy array).
- property centroid
Element geometric center (“centroid”). Numpy array of 3 floats in branch-global coordinates.
- property eid
External element identifier (a positive int.
- property elname
Element name (str).
- property elbase
Element-local coordinate system base vectors, if applicable. numpy array of 9 floats or None if not defined.
- property epar
Element parameter (EPAR) object of element.
- property familym
Element family member (str).
- property kwargs
Element optional attributes (a Python dict).
- property iid
Internal element identifier (a positive int or 0). Internal element numbers start at 0.
- property ityp
Internal element type identifier (a positive int or 0 if not defined).
- property mid
Element material identifier, if applicable (a positive int or 0 if material not defined).
- property pid
Element property identifier, if applicable (a positive int or 0 if element property not defined).
- property material
Get or set element material object (for convenience) or None if not defined.
- property nne
Get the number of nodes nne defining element (int).
2.2.4. Node and Element Sets
2.2.5. Node Set
Node sets define collections of FE mesh node sets, i.e arrays containing (external) node identifiers.
- class NodeSet(model, name, issorted=False, branch=1)
Create a B2000++ mesh node set object.
- Parameters:
model (Model) – Model class.
name (strs) – Node set name.
issorted (bool) – Is the set sorted or unsorted (default)?
branch (int) – Branch identifier. Default is 1.
- Raises:
KeyError – Set already exists.
- save()
Write set to DB.
- add(eid)
Adds the node identifier
eid
to the node set. If the node set is sorted the node is not duplicated.- Parameters:
eid (int) – External node identifier to be added to set.
- Raises:
KeyError – If
eid
not defined.
2.2.6. Element Set
Element sets define collections of FE mesh element sets, i.e arrays containing (external) element identifiers.
- class ElementSet(model, name, issorted=False, branch=1)
Create a B2000++ mesh element set object.
- Parameters:
model (Model) – Model class.
name (strs) – Element set name.
issorted (bool) – Is the set sorted or unsorted (default)?
branch (int) – Branch identifier. Default is 1.
- Raises:
KeyError – If set already exists.
- save()
Write set to DB.
- add(eid)
Adds the element identifier
eid
to the element set. If the element set is sorted the element is not duplicated.- Parameters:
eid (int) – External element identifier to be added to set.
- Raises:
KeyError – If
eid
not defined.
2.2.7. Element Edge Set
Element edge sets define collections of FE mesh element edge sets, i.e arrays containing pairs of (element identifier, edge identifier).
- class ElementEdgeSet(model, name, issorted=False, branch=1)
Create a B2000++ mesh element edge set object.
- Parameters:
model (Model) – Model class.
name (strs) – Element edge set name.
branch (int) – Branch identifier. Default is 1.
- save()
Write set to DB.
- add(eid, eeid)
Adds the element identifier
eid
and the associated element edgeeeid
to the element edge set. If the element edge set is sorted,eid
is not duplicated.- Parameters:
eid (int) – External element identifier to be added to set.
eeid (int) – Element edge identifier.
2.2.8. Element Face Set
Element face sets define collections of FE mesh element face sets, i.e arrays containing pairs of (element identifier, face identifier).
- class ElementFaceSet(model, name, issorted=False, branch=1)
Create a B2000++ mesh element face set object.
- Parameters:
model (Model) – Model class.
name (strs) – Element face set name.
issorted (bool) – Is the set sorted or unsorted (default)?
branch (int) – Branch identifier. Default is 1.
- save()
Write set to DB.
- add(eid, efid)
Adds the element identifier
eid
and the associated element faceefid
to the element face set. If the element face set is sortedeid
is not duplicated.- Parameters:
eid (int) – External element identifier to be added to set.
efid (int) – Element face identifier.
2.3. Essential Boundary Conditions
- B2000++ essential (ebc) boundary conditions classes. Essential boundary
conditions objects are automatically loaded when an existing model database is opened. When the model is closed the references to the objects are removed.
This version works with one branch/mesh only (branch=1)!
- class EbcSet(model, setid, domain='DOF', branch=1, orientation='LOCAL', title=None)
Defines an essential boundary condition (EBC) set of a branch.
- Parameters:
model (Model) – Model.
setid (int) – External set identifier (positive int).
domain (str) – Domain to which set applies: ‘DOF’ (default) or ‘ELEMENT’.
orientation (str) – Orientation of ebc values (if applicable). ‘branch’ defines forces in branch global system. ‘local’ defines forces in node-local system (default).
- property model
Returns the Model object assigned to the set.
- get_branch()
Returns int the branch object of this b. c.
- property branch
Returns the branch object of this b. c.
- property domain
Domain (DOF|ELEMENT).
- property eid
Set identifier.
- property orientation
Specifies orientation.
- property title
Specifies title.
- load()
Load EBC set from DB.
- save()
Save EBC set to DB.
2.4. Natural Boundary Conditions
B2000++ natural (nbc) boundary conditions classes. Natural boundary conditions objects are automatically loaded when an existing model database is opened. When the model is closed the references to the objects are removed.
This version works with one branch/mesh only (branch=1)!
2.4.1. Acceleration (Inertia) Forces
- class NbcAccelerations(model, setid, branch=1, orientation='BRANCH', title=None, replace=True)
Defines a set of elements subject to specific accelerations. One tuple \((a_x,a_y,a_z)\) is be assigned to any element. B2000++ will generate body loads with element mass (if any).
- Parameters:
model (Model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is 1.
title (str) – Set title. Default is no title.
- add(eids, values)
Add value(s) to one or several existing ubgelements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, values)
Assign value(s) to one or several elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.4.2. Body Heat
- class NbcBodyHeat(model, setid, branch=1, title=None, replace=True)
Define a set of elements subject to body heat. A single heat value is assigned to any element.
- Parameters:
model (Model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is branch 1.
title (str) – Set title. Default is no title.
- add(eids, values)
Add value(s) to one or several existing ubgelements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, values)
Assign value(s) to one or several elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.4.3. Body Forces
- class NbcBodyLoads(model, setid, branch=1, orientation='BRANCH', title=None, replace=True)
- Defines a set of elements subject to body loads. One tuple
\((F_x, F_y, F_z)\) will be assigned to an element. wasdqwdasdas
- Parameters:
Model (model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is branch 1.
title (str) – Set title. Default is no title.
- add(eids, values)
Add value(s) to one or several existing ubgelements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, values)
Assign value(s) to one or several elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.4.4. Concentrated Force Components on Nodes
- class NbcConcentratedLoads(model, setid, branch=1, orientation='LOCAL', title=None, replace=True)
Define NBC values at specific DOFs of nodes (“concentrated loads”).
- Parameters:
model (Model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is 1.
orientation (str) – Orientation of forces. ‘BRANCH’ defines forces in branch global system. ‘LOCAL’ defines forces in node-local system (default).
title (str) – Set title. Default is no title.
- add(eids, idx, values)
Add value(s) to one or several existing nodes/elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, idx, values)
Assign value(s) to one or several elements specified by
eids
list and edge/face index.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of floats specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.4.5. DOF Values on Nodes
- class NbcDofValues(model, setid, branch=1, orientation='LOCAL', title=None, replace=True)
Define NBC values at specific DOFs of nodes (“concentrated loads”).
- Parameters:
model (Model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is 1.
orientation (str) – Orientation of forces. ‘BRANCH’ defines forces in branch global system. ‘LOCAL’ defines forces in node-local system (default).
title (str) – Set title. Default is no title.
- add(eids, idx, values)
Add value(s) to one or several existing nodes/elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, idx, values)
Assign value(s) to one or several elements specified by
eids
list and edge/face index.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of floats specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.4.6. Forces on Nodes
- class NbcForces(model, setid, branch=1, orientation='LOCAL', title=None, replace=True)
Create a set of external forces (Fx, Fy, Fz) at nodes of a branch. This bc type does not exist on the database: It will be converted to and from a ‘CONCENTRATED_LOADS’ bc type.
- Parameters:
model (Model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is 1.
orientation (str) – Orientation of forces. ‘BRANCH’ defines forces in branch global system. ‘LOCAL’ defines forces in their respective node-local system (default).
title (str) – Set title. Default is no title.
- add(eids, values)
Add value(s) to one or several existing ubgelements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, values)
Assign value(s) to one or several elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
values (list) – float or list of float specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.4.7. Line Forces on Element Edges
- class NbcLineLoads(model, setid, branch=1, orientation='LOCAL', title=None, replace=True)
Define a set of edge tractions for a branch.
- Parameters:
model (Model) – object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is 1.
orientation (str) – Orientation of forces. ‘BRANCH’ defines forces in branch global system. ‘LOCAL’ defines forces in node-local system (default).
title (str) – Set title. Default is no title.
- add(eids, idx, values)
Add value(s) to one or several existing nodes/elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, idx, values)
Assign value(s) to one or several elements specified by
eids
list and edge/face index.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of floats specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.4.8. Normal Pressures on Element Faces
- class NbcPressure(model, setid, branch=1, orientation='LOCAL', title=None, replace=True)
Define a set of normal pressures acting on element faces of a branch.
- Parameters:
model (Model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is 1.
orientation (str) – Orientation of forces. ‘BRANCH’ defines forces in branch global system. ‘LOCAL’ defines forces in node-local system (default).
title (str) – Set title. Default is no title.
2.4.9. Surface Traction Forces on Element Faces
- class NbcSurfaceTractions(model, setid, branch=1, orientation='LOCAL', title=None, replace=True)
Define a set of surface tractions (forces) acting on element faces of a branch.
- Parameters:
model (Model) – Model object to which the set belongs.
setid (int) – Set identifier (a positive int).
branch (int) – Branch to which this set will be assigned. Default is 1.
orientation (str) – Orientation of surface tractions. ‘BRANCH’ defines forces in branch global system. ‘LOCAL’ defines forces in node-local system (default).
title (str) – Set title. Default is no title.
- add(eids, idx, values)
Add value(s) to one or several existing nodes/elements specified by
eids
list.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of float specifying boundary condition value(s) to be added exsting value(s).
- property branch
Returns the branch object of this b.c.
- property domain
Domain type (“DOF”, “ELEMENT”, “EFACE”, “EEDGE”, “EBODY”.
- get(eid)
Return boundary condition value(s) of element “eid”. :param int eid: External element identifier. :return: float or numpy array of floats.
- get_branch()
“Returns the branch object of this b. c.
- get_nbc_type()
Returns NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property indexed
True if the set values are indexed and False else.
- load()
Loads the set from database.
- property nbc_type
NBC type string of the set (“ACCELERATIONS”, “BODY_HEAT”, “BODY_LOADS”, “CONCENTRATED_LOADS”, “FORCES”, “LINE_LOADS”, “PRESSURE”, “SURFACE_TRACTIONS”).
- property orientation
Orientation of boundary conditions (if applicable. ‘BRANCH’, ‘LOCAL’, ‘LOCAL_DEFORMED’.
- save()
Saves the set to database.
- set(eids, idx, values)
Assign value(s) to one or several elements specified by
eids
list and edge/face index.- Parameters:
eids (list) – int or list of in specifying external element identifiers.
idx (int) – Element edge/face index (> 0).
values (list) – float or list of floats specifying boundary condition value(s).
- property setid
Get the boundary condition set identifier (int).
- show()
Prints the boundary condition parameters.
2.5. Solution Cases and Stages
simples.Case
specifies the parameters of a solution case.
Model
:class:methods simples.Model.get_case()
,
:class:simples.Model.get_cases()
, and
:class:simples.Model.get_cases_list()
. Case
:class:objects are automatically loaded when an existing model
:class:database is opened. When the model is closed the references to
:class:the objects are removed.
simples.Cases
manages all Case
objects and
is generated by Simples in simples.Model
and managed by the
Model
methods listed above.
2.5.1. Case Class
- class Case(model, eid, add=True)
Create a new solution case object. If the case
eid
already exists an exception is raised (an existing case object must be retrieved withModel.get_case()
.Notes: (1) When Simples loads a database, all cases found are loaded in Case objects and added to the list of cases of the Model. (2) New cases created are automatically added to the list of cases of the Model. (3) When a case object is deleted its reference in list of cases of the Model is deleted and any existing case object in the database is deleted, too. (4) A case cannot be renamed, i.e. the identifier cannot be chamnged.
- Parameters:
model (Model) – Parent Model object.
eid (int) – Case identifier (external identifier), a positive integer.
add (bool) – Add the case to the model database list of cases.
- set_params(**args)
Define one or more case analysis parameters. args is a list (key=value,…)
- get_param(key)
Get a case parameter
key
. Returns None if not found.
- get(key)
Get a case parameter
key
. Returns None if not found.
- property eid
Get external case identifier (int).
- property dof_name
Get or set generic DOF solution field name.
- property dofd_name
Get or set generic time-derived DOF solution field name.
- property dofdd_name
Get or set generic twice time-derived DOF solution field name.
- property dof_init
Get or set Initial DOF field identifier.
- property dofd_init
Get or set time-derived initial DOF field identifier.
- property model
Get the Model object assigned to this case.
- property nbc_name
Get or set generic NBC (right-hand side vector) solution field name.
- property residuum_name
Get or set generic solution residuum field name.
- property spf_names
Get or set generic sampling point solution field name(s).
- get_ebc_components()
Returns all EBC components.
- Returns:
dict with all EBC component objects {eid: object}.
- get_ebc_component(eid)
Returns EBC component
eid
. Returns None if not found.- Parameters:
eid (int) – EBC component (positive int).
- set_ebc_component(eid, sfactor=1.0)
Defines a new essential boundary condition component
eid
. If the componenteid
already exists it will be overwritten.- Parameters:
eid (int) – EBC identifier (positive int).
sfactor (float) – Optional scale factor.
- get_nbc_components()
Returns all NBC components.
- Returns:
dict with all NBC component objects {eid: object}.
- get_nbc_component(n)
Returns NBC component
eid
. Returns None if not found.- Parameters:
eid (int) – NBC component (positive int).
- Returns:
NBC component object.
- set_nbc_component(eid, sfactor=1.0, subcase=0)
Defines a new NBC component
eid
. If the componenteid
already exists it will be overwritten.- Parameters:
eid (int) – NBC identifier (positive int).
sfactor (float) – Optional scale factor.
subcase (int) – Defines subcase identifer, if any (positive int). Default is 0 (no subcase).
- get_linc_components()
Returns a the LINC components table dict.
- set_linc_component(eid)
Defines a new linc component
eid
. If the componenteid
already exists it will be overwritten.- Parameters:
eid (int) – LINC identifier (int >= 0, where 0 is the default identifier).
- get_join_components()
Returns the JOIN components table dict.
- set_join_component(eid)
Defines a new JOIN component
eid
. If the componenteid
already exists it will be overwritten.- Parameters:
eid (int) – JOIN identifier (int >= 0, where 0 is the default identifier).
- property cycles
Get list of all (nonlinear) solution cycles (steps) sorted in ascending order or None if not defined. Equivalent to steps/get_steps.
- property steps
Get list of all (nonlinear) solution steps (cycles) sorted in ascending order or None if not defined.
- get_stepsinfo()
List of all (nonlinear) solution steps attributes sorted in ascending order or None if not defined. Eqach entry is a StepAttributes tuple of.
- property stepsinfo
Get list of all (nonlinear) solution steps attributes sorted in ascending order or None if not defined. Each entry is a StepAttributes tuple.
- property last_step
Get last step (cycle) number or 0 if not defined (int).
- property nsteps
Get number of load or time steps (int).
- get_case_field_name(name)
Get the generic field name defined by Case if found. If not,
name
is returned.
- property title
Get or set the case title.
- property field_names
Get list of generic field names of fields defined for this case.
- property has_solution
Does case have a solution (bool)?
- load()
Load case data from database.
- save()
Save case data to database.
- show()
Print case parameters.
2.6. Fields Classes
Simples fields are discrete fields defined at mesh nodes or in elements.
2.6.1. Nodefield Class
The NodeField class loads a field defined at the mesh nodes, usually a DOF field, such as a displacement field or a temperature field for a given case and cycle.
- class NodeField(model, name, branch=1, case=1, cycle=None, subcycle=None, subcase=None, metadata=None)
Creates and loads a field defined at the mesh nodes. Node fields contain values produced by the B2000++ input processor (such as mesh node coordinates) and the B2000++ solvers (such as forces, displacements, temperatures, etc.).
- Parameters:
model (Model) – Model object containing the node field.
name (str) – Field name. Field names depend on the B2000++ solver. Some pre-defined names and aliases are available, see comment below.
branch (int) – Identifier of branch to be selected. The default value is 1.
cycle (int) – Load or time increment cycle. The default cycle is None.
subcycle (int) – Load or time increment subcycle. The default subcycle is 0.
case (int) – Solution case. The default case is 1.
subcase (int) – Solution subcase or buckling or free vibration analysis mode. The default is None (i.e no subcycle or mode).
Example
Get displacements (not rotations) of case 3 and (external) node 123:
disp = simples.NodeField(model, 'displacements', case=3) v = disp[123]
- property ncols
Get number of columns of this field (int).
- property nrows
Get number of rows of the array of this field (int).
- get_amplitude(eid)
Return amplitude of field at node eid or None if not defined or eid out of range.
- get(nodes=None)
Extracts values of nodes specified in ‘nodes’. Node identifiers must be external. If nodes i set to None (default), the entire array of values is returned.
- Parameters:
nodes (int) – Node identifiers of node(s) to be extracted. if set to None, all nodes are extracted (default). Node set or node list names can be specified, too. Node identifiers must be specified in the external or internal number system (see
ntype
).- Returns:
Array of values or None (see numpy return value). All values are floats.
- sum(axis=0, rows=None)
Returns the sum of all values of the node field along the axis.
- Parameters:
axis (int) – Axis along which a sum is performed (numpy definition). If set to 0 the function returns an array containing the sum of each column. if set to 1 the function returns an array with the sum of the columns of each row.
rows (list) – Optional list contains row identifiers of field (external node identifiers) to be taken into account. By default all rows are processed.
- Returns:
Numpy array with sums of all columns or None (see numpy return value) if sum could not be computed. All values are floats.
- property Mesh
Get mesh (branch) object associated to this field.
- property Metadata
Get field metadata object.
- property branch
Get branch identifier associated to this field.
- property case
Get solution case identifier associated to this field (int).
- property colnames
Get column (component) names of field (list of str).
- property cycle
Return solution cycle associated to this field (int).
- get_minmax(what)
Get minmax of column “what” of this field (list of float) or None if not found.
- property gname
Get generic name associated to this field (str).
- property has_amplitude
Can this field produce an amplitude? Returns True or False.
- property has_sum
Can this field produce sums of columns. Returns True or False.
- property mesh
Get mesh (branch) identifier associated to this field (int).
- property name
Get associated to this field (str).
- property setname
Get dataset name (name of MemCom dataset) of this field (str).
- property subcase
solution subcase associated to this field (int).
- property subcycle
Get solution subcycle associated to this field (int).
- property title
Get title string associated to this field (str).
2.6.2. ElementField Class
Element fields are element-wise defined fields for a given case and cycle. Similar to node fields, the number of values or data columns of each element is constant (element with values varying from element to element are stored in Sampling Point fields).
- class ElementField(model, name, branch=1, case=1, cycle=None, subcycle=None, subcase=None, metadata=None)
Creates and loads a field defined at the mesh elements. Element fields contain values produced by the B2000++ solver, usually max_stress, max_failure_index obtained by a post-processing program.
- Parameters:
model (Model) – Model object containing the element field.
name (str) – Field name. Field names depend on the B2000++ solver.
branch (int) – Identifier of branch to be selected. The default value is 1.
cycle (int) – Load or time increment cycle. The default cycle is None.
subcycle (int) – Load or time increment subcycle. The default subcycle is 0.
case (int) – Solution case. The default case is 1.
subcase (int) – Solution subcase or buckling or free vibration analysis mode. The default is None.
2.6.3. SamplingPointField Class
Sampling point fields are element-wise defined derived fields, such as strains, stresses, section forces, heat flows, etc. for a given case and cycle. Values are defined at specific evaluation (sampling) points within an element.
- class SamplingPointField(model, name, branch=1, case=1, cycle=None, subcycle=None, subcase=None, metadata=None)
Creates and loads a field defined at the element sampling points (also referred to as ‘integration points’. Sampling point fields contain values produced by the B2000++ solver, such as strains, stresses, section forces, etc.
- Parameters:
model (Model) – Model object containing the sampling point field.
name (str) – Field name. Field names depend on the B2000++ solver.
branch (int) – Identifier of branch to be selected. The default value is 1.
case (int) – Solution case. The default case is 1.
subcase (int) – Solution subcase. The default is None.
cycle (int) – Load or time increment cycle. The default cycle is 0.
subcase – Solution subcase or buckling or free vibration analysis mode. The default is None.
- Returns:
Array containing sampling point field values for all sampling points of element(s).
- property nrows
Get number of rows of the array of this field (int).
- property Mesh
Get mesh (branch) object associated to this field.
- property Metadata
Get field metadata object.
- property branch
Get branch identifier associated to this field.
- property case
Get solution case identifier associated to this field (int).
- property colnames
Get column (component) names of field (list of str).
- property cycle
Return solution cycle associated to this field (int).
- get_minmax(what)
Get minmax of column “what” of this field (list of float) or None if not found.
- property gname
Get generic name associated to this field (str).
- property has_amplitude
Can this field produce an amplitude? Returns True or False.
- property has_sum
Can this field produce sums of columns. Returns True or False.
- property mesh
Get mesh (branch) identifier associated to this field (int).
- property name
Get associated to this field (str).
- property ncols
Get number of columns of this field (int).
- property setname
Get dataset name (name of MemCom dataset) of this field (str).
- property subcase
solution subcase associated to this field (int).
- property subcycle
Get solution subcycle associated to this field (int).
- property title
Get title string associated to this field (str).
- get_i(iid)
Extracts all values for the element specified by its internal identifier
iid
.- Parameters:
iid (int) – Internal element identifier.
- Returns:
Array of rows containing the values for all integration points of the specified element or None (see numpy return value). All values are floats.
- get(eid)
Extract all values for the element specified by its external identifier.
- Parameters:
eid (int) – External element identifier.
- Returns:
Array of rows of floats containing the values for all integration points of the specified element or None (see numpy return value). All values are floats.
- get_icoor_i(iid)
“Get the element natural coordinates of the integration points for the element specified by its internal identifier. See also ref:SamplingPointField <field.spf.arrays>.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
Array of floats containing the element (natural) coordinates or None (see numpy return value). All values are floats.
- get_icoor(eid)
Get the element natural coordinates of the integration points for the element specified by its external identifier. See also ref:SamplingPointField <field.spf.arrays>.
- Parameters:
eid (int) – External element identifier.
- Returns:
Array of floats containing the element (natural) coordinates or None (see numpy return value). All values are floats.
- get_layers_i(iid)
Get the material layers of the integration points for the element specified by its internal identifier. See also ref:SamplingPointField <field.spf.arrays>.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
Array containing material layer definitions or None (see numpy return value). All values are floats.
- get_layers(eid)
Get the material layers of the integration points for the element specified by its external identifier. See also ref:SamplingPointField <field.spf.arrays>.
- Parameters:
eid (int) – External element identifier.
- Returns:
Array containing material layer definitions or None (see numpy return value). All values are floats.
- get_min(colname)
Compoutes the overall minimum value of a column (component).
- Parameters:
colname (str) – Name of column or, if
colname
is an int, column (component) index. Note that column indices start with 0.- Returns:
List containing
[eid, [x,y,z], ip, value]
, whereeid
is the sample field external element number,`` [x,y,z]`` are the sampling point global cooordinates,ip
is the integration point number, andvalue
is the minimum of all values of the columncolname
.- Raise:
Exception if column
colname
not found.
- get_max(colname)
Searches the overall maximum value of column (component).
- Parameters:
colname (str) – Name of column or, if
colname
is an int, column (component) index. Note that column indices start with 0.- Returns:
List containing
[eid, [x,y,z], ip, value]
, whereeid
is the sample field external element number,`` [x,y,z]`` are the sampling point global cooordinates,ip
is the integration point number, andvalue
is the maximum of all values of the columncolname
.- Raise:
Exception if column
colname
not found. of range.
- get_layer_count(eid)
Get the layer items count list for each layer. The list items are tuples
(i, n, nsub)
where
i
is the layer number (starting at 0), `` n`` the total number of items (stress, strain,…) arrays for that layer, andnsub
the number of sub-layers. The tuples are sorted in ascending values ofi
. See also ref:SamplingPointField <field.spf.arrays>.- Parameters:
eid (int) – External element identifier.
- Returns:
List of tuples
(i,n,nsub)
, see above, or None.
2.6.4. BeamStressField Class
Beam stress fields are element-wise defined sampling point fields, such as forces, moments, stresses, or strains defines at beam sections along the beam local x-axis for a given case and cycle. See also Using Beam Stress Fields.
- class BeamStressField(model, branch=1, case=1, cycle=0, subcycle=0, subcase=None, metadata=None)
The BeamStressField object
STRESSES_BEAMS
loads beam element section forcesSECTION_FORCES
and section momentsSECTION_MOMENTS
and computes section stresses for a single given case. The longitudinal stress due to the axial force and due to bending and, if available, the torsional stress st are computed. If available, the failure index is computed.- Parameters:
model (Model) – Model object containing the node field.
name (str) – Field name. Field names depend on the B2000++ solver. Some pre-defined names and aliases are available.
branch (int) – Identifier of branch to be selected. The default value is 1.
case (int) – Solution case. The default case is 1.
subcase (int) – Solution subcase. The default is None.
cycle (int) – Load or time increment cycle. The default cycle is 0.
subcycle (int) – Load or time increment subcycle. The default subcycle is 0.
- property Mesh
Get mesh (branch) object associated to this field.
- property Metadata
Get field metadata object.
- property branch
Get branch identifier associated to this field.
- property case
Get solution case identifier associated to this field (int).
- property colnames
Get column (component) names of field (list of str).
- property cycle
Return solution cycle associated to this field (int).
- get_minmax(what)
Get minmax of column “what” of this field (list of float) or None if not found.
- property gname
Get generic name associated to this field (str).
- property has_amplitude
Can this field produce an amplitude? Returns True or False.
- property has_sum
Can this field produce sums of columns. Returns True or False.
- property mesh
Get mesh (branch) identifier associated to this field (int).
- property name
Get associated to this field (str).
- property ncols
Get number of columns of this field (int).
- property nrows
Get number of rows of the array of this field (int).
- property setname
Get dataset name (name of MemCom dataset) of this field (str).
- property subcase
solution subcase associated to this field (int).
- property subcycle
Get solution subcycle associated to this field (int).
- property title
Get title string associated to this field (str).
- get_forces(eid)
Returns section forces for a single element identified by its external identifier.
- Parameters:
eid (int) – External element identifier.
- Returns:
A numpy array containing section forces (Fx, Fy, Fz) for all integration points or (see numpy return value). All values are floats.
- get_forces_i(iid)
Returns section forces for a single element identified by its internal identifier.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
Numpy array containing section forces (Fx, Fy, Fz) for all integration points or None (see numpy return value). All values are floats.
- get_moments(eid)
Returns section moments for a single element identified by its external identifier.
- Parameters:
eid (int) – External element identifier.
- Returns:
Array containing section moments (Mx, My, Mz) for all integration points or None (see numpy return value). All values are floats.
- get_moments_i(iid)
Returns section moments for a single element identified by its internal identifier.
- Parameters:
iid (int) – Internal element identifier.
- Returns:
A numpy array containing section moments (Mx, My, Mz) for all integration points or None (see numpy return value). All values are floats.
- get_stresses(elset=None)
Computes stresses for all integration point sections and for all stress evaluations points of one or more elements identified by their external element identifiers.
- Parameters:
elset (list) – External element identifier(s). int or (list, tuple, numpy intarray. If set to None the stresses of all beam elements will be returned. If a list of elements is specified the stresses of all elements will be returned, provided they are beam elements.
- Returns:
List of helper classes BeamElementStresses containing the stresses and the optional failure index of the selected elements. One BeamElementStresses object per processed element is returned in the list if no errors occurred. Note: Do no check for None, since the function returns a list!
2.7. Data Formatters
- class FormatSummary(model)
Extracts and formats a short resume of the model database.
- Parameters:
model (Model) – Model object.
- extract()
Extracts model information and returns a list with
tables.DataString
objects.
- class FormatNodeElementSet(model, what, name, branch=1)
Extracts and formats a node or element set/list of the branch ‘eid’ of a Simples ‘model’.
- Parameters:
model (Model) – Model object.
what (str) – Generic database name of set.
typ (str) – Node or element set type.
title (str) – Optional title.
- class FormatMeshConnectivity(model, name)
Extracts and formats the explicit branch connectivity table JCTS<.ident>. Nodes are B2000++ internal.
- Parameters:
model (Model) – Model object.
name (str) – Connectivity table dataset name, such as “JCTS”.
- class FormatEpatch(model, ident, title=None)
Extracts and formats the B2000++ epatch mesh patches.
- Parameters:
model (Model) – Model object.
eid (int) – Branch identification number.
title (str) – Optional title.
- class FormatNodeParameters(model, title=None)
Extracts and formats the node parameters. To get a string with the formatted (printable) output, call the
format()
method.- Parameters:
model (Model) – Model object.
- class FormatElementParameters(model, title=None)
Extracts and formats the element parameters. To get a string with the formatted (printable) output, call the
format()
method.- Parameters:
model (Model) – Model object.
- class FormatFIELDS(model, title=None)
Formats the FIELDS dataset. FIELDS contains the attributes of B2000++ fields.
- Parameters:
model (Model) – Model object.
- class FormatMatProp(model, what, ident)
Formats material or property tables. To get a string with the formatted (printable) output, call the
format()
method.- Parameters:
model (Model) – Model object.
what (str) – MATERIAL or PROPERTY.
ident (int) – Material ident to be formatted.
title (str) – Optional title.
- class FormatBoundaryConditions(model, dsname)
Extracts and formats the essential and natural boundary condition sets. To get a string with the formatted (printable) output, call the
format()
method.- Parameters:
model (Model) – Model object.
eid (int) – Boundary condition set identifier.
gname (str) – Name of boundary condition set (‘EBC’ or ‘NBC’).
branch (int) – Branch identifier containing the boundary condition set. Default is 1.
- class FormatCaseStage(model, gname, ident)
Extracts and formats the case conditions. To get a string with the formatted (printable) output, call the
format()
method.- Parameters:
model (Model) – Model object.
gname (str) – ‘CASE’ formats case tables, ‘STAGE’ formats stage tables.
eid (int) – Case or stage identifier.
- class FormatRTable(model, name, title=None)
Formats a relational table of the database.
- Parameters:
d (dict) – Dictionary to be formatted.
- class FormatDict(model, dictionary, title=None)
Formats a dictionary.
- Parameters:
d (dict) – Dictionary to be formatted.
- class FormatBucklingLoads(model, case=1, cycle=0)
Extracts and formats the critical loads of a buckling analysis. To get a string with the formatted (printable) output, call the
format()
method.- Parameters:
model (Model) – Model object.
case (int) – Solution case to be formatted. Default is 1.
- FormatBucklingLoad
alias of
FormatBucklingLoads
- class FormatEigenfrequencies(model, case=1, cycle=0)
Extracts and formats the eigenfrequencies of a free vibration analysis.
- Parameters:
model (Model) – Model object.
:param int case Solution case to be formatted. Default is 1.
- class FormatTransformations(model)
Extracts and formats the DREF node transformations.
- Parameters:
model (Model) – Model object.
- class FormatArray(model, values, title=None, colnames=None)
Formats a given array consisting of rows and columns to a Pandas dataframe.
- Parameters:
model (Model) – Model object.
values (float) – Array to be formatted.
header (str) – Header to be printed.
colnames (list) – Column names to be printed.
comment (str) – Additional comment to be printed.
- class FormatElements(model, mesh=1)
Create a Pandas DataFrame (2-dimensional table) for tabulating element attributes. The DataFrame is populated with the
extract()
method.- Parameters:
model (Model) – Model associated to table.
mesh (int) – Mesh (branch) identifier. Default is 1.
- extract(**args)
Extracts element attributes. The function returns a list of tuples
- Parameters:
elsets (list) – List of element set names (str) to be extracted.
items (list) – List of items (elements identifiers) to be extracted.
eltypes (list) – List of element types to be extracted.
csort (str) – If specified, sorts table according to column name
csort
.
- class FormatNodes(model, name='NODES', mesh=1)
Create a Pandas DataFrame (2-dimensional table) for tabulating FE mesh node attributes. The DataFrame is populated with the
extract()
method. Data can be formatted with to_string or other Pandas DataFrame methods.- Parameters:
model (Model) – Model associated to table.
name (str) – Node attribute names (‘NODES’ or ‘NODE-NORMALS’).
mesh (int) – Mesh (branch) identifier. Default is 1.
- extract(**args)
Extracts node attributes. The function returns a list of (name, DataFrame2), where name is the sets name and DataFrame2 the data frame containing the extracted data.
- Parameters:
sets (list) – List of node set names to be extracted.
items (list) – List of selected node identifiers to be extracted.
- class FormatDofField(model, name, mesh=1, cycle=0, subcycle=None, case=1, subcase=None, title=None)
Create a Pandas DataFrame (2-dimensional table) for tabulating DOF (node) solution fields. The DataFrame is populated with the
extract()
method. Data can be formatted with to_string or other Pandas DataFrame methods.- Parameters:
model (Model) – Model associated to table.
name (str) – DOF (node) solution field name. Only generic names can be specified in the current version, i.e the generic names on the database, such as “DISP”, “FORC”, “RCFO”, “TEMP”, etc.
mesh (int) – Mesh (branch) identifier. Default is 1.
cycle (int) – Solution cycle to be extracted.
subcycle (int) – Solution subcycle to be extracted.
case (int) – Solution case to be extracted.
subcase (int) – Solution aubvcase|mode to be extracted.
- extract(**args)
Extracts DOF (node) solution field values at nodes to
DataFrame2
(Pandas class:DataFrame) objects. These can be converted to various formats, such as a string (to_string(index=False)()
). The following args are procecssed:- Parameters:
items (list) – Specifies selected nodes. A single int or str specifies a identifier (positive int) or a set name. A list can contain node identifiers (int) or set names (str). Default: None (all items).
local (bool) – Values transformed to node-local (if any). Default: False, i.e all values in global system.
- class FormatSamplingPointField(model, name, mesh=1, cycle=0, subcycle=None, case=1, subcase=None, title=None)
Extracts a sampling point field to a Pandas DataFrame (2-dimensional table) for tabulating the sampling point solution fields. The
get
extracts data and creates a dataframe, while theformat
method formats the data of the data frame to a string or converts the data to CSV format.- Parameters:
model (Model) – Model associated to table.
name (str) – Sampling point solution field name.
mesh (int) – Mesh (branch) identifier. Default is 1.
cycle (int) – Solution cycle to be extracted.
subcycle (int) – Solution subcycle to be extracted.
case (int) – Solution case to be extracted.
subcase (int) – Solution subcase to be extracted.
- extract(**args)
The following args are procecssed:
- Parameters:
items (list) – Specifies selected nodes. A single int or str specifies a identifier (positive int) or a set name. A list can contain node identifiers (int) or set names (str). Default: None (all items).
2.8. Beam Cross-Sections
- class BeamCrossSection(model=None, connection='open', title=None)
Create a thin-walled beam cross section properties object defined by segments. Special cases, such as the rod, bar, tube, channel section, or I-profile) are treated analytically.
- Parameters:
model (Model) – Associated Simples model, if any.
connection (str) – Section connectivity information for thin-walled sections. ‘open’ defines an open profile (default). ‘closed’ defines a closed profile. None leaves it undefined (unknown), with potentially unpredictable result for the torsional constant.
title (str) – Title for printout. Default is None.
Note
Calculation of the shear center for cross sections defined by segments is not yet implemented!
- compute_properties()
Computes section properties of arbitrary thin-walled sections composed of ‘thin’ segments. Segments must be defined with the add_segment method. By default, the properties are computed with respect to the centroid.
- class BeamCrossSectionBox(width=0.0, height=0.0, tflange=0.0, tweb=0.0, model=None, title=None)
Create a cross section property object of a thin box section and computes the properties.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
w (float) – Width of box.
h (float) – Height of box.
tflange (float) – Thickness of horizontal box walls (flanges).
tweb (float) – Thickness of vertical box walls (webs).
- compute_properties(width=0.0, height=0.0, tflange=0.0, tweb=0.0)
Compute cross section properties of the L shape section with new values.
- Parameters:
w (float) – Width of box.
h (float) – HeightWidth of box.
tflange (float) – Thickness of horizontal box walls (flanges).
tweb (float) – Thickness of vertical box walls (webs).
- class BeamCrossSectionL(width=0.0, height=0.0, tflange=0.0, tweb=0.0, model=None, title=None)
Create a cross section property object of a L-shaped section and computes the properties.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
w (float) – Width of section flange.
h (float) – Height of section web.
tflange (float) – Thickness of flange.
tweb (float) – Thickness of web.
- compute_properties(width=0.0, height=0.0, tflange=0.0, tweb=0.0)
(Re)computes cross section properties of the L shape section.
- Parameters:
w (float) – Width of section flange.
h (float) – Height of section web.
tflange (float) – Thickness of flange.
tweb (float) – Thickness of web.
- class BeamCrossSectionT2(width=0.0, height=0.0, tflange=0.0, tweb=0.0, model=None, title=None)
Create a cross section property object of a T-shaped section and computes the properties.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
w (float) – Width of section flange (D1).
h (float) – Height of section web (D2).
tflange (float) – Thickness of flange (D3).
tweb (float) – Thickness of web (D4).
- compute_properties(width=0.0, height=0.0, tflange=0.0, tweb=0.0)
(Re)computes cross section properties of the L shape section.
- Parameters:
w (float) – Width of section flange.
h (float) – Height of section web.
tflange (float) – Thickness of flange.
tweb (float) – Thickness of web.
- class BeamCrossSectionTube(ro=1.0, ri=0.0, model=None, title=None)
Create a cross section property object of a circular tube section and computes the properties. The tube must not be “thin”.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
ro (float) – Outer radius of tube. Must be > 0.0.
ri (float) – Inner radius of tube. If se to 0.0 a solid circular section is generated.
- compute_properties(ro=0.0, ri=0.0)
(Re)compute cross section properties of circular tube section.
- Parameters:
ro (float) – Radius of tube. Must be > 0.0.
ri (float) – Inner radius of tube.
- class BeamCrossSectionBar(width=0.0, height=0.0, model=None, title=None, rotate=None)
Create a cross section property object of a bar (rectangular solid) section and computes the properties.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
w (float) – Width of bar.
h (float) – Height of bar.
- compute_properties(width=0.0, height=0.0)
(Re)compute cross section properties of bar (rectangular solid) section.
- Parameters:
w (float) – Width of bar.
h (float) – Height of bar.
- class BeamCrossSectionRod(area=0.0, model=None, title=None)
Create a cross section property object of a rod section and computes the properties. A rod has no defined shape and the only relevant constant is the cross section area.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
area (float) – Cross section area of rod.
- compute_properties(area=0.0)
(Re)compute cross section properties of the rod section.
- Parameters:
area (float) – Cross section area.
- class BeamCrossSectionI(height=0.0, width1=0.0, width2=0.0, tweb=0.0, tflange1=0.0, tflange2=0.0, model=None, title=None)
Create a cross section property object of a I-shaped section and computes the properties.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
h (float) – Height of profile web.
w1 (float) – Lower flange width of profile.
w2 (float) – Upper flange width of profile.
tweb (float) – Web thickness.
tflange1 (float) – Lower flange thickness of profile.
tflange2 (float) – Lower flange thickness of profile.
- compute_properties(height=0.0, width1=0.0, width2=0.0, tweb=0.0, tflange1=0.0, tflange2=0.0)
Compute or recompute properties of the L shape section.
- Parameters:
height (float) – Height of profile web.
width1 (float) – Lower flange width of profile.
width2 (float) – Upper flange width of profile.
tweb (float) – Web thickness.
tflange1 (float) – Lower flange thickness of profile.
tflange2 (float) – Lower flange thickness of profile.
- class BeamCrossSectionC(width=0.0, height=0.0, tweb=0.0, tflange=0.0, model=None, title=None, rangle=None)
Create a cross section property object of a thin-walled C-shaped section and computes the properties.
The origin of the reference frame y=0, z=0 is the centroid.
- Parameters:
w (float) – Width of section flanges.
h (float) – Height of section web.
tweb (float) – Thickness of web.
tflange (float) – Thickness of both flanges.
- compute_properties(width=0.0, height=0.0, tweb=0.0, tflange=0.0)
(Re)compute cross section properties of the L shape section.
- Parameters:
width (float) – Width of section flanges.
:param float height Height of section web.
- Parameters:
tweb (float) – Thickness of web.
tflange (float) – Thickness of flanges.
- class BeamCrossSectionConstants(A, yc, zc, Iyy, Izz, Iyz, It, K1, K2, Wt, ys=None, zs=None, spoints=None, model=None, title=None)
Create a cross section property object defined by constants and sets the properties. Properties are formulated with respect to the centroid.
- Parameters:
A (float) – Area.
zc (float yc,) – Centroid coordinates with respect to section coordinates (see figure).
Iyy (float) – Area moment around the beam local y-axis.
Izz (float) – Area moment around the beam local z-axis.
Iyz (float) – Mixed area moment.
It (float) – Torsional constant.
K1 (float) – Shear shape factor in y-direction. Default is 1.0.
K2 (float) – Sear shape factor in z-direction. Default is 1.0.
Wt (float) – Torsional constant.
zs (float ys,) – Shear center coordinates with respect to the centroid.
points (float) – List of (y,z, name) coordinates defining stress evaluation points or Default is None.
- compute_properties(A, yc, zc, Iyy, Izz, Iyz, It, K1, K2, Wt, ys=None, zs=None, spoints=None)
Compute cross section properties defined by constants. It is assumed that the section coordinate system coincides with the centroid.
- Parameters:
A (float) – Area.
zc (float yc,) – Centroid coordinates with respect to section coordinates (see figure).
Iyy (float) – Area moment around the beam local y-axis.
Izz (float) – Area moment around the beam local z-axis.
Iyz (float) – Mixed area moment.
It (float) – Torsional constant.
K1 (float) – Shear shape factor in y-direction. Default is 1.0.
K2 (float) – Sear shape factor in z-direction. Default is 1.0.
Wt (float) – Torsional constant.
zs (float ys,) – Shear center coordinates with respect to the centroid. If they are unspecified, set to None (default).
points (float) – List of (y,z) coordinates defining stress evaluation points.
2.9. Graphs
- class Graph2(width=150.0, height=100.0, margin_left=30.0, margin_right=10.0, margin_bottom=15.0, margin_top=10.0, subplot=None, label_x=None, label_y=None)
Creates a graph object for rendering one or more lines (curves) consisting of points (x,y) with Matplotlib.
Graph2 is based on Matplotlib and is compatible with the matplotlib.pyplot.figure class
get_figure()
and the the Matplotlib axes classget_axes()
.The default font sizes are 12 pt for axes annotations and title, and 8 pt for the legend entries.
All length units are in mm and all font sizes are in points (1 point = 1/72. 1 in = 0.3527mm).
- Parameters:
width (float) – Width of graph area in mm. Default is 150.
height (float) – Height of graph area in mm. Default is 100.
margin_left (float) – Left margin (= annotation area) in mm. Default is 30.
(float) (float margin_bottom) – Left margin (= annotation area) in mm. Default is 15.
(float) – Bottom margin (= annotation area) in mm. Default is 15.
margin_top (float) – Top margin (= annotation area) in mm. Default is 15.
Graph2 recognizes the properties listed below, which can also be specified with Matplotlib’s get and set methods.
- property get_plt
Get the matplotib plt object.
- property get_figure
Get the matplotib fig object.
- property get_axes
Get the matplotib axes object.
- property axes_minmax_x
Set or get the x-axis values min and max. Tuple (xmin, xmax) of floats. The values must be set after defining all lines, because lines can override the minmax values.
- property axes_minmax_y
Set or get the y-axis values min and max. Tuple (ymin, ymax) of floats. The values must be set after defining all lines, because lines can override the minmax values.
- property axes_label_x
Set or get the x axis label (str).
- property axes_labelsize_x
Set or get the x axis label font size. Must be specified before axes_label_x to take effect. Default is 8 pt.
- property axes_ticksize_x
Set or get the x axis tick label font size. Default is 8 pt.
- property axes_tickformat_x
Set ot get the x axis tick label format (str).
- property axes_label_y
Set or get the y axis label (str).
- property axes_labelsize_y
set or get the y axis label font size (pt). Must be specified before axes_label_x to take effect.
- property axes_ticksize_y
set ot get the y axis tick size. Default is 8 pt.
- property axes_tickformat_y
set or get the y axis tick label format.
- property grid_linewidth_x
Set or get the x grid line width. Default is 0.5 pt.
- property grid_linewidth_y
Set or get the y grid line width. Default is 0.5 pt.
- property grid_framelinewidth
Set or get the grid frame line width. Default is 0.5 pt.
- property grid
Set or get the axes grid status. True is ‘on’, False is ‘off’.
- property title
Set or get the figure title.
- property title_fontsize
Set or get the figure title font size in pt. Default is 8 pt.
- property legend_visible
Set or get the legend (if any) status. True means visible, False means invisible.
- property legend_fontsize
Set ot get the legend font size. Default is 5 pt.
- close()
Explicitly close the pyplot figure.
- get_size()
Get the graph size: Returns a tuple of floats (size_x, size_y). Units are mm.
- add_line(x, y, **args)
Creates a Matplotlib Line2 object from a line defined by arrays x and y and adds it to the graph. The function returns the Line2 object. To modify line attributes, such as color, set the proper Line2 attributes (see argument list). The function returns the Line2 object.
- Parameters:
x (array) – Array of floats or ints containing of x-coordinates (tuple, list, or numpy array).
y (array) – Array of floats or ints containing y-coordinates (tuple, list, or numpy array).
All other parameters are Matplotlib Line2D properties: linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased.
- add_line_xy(xy, **args)
Creates a Matplotlib Line2 object with a line defined by an array xy and adds it to the graph. To modify line attributes, such as color, set the proper Line2 attributes (see argument list). The function returns the Line2 object.
- Parameters:
xy (array) – Array xy containing pairs of float or int (x,y) values.
All other parameters are Matplotlib Line2D properties: linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased.
- add_line_arr(arr, **args)
Creates a Line2 object with x-values specified in arr[0] and y-values in arr[1] and adds the line to the graph. To modify line attributes, such as color, set the proper Line2 attributes. The function returns the Line2 object.
- Parameters:
arr (array) – Array containing x- and y-coordinates arrays (tuple, list or numpy array).
All other parameters are Matplotlib Line2D properties: linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased.
- add_legend(pos='best', fontsize=None)
Adds the legend table of curve labels at position pos (x,y) or in a predefined area in the plot. If pos is a tuple of 2 floats (x, y) the legend positioned at (x, y), with x and y in the range of 0 to 1. If pos is a string, the legend is positioned according to (see Matplotlib documentation): “upper right”, “upper left”, “lower left”, “lower right”, “right”, “center left”, “center right”, “lower center”, “upper center”, “center”. Default is “best”.
- Parameters:
pos (Tuple (x,y) or str) – Position of curve label table. See above.
- save(file=None, dpi=300)
Saves the current plot in a file. The file extension defines the format, such as png or svg.
- Parameters:
file (str) – Output file name. Default is “output.png”.
dpi (float) – Resolution in dots per inch for bitmap type file formats (png). Default is 300dpi.
- show()
Displays the current plot on the screen.
- swap()
Swaps the x- and y-axes.
- class Line2(x, y, **args)
Bases:
Line2D
Creates an object for rendering curves defined by points (x, y) with Matplotlib. Line properties are defined by Matplotlib Line2D properties: Either as arguments to Line2 or by means of the Matplotlib Line2D
set_
andget_
methods.Line2D is not called directly, but it is created and added by the
Graph2.add_line()
method.- Parameters:
x (array) – Array of floats containing x values (list, tuple, numpy array).
y (array) – Array of floats containing y values (list, tuple, numpy array).
2.10. Modal Transient Solver
- class ModalSolver(model, vcase, dcase, modes=None, fcase=0, zeta=0.0, dofinit=0, dofdinit=0, nstepsmax=0, fcutoff1=0.0, fcutoff2=10000000000.0, verbose=None)
B2000++ modal transient solver
- show()
Format modal analysis parameters and return as string.
- integrate(time0, time1, nsteps, hfunc=None, zeta=None)
Integrates the equations of motion for all modes with the Newmark beta method for beta=.25 and gamma=.5 and stores the resulting modal displacements, velocities, and accelerations in the Mode object.
- Parameters:
time0 (float) – Start time.
time1 (float) – End time.
nsteps (int) – Number of integration steps.
hfunc (function) – Force history function. Default: None (i.e hfunct=1.0 for all steps).
zeta (float) – Modal damping factor(s). If specified as float, damping will be the same for all modes. If specified as dict with modeid:zeta, damping will be applied to each mode found in the list. Default: 0.0 (no damping).
- back_transform_dof_time_history(node, dof)
Back-transform DOF values and their time derivatives for a given node for all steps.
- Parameters:
node (int) – External node identifier.
dof (int) – DOF (1,2,3…).
- Returns:
Numpy float array containing rows of [time, u, udot, udotdot] for all time steps and for the given node.
- Raise:
ModalSolver exception if no solution defined or node not defined.
- back_transform_step_db(step0, step1, deltastep)
Back-transforms the modal solutions of a time step and writes the displacements of the step to the database. The velocities are not saved.
- Parameters:
step0 (int) – First time step to be transformed. If set to 0, together with step1=0, all time steps are saved.
step1 (int) – Last time step. If set to 0 together with step0=0, all time steps are saved.
deltastep (int) – Step save increments. Must be > 0.
- Raise:
ModalSolver exception if no solution defined, or steps wrong.
2.11. Utility Classes and Functions
2.11.1. Version
The version
string contains the major.minor.patch
, where
major
is the major version (int), minor
the minor version
(int), and patch
the patch number (int).
The version_long
list contains a list
[major,minor,patch,origin]
, where major
is the major version
(int), minor
the minor version (int),`` patch`` the patch number
(int), and origin
a string identifying the origin, such as
SMR
.
- get_version()
Returns the version string in the form of a string “major.minor.patch”, where
major
is the major version (int),minor
the minor version (int), andpatch
the patch number (int).- return:
Version string.
- get_version_long()
Returns the “long” version of the current installation, i.e a list
[major,minor,patch,origin]
, wheremajor
is the major version (int),minor
the minor version (int),`` patch`` the patch number (int), andorigin
a string identifying the origin, such asSMR
.- Returns:
Version list.
”””
2.11.2. Curve Interpolation
- class BezierCurve(x, y, z)
Create a Bezier spline interpolation in R3. The array x, y, and z must have same length.
- Parameters:
x (array) – Global cartesian control point coordinates in x.
y (array) – Global cartesian control point coordinates in y.
z (array) – Global cartesian control point coordinates in z.
- interpolate_n(n)
Interpolate with n evenly distributed intervals.
- Parameters:
n (int) – Number of evenly spaced intervals to be generated.
- Returns:
numpy float array with n interpolated pairs (x,y,z) or (x,y), with n>=1.
- Raise:
Exception if one or more parameters are wrong or inconsistent or if interpolation fails.
- interpolate(u)
Interpolate point(s) at parametric position(s) u.
- Parameters:
u (array) – Array containing parametric position(s) of points. The u values must be in the range of 0.0 to 1.0.
- Returns:
numpy float array with n interpolated pairs (x,y,z) or (x,y), with n>=1.
- class BSplinePCurve(x, y, z, **kwargs)
Creates a parametric B-spline curve in R3 or R2. The array x, y, and z must have the same length.
- Parameters:
x (array) – Global cartesian control point coordinates in x.
y (array) – Global cartesian control point coordinates in y.
z (array) – Global cartesian control point coordinates in z. If set to None an interplation in R2 (x-y) will be performed.
All other parameters are described in the relevant scipy splprep documentation.
- interpolate_n(n)
Interpolate with n evenly distributed intervals.
- Parameters:
n (int) – Number of evenly spaced intervals to be generated.
- Returns:
numpy float array with n interpolated pairs (x,y,z) or (x,y), with n>=1.
- Raise:
Exception if n < 1.
- interpolate(u)
Interpolate point(s) at parametric position(s) u.
- Parameters:
u (array) – Array containing parametric position(s) of points. The u values must be in the range of 0.0 to 1.0.
- Returns:
numpy float array with n interpolated pairs (x,y,z) or (x,y), with n>=1.
2.11.3. Mesh Extract Utilities
Utility class for extracting mesh information for creating objects such as MeshElementConnectivity. Such objects can be used to create viewing objects.
- class ExtractMesh(model, verbose=0)
Extract meshes.
- Parameters:
model (Model) – Model from whcih to extract meshes.
verbose (int) – Verbose level (default is 0).
- get_elem_type(ityp, branch=1)
Extracts the connectivities of all elements listed by type of branch branch and creates the MeshElementConnectivity object.
- Parameters:
ityp (list) – B2000++ internal element type number.
branch (int) – Branch identifier. Default is 1.
- Returns:
A MeshElementConnectivity object or None if not found.
- get_elem_type_all()
Extracts all connectivities of all elements types of all branches and creates the MeshElementConnectivity objects.
- Returns:
List of MeshElementConnectivity objects.
- elem_sets(names, branch=1)
Extracts B2000++ element sets and element lists names and returns MeshElementConnectivity objects.
- Parameters:
names (list) – String or list of strings containing element lists or element sets names.
branch (int) – Branch for which face lists or face sets are extracted. Default is 1.
- Returns:
List of MeshElementConnectivity objects (element connectivities sorted element-type-wise).
- elem_face_sets(names=None, branch=None)
Given B2000++ element face set names, the function returns mesh polygon sets MeshElementConnectivity for basplqt. This function must be called for each branch involved!
- Parameters:
names (list) – String or list of strings containing face lists or face sets names. If name is set to “*” all face sets and face lists are selected. None extracts sets.
branch (int) – Branch for which face lists or face sets are extracted. Setting branch=None (default) extracts all face lists or face sets names of all branches if found.
- Returns:
List of MeshElementConnectivity objects.
- get_node_sets(names, branch=None)
Given B2000++ node set names, the function returns MeshPointSet mesh node sets for basplqt.
- Parameters:
names (str) – String or list of strings containing node set names.
- param int branch: Branch identifiers for which node lists or
node sets are extracted. Setting branch=None (default) extracts all node lists or node sets names of all branches if found.
- Returns:
List of MeshPointSet objects.
- print_set(r)
Prints a summary of the content of the set
r
or an error message.- Parameters:
r (object) – MeshElementConnectivity object.
2.11.4. Compare and Check Functions
- compare_float_value(value, refvalue, rtol=1e-05, atol=1e-08)
Compare a float value to a reference and return True if
abs(value - refvalue) <= (atol + rtol * abs(refvalue))
The function makes use of the numpy.allclose function. If both value and refvalue are 0 the function returns True.
- Parameters:
value (float) – Value to be compared to reference value.
refvalue (float) – Reference value.
rtol (float) – Relative tolerance. Default is 1.e-5.
atol (float) – Absolute tolerance. Default is 1.e-8.
- Returns:
Status (bool): True means passed, False means not passed.
- compare_node_field1(model, refvalue, name, nodeid, dof, branch=1, case=1, cycle=0, subcycle=0, mode=None, subcase=None, rtol=None, atol=None)
Compare a single DOF field value at a specific node of a specific node field. The function returns True if the value is within the specified tolerances and False if not. The function make use of the numpy.allclose function.
- Parameters:
model (Model) – Simples Model object from where data are extracted.
refvalue (float) – Reference value for the component dof at node nodeid.
name (str) – Node field name.
nodeid (int) – External node identifier.
dof (int) – Degree of freedom or component (numbering starts at 1).
branch – External branch id of branch to be selected. Default is 1.
case (int) – Solution case. Default is 1.
subcase (int) – Solution subcase. Default is None.
cycle (int) – Load or time increment cycle. Default is 0.
(int) (int subcycle) – Load or time increment subcycle. Default is 0.
mode (int) – Buckling or vibration analysis mode. Default is None.
rtol (float) – Relative tolerance. Default is 1.e-5.
atol (float) – Absolute tolerance. Default is 1.e-8.
- Returns:
Status True means passed, False means not passed.
- Raise:
Exception if field value not found.
- compare_curve1(u, xvalues, yvalues, xrefvalues, yrefvalues, tolx, toly, graph=None, graph_sx=160.0, graph_sy=120.0, axes_label_x=None, axes_label_y=None, pos=None)
The function compares 2 curves defined by points. The curves are interpolated with the
simples.interpolation.BSplinePCurve
spline interpolation method. Samples are taken for both curves at u positions and the max(distance) in x and y are calculated. If all samples are below the tolerance, the test passes.- Parameters:
u (array) – Array or int with positions along the u-coordinate for which samples are taken (0<=u<=1). If u is an int, then u intervals between 0.0 and 1.0 are selected.
xvalues (array) – Array of float containing evaluation points x values of the curve y = f(x) to be compared.
yvalues (array) – Array of floats containing evaluation points y values of the curve y = f(x) to be compared.
xrefvalues (array) – Array of floats containing data points x values defining the reference curve.
yrefvalues (array) – Array of floats containing data points y values defining the reference curve.
tolx (float) – Maximum allowable absolute distance in x.
toly (float) – Maximum allowable absolute distance in y.
graph (str) – If a file name is specified the function will create a graph with both curves. Please add the relevant extension such as “.png”, “.svg”, etc. to the file name. The function will also create CSV files with the extension “.csv”.
axes_label_x (str) – x-axis label to be displayed in graph.
axes_label_y (str) – y-axis label to be displayed in graph.
pos (tuple) – Tuple of floats (x,y) in the range of 0.0 to 1.0 specifying position of curve label table or string. Default is “center”.
- Returns:
A tuple (status, dx, dy), where status (bool) is True (passed) or False (not passed), and dx and dy are the maximum calculated distances (floats).
- Raise:
Exception if input error detected.
2.11.5. Unit Conversions
- m_to_mm(m)
Convert meters [m] to millimeters [mm]. Returns millimeters.
- ft_to_m(ft)
Convert feet [ft] to meters [m]. Returns meters.
- m_to_ft(m)
Convert meters [m] to feet [ft]. Returns feet.
- in_to_m(inch)
Convert inch [in] to meters [m]. Returns meters.
- m_to_in(m)
Convert meters [m] to inch [in]. Returns inches.
- mm_to_in(mm)
Convert millimeters [mm] to inch [in]. Returns inches.
- lbs_to_kg(lbs)
Convert pounds [lbs] to kilograms [kg]. Returns kilograms.
- lbf_to_n(lbf)
Convert pound-force [lbf] to Newtons [N]. Returns Newtons.
- psi_to_pa(psi)
Convert pounds per square inch [psi] to Pascals [Pa]. Returns Pascals.
- atm_to_pa(atm)
Convert atmospheres [atm] to Pascals [m]. Returns Pascals.
- pa_to_mpa(pa)
Convert Pascals [Pa] to Megapascals [Mpa]. Returns Megapascals.
2.11.6. Misc
- get_color_rgb(name)
Given a HTML color name or a HEX color string #rrggbb the function returns the rgb color representation as a tuple of 3 floats in the range of 0.0 to 1.0.
- Parameters:
name (str) – Color name or HEX color string #rrggbb.
- Returns:
Tuple of 3 floats containing RGB values, each of then in the range of 0.0 to 1.0.
- Raise:
Exception in name is wrong or colr is not found.
- intersect_line_plane(a, b, p0, normal)
Intersect a line defined by points \(A\) and \(B\) with a plane defined by a point \(P_{0}\) and a normal \(\vec{n}\). The function returns the intersection point or
None
. All values are numpy float arrays with 3 components.Line: \({\vec{P}(s) = \vec{A} + s \cdot (\vec{B} - \vec{A})}\)
Plane: \((\vec{P} - \vec{P_0}) \cdot \vec{n} = 0\)
- Parameters:
a (array) – Array with the 3 Cartesian coordinates of point \(A\).
b (array) – Array with the 3 Cartesian coordinates of point \(B\).
p0 (array) – Array with the 3 Cartesian coordinates of point \(P_{0}\).
- .param array normal: Array with the 3 components of the plane normal
vector \(\vec{n}\).
- Returns:
Numpy float array with the 3 Cartesian intersection point coordinates or None if the intersection point cannot be computed.
- Raise:
Exception if input wrong.
- point2plane_distance(p, n, q)
Given a point P on a plane and the normal n of a plane, the function computes the distance of a point Q to the plane. Raise an exception if does not work. All vectors are numpy arrays.
- Parameters:
p (array) – Array of floats containing the 3 Cartesian coordinates of point \(P\).
n (array) – Array of floats containing the 3 components defining plane normal vector \(\vec{n}\).
q (array) – Array of floats containing the 3 Cartesian coordinates of point \(q\).
- Returns:
The distance (float) or None in case \(\vec{n}\) has zero length.
2.11.7. Transformations
- class Rottrans3
A class for rotating and translating node coordinates. The default rotation is unity and translation is zero. Use as follows:
Define a transformation:
from simples.util import Rottrans3 transform = Rottrans3()
Define rotation (if not unity). In the present version, specify rotation with 2 base vectors defining new plane 1-2. Example: Rotate around z-axis by 90 °.
transform.set_rotation_e1e2((1., 0.0 , 0.0), (0.0, -1.0, 0.0)))
Specify translation (if any).
Apply transformation to node coordinate vector(s). Example: Transform xyz=(10.0,5.0,3.0).
newxyz = transform.apply((10.0, 5.0, 3.0))
- set_rotation_e1e2(e1, e2)
Define rotation by the new base defined by the base vectors
e1
ande2
. The basee3
is computed frome1
ande2
.e1
ande2
may not be parallel.- Parameters:
e1 (array) – Numpy array of 3 floats defining new base 1-direction.
e2 (array) – Numpy array of 3 floats defining a point in the new base 1-2 plane.
- set_rotation_x(angle)
Premultiply with rotation around x-axis in branch global system.
- Parameters:
angle (float) – Rotation angle (radians)
- set_rotation_y(angle)
Premultiply with rotation around y-axis in branch global system.
- Parameters:
angle (float) – Rotation angle (radians)
- set_rotation_z(angle)
Premultiply with rotation around z-axis in branch global system.
- Parameters:
angle (float) – Rotation angle (radians)
- set_translation(t)
Define translation vector.
- Parameters:
t (array) – Numpy array of 3 floats containing translation vector.
- apply(v)
Applies the rotation followed by the translation for the vector
v
.\(vt_i = m^t_{ij} v_j + t_i\)
- Parameters:
v (array) – Numpy array of 3 floats containing coordinate vector to be transformed.
- Returns:
Numpy array of transformed vector.
2.12. Helper Classes and Functions
2.12.1. Named Tuple Helper Classes
The name tuple helper classes are data structures returned by various data extraction functions.
Example
Extract eigenfrequencies of a Model m
and print the mode numbers
and the frequencies of all eigenmodes of vibration analysis case 2:
m = si.Model('demo')
# get_eigenfrequencies returns a named tuple ``Eigenfrequencies``
result = m.get_eigenfrequencies(case=2)
print("Mode Frequency")
for n, f in zip(result.modenum, result.frequency):
print(f"{n:4d} {f:10.3f}")
- class ArrayN2(branch: int, case: int, cycle: int, subcycle: int, nrows: int, ncols: int, values: ndarray)
A NamedTuple class containing an array of
nrows
byncol
float values. It is returned by various Simples methods.- branch
External branch identifier (int) if relevant, otherwise 0.
- case
Case identifier (int).
- cycle
Cycle identifier (int).
- nrows
Number of rows of array (int).
- ncols
Number of columns of array (int).
- values
Numpy array of floats.
- class BeamElementStresses(mesh: int, eid: int, iid: int, case: int, cycle: int, nstations: int, npoints: int, stresses: ndarray, nfindex: int, findex: ndarray)
A NamedTuple class containing beam stresses \(\sigma_{xx}\), \(\sigma_{t}\) and optional failure index of a single element computed by BeamStressField.
- mesh
External mesh (branch) identifier (int)
- eid
External element identifier (int)
- iid
Internal element identifier (int)
- nstations
Number of evaluation stations in beam i-direction (int).
- npoints
Number of stress evaluation points per station (int).
- stresses
Numpy array of floats containing all stresses
stresses[nstations,npoints,2]
.
- nfindex
Number of failure index coefficients (int).
- findex
Numpy array of floats containing all failure indices
findex[nstations, npoints, 1]
orNone
if not defined.
- class BucklingLoad(case: int, cycle: int, nbmodes: int, eigenvalues: ndarray, bloads: ndarray, force: ndarray, ebcidents: list, nbcidents: list)
A NamedTuple class containing a buckling analysis result summary of a case as returned by
simples.model.Model.get_buckling_load()
.- case
Case identifier (int).
- cycle
Cycle identifier (int).
- nbmodes
Number of buckling modes (int).
- eigenvalues
numpy array of floats containing allcomputed eigenvalues eigenvalues[nbmodes].
- bloads
numpy array of floats containing all buckling loads, i.e \(P_{crit}\) for all modes. Note that \(P_{crit}=0\) if the force vector has a zero length.
- force
numpy array of floats containing total applied force force[3].
- ebcidents
A list of all Essential Boundary Conditions identifiers contributing to the case and taken into account in the computation of the sum of all reaction forces
force
.
- nbcidents
A list of all Natural Boundary Conditions identifiers contributing to the case and taken into account in the computation of the sum of all reaction forces
force
.
- class Eigenfrequencies(case: int, cycle: int, nmodes: int, modenum: int, eigval: ndarray, frequency: ndarray, omega: ndarray, modalk: ndarray, modalm: ndarray, shift: float, swhere: str, termination: str)
A NamedTuple class containing the mode numbers and their frequencies as well as the modal stiffness and the modal mass of a case as returned by
simples.model.Model.get_eigenfrequencies()
.- case
Case identifier (int).
- cycle
Cycle identifier (int).
- nbmodes
Number of eigenfrequencies and dimension of all
numpy
arrays listed below (int)..
- modenum
Mode numbers of all
nbmodes
modes (int).
- eigval
Numpy array of floats containing calculated eigenvalues of all
nbmodes
corresponding to the mode numbersmodenum
.
- frequency
Numpy array of floats containing frequencies of all
nbmodes
corresponding to the mode numbersmodenum
.
- omega
Numpy array of floats containing circular frequencies of all
nbmodes
corresponding to the mode numbersmodenum
.
- modalk
Numpy array of floats containing modal stiffnesses of all
nbmodes
eigenmodes corresponding to the mode numbersmodenum
.
- modalm
Numpy array of floats containing modal masses all
nbmodes
eigenmodes corresponding to the mode numbersmodenum
.
- shift
Eigenvalue solver spectral shift value.
- swhere
Eigenvalue location with respect to shift.
- termination
Solution termination indicator.
- class FromCSV(label: str, colnames: list, nrows: int, ncols: int, values: list)
A NamedTuple class containing decoded CSV file data returned by
simples.csvutil.csv_read()
.- label
Curve label (str).
- colnames
List of strings containing column names.
- nrows
Number of rows of array (int).
- ncols
Number of columns of array (int).
- values
List containing numpy arrays of column values.
- class MeshElementConnectivity(name: str, branch: int, family: str, family_member: str, n: int, nne: int, elids: ndarray, connectivity: ndarray)
A NamedTuple class containing the element to node connectivity array of all members of a specific element family and branch, such as “B2.S.RS”.
- name
Element set name (str).
- family
- Element family name (str), ‘R’, ‘TR’, ‘TR’, ‘Q’, ‘Q’, ‘HE’,
‘TE’, etc.
- family_member
Element family member name (str), i.e ‘R2’, ‘R3’, ‘B2’, ‘TR3’, ‘TR6’, ‘Q4’, ‘Q8’, ‘Q9’, ‘HE8’, ‘HE20’, ‘HE27’, ‘TE4’, ‘TE10’, ‘PR6’, ‘PR15’
- branch
Branch identifier (int).
- n
Size of element identifier array
elids
andconnectivity
array (int).
- nne
Number of columns of connectivity array, i.e. number of nodes, with some exceptions (int).
- elids
Element identifiers numpy array
elids[n]
from which connectivity originates (int).
- connectivity
Connectivity numpy array
connectivity[n, nne]
(int). Note: The node identifiers of the connectivity array are Simples internal identifiers (0,1,2,…).
- class MeshPointSet(name: str, branch: int, n: int, pointids: ndarray)
A NamedTuple class containing a collection of mesh point set identifiers.
- class StepInfo(cycle: int, case: int, time: float, delta_time: float, stage_time: float, stage_number: int, stage_id: int)
A NamedTuple class containing time/load step attributes of a cycle
- cycle
Solution cycle identifier (int).
- case
Case identifier (int).
- time
Step time of current cycle (float).
- delta_time
Delta- time of current cycle (float).
- stage_time
Stage time of current cycle (float).
- stage_number
Current stage number (int).
- stage_id
Current stage identifier (int).
2.13. B2000++ FE Input Generator
MDL
generates a |b2k| MDL input file
from the information collected by the Modeler. Depending on the amount
of information delivered by the Modeler, at least a B2000++ FE mesh
is generated (a generic mesh is mesh without any element types
assigned).
Creates a B2000++ MDL file from the Simples description of nodes and elements as well as node and element lists (if any).
- param Model model:
Parent Model class.
- param str preamble:
String containing MDL commands that will be copied to the MDL file before MDL commands created by this function are copied to the MDL file.
- param str name:
MDL file name. The default MDL file name is the same as the model name, but with the extension .mdl.
Note: Case, Nbc, Ebc objects not yet converted to MDL!
2.14. Modeler Classes
The Simples modeler is an EXPERIMENTAL brep-based FE model generator.
The Brep modeler object. The object is created automatically by the
simples.Model
and the simples.Model.get_modeler()
function returns the Modeler object. If an new model is requested,
the modeler object is empty. If an existing model is loaded, the
Modeler tries to load any information.
- param Model model:
Model object assigned to this object.
2.14.1. Points
Defines points in the global Cartesian space. They are defined by the coordinates (x,y,z) and identified by name. All other Modeler objects refer to points.
- class CPoint(parent, name, xyz, dofref=0, elementid=0, iselement=False, merge=True, nodeid=0, pcolor='red', psize=5)
Defines a point. Points are generated by the
Modeler.point()
method.- Parameters:
parent (CPoints) – Parent object.
- get_name()
Point name.
- property name
Point name.
- get_dofref()
FE mesh node local DOF transformation identifier if this point.
- property dofref
Node local DOF transformation identifier or 0 if none.
- get_xyz()
Global cartesian coordinates of this point (numpy array of 3 float).
- property xyz
Global cartesian coordinates of this point (numpy array of 3 float).
- get_elementid()
FE mesh element identifier of this point (if any).
- property elementid
FE mesh element identifier of this point (if any).
- get_nodeid()
FE mesh node identifier of this point (if any).
- property nodeid
FE mesh node identifier of this point (if any).
- get_pid()
FE mesh property identificator of this point (if any).
- property pid
FE mesh property identificator of this point (if any).
- property iselement
Is point an element (bool)?
- property eprop
Element property object of FE point element.
- show()
Print point attributes.
2.14.2. Edges
An edge is uniquely identified by the start and end vertices p1 and p2:
+------ -----+ ---> u
Pstart Pend
All edges, except for composite edges, i.e edges composed of edges, are defined by the edge shape, the edge points, and additional shape-dependent parameters. The edge point list contains at least the start point and the end point, where the start point must be the first point in the list and the end point the last one.
- class EdgeBSpline(modeler, name, cpoints, **kwargs)
An edge object described by a 1D B-spline curve (see scipy documentation).
- param Modeler modeler:
Associated Modeler object.
- param str name:
Edge name.
- param list cpoints:
List of point names defining the spline. The first name in the list is the spline start point and the last element of the list the spline end point name.
Note
The cargs dictionary containing spline arguments to the scipy spline generation function. See scipy documentation. Among the parameters:
The smoothing condition s is set by default to 0, i.e. the spline passes through the points.
The weights w at the are all set to 1.0 by default.
The degree of interpolation is specified with the k paramater (default k=3). The help page of scipy says: Degree of the spline. Cubic splines are recommended. Even values of k should be avoided especially with a small s-value. 1<=k<= 5, default is 3.
- get_render_mesh(ncells=None)
Compute and return regular render mesh.
- Returns:
Numpy arrays
center[3]
,points[nnu, 3]
, wherecenter
is the edge center point coordinate andpoints
are the global coordinates of the regular mesh points, withnnu=points.shape[0]
.
- get_xyz(u)
Compute point on curve at parametric position u.
- Parameters:
u (float) – Parametric position(s), in the range of 0.0 to 1.0.
- Returns:
numpy float array xyz[3].
- class EdgeCircularArc(modeler, name, cpoints, **kwargs)
Create a circular arc edge, given the start and end points of the edge, the center of the circle, the normal of the plane in which the circle will be placed, and the angle.
The end point of the circle is not used in the calculation of the circle, but the last point of the arc will be placed there.
- Parameters:
modeler (Modeler) – Associated Modeler object.
name (str) – Edge name.
cpoints – List of 2 point names defining edge start and end points.
center (str) – Optional keyword argument specifying a point defining circle’s center. Default is center=(0,0,0). If center is parametrized (i.e specified by name) it will be updated.
normal (str) – Optional keyword argument defining the circle’s normal by specidying a point name or a normal (nx,ny,nz). Default is normal=(0,0,1). If normal is parametrized (i.e specified by name) it will be updated.
phi (float) – Optional keyword argument to define the angle in radians. If not specified the angle is computed with the first and last point and the center. See note below.
Note
If phi is specified it is kept constant unless the edge object is modified with a new phi value, followed by update.
If phi is not specified it will be computed at each update. Thus, if the start, end, or center points are modified, phi will be updated accordingly.
- get_render_mesh(ncells=None)
Compute and return regular render mesh.
- Returns:
Numpy arrays
center[3]
,points[nnu, 3]
, wherecenter
is the edge center point coordinate andpoints
are the global coordinates of the regular mesh points, withnnu=points.shape[0]
.
- get_xyz(u)
Compute point on curve at parametric position u.
- Parameters:
u (float) – Parametric position(s), in the range of 0.0 to 1.0.
- Returns:
numpy float array xyz[3].
- class EdgeStraightLine(modeler, name, cpoints, **kwargs)
Create a straight line edge object.
- Parameters:
modeler (Modeler) – Associated Modeler object.
name (str) – Edge name.
cpoints (list) – List of 2 point names defining edge start and end points.
free (ncells) – Optional keyword argument for specifying if edge is free. If set to True the edge is free. Default is False, i.e the edge will belong to a surface.
ncells) – Number of cells (elements of edge) to be generated by the FE mesher.
distribution (str) – FE cell distribution along edge: ‘equidistant’ (default) or ‘geom’. Not active.
zlocal (Numpy array or list zlocal[3].) – Defines local y axis for 1D elements along edge.
- get_render_mesh(ncells=None)
Compute and return regular render mesh.
- Returns:
Numpy arrays
center[3]
,points[nnu, 3]
, wherecenter
is the edge center point coordinate andpoints
are the global coordinates of the regular mesh points, withnnu=points.shape[0]
.
- set_cpoints(cpoints)
Compute and return regular render mesh.
- Parameters:
cpoints (list) – Point names defining edge start and end points.
- Returns:
True upon success
- get_xyz(u)
Compute point on curve at parametric position u.
- Parameters:
u (float) – Parametric position(s), in the range of 0.0 to 1.0.
- Returns:
numpy float array xyz[3].
2.14.3. Surfaces
Surface objects define quadrilateral surfaces. In the present version only surfaces defined by bilinear Coons Patches can be created, i.e. surfaces defined exclusively by their four edge curves.
The surface is uniquely identified with the four corner vertices p1..p4. The loop starts at p1 counterclockwise:
^ v
|
| p4 <-- p3
+------ e3 -----+
| |
| | | ^
| e4 e2 |
| | |
| |
+------ e1 -----+ ---> u
p1 --> p2
- class SurfaceCoons(modeler, name, p1, p2, p3, p4, kwargs)
Create a quadrilateral Coons surface.
- Parameters:
modeler (Modeler) – Modeler object associated to surface.
name (str) – Name of surface.
p1..p4 (strs) – Point names defining the 4 points p1 to p4.
- update()
Update surface object. Required in surface parameters, such as points, are changed.
- get_render_mesh(nu=None, nv=None)
Compute the regular render mesh and return the coordinates of the center of the surface and the mesh points.
- Parameters:
nu (int) – Number subdivision cells in u for computing render mesh. Default is None, i.e the modeler default taken (32).
nv (int) – Number subdivision cells in v for computing render mesh. Default is None, i.e the modeler default taken (32).
- Returns:
Numpy arrays center, points where center[3] are the surface center point coordinates and points[nnu, nnv, 3] are the coordinates of the regular mesh points. nnu=points.shape[0] nnv=points.shape[1].
- Return type:
numpy float arrays
- create_mesh_coons(nnu, nnv, border=True)
Create a regular coons mesh.
- get_xyz(u, v)
Given the parametric positions u and v, compute the point (x,y,z) of the surface. :param float u: Parametric position u in the range of 0.0 to 1.0.
- Parameters:
v (float) – Parametric position v the range of 0.0 to 1.0.
- Returns:
Point xyz[3] on the surface.
- Return type:
numpy array of 3 floats
Note Make sure that the surface parameter have been updated. The function does not call update nor does it range check u and v, this is too costly for each call.