29template <
short_t dim,
class T>
37template <
short_t dim,
class T>
43 Base(&mp,&thickness,nullptr)
48template <
short_t dim,
class T >
60template <
short_t dim,
class T >
73template <
short_t dim,
class T >
82 Base(mp,thickness,Density)
90template <
short_t dim,
class T >
101template <
short_t dim,
class T>
113template <
short_t dim,
class T >
123template <
short_t dim,
class T>
134template <
short_t dim,
class T>
142 Base(mp,thickness,density)
144 GISMO_ASSERT(pars.size()==2,
"Two material parameters should be assigned!");
149template <
short_t dim,
class T>
152 os <<
"---------------------------------------------------------------------\n"
153 <<
"---------------------Elastic Material Info---------------------------\n"
154 <<
"---------------------------------------------------------------------\n\n";
156 os <<
"Material model: \t";
157 os <<
"Saint-Venant Kirchhoff";
159 os <<
"---------------------------------------------------------------------\n\n";
163template <
short_t dim,
class T>
166 Base::defaultOptions();
167 m_options.addInt(
"NumGauss",
"Number of Gaussian points through thickness",4);
170template <
short_t dim,
class T>
174 this->defaultOptions();
177template <
short_t dim,
class T>
186 this->_computePoints(patch,u);
190 for (
index_t k=0; k!=u.cols(); k++)
193 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
194 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
196 for(
index_t j=0; j < z.rows(); ++j )
198 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
206 C(0,0) = _Cijkl(0,0,0,0);
207 C(1,1) = _Cijkl(1,1,1,1);
208 C(2,2) = _Cijkl(0,1,0,1);
209 C(1,0) = C(0,1) = _Cijkl(0,0,1,1);
210 C(2,0) = C(0,2) = _Cijkl(0,0,0,1);
211 C(2,1) = C(1,2) = _Cijkl(1,1,0,1);
217template <
short_t dim,
class T>
226 this->_computePoints(patch,u);
232 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
233 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,0);
236 this->_getMetricUndeformed(0, z * m_data.mine().m_Tmat(0, 0));
237 this->_getMetricDeformed(Cmat);
245 C(0,0) = _Cijkl(0,0,0,0);
246 C(1,1) = _Cijkl(1,1,1,1);
247 C(2,2) = _Cijkl(0,1,0,1);
248 C(1,0) = C(0,1) = _Cijkl(0,0,1,1);
249 C(2,0) = C(0,2) = _Cijkl(0,0,0,1);
250 C(2,1) = C(1,2) = _Cijkl(1,1,0,1);
254template <
short_t dim,
class T>
305template <
short_t dim,
class T>
308 return eval3D_stress(patch,u,z,out);
311template <
short_t dim,
class T>
314 return eval3D_CauchyStress(patch,u,z,out);
317template <
short_t dim,
class T>
326 this->_computePoints(patch,u);
333 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
334 m_data.mine().m_parvals.at(v) = m_data.mine().m_parmat(v,0);
337 this->_getMetricUndeformed(0, z * m_data.mine().m_Tmat(0, 0));
338 this->_getMetricDeformed(Cmat);
348 m_data.mine().m_Acov_def = m_data.mine().m_Gcov_def.block(0,0,2,2);
349 m_data.mine().m_Acon_def = m_data.mine().m_Gcon_def.block(0,0,2,2);
350 m_data.mine().m_Bcov_def.setZero();
351 m_data.mine().m_Bcon_def.setZero();
353 E = _E(z * m_data.mine().m_Tmat(0, 0),out);
355 result(0, 0) = _Sij(0, 0, E);
356 result(1, 0) = _Sij(1, 1, E);
357 result(2, 0) = _Sij(0, 1, E);
361template <
short_t dim,
class T>
371 for (
index_t k=0; k!=u.cols(); k++)
374 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
375 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
377 for(
index_t j=0; j < z.rows(); ++j )
379 colIdx = j * u.cols() + k;
381 S(0,0) = Smat(0,colIdx);
382 S(1,1) = Smat(1,colIdx);
383 S(0,1) = S(1,0) = Smat(2,colIdx);
385 res = this->_evalPStress(S);
386 result.col(j * u.cols() + k) = res.first;
394template <
short_t dim,
class T>
404 for (
index_t k=0; k!=u.cols(); k++)
407 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
408 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
410 for(
index_t j=0; j < z.rows(); ++j )
412 colIdx = j * u.cols() + k;
414 S(0,0) = Smat(0,colIdx);
415 S(1,1) = Smat(1,colIdx);
416 S(0,1) = S(1,0) = Smat(2,colIdx);
418 res = this->_evalPStress(S);
419 result.col(j * u.cols() + k) = res.second.
reshape(9,1);
427template <
short_t dim,
class T>
430 gsMatrix<T> Smat = eval3D_CauchyStress(patch,u,z,out);
437 for (
index_t k=0; k!=u.cols(); k++)
440 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
441 m_data.mine().m_parvals.
at(v) = m_data.mine().m_parmat(v,k);
443 for(
index_t j=0; j < z.rows(); ++j )
445 colIdx = j * u.cols() + k;
447 S(0,0) = Smat(0,colIdx);
448 S(1,1) = Smat(1,colIdx);
449 S(0,1) = S(1,0) = Smat(2,colIdx);
451 res = this->_evalPStress(S);
452 result.col(j * u.cols() + k) = res.first;
460template <
short_t dim,
class T>
468 this->_computePoints(patch,u);
473 for (
index_t k=0; k!=u.cols(); k++)
476 for (
index_t v=0; v!=m_data.mine().m_parmat.rows(); v++)
477 m_data.mine().m_parvals.at(v) = m_data.mine().m_parmat(v,k);
479 for(
index_t j=0; j < z.rows(); ++j )
481 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
484 E.block(0,0,2,2) = _E(0,out);
485 result(0, j * u.cols() + k) = _Sij(0, 0, E);
486 result(1, j * u.cols() + k) = _Sij(1, 1, E);
487 result(2, j * u.cols() + k) = _Sij(0, 1, E);
495template <
short_t dim,
class T>
498 this->_computePoints(patch,u);
501 for (
index_t k=0; k!=u.cols(); k++)
503 for(
index_t j=0; j < z.rows(); ++j )
505 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
506 result(0,j * u.cols() + k) = math::sqrt(m_data.mine().m_J0_sq*1.0);
512template <
short_t dim,
class T>
515 this->_computePoints(patch,u);
519 for (
index_t k=0; k!=u.cols(); k++)
521 for(
index_t j=0; j < z.rows(); ++j )
523 colIdx = j * u.cols() + k;
524 this->_getMetric(k, z(j, k) * m_data.mine().m_Tmat(0, k));
525 detF = math::sqrt(m_data.mine().m_J0_sq*1.0);
526 result.col(colIdx) /= detF;
538template <
short_t dim,
class T>
541 GISMO_ENSURE( ( (i < 2) && (j < 2) && (k < 2) && (l < 2) ) ,
"Index out of range. i="<<i<<
", j="<<j<<
", k="<<k<<
", l="<<l);
547 T lambda, mu, Cconstant;
549 mu = m_data.mine().m_parvals.at(0) / (2.*(1. + m_data.mine().m_parvals.at(1)));
550 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));
551 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))) ;
552 Cconstant = 2*lambda*mu/(lambda+2*mu);
554 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));
557template <
short_t dim,
class T>
560 T result = _Cijkl(i,j,0,0) * strain(0,0) + _Cijkl(i,j,0,1) * strain(0,1)
561 + _Cijkl(i,j,1,0) * strain(1,0) + _Cijkl(i,j,1,1) * strain(1,1);
565template <
short_t dim,
class T>
568 gsWarn<<
"This is dangerous, since it does not compute material parameters in advance!\n";
569 GISMO_ASSERT(strain.rows()==strain.cols() && strain.rows()==2,
"Strain tensor must be 2x2!");
573 result(i,j) = _Cijkl(i,j,0,0) * strain(0,0) + _Cijkl(i,j,0,1) * strain(0,1)
574 + _Cijkl(i,j,1,0) * strain(1,0) + _Cijkl(i,j,1,1) * strain(1,1);
579template <
short_t dim,
class T>
580gsMatrix<T> gsMaterialMatrixLinear<dim,T>::C(
const gsMatrix<T> &)
const
582 gsMatrix<T> result(2,2);
583 result(0,0) = _Cijkl(0,0,0,0);
584 result(1,1) = _Cijkl(1,1,1,1);
585 result(2,2) = _Cijkl(0,1,0,1);
586 result(1,0) = result(0,1) = _Cijkl(0,0,1,1);
587 result(2,0) = result(0,2) = _Cijkl(0,0,0,1);
588 result(2,1) = result(1,2) = _Cijkl(1,1,0,1);
592template <
short_t dim,
class T>
596 if ( out == MaterialOutput::VectorN ||
597 out == MaterialOutput::CauchyVectorN ||
598 out == MaterialOutput::StrainN ||
599 out == MaterialOutput::StressN ||
600 out == MaterialOutput::CauchyStressN ||
601 out == MaterialOutput::PStrainN ||
602 out == MaterialOutput::PStressN ||
603 out == MaterialOutput::PCauchyStressN ||
604 out == MaterialOutput::TensionField ||
605 out == MaterialOutput::StrainN )
606 strain = 0.5*(m_data.mine().m_Acov_def - m_data.mine().m_Acov_ori);
607 else if ( out == MaterialOutput::VectorM ||
608 out == MaterialOutput::CauchyVectorM ||
609 out == MaterialOutput::StressM ||
610 out == MaterialOutput::CauchyStressM ||
611 out == MaterialOutput::StrainM ||
612 out == MaterialOutput::PStrainM ||
613 out == MaterialOutput::PStressM ||
614 out == MaterialOutput::PCauchyStressM ||
615 out == MaterialOutput::StrainM )
616 strain = (m_data.mine().m_Bcov_ori - m_data.mine().m_Bcov_def);
617 else if ( out == MaterialOutput::Generic ||
618 out == MaterialOutput::Strain ||
619 out == MaterialOutput::Stress ||
620 out == MaterialOutput::PStress )
621 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));
623 GISMO_ERROR(
"Output type MaterialOutput::" + std::to_string((
short_t)(out)) +
" not understood. See gsMaterialMatrixUtils.h");
652template<
short_t d,
class T>
657 typedef gsMaterialMatrixLinear<d,T> Object;
660 GSXML_COMMON_FUNCTIONS(gsMaterialMatrixLinear<TMPLA2(d,T)>);
661 static std::string tag () {
return "MaterialMatrix"; }
662 static std::string type () {
return "Linear" +
to_string(d); }
664 GSXML_GET_POINTER(Object);
673 static void get_into(gsXmlNode * node,Object & obj)
675 obj = getMaterialMatrixFromXml< Object >( node );
678 static gsXmlNode * put (
const Object & obj,
681 return putMaterialMatrixToXml< Object >( obj,data );
Creates a mapped object or data pointer to a matrix without copying data.
Definition gsAsMatrix.h:32
Interface for the set of functions defined on a domain (the total number of functions in the set equa...
Definition gsFunctionSet.h:219
This class defines the base class for material matrices.
Definition gsMaterialMatrixBaseDim.h:37
virtual void setParameters(const std::vector< function_ptr > &pars)
Sets the material parameters.
Definition gsMaterialMatrixBase.h:684
This class defines a linear material.
Definition gsMaterialMatrixLinear.h:38
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:306
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:218
virtual 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:513
void _initialize()
Initializes the object.
Definition gsMaterialMatrixLinear.hpp:171
void setYoungsModulus(const gsFunctionSet< T > &YoungsModulus) override
Sets the YoungsModulus.
Definition gsMaterialMatrixLinear.h:218
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:558
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:395
void defaultOptions() override
See gsMaterialMatrixBase for details.
Definition gsMaterialMatrixLinear.hpp:164
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:496
std::ostream & print(std::ostream &os) const override
See gsMaterialMatrixBase for details.
Definition gsMaterialMatrixLinear.hpp:150
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:312
gsMatrix< T > _E(const T z, enum MaterialOutput out) const
Computes the strain tensor.
Definition gsMaterialMatrixLinear.hpp:593
gsMaterialMatrixLinear()
Empty constructor.
Definition gsMaterialMatrixLinear.hpp:30
void setPoissonsRatio(const gsFunctionSet< T > &PoissonsRatio) override
Sets the Poisson's Ratio.
Definition gsMaterialMatrixLinear.h:224
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:461
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:318
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:362
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:255
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:178
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:428
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
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
gsAsMatrix< T, Dynamic, Dynamic > reshape(index_t n, index_t m)
Returns the matrix resized to n x m matrix (data is not copied) This function assumes that the matrix...
Definition gsMatrix.h:221
T at(index_t i) const
Returns the i-th element of the vectorization of the matrix.
Definition gsMatrix.h:211
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
MaterialOutput
This class describes the output type.
Definition gsMaterialMatrixUtils.h:99
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_ERROR(message)
Definition gsDebug.h:118
#define gsWarn
Definition gsDebug.h:50
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
std::string to_string(const unsigned &i)
Helper to convert small unsigned to string.
Definition gsXml.cpp:74
The G+Smo namespace, containing all definitions for the library.