MAST3
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
plate_bending_section_property.hpp
Go to the documentation of this file.
1 /*
2 * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3 * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 #ifndef __mast_plate_bending_section_property_h__
21 #define __mast_plate_bending_section_property_h__
22 
23 // MAST includes
25 #include <mast/base/exceptions.hpp>
26 
27 namespace MAST {
28 namespace Physics {
29 namespace Elasticity {
30 
31 template <typename ScalarType,
32  typename MaterialType,
33  typename ThicknessType,
34  typename ContextType>
36 public:
37 
38  using material_scalar_t = typename MaterialType::scalar_t;
39  using thickness_scalar_t = typename ThicknessType::scalar_t;
41  using inplane_value_t = typename Eigen::Matrix<scalar_t, 3, 3>;
42  using shear_value_t = typename Eigen::Matrix<scalar_t, 2, 2>;
43 
45  _material (nullptr),
46  _th (nullptr) { }
47 
49 
50  inline void set_material_and_thickness(const MaterialType& material,
51  const ThicknessType& th) {
52 
53  _material = &material;
54  _th = &th;
55  }
56 
57 
58  inline const MaterialType& get_material() const {return *_material;}
59 
60  inline const ThicknessType& get_thickness() const {return *_th;}
61 
62  inline void inplane_value(ContextType &c,
63  inplane_value_t &m) const {
64 
65  Assert0(_material && _th, "Material and thickness not provided");
66 
67  _material->value(c, m);
68  m *= pow(_th->value(c), 3)/12.;
69  }
70 
71 
72  template <typename ScalarFieldType>
73  inline void inplane_derivative(ContextType &c,
74  const ScalarFieldType &f,
75  inplane_value_t &m) const {
76 
77  Assert0(_material && _th, "Material and thickness not provided");
78 
79  typename MaterialType::value_t
80  dm;
81 
82  _material->value(c, m);
83  _material->derivative(c, f, dm);
84 
85  dm *= pow(_th->value(c), 3)/12.;
86  m *= pow(_th->value(c), 2)/4.*_th->derivative(c, f);
87  m += dm;
88  }
89 
90  inline void shear_value(ContextType& c,
91  shear_value_t &m) const {
92 
93  Assert0(_material && _th, "Material and thickness not provided");
94 
95  m.setZero();
96  m(0, 0) = m(1, 1) = _material->G(c) * _th->value(c);
97  }
98 
99 
100  template <typename ScalarFieldType>
101  inline void shear_derivative(ContextType &c,
102  const ScalarFieldType &f,
103  shear_value_t &m) const {
104 
105  Assert0(_material && _th, "Material and thickness not provided");
106 
107  m.setZero();
108  m(0, 0) = m(1, 1) = (_material->G_derivative(c, f) * _th->value(c) +
109  _material->G(c) * _th->derivative(c, f));
110  }
111 
112 
113 private:
114 
115  const MaterialType* _material;
116  const ThicknessType* _th;
117 };
118 
119 
120 template <typename ScalarType,
121  typename DensityType,
122  typename ThicknessType,
123  typename ContextType>
125 public:
126 
127  using density_scalar_t = typename DensityType::scalar_t;
128  using thickness_scalar_t = typename ThicknessType::scalar_t;
130 
132  _density (nullptr),
133  _th (nullptr) { }
134 
136 
137  inline void set_density_and_thickness(const DensityType& density,
138  const ThicknessType& th) {
139 
140  _density = &density;
141  _th = &th;
142  }
143 
144 
145  inline const DensityType& get_density() const {return *_density;}
146 
147 
148  inline const ThicknessType& get_thickness() const {return *_th;}
149 
150 
151  inline void translation_inertia(ContextType &c,
152  scalar_t &m) const {
153 
154  Assert0(_density && _th, "Material and thickness not provided");
155 
156  m = _density->value(c) * _th->value(c);
157  }
158 
159 
160  template <typename ScalarFieldType>
161  inline void translation_inertia_derivative(ContextType &c,
162  const ScalarFieldType &f,
163  scalar_t &m) const {
164 
165  Assert0(_density && _th, "Material and thickness not provided");
166 
167  m = (_density->value(c) * _th->derivative(c, f) +
168  _density->derivative(c, f) * _th->value(c));
169  }
170 
171  inline void rotation_inertia(ContextType &c,
172  scalar_t &m) const {
173 
174  Assert0(_density && _th, "Material and thickness not provided");
175 
176  m = _density->value(c) * pow(_th->value(c), 3)/12.;
177  }
178 
179 
180  template <typename ScalarFieldType>
181  inline void rotation_inertia_derivative(ContextType &c,
182  const ScalarFieldType &f,
183  scalar_t &m) const {
184 
185  Assert0(_density && _th, "Material and thickness not provided");
186 
187  m = (_density->derivative(c, f) * pow(_th->value(c), 3)/12. +
188  _density->value(c) * pow(_th->value(c), 2)/4. * _th->derivative(c, f));
189  }
190 
191 
192 
193 private:
194 
195  const DensityType *_density;
196  const ThicknessType *_th;
197 };
198 
199 
200 } // namespace Elasticity
201 } // namespace Physics
202 } // namespace MAST
203 
204 
205 #endif // __mast_plate_bending_section_property_h__
typename MAST::DeducedScalarType< typename MAST::DeducedScalarType< density_scalar_t, thickness_scalar_t >::type, ScalarType >::type scalar_t
void rotation_inertia_derivative(ContextType &c, const ScalarFieldType &f, scalar_t &m) const
void inplane_value(ContextType &c, inplane_value_t &m) const
void inplane_derivative(ContextType &c, const ScalarFieldType &f, inplane_value_t &m) const
void set_density_and_thickness(const DensityType &density, const ThicknessType &th)
#define Assert0(cond, msg)
Definition: exceptions.hpp:134
void translation_inertia_derivative(ContextType &c, const ScalarFieldType &f, scalar_t &m) const
void set_material_and_thickness(const MaterialType &material, const ThicknessType &th)
typename MAST::DeducedScalarType< typename MAST::DeducedScalarType< material_scalar_t, thickness_scalar_t >::type, ScalarType >::type scalar_t
void shear_derivative(ContextType &c, const ScalarFieldType &f, shear_value_t &m) const