Seismo-VLAB  1.3
An Open-Source Finite Element Software for Meso-Scale Simulations
CentralDifference.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] Finite Element Procedures, Bathe, K.J., Chapter 9: pages 770-774.
25 // Prentice-Hall, 1996.
26 //
27 // Description:
32 //------------------------------------------------------------------------------
33 
34 #ifndef _CENTRALDIFFERENCE_HPP_
35 #define _CENTRALDIFFERENCE_HPP_
36 
37 #include <Eigen/Dense>
38 #include <Eigen/SparseCore>
39 
40 #include "Mesh.hpp"
41 #include "LoadCombo.hpp"
42 #include "Assembler.hpp"
43 #include "Algorithm.hpp"
44 #include "Integrator.hpp"
45 
54 
55  public:
63  CentralDifference(std::shared_ptr<Mesh> &mesh, double TimeStep, double mtol=1E-12, double ktol=1E-12, double ftol=1E-12);
64 
67 
71  void Initialize(std::shared_ptr<Mesh> &mesh);
72 
75  void SetLoadCombination(std::shared_ptr<LoadCombo> &combo);
76 
79  void SetAlgorithm(std::shared_ptr<Algorithm> &algorithm);
80 
84  const Eigen::VectorXd& GetDisplacements();
85 
89  const Eigen::VectorXd& GetVelocities();
90 
94  const Eigen::VectorXd& GetAccelerations();
95 
99  const Eigen::VectorXd& GetPMLHistoryVector();
100 
105  bool ComputeNewStep(std::shared_ptr<Mesh> &mesh, unsigned int k=0);
106 
113  Eigen::VectorXd ComputeReactionForce(std::shared_ptr<Mesh> &mesh, unsigned int k=0);
114 
119  Eigen::VectorXd ComputeProgressiveForce(std::shared_ptr<Mesh> &mesh, unsigned int k=0);
120 
128  void ComputeSupportMotionVector(std::shared_ptr<Mesh> &mesh, Eigen::VectorXd &Feff, double factor=1.00, unsigned int k=0);
129 
137  void ComputeEffectiveForce(std::shared_ptr<Mesh> &mesh, Eigen::VectorXd &Feff, double factor=1.00, unsigned int k=0);
138 
144  void ComputeEffectiveStiffness(std::shared_ptr<Mesh> &mesh, Eigen::SparseMatrix<double> &Keff);
145 
146  protected:
148  double dt;
149 
151  Eigen::VectorXd U;
152 
154  Eigen::VectorXd V;
155 
157  Eigen::VectorXd A;
158 
160  Eigen::VectorXd Up;
161 
163  Eigen::VectorXd Ubar;
164 
166  Eigen::VectorXd Fbar;
167 
169  Eigen::SparseMatrix<double> M;
170 
172  Eigen::SparseMatrix<double> C;
173 
175  Eigen::SparseMatrix<double> K;
176 
178  std::weak_ptr<Algorithm> theAlgorithm;
179 
181  std::unique_ptr<Assembler> theAssembler;
182 };
183 
184 #endif
std::unique_ptr< Assembler > theAssembler
The finite element assembler.
Definition: CentralDifference.hpp:181
Eigen::VectorXd Ubar
Total previous pml history values.
Definition: CentralDifference.hpp:163
std::weak_ptr< Algorithm > theAlgorithm
The static solver algorithm.
Definition: CentralDifference.hpp:178
Eigen::VectorXd ComputeReactionForce(std::shared_ptr< Mesh > &mesh, unsigned int k=0)
Gets the reaction force ins this step.
CentralDifference(std::shared_ptr< Mesh > &mesh, double TimeStep, double mtol=1E-12, double ktol=1E-12, double ftol=1E-12)
Creates a CentralDifference object.
const Eigen::VectorXd & GetVelocities()
Gets the velocity vector.
Eigen::VectorXd U
Total current displacements.
Definition: CentralDifference.hpp:151
void ComputeEffectiveStiffness(std::shared_ptr< Mesh > &mesh, Eigen::SparseMatrix< double > &Keff)
Gets the effective stiffness associated to the CentralDifference integrator.
This file contains the "Load Combination" class declarations, which defines how the loads are going t...
~CentralDifference()
Destroys this CentralDifference object.
Class for integrating the equation of motion using an explicit central difference method...
Definition: CentralDifference.hpp:53
void SetAlgorithm(std::shared_ptr< Algorithm > &algorithm)
Sets the integrator for this algorithm.
This file contains the "Assembler object" declarations, this object computes the system mass...
Class for defining how the static/dynamic analysis between two steps is going to be performed...
Definition: Integrator.hpp:53
Eigen::VectorXd Up
Total previous displacements (t - dt).
Definition: CentralDifference.hpp:160
Eigen::SparseMatrix< double > C
Model damping matrix.
Definition: CentralDifference.hpp:172
void Initialize(std::shared_ptr< Mesh > &mesh)
Initialize model matrices.
This file contains the "Integrator object" declarations, and defines how the dynamic solution between...
void ComputeEffectiveForce(std::shared_ptr< Mesh > &mesh, Eigen::VectorXd &Feff, double factor=1.00, unsigned int k=0)
Gets the effective force associated to the CentralDifference integrator.
This file contains the "Mesh object" declarations, which stores nodes, materials, elements...
bool ComputeNewStep(std::shared_ptr< Mesh > &mesh, unsigned int k=0)
Computes a new time step.
double dt
Integration time step.
Definition: CentralDifference.hpp:148
void ComputeSupportMotionVector(std::shared_ptr< Mesh > &mesh, Eigen::VectorXd &Feff, double factor=1.00, unsigned int k=0)
Gets the incremental nodal support motion vector.
Eigen::VectorXd Fbar
The previous stage Force vector.
Definition: CentralDifference.hpp:166
void SetLoadCombination(std::shared_ptr< LoadCombo > &combo)
Set the load combination.
Eigen::SparseMatrix< double > K
Model stiffness matrix.
Definition: CentralDifference.hpp:175
const Eigen::VectorXd & GetDisplacements()
Gets the displacement vector.
Eigen::VectorXd A
Total current acceleration.
Definition: CentralDifference.hpp:157
const Eigen::VectorXd & GetPMLHistoryVector()
Gets the PML history vector.
Eigen::SparseMatrix< double > M
Model mass matrix.
Definition: CentralDifference.hpp:169
const Eigen::VectorXd & GetAccelerations()
Gets the acceleration vector.
Eigen::VectorXd ComputeProgressiveForce(std::shared_ptr< Mesh > &mesh, unsigned int k=0)
Gets the external force vector from previous analysis.
Eigen::VectorXd V
Total current velocity.
Definition: CentralDifference.hpp:154