1 /*!
2  * \file   StiffnessTensor.hxx
3  * \brief
4  * \author Thomas Helfer
5  * \date   23 oct. 2014
6  * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights
7  * reserved.
8  * This project is publicly released under either the GNU GPL Licence
9  * or the CECILL-A licence. A copy of thoses licences are delivered
10  * with the sources of TFEL. CEA or EDF may also distribute this
11  * project under specific licensing conditions.
12  */
13 
14 #ifndef LIB_TFEL_MATERIAL_STIFFNESSTENSOR_HXX
15 #define LIB_TFEL_MATERIAL_STIFFNESSTENSOR_HXX
16 
17 #include"TFEL/Config/TFELConfig.hxx"
18 #include"TFEL/Math/st2tost2.hxx"
19 #include"TFEL/Material/ModellingHypothesis.hxx"
20 #include"TFEL/Material/OrthotropicAxesConvention.hxx"
21 
22 namespace tfel{
23 
24   namespace material{
25 
26     //! a small enumerattion
27     enum struct StiffnessTensorAlterationCharacteristic{
28       UNALTERED,
29       ALTERED
30     }; // end of enum struct StiffnessTensorAlterationCharacteristic
31 
32     /*!
33      * a simple metafunction which returns the more naturel stiffness
34      * tensor alteration characteristic for a given hypothesis
35      * \tparam H: modelling hypothesis
36      */
37     template<ModellingHypothesis::Hypothesis H>
38     struct GetDefaultStiffnessTensorAlterationCharacteristic
39     {
40       static constexpr const auto value =
41 	StiffnessTensorAlterationCharacteristic::UNALTERED;
42     };
43 
44     template<>
45     struct GetDefaultStiffnessTensorAlterationCharacteristic<ModellingHypothesis::PLANESTRESS>
46     {
47       static constexpr const auto value =
48 	StiffnessTensorAlterationCharacteristic::ALTERED;
49     };
50 
51     template<>
52     struct GetDefaultStiffnessTensorAlterationCharacteristic<ModellingHypothesis::AXISYMMETRICALGENERALISEDPLANESTRESS>
53     {
54       static constexpr const auto value =
55 	StiffnessTensorAlterationCharacteristic::ALTERED;
56     };
57 
58     /*!
59      * \brief compute the altered stiffness tensor from the unaltered
60      * one.
61      */
62     template<ModellingHypothesis::Hypothesis H>
63     struct ComputeAlteredStiffnessTensor
64     {
65       /*!
66        * \param[out] Da : altered stiffness
67        * \param[in]  D  : unaltered stiffness
68        */
69       template<typename StressType>
70       static TFEL_MATERIAL_INLINE void
71       exe(tfel::math::st2tost2<ModellingHypothesisToSpaceDimension<H>::value,StressType>&,
72 	  const tfel::math::st2tost2<ModellingHypothesisToSpaceDimension<H>::value,StressType>&);
73     };
74     /*!
75      * \brief compute the altered stiffness tensor from the unaltered
76      * one in plane stress.
77      */
78     template<>
79     struct ComputeAlteredStiffnessTensor<ModellingHypothesis::PLANESTRESS>
80     {
81       /*!
82        * \param[out] Da : altered stiffness
83        * \param[in]  D  : unaltered stiffness
84        */
85       template<typename StressType>
86       static TFEL_MATERIAL_INLINE void
87       exe(tfel::math::st2tost2<2u,StressType>&,
88 	  const tfel::math::st2tost2<2u,StressType>&);
89     };
90 
91     /*!
92      * \param[out] D:  stiffness tensor
93      * \param[in]  yg: young modulus
94      * \param[in]  nu: poisson ratio
95      */
96     template<unsigned short N,StiffnessTensorAlterationCharacteristic,
97 	     typename StressType,typename RealType>
98     TFEL_MATERIAL_INLINE void
99     computeIsotropicStiffnessTensorII(tfel::math::st2tost2<N,StressType>&,
100 				      const StressType,
101 				      const RealType);
102     /*!
103      * \param[out] D: stiffness tensor
104      * \param[in]  yg1:  young modulus in the first direction
105      * \param[in]  yg2:  young modulus in the second direction
106      * \param[in]  yg3:  young modulus in the third direction
107      * \param[in]  nu12: PoissonRatio
108      * \param[in]  nu23: PoissonRatio
109      * \param[in]  nu13: PoissonRatio
110      * \param[in]  G12:  shear modulus
111      * \param[in]  G23:  shear modulus
112      * \param[in]  G13:  shear modulus
113      */
114     template<unsigned short N,StiffnessTensorAlterationCharacteristic,
115 	     typename StressType,typename RealType>
116     TFEL_MATERIAL_INLINE void
117     computeOrthotropicStiffnessTensorII(tfel::math::st2tost2<N,StressType>&,
118 					const StressType,const StressType,const StressType,
119 					const RealType,const RealType,const RealType,
120 					const StressType,const StressType,const StressType);
121 
122     /*!
123      * \param[out] D:  stiffness tensor
124      * \param[in]  yg: young modulus
125      * \param[in]  nu: poisson ratio
126      */
127     template<ModellingHypothesis::Hypothesis H,
128 	     StiffnessTensorAlterationCharacteristic,
129 	     typename StressType,typename RealType>
130     TFEL_MATERIAL_INLINE void
131     computeIsotropicStiffnessTensor(tfel::math::st2tost2<ModellingHypothesisToSpaceDimension<H>::value,StressType>&,
132 				    const StressType,
133 				    const RealType);
134     /*!
135      * \param[out] D: stiffness tensor
136      * \param[in]  yg1:  young modulus in the first direction
137      * \param[in]  yg2:  young modulus in the second direction
138      * \param[in]  yg3:  young modulus in the third direction
139      * \param[in]  nu12: PoissonRatio
140      * \param[in]  nu23: PoissonRatio
141      * \param[in]  nu13: PoissonRatio
142      * \param[in]  G12:  shear modulus
143      * \param[in]  G23:  shear modulus
144      * \param[in]  G13:  shear modulus
145      */
146     template<ModellingHypothesis::Hypothesis H,
147 	     StiffnessTensorAlterationCharacteristic,
148 	     typename StressType,typename RealType>
149     TFEL_MATERIAL_INLINE void
150     computeOrthotropicStiffnessTensor(tfel::math::st2tost2<ModellingHypothesisToSpaceDimension<H>::value,StressType>&,
151 				      const StressType,const StressType,const StressType,
152 				      const RealType,const RealType,const RealType,
153 				      const StressType,const StressType,const StressType);
154 
155 
156     /*!
157      * \param[out] D: stiffness tensor
158      * \param[in]  yg1:  young modulus in the first direction
159      * \param[in]  yg2:  young modulus in the second direction
160      * \param[in]  yg3:  young modulus in the third direction
161      * \param[in]  nu12: PoissonRatio
162      * \param[in]  nu23: PoissonRatio
163      * \param[in]  nu13: PoissonRatio
164      * \param[in]  G12:  shear modulus
165      * \param[in]  G23:  shear modulus
166      * \param[in]  G13:  shear modulus
167      */
168     template<ModellingHypothesis::Hypothesis H,
169 	     StiffnessTensorAlterationCharacteristic smt,
170 	     OrthotropicAxesConvention c,
171 	     typename StressType,typename RealType>
172     TFEL_MATERIAL_INLINE void
173     computeOrthotropicStiffnessTensor(tfel::math::st2tost2<ModellingHypothesisToSpaceDimension<H>::value,StressType>&,
174 				      const StressType,const StressType,const StressType,
175 				      const RealType,const RealType,const RealType,
176 				      const StressType,const StressType,const StressType);
177 
178   } // end of namespace material
179 
180 } // end of namespace tfel
181 
182 #include"TFEL/Material/StiffnessTensor.ixx"
183 
184 #endif /* LIB_TFEL_MATERIAL_STIFFNESSTENSOR_HXX */
185