-
Notifications
You must be signed in to change notification settings - Fork 3
/
QuasiStaticModel.h
217 lines (173 loc) · 4.85 KB
/
QuasiStaticModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2019 Prashant K. Jha
// Copyright (c) 2019 Patrick Diehl
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////
#ifndef MODEL_QSMODEL_H
#define MODEL_QSMODEL_H
#include <hpx/config.hpp>
#include "model/model.h"
#include "inp/decks/modelDeck.h"
// forward declaration of class
namespace fe {
class MassMatrix;
class Mesh;
// class Quadrature;
}// namespace fe
namespace geometry {
class Fracture;
class InteriorFlags;
class Neighbor;
class VolumeCorrection;
} // namespace geometry
namespace inp {
struct ModelDeck;
struct RestartDeck;
struct OutputDeck;
struct SolverDeck;
class Input;
class Policy;
} // namespace inp
namespace loading {
class InitialCondition;
class ULoading;
class FLoading;
struct BCData;
} // namespace loading
namespace material {
namespace pd {
class BaseMaterial;
}
} // namespace material
namespace util {
class StateBasedHelperFunctions;
} // namespace util
namespace data {
class DataManager;
} // namespace data
namespace rw {
namespace writer {
class Writer;
}
}
namespace model {
/**
* \defgroup Explicit Explicit
*/
/**@{*/
/*! @brief A class for *finite difference approximation* of **Peridynamics**
*
* We consider *explicit* schemes such as *central difference* and
* *velocity verlet* for time integration.
*
* This class acts as a holder of lower rank classes, such as Mesh, Loading,
* InitialCondition, Fracture, etc, and uses the methods and data of the
* lower rank classes to perform calculation.
*
* @note 1. We can run finite difference on any finite element mesh as long as
* the mesh consists of only one type of elements. We can mesh the domain
* using **Gmsh** and use its **.msh** file to run the finite difference
* approximation.
*
* @note 2. Currently only dimension 2 is supported.
*
* @note 3. Either triangle or quadrangle elements are supported.
*/
template<class T>
class QuasiStaticModel: public Model {
public:
/*! @brief Constructor
* @param deck Pointer to the input deck
*/
QuasiStaticModel(inp::Input *deck);
/*! @brief Destructor */
~QuasiStaticModel();
private:
/*!
* @brief Initialize all data members
*/
void initHObjects();
/*!
* @brief Computes the forces of all nodes
* @param full If true the Strain and Stress tensors are computed
*/
void computeForces(bool full=false);
/*!
* @brief Computes the forces of all nodes using the perturbed displacement
* @param thread The thread which is doing the actual computation
*/
void computePertubatedForces(size_t thread);
/*! @brief Assembles the Jacobian matrix
*/
void assembly_jacobian_matrix();
/*! @brief Assembles the Jacobian matrix
* @param begin First node of the chunk
* @param end Last node of the chunk
* @param thread Id of the thread handling this chunk
*/
void assembly_jacobian_matrix_part(size_t begin, size_t end, size_t thread);
/*! @brief Computes the new displacement of Newton step
* @param res Residual vector
* @return The updated displacement
*/
util::VectorXi newton_step(util::VectorXi &res);
/*!
* @brief Starts the simulation and controls the solver
*/
void solver();
/*!
* @brief Computes the residual for the Newton step
* @return The residual vector
*/
util::VectorXi computeResidual();
/**
* @name Functions to manipulate the tangent stiffness matrix
*
*/
/**@{*/
/*!
* @brief Removes the i-th row of a matrix
* @param matrix The matrix
* @param rowToRemove Id of the row to remove
*/
void removeRow(util::Matrixij &matrix, size_t rowToRemove);
/*!
* @brief Removes the i-th column of a matrix
* @param matrix The matrix
* @param colToRemove Id of the column to remove
*/
void removeCol(util::Matrixij &matrix, size_t colToRemove);
/*!
* @brief Removes the i-th row of a vector
* @param vector The vector
* @param rowToRemove Id of the row to remove
*/
void removeRow(util::VectorXi &vector, size_t rowToRemove);
/** @}*/
/*! @brief Number of nodes */
size_t d_nnodes;
/*! @brief Current simulation time */
double d_time;
/*! @brief Name of the model */
std::string d_name;
/*! @brief Number of available os threads */
size_t d_osThreads;
/*! Jacobian matrix */
util::Matrixij jacobian;
/*! @brief Data manager objects for the assembly of the stiffness matrix */
std::vector<data::DataManager*> d_dataManagers;
/*! @brief Model deck */
inp::ModelDeck *d_modelDeck_p;
/*! @brief Output deck */
inp::OutputDeck *d_outputDeck_p;
/*! @brief Pointer to Input object */
inp::Input *d_input_p;
/*! @brief Pointer to Material object */
material::pd::BaseMaterial *d_material_p;
/*! @brief Data Manager */
data::DataManager *d_dataManager_p;
};
}
#endif