suanPan
LeeNewmarkIterative.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  ******************************************************************************/
35 #ifndef LEENEWMARKITERATIVE_H
36 #define LEENEWMARKITERATIVE_H
37 
38 #include "Newmark.h"
40 #include <Domain/Factory.hpp>
41 
42 class LeeNewmarkIterative final : public Newmark {
43 public:
44  enum class Type {
45  T0,
46  T1,
47  T2,
48  T3,
49  T4
50  };
51 
52  struct Mode {
54  vec p;
55  double zeta, omega;
56  };
57 
58 private:
59  const unsigned n_block{0};
60 
61  std::vector<Mode> damping_mode;
62 
63  shared_ptr<Factory<double>> factory = nullptr;
64 
65  shared_ptr<MetaMat<double>> current_mass = nullptr;
66  shared_ptr<MetaMat<double>> current_stiffness = nullptr;
67 
68  unique_ptr<MetaMat<double>> worker = nullptr;
69 
70  void init_worker(unsigned, unsigned);
71 
72  void assemble(const shared_ptr<MetaMat<double>>&, uword, uword, double) const;
73 
74  void assemble_mass(uword, uword, double) const;
75  void assemble_stiffness(uword, uword, double) const;
76  void assemble_mass(const std::vector<sword>&, const std::vector<sword>&, const std::vector<double>&) const;
77  void assemble_stiffness(const std::vector<sword>&, const std::vector<sword>&, const std::vector<double>&) const;
78 
79  void formulate_block(sword&, double, double, int) const;
80  void formulate_block(sword&, const std::vector<double>&, const std::vector<double>&, const std::vector<int>&) const;
81 
82  [[nodiscard]] vec update_by_mode_zero(double, double) const;
83  [[nodiscard]] vec update_by_mode_one(double, double, int);
84  [[nodiscard]] vec update_by_mode_two(double, double, int, int);
85  [[nodiscard]] vec update_by_mode_three(double, double, double);
86  [[nodiscard]] vec update_by_mode_four(double, double, int, int, int, int, double);
87 
88  void update_damping_force();
89 
90 public:
91  LeeNewmarkIterative(unsigned, std::vector<Mode>&&, double, double);
92 
93  int initialize() override;
94 
95  [[nodiscard]] int process_constraint() override;
96  [[nodiscard]] int process_constraint_resistance() override;
97 
98  void assemble_matrix() override;
99 
100  void print() override;
101 };
102 
103 #endif
104 
A LeeNewmarkIterative class defines a solver using Newmark algorithm with Lee damping model.
Definition: LeeNewmarkIterative.h:42
int process_constraint() override
Definition: LeeNewmarkIterative.cpp:388
int initialize() override
Definition: LeeNewmarkIterative.cpp:378
void assemble_matrix() override
Definition: LeeNewmarkIterative.cpp:409
LeeNewmarkIterative(unsigned, std::vector< Mode > &&, double, double)
Definition: LeeNewmarkIterative.cpp:351
Type
Definition: LeeNewmarkIterative.h:44
int process_constraint_resistance() override
Definition: LeeNewmarkIterative.cpp:403
void print() override
Definition: LeeNewmarkIterative.cpp:435
A MetaMat class that holds matrices.
Definition: MetaMat.hpp:72
A Newmark class defines a solver using Newmark algorithm.
Definition: Newmark.h:45
Definition: LeeNewmarkIterative.h:52
double zeta
Definition: LeeNewmarkIterative.h:55
double omega
Definition: LeeNewmarkIterative.h:55
Type t
Definition: LeeNewmarkIterative.h:53
vec p
Definition: LeeNewmarkIterative.h:54