suanPan
Material.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 ******************************************************************************/
28#ifndef MATERIAL_H
29#define MATERIAL_H
30
31#include <Domain/Tag.h>
32#include "ParameterType.h"
33
34enum class MaterialType : unsigned {
35 D0 = 0,
36 D1 = 1,
37 D2 = 3,
38 D3 = 6,
39 DS = 10,
40 OS = 3
41};
42
43enum class PlaneType : unsigned {
44 S = 1,
45 E = 2,
46 A = 3,
47 N = 0
48};
49
50class DomainBase;
51enum class OutputType;
52
56
59
62
63 mat initial_couple_stiffness{}; // stiffness matrix
64 mat current_couple_stiffness{}; // stiffness matrix
65 mat trial_couple_stiffness{}; // stiffness matrix
66};
67
69 const double density = 0.;
72
73 const double tolerance = 1E-14;
74 const double characteristic_length = -1.;
75
76 vec current_strain{}; // current status
77 vec current_strain_rate{}; // current status
78 vec current_strain_acc{}; // current status
79 vec current_stress{}; // current status
80 // vec current_stress_rate{}; // current status
81
82 vec trial_strain{}; // trial status
83 vec trial_strain_rate{}; // trial status
84 vec trial_strain_acc{}; // trial status
85 vec trial_stress{}; // trial status
86 // vec trial_stress_rate{}; // trial status
87
88 vec incre_strain{}; // incremental status
89 vec incre_strain_rate{}; // incremental status
90 vec incre_strain_acc{}; // incremental status
91 vec incre_stress{}; // incremental status
92 // vec incre_stress_rate{}; // incremental status
93
94 vec initial_history{}; // initial status
95 vec current_history{}; // current status
96 vec trial_history{}; // trial status
97
98 mat initial_stiffness{}; // stiffness matrix
99 mat current_stiffness{}; // stiffness matrix
100 mat trial_stiffness{}; // stiffness matrix
101
102 mat initial_damping{}; // damping matrix
103 mat current_damping{}; // damping matrix
104 mat trial_damping{}; // damping matrix
105
106 mat initial_inertial{}; // inertial matrix
107 mat current_inertial{}; // inertial matrix
108 mat trial_inertial{}; // inertial matrix
109};
110
111class Material : protected DataMaterial, protected DataCoupleMaterial, public Tag {
112 const bool initialized = false;
113 const bool symmetric = false;
114 const bool support_couple = false; // indicate if the material supports couple stress theory
115
116 friend void ConstantStiffness(DataMaterial*);
117 friend void ConstantDamping(DataMaterial*);
118 friend void ConstantInertial(DataMaterial*);
120 friend void PureWrapper(Material*);
121
122public:
123 explicit Material(
124 unsigned = 0, // tag
125 MaterialType = MaterialType::D0, // material type
126 double = 0. // density
127 );
128 Material(const Material&) = default;
129 Material(Material&&) = delete; // move forbidden
130 Material& operator=(const Material&) = delete; // assign forbidden
131 Material& operator=(Material&&) = delete; // assign forbidden
132
133 ~Material() override = default;
134
135 [[nodiscard]] double get_density() const;
136 [[nodiscard]] MaterialType get_material_type() const;
137 [[nodiscard]] PlaneType get_plane_type() const;
138
139 int initialize_base(const shared_ptr<DomainBase>&);
140
141 virtual int initialize(const shared_ptr<DomainBase>&) = 0;
142 virtual void initialize_couple(const shared_ptr<DomainBase>&);
143
144 virtual void initialize_history(unsigned);
145 virtual void set_initial_history(const vec&);
146
147 void set_initialized(bool) const;
148 void set_symmetric(bool) const;
149 void set_support_couple(bool) const;
150 [[nodiscard]] bool is_initialized() const;
151 [[nodiscard]] bool is_symmetric() const;
152 [[nodiscard]] bool is_support_couple() const;
153
154 void set_characteristic_length(double) const;
155 [[nodiscard]] double get_characteristic_length() const;
156
157 [[nodiscard]] virtual double get_parameter(ParameterType) const;
158
159 virtual const vec& get_trial_strain();
160 virtual const vec& get_trial_strain_rate();
161 virtual const vec& get_trial_strain_acc();
162 virtual const vec& get_trial_stress();
163 virtual const mat& get_trial_stiffness();
164 virtual const mat& get_trial_secant();
165 virtual const mat& get_trial_damping();
166 virtual const mat& get_trial_inertial();
167
168 virtual const vec& get_current_strain();
169 virtual const vec& get_current_strain_rate();
170 virtual const vec& get_current_strain_acc();
171 virtual const vec& get_current_stress();
172 virtual const mat& get_current_stiffness();
173 virtual const mat& get_current_secant();
174 virtual const mat& get_current_damping();
175 virtual const mat& get_current_inertial();
176
177 [[nodiscard]] virtual const vec& get_initial_history() const;
178 [[nodiscard]] virtual const mat& get_initial_stiffness() const;
179 [[nodiscard]] virtual const mat& get_initial_damping() const;
180 [[nodiscard]] virtual const mat& get_initial_inertial() const;
181
182 virtual const vec& get_trial_curvature();
183 virtual const vec& get_trial_couple_stress();
184 virtual const mat& get_trial_couple_stiffness();
185
186 virtual const vec& get_current_curvature();
187 virtual const vec& get_current_couple_stress();
188 virtual const mat& get_current_couple_stiffness();
189
190 [[nodiscard]] virtual const mat& get_initial_couple_stiffness() const;
191
192 virtual unique_ptr<Material> get_copy() = 0;
193
194 int update_incre_status(double);
195 int update_incre_status(double, double);
196 int update_incre_status(double, double, double);
197 int update_trial_status(double);
198 int update_trial_status(double, double);
199 int update_trial_status(double, double, double);
200
201 virtual int update_incre_status(const vec&);
202 virtual int update_incre_status(const vec&, const vec&);
203 virtual int update_incre_status(const vec&, const vec&, const vec&);
204 virtual int update_trial_status(const vec&);
205 virtual int update_trial_status(const vec&, const vec&);
206 virtual int update_trial_status(const vec&, const vec&, const vec&);
207
208 int update_couple_incre_status(double);
209 int update_couple_incre_status(double, double);
210 int update_couple_incre_status(double, double, double);
211 int update_couple_trial_status(double);
212 int update_couple_trial_status(double, double);
213 int update_couple_trial_status(double, double, double);
214
215 virtual int update_couple_incre_status(const vec&);
216 virtual int update_couple_incre_status(const vec&, const vec&);
217 virtual int update_couple_incre_status(const vec&, const vec&, const vec&);
218 virtual int update_couple_trial_status(const vec&);
219 virtual int update_couple_trial_status(const vec&, const vec&);
220 virtual int update_couple_trial_status(const vec&, const vec&, const vec&);
221
222 virtual int clear_status() = 0;
223 virtual int commit_status() = 0;
224 virtual int reset_status() = 0;
225
226 virtual int clear_couple_status();
227 virtual int commit_couple_status();
228 virtual int reset_couple_status();
229
230 virtual std::vector<vec> record(OutputType);
231};
232
233namespace suanpan {
234 unique_ptr<Material> make_copy(const shared_ptr<Material>&);
236} // namespace suanpan
237
238#endif
239
OutputType
Definition: OutputType.h:23
ParameterType
Definition: ParameterType.h:21
The DomainBase class is a template.
Definition: DomainBase.h:104
A Material abstract base class.
Definition: Material.h:111
virtual const vec & get_trial_couple_stress()
Definition: Material.cpp:127
virtual const vec & get_current_strain_acc()
Definition: Material.cpp:105
friend void ConstantCoupleStiffness(DataCoupleMaterial *)
Definition: Material.cpp:319
friend void ConstantInertial(DataMaterial *)
Definition: Material.cpp:314
int update_couple_incre_status(double)
Definition: Material.cpp:172
virtual int reset_couple_status()
Definition: Material.cpp:285
virtual const mat & get_current_couple_stiffness()
Definition: Material.cpp:135
virtual int commit_status()=0
Definition: Material.cpp:231
virtual void initialize_couple(const shared_ptr< DomainBase > &)
Definition: Material.cpp:51
virtual int commit_couple_status()
Definition: Material.cpp:277
double get_characteristic_length() const
Definition: Material.cpp:75
PlaneType get_plane_type() const
Definition: Material.cpp:31
virtual int clear_couple_status()
Definition: Material.cpp:265
virtual int initialize(const shared_ptr< DomainBase > &)=0
virtual const mat & get_current_stiffness()
Definition: Material.cpp:109
virtual int clear_status()=0
Definition: Material.cpp:199
virtual const vec & get_trial_strain()
Definition: Material.cpp:79
virtual std::vector< vec > record(OutputType)
Definition: Material.cpp:293
virtual const mat & get_initial_couple_stiffness() const
Definition: Material.cpp:137
friend void ConstantDamping(DataMaterial *)
Definition: Material.cpp:309
~Material() override=default
virtual const vec & get_trial_stress()
Definition: Material.cpp:85
virtual int reset_status()=0
Definition: Material.cpp:248
Material(unsigned=0, MaterialType=MaterialType::D0, double=0.)
Definition: Material.cpp:22
virtual const vec & get_current_strain()
Definition: Material.cpp:101
Material(const Material &)=default
virtual const mat & get_initial_stiffness() const
Definition: Material.cpp:119
void set_support_couple(bool) const
Definition: Material.cpp:65
virtual const mat & get_trial_couple_stiffness()
Definition: Material.cpp:129
bool is_support_couple() const
Definition: Material.cpp:71
friend void PureWrapper(Material *)
Definition: Material.cpp:324
virtual const mat & get_current_damping()
Definition: Material.cpp:113
Material(Material &&)=delete
virtual const mat & get_current_inertial()
Definition: Material.cpp:115
virtual const mat & get_trial_inertial()
Definition: Material.cpp:99
virtual unique_ptr< Material > get_copy()=0
Definition: Material.cpp:139
virtual const mat & get_initial_damping() const
Definition: Material.cpp:121
Material & operator=(const Material &)=delete
virtual const vec & get_initial_history() const
Definition: Material.cpp:117
virtual const vec & get_current_couple_stress()
Definition: Material.cpp:133
MaterialType get_material_type() const
Definition: Material.cpp:29
virtual const vec & get_trial_curvature()
Definition: Material.cpp:125
bool is_symmetric() const
Definition: Material.cpp:69
bool is_initialized() const
Definition: Material.cpp:67
void set_symmetric(bool) const
Definition: Material.cpp:63
friend void ConstantStiffness(DataMaterial *)
Definition: Material.cpp:304
virtual const mat & get_trial_damping()
Definition: Material.cpp:97
int update_trial_status(double)
Definition: Material.cpp:147
virtual void initialize_history(unsigned)
Definition: Material.cpp:53
int update_couple_trial_status(double)
Definition: Material.cpp:178
Material & operator=(Material &&)=delete
virtual const mat & get_trial_stiffness()
Definition: Material.cpp:87
int update_incre_status(double)
Definition: Material.cpp:141
virtual const mat & get_trial_secant()
Definition: Material.cpp:89
virtual const vec & get_current_stress()
Definition: Material.cpp:107
void set_characteristic_length(double) const
Definition: Material.cpp:73
virtual void set_initial_history(const vec &)
Definition: Material.cpp:59
virtual const vec & get_current_strain_rate()
Definition: Material.cpp:103
void set_initialized(bool) const
Definition: Material.cpp:61
virtual double get_parameter(ParameterType) const
Definition: Material.cpp:77
int initialize_base(const shared_ptr< DomainBase > &)
Definition: Material.cpp:33
virtual const vec & get_current_curvature()
Definition: Material.cpp:131
double get_density() const
Definition: Material.cpp:27
virtual const vec & get_trial_strain_rate()
Definition: Material.cpp:81
virtual const mat & get_initial_inertial() const
Definition: Material.cpp:123
virtual const vec & get_trial_strain_acc()
Definition: Material.cpp:83
virtual const mat & get_current_secant()
Definition: Material.cpp:111
A base Tag class.
Definition: Tag.h:38
MaterialType
Definition: Material.h:34
PlaneType
Definition: Material.h:43
Definition: MatrixModifier.hpp:36
unique_ptr< Material > make_copy(const shared_ptr< Material > &)
Definition: Material.cpp:370
Definition: Material.h:53
mat current_couple_stiffness
Definition: Material.h:64
vec trial_curvature
Definition: Material.h:57
vec incre_couple_stress
Definition: Material.h:61
mat trial_couple_stiffness
Definition: Material.h:65
vec incre_curvature
Definition: Material.h:60
vec current_couple_stress
Definition: Material.h:55
mat initial_couple_stiffness
Definition: Material.h:63
vec current_curvature
Definition: Material.h:54
vec trial_couple_stress
Definition: Material.h:58
Definition: Material.h:68
mat current_inertial
Definition: Material.h:107
vec trial_strain_acc
Definition: Material.h:84
vec current_strain
Definition: Material.h:76
vec incre_stress
Definition: Material.h:91
mat initial_stiffness
Definition: Material.h:98
const double density
Definition: Material.h:69
mat initial_inertial
Definition: Material.h:106
const double characteristic_length
Definition: Material.h:74
const MaterialType material_type
Definition: Material.h:70
vec current_history
Definition: Material.h:95
mat current_damping
Definition: Material.h:103
mat trial_damping
Definition: Material.h:104
mat trial_inertial
Definition: Material.h:108
vec incre_strain_rate
Definition: Material.h:89
vec incre_strain_acc
Definition: Material.h:90
vec current_stress
Definition: Material.h:79
const PlaneType plane_type
Definition: Material.h:71
vec trial_strain
Definition: Material.h:82
vec trial_stress
Definition: Material.h:85
mat trial_stiffness
Definition: Material.h:100
mat current_stiffness
Definition: Material.h:99
vec current_strain_rate
Definition: Material.h:77
vec current_strain_acc
Definition: Material.h:78
vec incre_strain
Definition: Material.h:88
vec trial_history
Definition: Material.h:96
mat initial_damping
Definition: Material.h:102
vec initial_history
Definition: Material.h:94
vec trial_strain_rate
Definition: Material.h:83
const double tolerance
Definition: Material.h:73