Assembly

namespace assy
class Assembly1D
#include <assembly.hpp>

1D Assembly of spring elements and calculates their displacements

Each spring element added gets assembled onto the previous with addElement().

For Example: Elem 1 Elem 2 Elem n u0/\ /\ /_u1_/\ /\ /_u2_ …_un-1_/\ /\ /_un \/ \/ \/ \/ \/ \/

The 2nd displacement of the previously added element is set to be equal to the 1st displacement of the element being added.

Public Functions

inline Assembly1D()

Default Constructor.

inline void addElement(const elem::Spring1D &spring)

Adds element to Assembly system.

Parameters:

spring – 1D Spring element (elem::Spring1D) with spring constant (k) defined

inline void print() const

Prints out values of assembly.

inline void assemble()

Generates the global stiffness matrix, K.

K gets resized to a square matrix with a size equal to the number of elements in the assembly.

For each element in the assembly, the element’s stiffness matrix gets summed to the

Example:

For 2 Elements, Size of K = 3 X 3 matrix

Elem 1: K = [e1(0,0) e1(1,0) 0 e1(0,1) e1(1,1) 0 0 0 0]

Elem 2: K = [e1(0,0) e1(1,0) 0 e1(0,1) e1(1,1) + e2(0,0) e2(1,0) 0 e2(0,1) e2(1,1)]

inline void displacementConstraint(int id, double value)

Add displacement constraint to Assembly system.

Parameters:
  • id – The node id for the displacement constraint

  • value – The value for the node displacement to equal

Private Members

std::vector<elem::Spring1D> elements

Vector to hold each element in assembly.

Eigen::MatrixXd K

Global Stiffness Matrix.

Eigen::VectorXd displacements

Displacements of System.

Eigen::VectorXd forces

Forces of System.

int numUnknowns

Number of Unkowns in System of Equations.

size_t globalStiffMatrixSize

Size of K, displacements, and forces.