framat package¶
Submodules¶
framat.__version__ module¶
framat._assembly module¶
Assembly
-
framat._assembly.connect(x1, x2, num_node1, num_node2, ndofs, dof_constraints)¶ Make a rigid connection between two nodes
- Note:
The two nodes may belong to the same or to different beams
- Args:
- x1
(numpy) coordinate of point 1
- x2
(numpy) coordinate of point 2
- num_node1
(int) global node number of point 1
- num_node2
(int) global node number of point 2
- ndofs
(int) number of dofs
- dof_constraints
list with dofs to be fixed (NOT YET IMPLEMENTED)
-
framat._assembly.create_bc_matrices(m)¶ Assemble the constraint matrix B
-
framat._assembly.create_main_tensors(m)¶ Create system tensors K, M and F
The stiffness matrix K and the mass matrix M are created as sparse matrices
-
framat._assembly.create_system_matrices(m)¶ Assemble global tensors
- K
global stiffness matrix
- M
global mass matrix
- F
global load vector
- B
constraint matrix
-
framat._assembly.empty(dtype)¶
-
framat._assembly.fix_dof(node_number, total_ndof, dof_constraints)¶ Return part of constraint matrix B for fixed degrees of freedom
- Note:
Only non-zero rows are returned. If, say, three dof are fixed, then B will have size 3xndof
- Args:
- node_number
node_number
- total_ndof
total number of degrees of freedom
- dof_constraints
list with dofs to be fixed
-
framat._assembly.sparse_matrix(data, rows, cols)¶ Return a compressed sparse matrix
Duplicate entries are summed together
framat._element module¶
Beam element definition
-
class
framat._element.Element(p1, p2, up)¶ Bases:
objectEuler-Bernoulli element with 6 degrees of freedom
Nomenclature
- Material properties:
- E
Young’s modulus [N/m²]
- G
Shear modulus [N/m²]
- rho
Material density [kg/m³]
- Cross section properties:
- A
Cross section area [m²]
- Iy
Second moment of area about element local y-axis [m⁴]
- Iz
Second moment of area about element local z-axis [m⁴]
- J
Torsional constant [m⁴]
- Inertia properties:
- m{1,2}
Point mass attached to node 1 or 2 [kg]
- Loads:
F{x,y,z}{1,2}: Point load in x,y,z-directions applied to node 1 or 2 [N] M{x,y,z}{1,2}: Point moment in x,y,z-directions applied to node 1 or 2 [N] q{x,y,z}: Line force in x,y,z-directions applied to length of element [N/m] m{x,y,z}: Line moment in x,y,z-directions applied to length of element [N*m/m]
- Deformation:
u{x,y,z}{1,2}: Displacement in x,y,z-direction (in global system) [m] t{x,y,z}{1,2}: Rotation in x,y,z-direction (in global system) [rad]
-
CONC_LOAD_BASE_TYPES= ('Fx', 'Fy', 'Fz', 'Mx', 'My', 'Mz')¶
-
CONC_LOAD_TYPES= ('Fx1', 'Fy1', 'Fz1', 'Mx1', 'My1', 'Mz1', 'Fx2', 'Fy2', 'Fz2', 'Mx2', 'My2', 'Mz2')¶
-
CROSS_SECTION_PROPS= ('A', 'Iy', 'Iz', 'J')¶
-
DEFORM_TYPES= ('ux', 'uy', 'uz', 'tx', 'ty', 'tz')¶
-
DIST_LOAD_TYPES= ('qx', 'qy', 'qz', 'mx', 'my', 'mz')¶
-
DOF_PER_NODE= 6¶
-
MATERIAL_PROPS= ('E', 'G', 'rho')¶
-
POINT_PROPS= ('m1', 'm2')¶
-
PROP_TYPES= ('E', 'G', 'rho', 'A', 'Iy', 'Iz', 'J')¶
-
add_distr_load(load, loc_system)¶ Add a distributed load to the element
- Args:
- load
load vector (6x1)
- loc_system
if True, loads are interpreted as being defined in the local system
-
add_point_load(load, node_num, loc_system)¶ Add a point load to the element node 1 or 2
- Args:
- load
load vector (6x1)
- node_num
node to which loads are to be applied (1, 2)
- loc_system
if True, loads are interpreted as being defined in the local system
-
add_point_mass(mass, node_num)¶ Add a point load to the element node 1 or 2
- Args:
- mass
mass (scalar)
- node_num
node to which mass is added (1, 2)
-
classmethod
from_abstract_element(a)¶ Create an new element from an abstract beam element
-
property
mass_matrix_local¶ Element mass matrix (as formulated in local system)
-
shape_function_matrix(xi)¶ Return the shape function (basis function) matrix of shape (6, 12)
- Notes:
Rows 1 to 6 correspond to deformations ‘ux’, ‘uy’, ‘uz’, ‘tx’, ‘ty’, ‘tz’ in this order
- Args:
- xi
relative element coordinate [0, 1]
- Returns:
- N
shape function matrix
-
property
stiffness_matrix_local¶ Element stiffness matrix (as formulated in local system)
-
update_element_mass_matrix()¶ Element mass matrix (transformed to global system)
-
update_element_stiffness_matrix()¶ Element stiffness matrix (transformed to global system)
-
framat._element.G¶ alias of
framat._element.GlobalSystem
-
class
framat._element.GlobalSystem¶ Bases:
object-
Origin= array([0, 0, 0])¶
-
X= array([1, 0, 0])¶
-
Y= array([0, 1, 0])¶
-
Z= array([0, 0, 1])¶
-
-
framat._element.get_local_system_from_up(x_elem, up)¶ Return the y- and z-axis of a Cartesian coordinate system (local element coordinate system) for a given x-axis and a defined “up-direction”
- Args:
- x_elem
x-axis (of the element)
- up
up-direction
- Returns:
- y_axis
y-axis
- z_axis
z-axis
Values are returned as a tuple
framat._log module¶
Logging
framat._meshing module¶
Module for creating the geometric mesh
-
class
framat._meshing.AbstractBeamMesh¶ Bases:
object-
add_beam_line(sup_points, n=10)¶ Add a new beam to the entire beam structure
- Args:
- sup_points
(dict) key: support point uid, value: nodes coordinates
- n
(int) number of elements for the entire chain
-
gbv(vector, beam_idx)¶ Return the beam value from a given vector (e.g. displacement or load)
- Args:
- vector
vector
- beam_idx
(int) beam index
-
get_all_points(beam_idx)¶ Return an array (n x 3) with all node coordinates
-
get_by_uid(beam_idx, uid)¶ Return an element with a named node
- Args:
- beam_idx
(int) beam index
- uid
UID of named node
-
get_lims()¶ Return the bounding box for the entire beam structure
-
get_lims_beam(beam_idx)¶ Return the bounding box of a specific beam
-
get_point_by_uid(uid)¶ Return a node point
- Args:
- uid
UID of named node
-
get_sup_points(beam_idx)¶ Return an array (n x 3) with support point coordinates
-
gnv(vector, uid)¶ Return the nodal value from a given vector (e.g. displacement or load)
- Args:
- vector
vector
- uid
UID of named node
-
iter_from_to(beam_idx, uid1, uid2)¶ Iterate trough elements from UID1 to UID2
- Args:
- beam_idx
(int) beam index
- uid1
UID of first node
- uid2
UID of second node
-
property
nbeams¶ Total number of beam elements
-
ndofs(ndof_per_node=6)¶ Total number of DOFs
-
ndofs_beam(beam_idx, ndof_per_node=6)¶ Number of DOFs per beam
-
nelem_beam(beam_idx)¶ Number of elements in beam with given beam index
-
property
nelems¶ Total number of elements
-
property
nnodes¶ Total number of nodes
-
nnodes_beam(beam_idx)¶ Number of nodes in beam with given beam index
-
-
class
framat._meshing.AbstractEdgeElement(p1, p2)¶ Bases:
mframework._mframework._BaseSpec._provide_user_class_from_base.<locals>.UserSpace
-
class
framat._meshing.LineSegment(p1, p2)¶ Bases:
object-
property
from_uid¶
-
iter_points(*, exclude_last=False)¶
-
split_into(n)¶ Split segment into smaller segments
The new line segment will have n + 1 nodes.
-
property
to_uid¶
-
property
-
class
framat._meshing.Point(coord, *, rel_coord=None, uid=None)¶ Bases:
object
-
class
framat._meshing.PolygonalChain(sup_points, n=10)¶ Bases:
object-
add_segment(seg)¶
-
iter_points()¶
-
set_node_num(n)¶
-
-
framat._meshing.create_mesh(m)¶ Top-level function for mesh creation
framat._model module¶
Model definition
-
class
framat._model.Builtin¶ Bases:
enum.EnumBuilt-in models
-
CANTILEVER= 'cantilever'¶
-
HELIX= 'helix'¶
-
classmethod
to_list()¶
-
-
class
framat._model.Model¶ Bases:
mframework._mframework._BaseSpec._provide_user_class_from_base.<locals>.UserSpace-
_abc_impl= <_abc_data object>¶
-
classmethod
from_example(example='cantilever')¶
-
run()¶ The ‘run()’ method is the main entry point for evaluating the user model. This method needs to be overridden in the subclass. The ‘run()’ method should return an instance of ‘_result_user_class’. When implementing ‘run()’ in the subclass, the superclass ‘run()’ method should first be called with ‘super().run()’.
-
-
framat._model.get_example_cantilever()¶
-
framat._model.get_example_helix()¶
-
framat._model.init_examples()¶
-
framat._model.is_dir(key, value, comp_value, _)¶ Validator to check if the value is a writeable directory
framat._plot module¶
Plotting
-
class
framat._plot.C¶ Bases:
object-
BOX_BC= 'black'¶
-
BOX_BEAM_IDX= 'navy'¶
-
BOX_NODE_UID= 'orange'¶
-
DEFORMED= 'red'¶
-
FORCE= 'steelblue'¶
-
GLOBAL_SYS= 'blue'¶
-
LOCAL_SYS= 'green'¶
-
MASS= 'maroon'¶
-
MOMENT= 'purple'¶
-
TXT_BC= 'white'¶
-
TXT_BEAM_IDX= 'white'¶
-
TXT_NODE_UID= 'black'¶
-
UNDEFORMED= 'grey'¶
-
-
class
framat._plot.PlotItems¶ Bases:
enum.EnumAn enumeration.
-
bc= 'bc'¶
-
bc_id= 'bc_id'¶
-
beam_index= 'beam_index'¶
-
deformed= 'deformed'¶
-
forces= 'forces'¶
-
global_axes= 'global_axes'¶
-
moments= 'moments'¶
-
node_uids= 'node_uids'¶
-
nodes= 'nodes'¶
-
classmethod
to_list()¶
-
undeformed= 'undeformed'¶
-
-
framat._plot._coordinate_system(plot, origin, axes, axes_names, color, scale=1)¶
-
framat._plot.add_boundary_conditions(m, ax, plot_num)¶
-
framat._plot.add_global_axes(m, ax, plot_num)¶
-
framat._plot.add_items_per_beam(m, ax, plot_num)¶
-
framat._plot.args_plot(m, color, marker=None)¶
-
framat._plot.args_scatter(m, color, marker=None)¶
-
framat._plot.args_text(m, c_txt, c_box)¶
-
framat._plot.get_bc_id(constraints)¶
-
framat._plot.init_3D_plot(x_lims, y_lims, z_lims)¶ Inititalize the 3D plot
- Args:
- x_lims
(tuple) min and max x-value
- y_lims
(tuple) min and max y-value
- z_lims
(tuple) min and max z-value
-
framat._plot.plot_all(m)¶ Create all plots defined in the model object
-
framat._plot.set_equal_aspect_3D(ax)¶ Set aspect ratio of plot correctly
- Args:
- ax
(obj) axis object
framat._run module¶
Run the model
-
framat._run.run_model(m)¶ Run the complete model analysis
- Args:
- m
model instance
framat._solve module¶
Solving
-
framat._solve.solve(m)¶
-
framat._solve.static_load_analysis(m)¶ Perform a static load analysis
- Returns:
- U
global vector of nodal displacements
- F_react
reaction loads
framat._util module¶
Solving
-
class
framat._util.Schemas¶ Bases:
object-
any_int= {'type': <class 'int'>}¶
-
any_num= {'type': <class 'numbers.Number'>}¶
-
pos_int= {'>': 0, 'type': <class 'int'>}¶
-
pos_number= {'>': 0, 'type': <class 'numbers.Number'>}¶
-
string= {'>': 0, 'type': <class 'str'>}¶
-
vector3x1= {'item_types': <class 'numbers.Number'>, 'max_len': 3, 'min_len': 3, 'type': <class 'list'>}¶
-
vector6x1= {'item_types': <class 'numbers.Number'>, 'max_len': 6, 'min_len': 6, 'type': <class 'list'>}¶
-
-
framat._util.enumerate_with_step(iterable, start=0, step=1)¶ TODO https://stackoverflow.com/questions/24290025/python-enumerate-downwards-or-with-a-custom-step
-
framat._util.pairwise(iterable)¶ Return a new iterator which yields pairwise items
s –> (s0,s1), (s1,s2), (s2, s3), …
See: https://docs.python.org/3/library/itertools.html#itertools-recipes