3D Beam Finite Element Code
1.0
|
Classes | |
struct | BC |
A boundary condition to enforce. More... | |
class | CSVParser |
Reads data from a csv file into an std::vector and writes the contents of an std::vector to a file. More... | |
struct | Elem |
An element of the mesh. Contains the indices of the two fea::Node 's that form the element as well as the properties of the element given by the fea::Props struct. More... | |
struct | Equation |
A linear multipoint constraint. More... | |
struct | Force |
A nodal force to enforce. More... | |
class | GlobalStiffAssembler |
Assembles the global stiffness matrix. More... | |
struct | Job |
Contains a node list, element list, and the properties of each element. More... | |
struct | Options |
Provides a method for customizing the finite element analysis. More... | |
struct | Props |
The set of properties associated with an element. More... | |
struct | Summary |
Contains the results of an analysis after calling fea::solve . More... | |
struct | Tie |
Places linear springs between all degrees of freedom of 2 nodes. More... | |
Typedefs | |
typedef Eigen::Vector3d | Node |
A node that describes a mesh. Uses Eigen's predefined Vector class for added functionality. More... | |
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > | GlobalStiffMatrix |
typedef Eigen::Matrix< double, 12, 12, Eigen::RowMajor > | LocalMatrix |
typedef Eigen::Matrix< double, Eigen::Dynamic, 1 > | ForceVector |
typedef Eigen::SparseMatrix< double > | SparseMat |
Enumerations | |
enum | DOF { DISPLACEMENT_X, DISPLACEMENT_Y, DISPLACEMENT_Z, ROTATION_X, ROTATION_Y, ROTATION_Z, NUM_DOFS } |
Convenience enumerator for specifying the active degree of freedom in a constraint. More... | |
Functions | |
template<typename T > | |
std::istream & | operator>> (std::istream &ins, std::vector< T > &record) |
template<typename T > | |
std::istream & | operator>> (std::istream &ins, std::vector< std::vector< T > > &data) |
rapidjson::Document | parseJSONConfig (const std::string &config_filename) |
std::vector< Node > | createNodeVecFromJSON (const rapidjson::Document &config_doc) |
std::vector< Elem > | createElemVecFromJSON (const rapidjson::Document &config_doc) |
std::vector< BC > | createBCVecFromJSON (const rapidjson::Document &config_doc) |
std::vector< Force > | createForceVecFromJSON (const rapidjson::Document &config_doc) |
std::vector< Tie > | createTieVecFromJSON (const rapidjson::Document &config_doc) |
std::vector< Equation > | createEquationVecFromJSON (const rapidjson::Document &config_doc) |
Job | createJobFromJSON (const rapidjson::Document &config_doc) |
Options | createOptionsFromJSON (const rapidjson::Document &config_doc) |
double | norm (const Node &n1, const Node &n2) |
Calculates the distance between 2 nodes. More... | |
void | loadBCs (SparseMat &Kg, ForceVector &force_vec, const std::vector< BC > &BCs, unsigned int num_nodes) |
Loads the boundary conditions into the global stiffness matrix and force vector. More... | |
void | loadEquations (SparseMat &Kg, const std::vector< Equation > &equations, unsigned int num_nodes, unsigned int num_bcs) |
void | loadTies (std::vector< Eigen::Triplet< double > > &triplets, const std::vector< Tie > &ties) |
Loads any tie constraints into the set of triplets that will become the global stiffness matrix. More... | |
std::vector< std::vector< double > > | computeTieForces (const std::vector< Tie > &ties, const std::vector< std::vector< double > > &nodal_displacements) |
Computes the forces in the tie elements based on the nodal displacements of the FE analysis and the spring constants provided in ties . More... | |
void | loadForces (SparseMat &force_vec, const std::vector< Force > &forces) |
Loads the prescribed forces into the force vector. More... | |
Summary | solve (const Job &job, const std::vector< BC > &BCs, const std::vector< Force > &forces, const std::vector< Tie > &ties, const std::vector< Equation > &equations, const Options &options) |
Solves the finite element analysis defined by the input Job, boundary conditions, and prescribed nodal forces. More... | |
void | loadBCs (SparseMat &Kg, SparseMat &force_vec, const std::vector< BC > &BCs, unsigned int num_nodes) |
typedef Eigen::Matrix<double, Eigen::Dynamic, 1> fea::ForceVector |
Vector that stores the nodal forces, i.e. the variable \([F]\) in \([K][Q]=[F]\), where \([K]\) is the global stiffness matrix and \([Q]\) contains the nodal displacements
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> fea::GlobalStiffMatrix |
Dense global stiffness matrix
typedef Eigen::Matrix<double, 12, 12, Eigen::RowMajor> fea::LocalMatrix |
An elemental matrix in local coordinates. Will either be the elemental stiffness matrix or the global-to-local rotation matrix
typedef Eigen::Vector3d fea::Node |
A node that describes a mesh. Uses Eigen's predefined Vector class for added functionality.
See the Eigen documentation on the Vector3d class for more options of what can be done with Nodes
.
Examples of constucting a Node
at \((x, y, z)=(0,1,2)\):
typedef Eigen::SparseMatrix<double> fea::SparseMat |
Sparse matrix that is used internally to hold the global stiffness matrix
enum fea::DOF |
Convenience enumerator for specifying the active degree of freedom in a constraint.
std::vector< std::vector< double > > fea::computeTieForces | ( | const std::vector< Tie > & | ties, |
const std::vector< std::vector< double > > & | nodal_displacements | ||
) |
Computes the forces in the tie elements based on the nodal displacements of the FE analysis and the spring constants provided in ties
.
[in] | ties | std::vector<Tie> . Vector of fea::Tie 's to applied to the current analysis. |
[in] | nodal_displacements | std::vector < std::vector < double > > . The resultant nodal displacements of the analysis. |
std::vector < std::vector < double > >
std::vector< BC > fea::createBCVecFromJSON | ( | const rapidjson::Document & | config_doc | ) |
std::vector< Elem > fea::createElemVecFromJSON | ( | const rapidjson::Document & | config_doc | ) |
Parses the files indicated by the "elems" and "props" keys in config_doc
into a vector of fea::Elem
's.
config_doc | rapidjson::Document . Document storing the file names of the csv files that contain the node number designations for each element and elemental properties. |
std::vector<Elem>
. std::vector< Equation > fea::createEquationVecFromJSON | ( | const rapidjson::Document & | config_doc | ) |
Parses the file indicated by the "equations" key in config_doc
into a vector of fea::Equation
's.
config_doc | rapidjson::Document . Document storing the file name containing the prescribed forces. |
std::vector< Force > fea::createForceVecFromJSON | ( | const rapidjson::Document & | config_doc | ) |
Parses the file indicated by the "forces" key in config_doc
into a vector of fea::Forces
's.
config_doc | rapidjson::Document . Document storing the file name containing the prescribed forces. |
std::vector<BC>
. Job fea::createJobFromJSON | ( | const rapidjson::Document & | config_doc | ) |
Creates vectors of fea::Node
's and fea::Elem
's from the files specified in config_doc
. A fea::Job
is created from the node and element vectors and returned.
config_doc | rapidjson::Document . Document storing the file name containing the nodes, elements, and properties. |
std::vector< Node > fea::createNodeVecFromJSON | ( | const rapidjson::Document & | config_doc | ) |
Parses the file indicated by the "nodes" key in config_doc
into a vector of fea::Node
's.
config_doc | rapidjson::Document . Document storing the file name containing the nodal coordinates. |
std::vector<Node>
. Options fea::createOptionsFromJSON | ( | const rapidjson::Document & | config_doc | ) |
Creates an fea::Options
object from the configuration document. Any options provided will override the defaults.
config_doc | rapidjson::Document . Document containing the configuration for the current analysis. This function will look for the "options" member in config_document for a json object holding the user-supplied options. |
fea::Options
. std::vector< Tie > fea::createTieVecFromJSON | ( | const rapidjson::Document & | config_doc | ) |
void fea::loadBCs | ( | SparseMat & | Kg, |
ForceVector & | force_vec, | ||
const std::vector< BC > & | BCs, | ||
unsigned int | num_nodes | ||
) |
Loads the boundary conditions into the global stiffness matrix and force vector.
Boundary conditions are enforced via Lagrange multipliers. The reaction force due to imposing the boundary condition will be appended directly onto the returned nodal displacements in the order the boundary conditions were specified.
Kg | fea::GlobalStiffnessMatrix . Coefficients are modified in place to reflect Lagrange multipliers. Assumes Kg has the correct dimensions. | |
force_vec | fea::ForceVector . Right hand side of the \([K][Q]=[F]\) equation of the FE analysis. | |
[in] | BCs | std::vector<fea::BC> . Vector of BC 's to apply to the current analysis. |
[in] | num_nodes | unsigned int . The number of nodes in the current job being analyzed. Used to calculate the position to insert border coefficients associated with enforcing boundary conditions via Langrange multipliers. |
void fea::loadBCs | ( | SparseMat & | Kg, |
SparseMat & | force_vec, | ||
const std::vector< BC > & | BCs, | ||
unsigned int | num_nodes | ||
) |
void fea::loadEquations | ( | SparseMat & | Kg, |
const std::vector< Equation > & | equations, | ||
unsigned int | num_nodes, | ||
unsigned int | num_bcs | ||
) |
Loads the prescribed forces into the force vector.
force_vec | ForceVector . Right hand side of the \([K][Q]=[F]\) equation of the FE analysis. | |
[in] | forces | std::vector<Force>. Vector of prescribed forces to apply to the current analysis. |
void fea::loadTies | ( | std::vector< Eigen::Triplet< double > > & | triplets, |
const std::vector< Tie > & | ties | ||
) |
Loads any tie constraints into the set of triplets that will become the global stiffness matrix.
Tie constraints are enforced via linear springs between the 2 specified nodes. The lmult
member variable is used as the spring constant for displacement degrees of freedom, e.g. 0, 1, and 2. rmult
is used for rotational degrees of freedom, e.g. 3, 4, and 5.
triplets | std::vector< Eigen::Triplet< double > > . A vector of triplets that store data in the form (i, j, value) that will be become the sparse global stiffness matrix. | |
[in] | ties | std::vector<fea::Tie> . Vector of Tie 's to apply to the current analysis. |
Calculates the distance between 2 nodes.
Calculates the original Euclidean distance between 2 nodes in the x-y plane.
[in] | n1 | fea::Node . Nodal coordinates of first point. |
[in] | n2 | fea::Node . Nodal coordinates of second point. |
double
. The distance between the nodes. std::istream& fea::operator>> | ( | std::istream & | ins, |
std::vector< T > & | record | ||
) |
Takes a line from the input stream and appends it to the record.
ins | std::istream . The file where data is read from. |
record | std::vector<T> . Vector where the data is placed. |
|
inline |
Parses the file into a 2D vector. Each sub-vector is a line from the input file.
ins | std::istream . The file where data is read from. Each line will become a vector in data |
data | std::vector< std::vector< T > > . 2D Vector where the data is placed. |
rapidjson::Document fea::parseJSONConfig | ( | const std::string & | config_filename | ) |
Opens the specified json file and parses the data into a rapidjson::Document and returns the result. The config document should have key's "nodes", "elems", and "props". Optionally, there can be keys "bcs" for boundary conditions, "forces" for prescribed forces, and "ties" for and tie constraints between nodes.
config_filename | std::string . The location of the configuration json file. |
rapidjson::Document
Summary fea::solve | ( | const Job & | job, |
const std::vector< BC > & | BCs, | ||
const std::vector< Force > & | forces, | ||
const std::vector< Tie > & | ties, | ||
const std::vector< Equation > & | equations, | ||
const Options & | options | ||
) |
Solves the finite element analysis defined by the input Job, boundary conditions, and prescribed nodal forces.
Solves \([K][Q]=[F]\) for \([Q]\), where \([K]\) is the global stiffness matrix, \([Q]\) contains the nodal displacements, and \([Q]\) contains the nodal forces.
[in] | job | fea::Job . Contains the node, element, and property lists for the mesh. |
[in] | BCs | std::vector<fea::BC> . Vector of boundary conditions to apply to the nodal degrees of freedom contained in the job. |
[in] | forces | std::vector<fea::Force> . Vector of prescribed forces to apply to the nodal degrees of freedom contained in the job. |
[in] | ties | std::vector<fea::Tie> . Vector of ties that apply to attach springs of specified stiffness to all nodal degrees of freedom between each set of nodes indicated. |
fea::Summary
. Summary containing the results of the analysis.