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