Seismo-VLAB  1.3
An Open-Source Finite Element Software for Meso-Scale Simulations
Element.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // Seismo Virtual Laboratory
4 // Module for Serial and Parallel Analysis of seismic
5 // wave propagation and soil-structure interaction simulation
6 // Copyright (C) 2018-2021, The California Institute of Technology
7 // All Rights Reserved.
8 //
9 // Commercial use of this program without express permission of the California
10 // Institute of Technology, is strictly prohibited. See file "COPYRIGHT" in
11 // main directory for information on usage and redistribution, and for a
12 // DISCLAIMER OF ALL WARRANTIES.
13 //
14 //==============================================================================
15 //
16 // Written by:
17 // Danilo S. Kusanovic (dkusanov@caltech.edu)
18 // Elnaz E. Seylabi (elnaze@unr.edu)
19 //
20 // Supervised by:
21 // Domniki M. Asimaki (domniki@caltech.edu)
22 //
23 // References :
24 // [1]
25 //
26 // Description:
29 //------------------------------------------------------------------------------
30 
31 #ifndef _ELEMENT_HPP_
32 #define _ELEMENT_HPP_
33 
34 #include <map>
35 #include <vector>
36 #include <memory>
37 #include <string>
38 #include <Eigen/Dense>
39 
40 #include "Node.hpp"
41 #include "Load.hpp"
42 #include "Damping.hpp"
43 
51 class Element{
52 
53  public:
62  Element(std::string name, const std::vector<unsigned int> nodes, unsigned int ndofs, unsigned int VTKcell, unsigned int SVLcell);
63 
65  virtual ~Element() = 0;
66 
69  virtual void CommitState() = 0;
70 
73  virtual void UpdateState() = 0;
74 
77  virtual void ReverseState() = 0;
78 
81  virtual void InitialState() = 0;
82 
87  virtual void SetDomain(std::map<unsigned int, std::shared_ptr<Node> > &nodes) = 0;
88 
92  virtual void SetDamping(const std::shared_ptr<Damping> &damping) = 0;
93 
96  virtual std::vector<unsigned int> GetTotalDegreeOfFreedom() const = 0;
97 
101  virtual Eigen::MatrixXd GetStrain() const = 0;
102 
106  virtual Eigen::MatrixXd GetStress() const = 0;
107 
111  virtual Eigen::MatrixXd GetStrainRate() const = 0;
112 
118  virtual Eigen::MatrixXd GetStrainAt(double x3=0.0, double x2=0.0) const = 0;
119 
125  virtual Eigen::MatrixXd GetStressAt(double x3=0.0, double x2=0.0) const = 0;
126 
131  virtual Eigen::VectorXd GetVTKResponse(std::string response) const = 0;
132 
135  virtual double ComputeEnergy() = 0;
136 
141  virtual Eigen::MatrixXd ComputeMassMatrix() = 0;
142 
147  virtual Eigen::MatrixXd ComputeStiffnessMatrix() = 0;
148 
153  virtual Eigen::MatrixXd ComputeDampingMatrix() = 0;
154 
159  virtual Eigen::MatrixXd ComputePMLMatrix() = 0;
160 
165  virtual Eigen::VectorXd ComputeInternalForces() = 0;
166 
171  virtual Eigen::VectorXd ComputeInternalDynamicForces() = 0;
172 
179  virtual Eigen::VectorXd ComputeSurfaceForces(const std::shared_ptr<Load> &surface, unsigned int k) = 0;
180 
187  virtual Eigen::VectorXd ComputeBodyForces(const std::shared_ptr<Load> &body, unsigned int k=0) = 0;
188 
195  virtual Eigen::VectorXd ComputeDomainReductionForces(const std::shared_ptr<Load> &drm, unsigned int k) = 0;
196 
200  std::string GetName() const;
201 
205  unsigned int GetVTKCellType() const;
206 
210  unsigned int GetVTKGroupType() const;
211 
215  unsigned int GetNumberOfNodes() const;
216 
220  unsigned int GetNumberOfDegreeOfFreedom() const;
221 
225  const std::vector<unsigned int>& GetNodes() const;
226 
229  bool HasFixedNode(const std::vector<std::shared_ptr<Node> > &nodes) const;
230 
231  private:
233  std::string Name;
234 
236  unsigned int VTKCell;
237 
239  unsigned int SVLCell;
240 
242  unsigned int NumberOfNodes;
243 
246 
248  std::vector<unsigned int> Nodes;
249 };
250 
251 #endif
virtual Eigen::MatrixXd GetStrainAt(double x3=0.0, double x2=0.0) const =0
Gets the material strain in section at coordinate (x3,x2).
virtual Eigen::VectorXd ComputeInternalDynamicForces()=0
Compute the elastic, inertial, and viscous forces acting on the element.
virtual Eigen::MatrixXd ComputeStiffnessMatrix()=0
Compute the stiffness matrix of the element using gauss-integration or close form solutions...
unsigned int GetNumberOfNodes() const
Returns the number of nodes in element.
This file contains the "Load" class declarations, which defines a load that can act in a node or an e...
virtual void ReverseState()=0
Reverse the material/section states to previous converged state in this element.
virtual Eigen::VectorXd ComputeInternalForces()=0
Compute the internal forces acting on the element.
std::vector< unsigned int > Nodes
The node connectivity indexes.
Definition: Element.hpp:248
std::string GetName() const
Gets the Element Name.
Element(std::string name, const std::vector< unsigned int > nodes, unsigned int ndofs, unsigned int VTKcell, unsigned int SVLcell)
Creates an Element in a finite element Mesh.
virtual double ComputeEnergy()=0
Computes the element energy for a given deformation.
unsigned int GetVTKGroupType() const
Gets the Element VTK group type.
virtual void SetDomain(std::map< unsigned int, std::shared_ptr< Node > > &nodes)=0
Sets the finite element dependance among objects.
unsigned int SVLCell
The SeismoVLAB element type.
Definition: Element.hpp:239
bool HasFixedNode(const std::vector< std::shared_ptr< Node > > &nodes) const
Returns if the element has fixed nodes.
virtual void SetDamping(const std::shared_ptr< Damping > &damping)=0
Sets the damping model.
virtual Eigen::VectorXd ComputeSurfaceForces(const std::shared_ptr< Load > &surface, unsigned int k)=0
Compute the surface forces acting on the element.
virtual void InitialState()=0
Brings the material/section state to its initial state in this element.
virtual std::vector< unsigned int > GetTotalDegreeOfFreedom() const =0
Gets the list of total-degree of freedom of this Element.
virtual void UpdateState()=0
Update the material/section states in the element.
virtual Eigen::MatrixXd GetStress() const =0
Gets the material/section (generalised) stress.
unsigned int NumberOfDegreeOfFreedom
The number of nodes in element.
Definition: Element.hpp:245
const std::vector< unsigned int > & GetNodes() const
Returns the Node Connectivity Indexes.
Virtual class for creating an element in a mesh.
Definition: Element.hpp:51
virtual Eigen::VectorXd ComputeBodyForces(const std::shared_ptr< Load > &body, unsigned int k=0)=0
Compute the body forces acting on the element.
unsigned int GetVTKCellType() const
Gets the Element VTK cell type.
virtual Eigen::VectorXd GetVTKResponse(std::string response) const =0
Gets the element internal response in VTK format for Paraview display.
virtual ~Element()=0
Destroys this Element object.
virtual Eigen::MatrixXd GetStressAt(double x3=0.0, double x2=0.0) const =0
Gets the material stress in section at coordinate (x3,x2).
This file contains the "Node object" declarations, which is stores the coordinates, state variables, degrees-of-freedom, and total-degree of freedom lists of a node in a finite element mesh.
virtual Eigen::MatrixXd ComputeDampingMatrix()=0
Compute the damping matrix of the element using gauss-integration or close form solutions.
This file contains the "Damping object" declarations to update damping matrix to account for Caughey-...
unsigned int NumberOfNodes
The number of nodes in element.
Definition: Element.hpp:242
virtual void CommitState()=0
Save the material/section states in the element.
virtual Eigen::MatrixXd GetStrain() const =0
Gets the material/section (generalised) strain.
virtual Eigen::MatrixXd GetStrainRate() const =0
Gets the material/section (generalised) strain-rate.
unsigned int VTKCell
The VTK element number.
Definition: Element.hpp:236
virtual Eigen::MatrixXd ComputeMassMatrix()=0
Compute the lumped/consistent mass matrix of the element or close form solutions. ...
unsigned int GetNumberOfDegreeOfFreedom() const
Returns total number of degree of freedom in the element.
std::string Name
The element name.
Definition: Element.hpp:233
virtual Eigen::MatrixXd ComputePMLMatrix()=0
Compute the PML history matrix for Perfectly-Matched Layer (PML).
virtual Eigen::VectorXd ComputeDomainReductionForces(const std::shared_ptr< Load > &drm, unsigned int k)=0
Compute the domain reduction forces acting on the element.