33 template <
short_t dim,
class T >
35 const gsFunctionSet<T> & mp,
36 const std::vector< gsFunctionSet<T> *> & thickness,
37 const std::vector< gsFunctionSet<T> *> & G,
38 const std::vector< gsFunctionSet<T> *> & alpha,
39 const std::vector< gsFunctionSet<T> *> & rho )
43 index_t nLayers = thickness.size();
48 for (
size_t k=0; k!=thickness.size(); k++)
50 GISMO_ENSURE(thickness[k]!=NULL,
"Function "<<k<<
" of the thickness vector is not defined!");
51 GISMO_ENSURE(G[k]!=NULL,
"Function "<<k<<
" of the shear moduli vector is not defined!");
52 GISMO_ENSURE(alpha[k]!=NULL,
"Function "<<k<<
" of the alpha vector is not defined!");
54 for (
size_t k=0; k!=rho.size(); k++)
55 GISMO_ENSURE(rho[k]!=NULL,
"Function "<<k<<
" of the density vector is not defined!");
59 for (
index_t k=0; k!=nLayers; k++)
68 template <
short_t dim,
class T >
70 const gsFunctionSet<T> & mp,
71 const std::vector< gsFunctionSet<T> *> & thickness,
72 const std::vector< gsFunctionSet<T> *> & G,
73 const std::vector< gsFunctionSet<T> *> & alpha )
77 index_t nLayers = thickness.size();
81 for (
size_t k=0; k!=thickness.size(); k++)
83 GISMO_ENSURE(thickness[k]!=NULL,
"Function "<<k<<
" of the thickness vector is not defined!");
84 GISMO_ENSURE(G[k]!=NULL,
"Function "<<k<<
" of the shear moduli vector is not defined!");
85 GISMO_ENSURE(alpha[k]!=NULL,
"Function "<<k<<
" of the alpha vector is not defined!");
89 for (
index_t k=0; k!=nLayers; k++)
97 template <
short_t dim,
class T >
98 void gsMaterialMatrixComposite<dim,T>::_defaultOptions()
100 m_options.addInt(
"NumGauss",
"Number of Gaussian points through thickness",4);
103 template <
short_t dim,
class T >
106 os <<
"---------------------------------------------------------------------\n"
107 <<
"----------------------Composite Material Info------------------------\n"
108 <<
"---------------------------------------------------------------------\n\n";
110 os <<
"Material model: \t";
111 os <<
"Saint-Venant Kirchhoff";
114 os <<
"---------------------------------------------------------------------\n\n";
118 template <
short_t dim,
class T >
122 this->_defaultOptions();
125 m_Ts.resize(m_nLayers);
126 m_Gs.resize(m_nLayers);
127 m_As.resize(m_nLayers);
128 m_Rs.resize(m_nLayers);
131 template <
short_t dim,
class T >
132 void gsMaterialMatrixComposite<dim,T>::_computePoints(
const index_t patch,
const gsMatrix<T> & u,
bool basis)
const
134 this->_computeMetricUndeformed(patch,u);
136 if (Base::m_defpatches->nPieces()!=0)
137 this->_computeMetricDeformed(patch,u);
140 template <
short_t dim,
class T >
143 GISMO_ASSERT(m_Ts.size()==m_Rs.size(),
"Size of vectors of thickness and densities is not equal: " << m_Ts.size()<<
" & "<<m_Rs.size());
148 static_cast<const gsFunction<T>&
>(m_patches->piece(patch) ).computeMap(map);
150 result.resize(1, u.cols());
152 std::vector<gsMatrix<T>> Tcontainer(m_nLayers);
153 std::vector<gsMatrix<T>> Rcontainer(m_nLayers);
154 for (
size_t k=0; k!= m_Rs.size(); k++)
156 Tcontainer[k] = m_Ts[k]->piece(patch).eval(map.values[0]);
157 Rcontainer[k] = m_Rs[k]->piece(patch).eval(map.values[0]);
159 GISMO_ASSERT(Tcontainer[k].rows()==1,
"Thickness has the wrong size, must be scalar");
160 GISMO_ASSERT(Rcontainer[k].rows()==1,
"Densities has the wrong size, must be scalar");
164 for (
index_t i = 0; i != m_nLayers; ++i)
165 for (
index_t k = 0; k != u.cols(); ++k)
166 result(0,k) += Tcontainer[i](0,k)*Rcontainer[i](0,k);
170 template <
short_t dim,
class T >
176 static_cast<const gsFunction<T>&
>(m_patches->piece(patch) ).computeMap(map);
178 std::vector<gsMatrix<T>> Tcontainer(m_nLayers);
179 for (
size_t k=0; k!= m_Rs.size(); k++)
181 Tcontainer[k] = m_Ts[k]->eval(map.values[0]);
182 GISMO_ASSERT(Tcontainer[k].rows()==1,
"Thickness has the wrong size, must be scalar");
185 for (
index_t i = 0; i != m_nLayers; ++i)
186 for (
index_t k = 0; k != u.cols(); ++k)
187 result.row(i) = Tcontainer[i].row(0);
190 template <
short_t dim,
class T >
198 this->_computePoints(patch,u);
203 T t, t_tot, z_mid, t_temp, dz;
205 std::vector<gsMatrix<T>> Tcontainer(m_nLayers);
206 std::vector<gsMatrix<T>> Rcontainer(m_nLayers);
207 std::vector<gsMatrix<T>> Acontainer(m_nLayers);
208 std::vector<gsMatrix<T>> Gcontainer(m_nLayers);
213 static_cast<const gsFunction<T>&
>(m_patches->piece(patch) ).computeMap(map);
216 for (
size_t k=0; k!= m_Gs.size(); k++)
218 Gcontainer[k] = m_Gs[k]->piece(patch).eval(map.values[0]);
219 Tcontainer[k] = m_Ts[k]->piece(patch).eval(map.values[0]);
220 angles = m_As[k]->piece(patch).eval(map.values[0]);
222 GISMO_ASSERT(Gcontainer[k].rows()==9,
"G has the wrong size, must be 3x3");
223 GISMO_ASSERT(Tcontainer[k].rows()==1,
"Thickness has the wrong size, must be scalar");
225 Acontainer[k] = _transformationMatrix(angles,map.values[0]);
229 for (
index_t k = 0; k != u.cols(); ++k)
232 this->_getMetric(k,0.0);
236 for (
size_t i=0; i!=Tcontainer.size(); i++)
237 t_tot += Tcontainer[i](0,k);
246 for (
index_t i = 0; i != m_nLayers; ++i)
249 t = Tcontainer[i](0,k);
252 Dmat = Acontainer[i].
reshapeCol(k,3,3).transpose() * Gcontainer[i].reshapeCol(k,3,3) * Acontainer[i].reshapeCol(k,3,3);
256 dz = z_mid - (t/2.0 + t_temp);
258 if (out==MaterialOutput::MatrixA)
260 else if (out==MaterialOutput::MatrixB || out==MaterialOutput::MatrixC)
262 else if (out==MaterialOutput::MatrixD)
263 Cmat += Dmat * ( t*math::pow(dz,2) + math::pow(t,3)/12.0 );
269 GISMO_ASSERT(
std::abs(t_tot-t_temp)/t_tot < 1e-12,
"Total thickness after loop is wrong. t_temp = "<<t_temp<<
", sum(thickness) = "<<t_tot<<
", difference = "<<t_tot-t_temp);
272 a1 = m_data.mine().m_gcov_ori.col(0); a2 = m_data.mine().m_gcov_ori.col(1);
273 ac1 = m_data.mine().m_gcon_ori.col(0); ac2 = m_data.mine().m_gcon_ori.col(1);
274 e1 = m_data.mine().m_gcov_ori.col(0).normalized(); e2 = m_data.mine().m_gcon_ori.col(1).normalized();
276 Cmat = _cart2cov(a1,a2,e1,e2) * Cmat;
277 Cmat = Cmat * _con2cart(ac1,ac2,e1,e2);
279 result.reshapeCol(k,3,3) = Cmat;
285 template <
short_t dim,
class T >
294 this->_computePoints(patch,u);
297 if (out==MaterialOutput::VectorN)
298 _out=MaterialOutput::MatrixA;
299 else if (out==MaterialOutput::VectorM)
300 _out=MaterialOutput::MatrixD;
304 gsMatrix<T> Cmat = this->eval3D_matrix(patch,u,z,_out);
307 for (
index_t k = 0; k != u.cols(); ++k)
309 this->_getMetric(k,0.0);
311 if (out == MaterialOutput::VectorN)
312 Eij = 0.5*(m_data.mine().m_Acov_def - m_data.mine().m_Acov_ori);
313 else if (out == MaterialOutput::VectorM)
314 Eij = (m_data.mine().m_Bcov_ori - m_data.mine().m_Bcov_def);
315 else if (out == MaterialOutput::Generic)
316 Eij = 0.5*(m_data.mine().m_Acov_def - m_data.mine().m_Acov_ori) + z*(m_data.mine().m_Bcov_ori - m_data.mine().m_Bcov_def);
318 GISMO_ERROR(
"Output type is not VectorN, VectorM or Generic!");
320 Eij(0,1) += Eij(1,0);
321 std::swap(Eij(1,0), Eij(1,1));
323 Eij.conservativeResize(3,1);
330 template <
short_t dim,
class T>
334 GISMO_ASSERT(phi.rows()==1,
"Angles has the wrong size, must be scalar");
336 for (
index_t k=0; k!=u.cols(); k++)
340 Tmat(0,0) = Tmat(1,1) = math::pow(math::cos(phi(0,k)),2);
341 Tmat(0,1) = Tmat(1,0) = math::pow(math::sin(phi(0,k)),2);
342 Tmat(2,0) = Tmat(0,2) = Tmat(2,1) = Tmat(1,2) = math::sin(phi(0,k)) * math::cos(phi(0,k));
346 Tmat(2,2) = math::pow(math::cos(phi(0,k)),2) - math::pow(math::sin(phi(0,k)),2);
353 template <
short_t dim,
class T>
354 gsMatrix<T> gsMaterialMatrixComposite<dim,T>::_cart2cov(
const gsVector<T> & a1,
const gsVector<T> & a2,
const gsVector<T> & e1,
const gsVector<T> & e2)
const
356 gsMatrix<T,3,3> Tmat;
359 Tmat(0,0) = (e1.dot(a1))*(a1.dot(e1));
360 Tmat(0,1) = (e1.dot(a2))*(a2.dot(e2));
361 Tmat(0,2) = 2*(e1.dot(a1))*(a2.dot(e1));
363 Tmat(1,0) = (e2.dot(a1))*(a1.dot(e2));
364 Tmat(1,1) = (e2.dot(a2))*(a2.dot(e2));
365 Tmat(1,2) = 2*(e2.dot(a1))*(a2.dot(e2));
367 Tmat(2,0) = (e1.dot(a1))*(a1.dot(e2));
368 Tmat(2,1) = (e1.dot(a2))*(a2.dot(e2));
369 Tmat(2,2) = (e1.dot(a1))*(a2.dot(e2)) + (e1.dot(a2))*(a1.dot(e2));
371 Tmat = Tmat.template block<3,3>(0,0).inverse();
375 template <
short_t dim,
class T>
376 gsMatrix<T> gsMaterialMatrixComposite<dim,T>::_con2cart(
const gsVector<T> & ac1,
const gsVector<T> & ac2,
const gsVector<T> & e1,
const gsVector<T> & e2)
const
378 gsMatrix<T,3,3> Tmat;
381 Tmat(0,0) = (e1.dot(ac1))*(ac1.dot(e1));
382 Tmat(0,1) = (e1.dot(ac2))*(ac2.dot(e2));
383 Tmat(0,2) = 2*(e1.dot(ac1))*(ac2.dot(e1));
385 Tmat(1,0) = (e2.dot(ac1))*(ac1.dot(e2));
386 Tmat(1,1) = (e2.dot(ac2))*(ac2.dot(e2));
387 Tmat(1,2) = 2*(e2.dot(ac1))*(ac2.dot(e2));
389 Tmat(2,0) = (e1.dot(ac1))*(ac1.dot(e2));
390 Tmat(2,1) = (e1.dot(ac2))*(ac2.dot(e2));
391 Tmat(2,2) = (e1.dot(ac1))*(ac2.dot(e2)) + (e1.dot(ac2))*(ac1.dot(e2));
MaterialOutput
This class describes the output type.
Definition: gsMaterialMatrixUtils.h:98
shared_ptr< T > make_shared_not_owned(const T *x)
Creates a shared pointer which does not eventually delete the underlying raw pointer. Usefull to refer to objects which should not be destroyed.
Definition: gsMemory.h:189
Creates a mapped object or data pointer to a matrix without copying data.
Definition: gsLinearAlgebra.h:126
the gsMapData is a cache of pre-computed function (map) values.
Definition: gsFuncData.h:324
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
A function from a n-dimensional domain to an m-dimensional image.
Definition: gsFunction.h:59
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition: gsVector.h:35
void thickness_into(const index_t patch, const gsMatrix< T > &u, gsMatrix< T > &result) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixComposite.hpp:171
gsAsMatrix< T, Dynamic, Dynamic > reshapeCol(index_t c, index_t n, index_t m)
Returns column c of the matrix resized to n x m matrix This function assumes that the matrix is size ...
Definition: gsMatrix.h:231
Provides material matrix utilities.
gsMaterialMatrixComposite()
Constructor of the assembler object.
Definition: gsMaterialMatrixComposite.h:56
gsMatrix< T > eval3D_matrix(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
Evaluates the matrix on patch on in-plane points u with height z.
Definition: gsMaterialMatrixComposite.hpp:191
void density_into(const index_t patch, const gsMatrix< T > &u, gsMatrix< T > &result) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixComposite.hpp:141
Provides a material matrix for laminates.
Value of the object.
Definition: gsForwardDeclarations.h:72
This class defines a linear material laminate.
Definition: gsMaterialMatrixComposite.h:39
#define GISMO_ERROR(message)
Definition: gsDebug.h:118
EIGEN_STRONG_INLINE abs_expr< E > abs(const E &u)
Absolute value.
Definition: gsExpressions.h:4486
gsMatrix< T > points
input (parametric) points
Definition: gsFuncData.h:348
std::ostream & print(std::ostream &os) const override
Prints the object as a string.
Definition: gsMaterialMatrixComposite.hpp:104
Provides declaration of Function abstract interface.
gsMatrix< T > eval3D_vector(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
Evaluates the vector on patch on in-plane points u with height z.
Definition: gsMaterialMatrixComposite.hpp:286