suanPan
LeeNewmarkFull.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2017-2024 Theodore Chang
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  ******************************************************************************/
32 #ifndef LEENEWMARKFULL_H
33 #define LEENEWMARKFULL_H
34 
35 #include "LeeNewmarkBase.h"
36 
37 class LeeNewmarkFull final : public LeeNewmarkBase {
38 public:
39  enum class Type {
40  T0,
41  T1,
42  T2,
43  T3,
44  T4
45  };
46 
47  struct Mode {
49  vec p;
50  double zeta, omega;
51  };
52 
53 private:
54  std::vector<Mode> damping_mode;
55 
56  // a temporary matrix holding first block nonzero entries from damping matrix
57  const triplet_form<double, uword> rabbit;
58  const triplet_form<double, uword> current_stiffness;
59  const triplet_form<double, uword> current_mass;
60 
61  const bool build_graph = false;
62  mutable sp_mat stiffness_graph, mass_graph;
63 
64  using index_tm = decltype(current_mass)::index_type;
65  using index_ts = decltype(current_stiffness)::index_type;
66 
67  [[nodiscard]] uword get_amplifier() const;
68  [[nodiscard]] uword get_total_size() const override;
69 
70  void update_stiffness() const override;
71  void update_residual() const override;
72 
73  void assemble_mass(uword, uword, double) const;
74  void assemble_stiffness(uword, uword, double) const;
75  void assemble_mass(const std::vector<uword>&, const std::vector<uword>&, const std::vector<double>&) const;
76  void assemble_stiffness(const std::vector<uword>&, const std::vector<uword>&, const std::vector<double>&) const;
77 
78  template<sp_d in_dt, sp_i in_it> void assemble(sp_mat&, const triplet_form<in_dt, in_it>&, uword, uword, double) const;
79 
80  void formulate_block(uword&, double, double, int) const;
81  void formulate_block(uword&, const std::vector<double>&, const std::vector<double>&, const std::vector<int>&) const;
82  void assemble_by_mode_zero(uword&, double, double) const;
83  void assemble_by_mode_one(uword&, double, double, int) const;
84  void assemble_by_mode_two(uword&, double, double, int, int) const;
85  void assemble_by_mode_three(uword&, double, double, double) const;
86  void assemble_by_mode_four(uword&, double, double, int, int, int, int, double) const;
87 
88 public:
89  LeeNewmarkFull(unsigned, std::vector<Mode>&&, double, double, StiffnessType);
90 
91  int initialize() override;
92 
93  int process_constraint() override;
94  int process_constraint_resistance() override;
95 
96  void print() override;
97 };
98 
99 template<sp_d in_dt, sp_i in_it> void LeeNewmarkFull::assemble(sp_mat& graph, const triplet_form<in_dt, in_it>& in_mat, const uword row_shift, const uword col_shift, const double scalar) const {
100  stiffness->triplet_mat.assemble(in_mat, row_shift, col_shift, scalar);
101 
102  if(build_graph) graph(row_shift / n_block, col_shift / n_block) += scalar;
103 }
104 
105 #endif
106 
A LeeNewmarkBase class defines a solver using Newmark algorithm with Lee damping model.
Definition: LeeNewmarkBase.h:36
const uword n_block
Definition: LeeNewmarkBase.h:45
unique_ptr< MetaMat< double > > stiffness
Definition: LeeNewmarkBase.h:57
StiffnessType
Definition: LeeNewmarkBase.h:38
A LeeNewmarkFull class defines a solver using Newmark algorithm with Lee damping model.
Definition: LeeNewmarkFull.h:37
void print() override
Definition: LeeNewmarkFull.cpp:527
int initialize() override
Definition: LeeNewmarkFull.cpp:349
int process_constraint() override
Definition: LeeNewmarkFull.cpp:363
int process_constraint_resistance() override
Definition: LeeNewmarkFull.cpp:514
LeeNewmarkFull(unsigned, std::vector< Mode > &&, double, double, StiffnessType)
Definition: LeeNewmarkFull.cpp:322
Type
Definition: LeeNewmarkFull.h:39
vector< set< T > > graph
Definition: container.h:59
Definition: LeeNewmarkFull.h:47
vec p
Definition: LeeNewmarkFull.h:49
double zeta
Definition: LeeNewmarkFull.h:50
double omega
Definition: LeeNewmarkFull.h:50
Type t
Definition: LeeNewmarkFull.h:48