framat.fem package¶
Submodules¶
framat.fem.analysis module¶
Analysis
-
framat.fem.analysis.free_vibration_analysis(frame)¶ Perform a free vibration analysis
- Args:
frame: frame object - Returns:
U: global vector of nodal displacements
-
framat.fem.analysis.static_load_analysis(frame)¶ Perform a static load analysis
- Args:
frame: frame object - Returns:
U: global vector of nodal displacements F_react: reaction loads
framat.fem.beamline module¶
Beamline
-
class
framat.fem.beamline.BeamLine(uid, nodes, nelem, beamprops, loads=None, symmetry=None, make_mirror=False, mirror_loads=None, mirror_beamprops=None, parent_frame=None, free_node_mapping=None)¶ Bases:
object-
FINDER_KEYWORDS= ['__GET_CLOSEST_NODE', '__GET_CLOSEST_X', '__GET_CLOSEST_Y', '__GET_CLOSEST_Z']¶
-
GET_CLOSEST_NODE= '__GET_CLOSEST_NODE'¶
-
GET_CLOSEST_X= '__GET_CLOSEST_X'¶
-
GET_CLOSEST_Y= '__GET_CLOSEST_Y'¶
-
GET_CLOSEST_Z= '__GET_CLOSEST_Z'¶
-
get_centre_of_mass()¶ Return the centre of mass (CG) and the total mass of the beamline
- Notes:
- Returns a CG = (0, 0, 0) if the total mass is zero
- Returns:
coord_CG: tuple with x, y and z coordinate of the CG total_mass: total mass of the frame structure
-
get_closest_beam_node(point_coord, in_range=(0, 1), search='__GET_CLOSEST_NODE')¶ Return closest node on beamline given a point in space
- Args:
point_coord: coordinates of point in_range: restrict search to beamline range (0, 1) search: scheme for node search - Returns:
closest_node: closest beam node distance: distance to closest beam node
-
get_deformation(xsi)¶ Return the beamline deformation at xsi
- Args:
xsi: relative coordinate in range [0, 1] - Returns:
U_b: deformation
-
get_nodes_by_xsi(xsi)¶ Get a beam node for a given xsi position
- Args:
xsi: relative coordinate in range [0, 1] - Returns:
next_node, prev_node: next and previous node
-
get_point(xsi)¶ Return coordinate of a beam point based on a line coordinate xsi
- Args:
xsi: relative coordinate in range [0, 1] - Returns:
coord: x, y, z coordinates
-
length¶ Beamline length
-
static
load_as_dict(input_load, keys)¶ Convert concentrated or distributed loads to a dictionary with specified keys
- Note:
- If the input is a dict, missing keys will be added with default values of zero
- Args:
input_load: loads in form of a dict or list keys: names/keys of loads - Returns:
load: loads converted to a dict
-
static
mirror_load(load, plane)¶ Mirror loads across a symmetry plane
- Args:
load: “sliceable” load with length (6x1) plane: symmetry plane - Returns:
mirrored_loads: mirrored loads
-
ndof¶ Number of nodes
-
nelem¶ Number of elements
-
nnodes¶ Number of nodes
-
nodes¶ Nodes of the beamline instance
-
static
project_load(load, from_point, to_point)¶ Project a concentrated load from one point onto another
- Args:
load: concentrated load which is to be projected from_point: point at which ‘load’ acts to_point: point onto which ‘load’ is to be projected - Returns:
load_proj: projected load
-
-
exception
framat.fem.beamline.ComponentDefinitionError¶ Bases:
Exception
-
framat.fem.beamline.mirror_point(point, plane)¶ Mirror a point in 3D space about a symmetry plane.
- Args:
point: point plane: (str) plane (‘xy’, ‘xz’ or ‘yz’)
framat.fem.boundary_conditions module¶
Boundary conditions
-
framat.fem.boundary_conditions.connect(node1_number, node2_number, uid1, uid2, total_ndof, dof_constraints, frame)¶ Make a connection between two nodes
- Note:
- The two nodes may belong to the same or to different beams
- Args:
node1_number: number of first node node2_number: number of second node uid1: UID of first node uid2: UID of second node total_ndof: total number of degrees of freedom dof_constraints: list with dofs to be fixed (NOT YET IMPLEMENTED)
-
framat.fem.boundary_conditions.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.fem.element module¶
Beam element definition
-
class
framat.fem.element.Element(parent_beamline, xsi1, xsi2, uid1, uid2, up=None)¶ 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')¶
-
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')¶
-
PROFIL_PROPS= ('A', 'Iy', 'Iz', 'J')¶
-
PROP_TYPES= ('E', 'G', 'rho', 'A', 'Iy', 'Iz', 'J')¶
-
add_pointmass(pointmass, loc_node_number)¶ Add a point mass
- Args:
pointmass: mass in SI units loc_node_number: node to which loads are to be applied (1, 2)
-
concentrated_load_vector¶ Concentrated load vector (here independent of coordinate system)
-
concentrated_load_vector_glob¶ Concentrated load vector (transformed to global system)
-
distributed_load_vector¶ Distributed load vector (as formulated in local system)
-
distributed_load_vector_glob¶ Distributed load vector (transformed to global system)
-
length¶ Length of the element
-
load_vector_glob¶ Element load vector (transformed to global system)
-
mass¶ Return the mass of the element
-
mass_matrix_glob¶ Element mass matrix (transformed to global system)
-
mass_matrix_local¶ Element mass matrix (as formulated in local system)
-
mid_point¶ Centre position of the element
-
mid_xsi¶ Centre position of the element in relative xsi coordinate
-
point_mass_matrix_local¶ Point mass matrix
-
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
-
stiffness_matrix_glob¶ Element stiffness matrix (transformed to global system)
-
stiffness_matrix_local¶ Element stiffness matrix (as formulated in local system)
-
transformation_matrix¶ Transformation matrix
-
up¶
-
update_concentrated_loads(loads, loc_node_number, is_loc_system)¶ Add concentrated loads to the element
- Notes:
- Acceptable dictionary keys see __class__.CONC_LOAD_TYPES
- Args:
loads: dict with concentrated loads loc_node_number: node to which loads are to be applied (1, 2) is_loc_system: flag, which, if True, makes loads be treated according to local coordinate system
-
update_distributed_loads(loads, is_loc_system)¶ Add the distributed loads to the element
- Notes:
- Acceptable dictionary keys see __class__.DIST_LOAD_TYPES
- Args:
loads: dict with distributed loads is_loc_system: flag, which, if True, makes loads be treated according to local coordinate system
-
update_properties(prop)¶ Update the element properties
- Args:
prop: dict with element properties
- Acceptable dictionary keys see __class__.PROP_TYPES
-
class
framat.fem.element.GlobalSystem¶ Bases:
object
-
framat.fem.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.fem.frame module¶
Frame definition
Frame structure hierarchie:
| FRAME
| |
| BEAMLINES
| |
| ELEMENTS
| |
| NODES
-
class
framat.fem.frame.BoundaryConditions¶ Bases:
object-
add_boundary_condition(bc_type, nodes)¶
-
get_identifier(constraints)¶
-
-
class
framat.fem.frame.Deformation¶ Bases:
object-
by_node_num(node_num, as_dict=False)¶ Return the nodal deformation based on the global node number
-
get_beamline_interpolator(beamline_uid, frame)¶ Return an interpolator for the deformation along a beam line
- Note:
- The interpolation function takes xsi (relative beamline coordinate) as an argument and return a 6x1 vector which contains the interpolated deformation (translations and rotations)
- Args:
beamline_uid: UID of the beamline - Returns:
def_interpolator: interpolation function
-
get_displacement_fields(frame, n_sup=20)¶ Returns beam displacement field
- Args:
frame: Frame object n_sup: Number of support points (linearly spaced along the beam) - Returns:
def_fields: Dictionary with arrays of displacement fields
Example:
For a frame with two beamlines, say ‘main_wing’ and ‘fuselage’, a dictionary with the following form will be created:
def_fields = { 'main_wing': array([ [x1, y1, z1, ux1, uy1, uz1, tx1, ty1, tz1], [x2, y2, z2, ux2, uy2, uz2, tx2, ty2, tz2], ... [x3, y3, z3, ux3, uy3, uz3, tx3, ty3, tz3], ]), 'fuselage': array([ [x1, y1, z1, ux1, uy1, uz1, tx1, ty1, tz1], [x2, y2, z2, ux2, uy2, uz2, tx2, ty2, tz2], ... [x3, y3, z3, ux3, uy3, uz3, tx3, ty3, tz3], ]), }
-
-
class
framat.fem.frame.Frame(beamline_definitions, bc_definitions, accel_definition, material_db, profile_db)¶ Bases:
object-
F_accel¶ Loads due to inertia
-
accel_direction¶
-
get_mass_breakdown(enforce_recompute=False)¶ Return a mass breakdown of the frame structure
- Note:
- Masses and centre of masses (CGs) of beamlines and entire frame are computed
- Args:
enforce_recompute: if True, the mass breakdown will be re-computed even if one already exists - Returns:
mass_breakdown: dictionary containing a masses and CG positions
-
get_work_breakdown(enforce_recompute=False)¶ Return a work breakdown of the frame structure
- Args:
enforce_recompute: if True, the work breakdown will be re-computed even if one already exists - Returns:
work_breakdown: dictionary containing a masses and the
-
-
class
framat.fem.frame.ObjectCounter¶ Bases:
object-
get_last_node_num()¶
-
increment_beam_count()¶
-
increment_element_count()¶
-
nodes¶
-
-
class
framat.fem.frame.ObjectFinder¶ Bases:
object
framat.fem.interpolate module¶
Interpolate
-
class
framat.fem.interpolate.PointInterpolator(points, point_uids=None)¶ Bases:
object-
get_n_points(n, min_factor=0.1)¶ Return a list of :n: points
- Args:
n: number of points to return
-
get_xsi_support_points()¶ TODO
-
interpolate(xsi)¶ Return a interpolated point at given xsi position
- Args:
xsi: relative position - Returns:
point: interpolated point
-
-
class
framat.fem.interpolate.PropertyInterpolator(x, props)¶ Bases:
object-
interpolate(x, kind)¶ Interpolate property at given position x
- Notes:
- The ‘kind’ parameter determines whether the next or previous property object shall be returned
- Args:
x: position at which to interpolate kind: type of interpolation (‘prev’, ‘next’) - Returns:
inperpol_property: interpolated property
-
framat.fem.modelgenerator module¶
Frame model generator
-
class
framat.fem.modelgenerator.Acceleration(turn_on=False, direction=[0, 0, -9.81], accel_factor=1)¶ Bases:
object
-
class
framat.fem.modelgenerator.BeamLine(uid=None, nelem=1)¶ Bases:
object-
add_concentrated_load(node_uid, load)¶
-
add_const_cross_section(from_node, to_node, material_uid, profil_uid)¶
-
add_const_distributed_load(from_node_uid, to_node_uid, load)¶
-
add_free_node_load(coord, load)¶
-
add_point_mass(node_uid, mass)¶
-
append_node(node)¶
-
append_nodes(nodes)¶
-
delete_node(node_uid)¶
-
get_node_uids(node_num=None)¶
-
classmethod
make_cantilever(uid=None)¶ Return a basic cantilever beamline
-
move(direction, steps=1)¶ Shift all nodes of the beamline
- Args:
direction: vector with direction along which nodes are to be shifted steps: nodes are shifted :steps: times :direction:
-
reset_loads()¶
-
rotate(rot_axis, degree)¶ Rotate all nodes of the beamline
- Args:
rot_axis: rotation axis around which nodes are to be rotated degree: degrees by which to rotate
-
-
class
framat.fem.modelgenerator.BoundaryConditions¶ Bases:
object-
add_connection(node1_uid, node2_uid, dof=['all'])¶
-
add_fix(node_uid, dof=['all'])¶
-
remove_connection(node_uid)¶
-
remove_fix(node_uid)¶
-
-
class
framat.fem.modelgenerator.FreeNodeLoad(coord, load, dest_node=None)¶ Bases:
object
-
class
framat.fem.modelgenerator.MaterialData(uid=None, E=1, G=1, rho=1)¶ Bases:
object
-
class
framat.fem.modelgenerator.Model¶ Bases:
object-
add_beamline(beamline)¶
-
add_beamlines(beamlines)¶
-
add_material(material)¶
-
add_profil(profil)¶
-
get_beamline_uids(beam_number=None)¶
-
classmethod
import_from_dict(modeldict)¶ Convert a dictionary into a model object
- Args:
modeldict: dictionary of the model definition - Returns:
TODO:
-
classmethod
make_template()¶ Return a minimal working example of a model definition
- Note:
- A simple cantilever beam will be return, with a tip and a root node
- The root node is clamped
- Returns:
modelobj: model definition object
-
remove_beamline(beamline_uid)¶
-
remove_beamlines()¶ Remove all beamlines and boundary conditions
-
remove_material(material_uid)¶
-
remove_profil(profil_uid)¶
-
serialise(filename=None)¶ Return a dictionary object and write to a JSON file (optional)
- Args:
filename: if provided a - Returns:
modeldict: model definition object converted into a dictionary
-
update_acceleration(acceleration)¶
-
-
class
framat.fem.modelgenerator.Node(uid=None, coord=None, up=None)¶ Bases:
object
-
class
framat.fem.modelgenerator.ProfilData(uid=None, A=1, Iy=1, Iz=1, J=1)¶ Bases:
object
-
framat.fem.modelgenerator.get_example(model_name='cantilever')¶ Return an example model object
- Args:
model_name: TODO - Returns:
modelobj: Model object instance
-
framat.fem.modelgenerator.get_uuid()¶ Return a (universally) unique identifier in a string representation
- Note:
- This function uses UUID4, see https://en.wikipedia.org/wiki/Universally_unique_identifier
framat.fem.plot module¶
Plot
-
framat.fem.plot.create_3D_plot(frame, plot_settings, filestructure)¶ Main plotting function
- Args:
frame: frame object plot_settings: settings dictionary
-
framat.fem.plot.create_matrix_plot(frame, plot_settings)¶ Create a matrix plot
- Args:
frame: frame object plot_settings: dict with settings
-
framat.fem.plot.get_all_plot_settings(ps, frame)¶ Return a dictionary with all plot setting
- Args:
plot_settings: dict with settings frame: frame object - Returns:
plot_settings: completed dict (defaults added if no value provided)
-
framat.fem.plot.plot_all(frame, plots, filestructure)¶ Wrapper function which creates all plot defined in ‘plots’
- Args:
frame: frame object plots: input (list with plot settings as dict)
-
framat.fem.plot.set_equal_aspect_3D(plot)¶ Set aspect ratio of plot correctly
- Args:
plot: plot
framat.fem.properties module¶
FEM properties