3D Beam Finite Element Code  1.0
Classes | Typedefs | Enumerations | Functions
fea Namespace Reference

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< NodecreateNodeVecFromJSON (const rapidjson::Document &config_doc)
 
std::vector< ElemcreateElemVecFromJSON (const rapidjson::Document &config_doc)
 
std::vector< BCcreateBCVecFromJSON (const rapidjson::Document &config_doc)
 
std::vector< ForcecreateForceVecFromJSON (const rapidjson::Document &config_doc)
 
std::vector< TiecreateTieVecFromJSON (const rapidjson::Document &config_doc)
 
std::vector< EquationcreateEquationVecFromJSON (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 Documentation

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)\):

// specify values on constuction
fea::Node n1(1.0, 2.0, 3.0);
// construct a Node then insert values
n2 << 0.0, 1.0, 2.0;
typedef Eigen::SparseMatrix<double> fea::SparseMat

Sparse matrix that is used internally to hold the global stiffness matrix

Enumeration Type Documentation

enum fea::DOF

Convenience enumerator for specifying the active degree of freedom in a constraint.

Enumerator
DISPLACEMENT_X 

Displacement along the global x-axis.

DISPLACEMENT_Y 

Displacement along the global y-axis.

DISPLACEMENT_Z 

Displacement along the global z-axis.

ROTATION_X 

Rotation about the global x-axis.

ROTATION_Y 

Rotation about the global y-axis.

ROTATION_Z 

Rotation about the global z-axis.

NUM_DOFS 

Number of degrees of freedom per node.

Function Documentation

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.

Parameters
[in]tiesstd::vector<Tie>. Vector of fea::Tie's to applied to the current analysis.
[in]nodal_displacementsstd::vector < std::vector < double > >. The resultant nodal displacements of the analysis.
Returns
Tie forces. std::vector < std::vector < double > >

Here is the caller graph for this function:

std::vector< BC > fea::createBCVecFromJSON ( const rapidjson::Document &  config_doc)

Parses the file indicated by the "bcs" key in config_doc into a vector of fea::BC's.

Parameters
config_docrapidjson::Document. Document storing the file name containing the boundary conditions.
Returns
Boundary conditions. std::vector<BC>.

Here is the caller graph for this function:

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.

Parameters
config_docrapidjson::Document. Document storing the file names of the csv files that contain the node number designations for each element and elemental properties.
Returns
Elements. std::vector<Elem>.

Here is the caller graph for this function:

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.

Parameters
config_docrapidjson::Document. Document storing the file name containing the prescribed forces.
Returns
Equation constraints. std::vector<Equation>.

Here is the caller graph for this function:

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.

Parameters
config_docrapidjson::Document. Document storing the file name containing the prescribed forces.
Returns
Boundary conditions. std::vector<BC>.

Here is the caller graph for this function:

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.

Parameters
config_docrapidjson::Document. Document storing the file name containing the nodes, elements, and properties.
Returns
Job. fea::Job.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
config_docrapidjson::Document. Document storing the file name containing the nodal coordinates.
Returns
Nodal coordinates. std::vector<Node>.

Here is the caller graph for this function:

Options fea::createOptionsFromJSON ( const rapidjson::Document &  config_doc)

Creates an fea::Options object from the configuration document. Any options provided will override the defaults.

Parameters
config_docrapidjson::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.
Returns
Analysis options fea::Options.

Here is the caller graph for this function:

std::vector< Tie > fea::createTieVecFromJSON ( const rapidjson::Document &  config_doc)

Parses the file indicated by the "ties" key in config_doc into a vector of fea::Tie's.

Parameters
config_docrapidjson::Document. Document storing the file name containing the prescribed forces.
Returns
Prescribed forces. std::vector<Force>.

Here is the caller graph for this function:

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.

Parameters
Kgfea::GlobalStiffnessMatrix. Coefficients are modified in place to reflect Lagrange multipliers. Assumes Kg has the correct dimensions.
force_vecfea::ForceVector. Right hand side of the \([K][Q]=[F]\) equation of the FE analysis.
[in]BCsstd::vector<fea::BC>. Vector of BC's to apply to the current analysis.
[in]num_nodesunsigned 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.

Here is the caller graph for this function:

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 
)

Here is the caller graph for this function:

void fea::loadForces ( SparseMat force_vec,
const std::vector< Force > &  forces 
)

Loads the prescribed forces into the force vector.

Parameters
force_vecForceVector. Right hand side of the \([K][Q]=[F]\) equation of the FE analysis.
[in]forcesstd::vector<Force>. Vector of prescribed forces to apply to the current analysis.

Here is the caller graph for this function:

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.

Parameters
tripletsstd::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]tiesstd::vector<fea::Tie>. Vector of Tie's to apply to the current analysis.

Here is the caller graph for this function:

double fea::norm ( const Node n1,
const Node n2 
)
inline

Calculates the distance between 2 nodes.

Calculates the original Euclidean distance between 2 nodes in the x-y plane.

Parameters
[in]n1fea::Node. Nodal coordinates of first point.
[in]n2fea::Node. Nodal coordinates of second point.
Returns
Distance double. The distance between the nodes.

Here is the caller graph for this function:

template<typename T >
std::istream& fea::operator>> ( std::istream &  ins,
std::vector< T > &  record 
)

Takes a line from the input stream and appends it to the record.

Parameters
insstd::istream. The file where data is read from.
recordstd::vector<T>. Vector where the data is placed.
template<typename T >
std::istream& fea::operator>> ( std::istream &  ins,
std::vector< std::vector< T > > &  data 
)
inline

Parses the file into a 2D vector. Each sub-vector is a line from the input file.

Parameters
insstd::istream. The file where data is read from. Each line will become a vector in data
datastd::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.

Parameters
config_filenamestd::string. The location of the configuration json file.
Returns
Documentrapidjson::Document

Here is the caller graph for this function:

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.

Parameters
[in]jobfea::Job. Contains the node, element, and property lists for the mesh.
[in]BCsstd::vector<fea::BC>. Vector of boundary conditions to apply to the nodal degrees of freedom contained in the job.
[in]forcesstd::vector<fea::Force>. Vector of prescribed forces to apply to the nodal degrees of freedom contained in the job.
[in]tiesstd::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.
Returns
Summary fea::Summary. Summary containing the results of the analysis.

Here is the call graph for this function:

Here is the caller graph for this function: