My Project
|
Contains mesh data and has function to calculate and retrieve mesh properties. More...
#include <Mesh.h>
Public Member Functions | |
Mesh (std::string fileName, Material mat) | |
Constructor. More... | |
void | solveBendingMoments () |
Calculates bending moments. More... | |
void | solveTorsion () |
Calculates the shear stress distribution under torsional load. | |
void | solveShearX () |
Calculates the shear stress distribution under shear force along x-axis. | |
void | solveShearY () |
Calculates the shear stress distribution under shear force along y-axis. | |
void | applyShearFactor (MatrixXd &S, std::string) |
Divides the load vector by the seccond moment of area Iy or Ix. | |
void | setMaterial (Material) |
Adds the same material to all the elements in the mesh. | |
void | calculateMeshProperties () |
Calculates mesh properties. More... | |
void | transformCoordinates () |
Transforms coordinates for computation purposes. More... | |
void | calculateMeshBendingStiffness () |
Calculates bending stiffness. More... | |
void | calculateMeshSecondMomentsOfArea () |
Calculates second area moments. More... | |
void | calculateAnglePrincipalAxes () |
Calculates angle of the principal axes. More... | |
double | getAnglePrincipalAxes () |
Returns the angle of the principal axes. | |
void | solveEquations (SparseMatrix< double > &A, MatrixXd &b, MatrixXd &C) |
Solves the system equations. More... | |
void | constrainDOF (SparseMatrix< double > &K, MatrixXd &R, int nNumber) |
Applies boundary conditions. More... | |
void | constrainNodeNearCenter (SparseMatrix< double > &K, MatrixXd &R) |
Constrains the center node. | |
Node | getNodeAt (int n) |
Returns the n'th node from the nodes vector. | |
Element * | getElementAt (int e) |
Returns the e'th element from the elements vector. | |
int | getNumNodes () |
Returns total number of nodes. | |
int | getNumElements () |
Returns total number of elements. | |
void | SetSmoothNodalTau () |
Sets the tau value for all the nodes equal to the avarage of the tau values from all the surrounding elements. | |
Public Attributes | |
double | Ax |
Area centre for mesh in X-direction. | |
double | Ay |
Area centre for mesh in Y-direction. | |
double | totalArea |
Total area of the mesh. | |
double | areaStiffness |
Sum of all Ai * Ei. | |
double | Ix |
Second area moment for mesh in X-direction. | |
double | Iy |
Second area moment for mesh in Y-direction. | |
double | Ixy |
Second area moment for mesh in XY-direction. | |
double | Imax |
Maximum second area moment for mesh along principal axis. | |
double | EIx |
Second area moment for mesh in X-direction. | |
double | EIy |
Second area moment for mesh in Y-direction. | |
double | EIxy |
Second area moment for mesh in XY-direction. | |
double | EImax |
Maximum second area moment for mesh along principal axis. | |
double | anglePrincipalAxes |
Stores the angle of the principal axes in degrees. | |
double | anglePrincipalAxesRad |
Stores the angle of the principal axes in radians. | |
std::vector< Element * > | elements |
List of all elements in mesh. | |
std::vector< Node > | nodes |
List of all nodes in mesh. | |
MatrixXd | sigmaAxial |
Stores nodal stress from axial force. | |
MatrixXd | sigmaOfX |
Stores all nodal stresses from moment about x-axis. | |
MatrixXd | sigmaOfY |
Stores all nodal stresses from moment about y-axis. | |
std::string | shearType |
Variable used in applyShearLoad, that is dependent on the shear analysis being in x or y direction. | |
MatrixXd | tauXZtorsion |
Stores nodal \( \tau_{xz} \) from torsional load. | |
MatrixXd | tauYZtorsion |
Stores nodal \( \tau_{yz} \) from torsional load. | |
MatrixXd | tauRtorsion |
Stores nodal \( \tau_{R} \) from torsional load. | |
MatrixXd | tauXZshearX |
Stores nodal \( \tau_{xz} \) from shear load in x-direction. | |
MatrixXd | tauYZshearX |
Stores nodal \( \tau_{yz} \) from shear load in x-direction. | |
MatrixXd | tauRshearX |
Stores nodal \( \tau_{R} \) from shear load in x-direction. | |
MatrixXd | tauXZshearY |
Stores nodal \( \tau_{xz} \) from shear load in y-direction. | |
MatrixXd | tauYZshearY |
Stores nodal \( \tau_{yz} \) from shear load in y-direction. | |
MatrixXd | tauRshearY |
Stores nodal \( \tau_{R} \) from shear load in y-direction. | |
MatrixXd | torsion_displacement |
Stores values for displacement for the case of torsion. | |
MatrixXd | torsion_load |
Stores values for load for the case of torsion. | |
MatrixXd | shearX_load |
Stores values for load for the case of shearX. | |
MatrixXd | shearX_displacement |
Stores values for displacement for the case of shearX. | |
MatrixXd | shearY_load |
Stores values for load for the case of shearY. | |
MatrixXd | shearY_displacement |
Stores values for displacement for the case of shearY. | |
MatrixXd | printTemp1 |
Used in testing to store desired value for printing. | |
MatrixXd | printTemp2 |
Used in testing to store desired value for printing. | |
Contains mesh data and has function to calculate and retrieve mesh properties.
Mesh::Mesh | ( | std::string | fileName, |
Material | mat | ||
) |
Constructor.
Computes the area, areacentre and the stiffness matrix
elements | List of all elements |
nodes | List of all nodes |
void Mesh::calculateAnglePrincipalAxes | ( | ) |
Calculates angle of the principal axes.
\( t = \frac{-2I_{xy}}{I_x - I_y} \)
\( \alpha = \frac{1}{2}\arctan(t)\frac{180}{\pi} \)
void Mesh::calculateMeshBendingStiffness | ( | ) |
Calculates bending stiffness.
Loops through all elements calculating the distance between mesh- and element area centres, and calculates the bendingStiffnesses for the mesh's x-, y- and xy-axis.
void Mesh::calculateMeshProperties | ( | ) |
Calculates mesh properties.
The function is run by constructor. It runs through all elements calculating element areas and element centres for each element.
It also calculates total area of mesh, and area centre of the mesh using
\( A_x = \sum{( \frac{dx_e*a_e}{A}) } \) and \( A_y = \sum{ (\frac{dy_e*a_e}{A}) } \)
void Mesh::calculateMeshSecondMomentsOfArea | ( | ) |
Calculates second area moments.
\( I_x = \dfrac{EI_x}{E_b} \) \( I_y = \dfrac{EI_y}{E_b} \) \( I_xy = \dfrac{EI_xy}{E_b} \)
void Mesh::constrainDOF | ( | SparseMatrix< double > & | K, |
MatrixXd & | R, | ||
int | nNumber | ||
) |
Applies boundary conditions.
puts the stiffness relation equations on the form \( \textbf{Ab} = \textbf{C} \Rightarrow \begin{bmatrix} & & & & \vdots \\ & & & & 0 \\ & & & & 0 \\ \cdots & 0 & 0 & 0 & 1\\ \end{bmatrix} \boldsymbol{b} = \begin{bmatrix} \vdots \\ - \\ - \\ 1\\ \end{bmatrix} \)
K | is the global stiffness matrix |
R | is the load vector |
int | is the node to be constrained |
void Mesh::solveBendingMoments | ( | ) |
Calculates bending moments.
\( \sigma = dy / I_x \) \( \sigma = dx / I_y \)
void Mesh::solveEquations | ( | SparseMatrix< double > & | A, |
MatrixXd & | b, | ||
MatrixXd & | C | ||
) |
Solves the system equations.
\( Kr = R \),
where K is the stiffness matrix, and r and R are vectors with displacements and loads in each node.
A | is the stiffness matrix |
b | is the displacement |
C | is the load vector |
void Mesh::transformCoordinates | ( | ) |
Transforms coordinates for computation purposes.
\( x' = x-A_xcos(\alpha) + y-A_ysin(\alpha) \)
\( x' = y-A_ycos(\alpha) - x-A_xsin(\alpha) \)