30 using namespace gismo;
35 template <
short_t dim,
class T>
43 template <
short_t dim,
class T>
49 Base(&mp,&thickness,nullptr)
54 template <
short_t dim,
class T >
66 template <
short_t dim,
class T >
79 template <
short_t dim,
class T >
88 Base(mp,thickness,Density)
96 template <
short_t dim,
class T >
107 template <
short_t dim,
class T>
119 template <
short_t dim,
class T >
129 template <
short_t dim,
class T>
140 template <
short_t dim,
class T>
148 Base(mp,thickness,density)
150 GISMO_ASSERT(pars.size()==2,
"Two material parameters should be assigned!");
155 template <
short_t dim,
class T>
161 template <
short_t dim,
class T>
164 os <<
"---------------------------------------------------------------------\n"
165 <<
"---------------------Elastic Material Info---------------------------\n"
166 <<
"---------------------------------------------------------------------\n\n";
168 os <<
"Material model: \t";
169 os <<
"Saint-Venant Kirchhoff";
171 os <<
"---------------------------------------------------------------------\n\n";
175 template <
short_t dim,
class T>
178 Base::defaultOptions();
179 m_options.addInt(
"NumGauss",
"Number of Gaussian points through thickness",4);
182 template <
short_t dim,
class T>
186 this->defaultOptions();
189 template <
short_t dim,
class T>
198 this->_computePoints(patch,u);
202 for (
index_t k=0; k!=u.cols(); k++)
205 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
206 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
208 for(
index_t j=0; j < z.rows(); ++j )
210 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
218 C(0,0) = _Cijkl(0,0,0,0);
219 C(1,1) = _Cijkl(1,1,1,1);
220 C(2,2) = _Cijkl(0,1,0,1);
221 C(1,0) = C(0,1) = _Cijkl(0,0,1,1);
222 C(2,0) = C(0,2) = _Cijkl(0,0,0,1);
223 C(2,1) = C(1,2) = _Cijkl(1,1,0,1);
229 template <
short_t dim,
class T>
238 this->_computePoints(patch,u);
244 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
245 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,0);
248 this->_getMetricUndeformed(0, z * m_data.mine().m_Tmat(0, 0));
249 this->_getMetricDeformed(Cmat);
257 C(0,0) = _Cijkl(0,0,0,0);
258 C(1,1) = _Cijkl(1,1,1,1);
259 C(2,2) = _Cijkl(0,1,0,1);
260 C(1,0) = C(0,1) = _Cijkl(0,0,1,1);
261 C(2,0) = C(0,2) = _Cijkl(0,0,0,1);
262 C(2,1) = C(1,2) = _Cijkl(1,1,0,1);
266 template <
short_t dim,
class T>
317 template <
short_t dim,
class T>
320 return eval3D_stress(patch,u,z,out);
323 template <
short_t dim,
class T>
326 return eval3D_CauchyStress(patch,u,z,out);
329 template <
short_t dim,
class T>
338 this->_computePoints(patch,u);
345 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
346 m_data.mine().m_parvals.at(v) = m_data.mine().m_parmat(v,0);
349 this->_getMetricUndeformed(0, z * m_data.mine().m_Tmat(0, 0));
350 this->_getMetricDeformed(Cmat);
360 m_data.mine().m_Acov_def = m_data.mine().m_Gcov_def.block(0,0,2,2);
361 m_data.mine().m_Acon_def = m_data.mine().m_Gcon_def.block(0,0,2,2);
362 m_data.mine().m_Bcov_def.setZero();
363 m_data.mine().m_Bcon_def.setZero();
365 E = _E(z * m_data.mine().m_Tmat(0, 0),out);
367 result(0, 0) = _Sij(0, 0, E);
368 result(1, 0) = _Sij(1, 1, E);
369 result(2, 0) = _Sij(0, 1, E);
373 template <
short_t dim,
class T>
383 for (
index_t k=0; k!=u.cols(); k++)
386 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
387 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
389 for(
index_t j=0; j < z.rows(); ++j )
391 colIdx = j * u.cols() + k;
393 S(0,0) = Smat(0,colIdx);
394 S(1,1) = Smat(1,colIdx);
395 S(0,1) = S(1,0) = Smat(2,colIdx);
397 res = this->_evalPStress(S);
398 result.col(j * u.cols() + k) = res.first;
406 template <
short_t dim,
class T>
416 for (
index_t k=0; k!=u.cols(); k++)
419 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
420 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
422 for(
index_t j=0; j < z.rows(); ++j )
424 colIdx = j * u.cols() + k;
426 S(0,0) = Smat(0,colIdx);
427 S(1,1) = Smat(1,colIdx);
428 S(0,1) = S(1,0) = Smat(2,colIdx);
430 res = this->_evalPStress(S);
431 result.col(j * u.cols() + k) = res.second.reshape(9,1);
439 template <
short_t dim,
class T>
442 gsMatrix<T> Smat = eval3D_CauchyStress(patch,u,z,out);
449 for (
index_t k=0; k!=u.cols(); k++)
452 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
453 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
455 for(
index_t j=0; j < z.rows(); ++j )
457 colIdx = j * u.cols() + k;
459 S(0,0) = Smat(0,colIdx);
460 S(1,1) = Smat(1,colIdx);
461 S(0,1) = S(1,0) = Smat(2,colIdx);
463 res = this->_evalPStress(S);
464 result.col(j * u.cols() + k) = res.first;
472 template <
short_t dim,
class T>
480 this->_computePoints(patch,u);
485 for (
index_t k=0; k!=u.cols(); k++)
488 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
489 m_data.mine().m_parvals.at(v) = m_data.mine().m_parmat(v,k);
491 for(
index_t j=0; j < z.rows(); ++j )
493 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
496 E.block(0,0,2,2) = _E(0,out);
497 result(0, j * u.cols() + k) = _Sij(0, 0, E);
498 result(1, j * u.cols() + k) = _Sij(1, 1, E);
499 result(2, j * u.cols() + k) = _Sij(0, 1, E);
507 template <
short_t dim,
class T>
510 this->_computePoints(patch,u);
513 for (
index_t k=0; k!=u.cols(); k++)
515 for(
index_t j=0; j < z.rows(); ++j )
517 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
518 result(0,j * u.cols() + k) = math::sqrt(m_data.mine().m_J0_sq*1.0);
524 template <
short_t dim,
class T>
527 this->_computePoints(patch,u);
531 for (
index_t k=0; k!=u.cols(); k++)
533 for(
index_t j=0; j < z.rows(); ++j )
535 colIdx = j * u.cols() + k;
536 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
537 detF = math::sqrt(m_data.mine().m_J0_sq*1.0);
538 result.col(colIdx) /= detF;
550 template <
short_t dim,
class T>
553 GISMO_ENSURE( ( (i < 2) && (j < 2) && (k < 2) && (l < 2) ) ,
"Index out of range. i="<<i<<
", j="<<j<<
", k="<<k<<
", l="<<l);
559 T lambda, mu, Cconstant;
561 mu = m_data.mine().m_parvals.at(0) / (2.*(1. + m_data.mine().m_parvals.at(1)));
562 GISMO_ENSURE((1.-2.*m_data.mine().m_parvals.at(1)) != 0,
"Division by zero in construction of SvK material parameters! (1.-2.*nu) = "<<(1.-2.*m_data.mine().m_parvals.at(1))<<
"; m_data.mine().m_parvals.at(1) = "<<m_data.mine().m_parvals.at(1));
563 lambda = m_data.mine().m_parvals.at(0) * m_data.mine().m_parvals.at(1) / ( (1. + m_data.mine().m_parvals.at(1))*(1.-2.*m_data.mine().m_parvals.at(1))) ;
564 Cconstant = 2*lambda*mu/(lambda+2*mu);
566 return Cconstant*m_data.mine().m_Acon_ori(i,j)*m_data.mine().m_Acon_ori(k,l) + mu*(m_data.mine().m_Acon_ori(i,k)*m_data.mine().m_Acon_ori(j,l) + m_data.mine().m_Acon_ori(i,l)*m_data.mine().m_Acon_ori(j,k));
569 template <
short_t dim,
class T>
572 T result = _Cijkl(i,j,0,0) * strain(0,0) + _Cijkl(i,j,0,1) * strain(0,1)
573 + _Cijkl(i,j,1,0) * strain(1,0) + _Cijkl(i,j,1,1) * strain(1,1);
577 template <
short_t dim,
class T>
580 gsWarn<<
"This is dangerous, since it does not compute material parameters in advance!\n";
581 GISMO_ASSERT(strain.rows()==strain.cols() && strain.rows()==2,
"Strain tensor must be 2x2!");
585 result(i,j) = _Cijkl(i,j,0,0) * strain(0,0) + _Cijkl(i,j,0,1) * strain(0,1)
586 + _Cijkl(i,j,1,0) * strain(1,0) + _Cijkl(i,j,1,1) * strain(1,1);
591 template <
short_t dim,
class T>
595 result(0,0) = _Cijkl(0,0,0,0);
596 result(1,1) = _Cijkl(1,1,1,1);
597 result(2,2) = _Cijkl(0,1,0,1);
598 result(1,0) = result(0,1) = _Cijkl(0,0,1,1);
599 result(2,0) = result(0,2) = _Cijkl(0,0,0,1);
600 result(2,1) = result(1,2) = _Cijkl(1,1,0,1);
604 template <
short_t dim,
class T>
608 if ( out == MaterialOutput::VectorN ||
609 out == MaterialOutput::CauchyVectorN ||
610 out == MaterialOutput::StrainN ||
611 out == MaterialOutput::StressN ||
612 out == MaterialOutput::CauchyStressN ||
613 out == MaterialOutput::PStrainN ||
614 out == MaterialOutput::PStressN ||
615 out == MaterialOutput::PCauchyStressN ||
616 out == MaterialOutput::TensionField ||
617 out == MaterialOutput::StrainN )
618 strain = 0.5*(m_data.mine().m_Acov_def - m_data.mine().m_Acov_ori);
619 else if ( out == MaterialOutput::VectorM ||
620 out == MaterialOutput::CauchyVectorM ||
621 out == MaterialOutput::StressM ||
622 out == MaterialOutput::CauchyStressM ||
623 out == MaterialOutput::StrainM ||
624 out == MaterialOutput::PStrainM ||
625 out == MaterialOutput::PStressM ||
626 out == MaterialOutput::PCauchyStressM ||
627 out == MaterialOutput::StrainM )
628 strain = (m_data.mine().m_Bcov_ori - m_data.mine().m_Bcov_def);
629 else if ( out == MaterialOutput::Generic ||
630 out == MaterialOutput::Strain ||
631 out == MaterialOutput::Stress ||
632 out == MaterialOutput::PStress )
633 strain = 0.5*(m_data.mine().m_Gcov_def.block(0,0,2,2) - m_data.mine().m_Gcov_ori.block(0,0,2,2));
664 template<
short_t d,
class T>
673 static std::string tag () {
return "MaterialMatrix"; }
674 static std::string type () {
return "Linear" +
to_string(d); }
676 GSXML_GET_POINTER(Object);
685 static void get_into(gsXmlNode * node,Object & obj)
687 obj = getMaterialMatrixFromXml< Object >( node );
690 static gsXmlNode * put (
const Object & obj,
693 return putMaterialMatrixToXml< Object >( obj,data );
gsMatrix< T > eval3D_matrix(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:190
MaterialOutput
This class describes the output type.
Definition: gsMaterialMatrixUtils.h:98
virtual void setParameters(const std::vector< function_ptr > &pars)
Sets the material parameters.
Definition: gsMaterialMatrixBase.h:684
gsMaterialMatrixLinear()
Empty constructor.
Definition: gsMaterialMatrixLinear.hpp:36
gsMatrix< T > eval3D_stress(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:473
Creates a mapped object or data pointer to a matrix without copying data.
Definition: gsLinearAlgebra.h:126
#define short_t
Definition: gsConfig.h:35
gsMatrix< T > _E(const T z, enum MaterialOutput out) const
Computes the strain tensor.
Definition: gsMaterialMatrixLinear.hpp:605
gsMatrix< T > eval3D_vector(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:318
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
void setPoissonsRatio(const gsFunctionSet< T > &PoissonsRatio) override
Sets the Poisson's Ratio.
Definition: gsMaterialMatrixLinear.h:223
std::ostream & print(std::ostream &os) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:162
gsMatrix< T > eval3D_CauchyVector(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:324
gsMatrix< T > eval3D_detF(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:508
#define GISMO_ASSERT(cond, message)
Definition: gsDebug.h:89
This class defines the base class for material matrices.
Definition: gsMaterialMatrixBase.h:32
gsMatrix< T > eval3D_pstress(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:374
T _Sij(const index_t i, const index_t j, const gsMatrix< T > &z) const
Computes the linear material matrix entry with indices i j k l.
Definition: gsMaterialMatrixLinear.hpp:570
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition: gsMatrix.h:211
std::string to_string(const unsigned &i)
Helper to convert small unsigned to string.
Definition: gsXml.cpp:74
#define gsWarn
Definition: gsDebug.h:50
gsMatrix< T > eval3D_CauchyStress(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:525
This class defines a linear material.
Definition: gsMaterialMatrixLinear.h:39
gsMatrix< T > eval3D_pstressDir(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:407
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition: gsFuncData.h:23
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.
void defaultOptions() override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:176
#define GISMO_ERROR(message)
Definition: gsDebug.h:118
gsMatrix< T > eval3D_CauchyPStress(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:440
void _initialize()
Initializes the object.
Definition: gsMaterialMatrixLinear.hpp:183
void setYoungsModulus(const gsFunctionSet< T > &YoungsModulus) override
Sets the YoungsModulus.
Definition: gsMaterialMatrixLinear.h:217
gsMatrix< T > eval3D_dmatrix(const index_t patch, const gsMatrix< T > &u, const gsMatrix< T > &z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:267
gsMatrix< T > eval3D_vector_C(const gsMatrix< T > &Cmat, const index_t patch, const gsVector< T > &u, const T z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:330
gsMatrix< T > eval3D_matrix_C(const gsMatrix< T > &Cmat, const index_t patch, const gsVector< T > &u, const T z, enum MaterialOutput out=MaterialOutput::Generic) const override
See gsMaterialMatrixBase for details.
Definition: gsMaterialMatrixLinear.hpp:230
Provides declaration of input/output XML utilities struct.