suanPan
🧮 An Open Source, Parallel and Heterogeneous Finite Element Analysis Framework
Loading...
Searching...
No Matches
LeeNewmarkFull.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2026 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
37class LeeNewmarkFull final : public LeeNewmarkBase {
39
40public:
41 enum class Type {
42 T0,
43 T1,
44 T2,
45 T3,
46 T4
47 };
48
49 struct Mode {
51 vec p;
52 double zeta, omega;
53 };
54
55private:
56 std::vector<Mode> damping_mode;
57
58 // a temporary matrix holding first block nonzero entries from damping matrix
59 const mat_t rabbit;
60 const mat_t current_stiffness;
61 const mat_t current_mass;
62
63 const bool build_graph = false;
64 mutable sp_mat stiffness_graph, mass_graph;
65
66 using index_tm = decltype(current_mass)::index_type;
67 using index_ts = decltype(current_stiffness)::index_type;
68
69 [[nodiscard]] uword get_amplifier() const;
70 [[nodiscard]] uword get_total_size() const override;
71
72 void update_stiffness() const override;
73 void update_residual() const override;
74
75 void assemble_mass(uword, uword, double) const;
76 void assemble_stiffness(uword, uword, double) const;
77 void assemble_mass(const std::vector<uword>&, const std::vector<uword>&, const std::vector<double>&) const;
78 void assemble_stiffness(const std::vector<uword>&, const std::vector<uword>&, const std::vector<double>&) const;
79
80 template<sp_d in_dt, sp_i in_it> void assemble(sp_mat&, const triplet_form<in_dt, in_it>&, uword, uword, double) const;
81
82 void formulate_block(uword&, double, double, int) const;
83 void formulate_block(uword&, const std::vector<double>&, const std::vector<double>&, const std::vector<int>&) const;
84 void assemble_by_mode_zero(uword&, double, double) const;
85 void assemble_by_mode_one(uword&, double, double, int) const;
86 void assemble_by_mode_two(uword&, double, double, int, int) const;
87 void assemble_by_mode_three(uword&, double, double, double) const;
88 void assemble_by_mode_four(uword&, double, double, int, int, int, int, double) const;
89
90public:
91 LeeNewmarkFull(unsigned, std::vector<Mode>&&, double, double, StiffnessType);
92
93 int initialize() override;
94
95 int process_constraint() override;
96 int process_constraint_resistance() override;
97
98 void assemble_effective_matrix() override;
99
100 void print() override;
101};
102
103template<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 {
104 stiffness->triplet_mat.assemble(in_mat, row_shift, col_shift, scalar);
105
106 if(build_graph) graph(row_shift / n_block, col_shift / n_block) += scalar;
107}
108
109#endif
110
A LeeNewmarkBase class defines a solver using Newmark algorithm with Lee damping model.
Definition LeeNewmarkBase.h:37
const uword n_block
Definition LeeNewmarkBase.h:46
unique_ptr< MetaMat< double > > stiffness
Definition LeeNewmarkBase.h:56
StiffnessType
Definition LeeNewmarkBase.h:39
A LeeNewmarkFull class defines a solver using Newmark algorithm with Lee damping model.
Definition LeeNewmarkFull.h:37
void print() override
Definition LeeNewmarkFull.cpp:529
int initialize() override
Definition LeeNewmarkFull.cpp:350
void assemble_effective_matrix() override
Definition LeeNewmarkFull.cpp:527
int process_constraint() override
Definition LeeNewmarkFull.cpp:359
int process_constraint_resistance() override
Definition LeeNewmarkFull.cpp:510
Type
Definition LeeNewmarkFull.h:41
Definition triplet_form.hpp:62
Definition LeeNewmarkFull.h:49
vec p
Definition LeeNewmarkFull.h:51
double zeta
Definition LeeNewmarkFull.h:52
double omega
Definition LeeNewmarkFull.h:52
Type t
Definition LeeNewmarkFull.h:50