1 /*! 2 * \file AbaqusConvert.hxx 3 * \brief 4 * \author Thomas Helfer 5 * \date 22 mars 2016 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_MFRONT_ABAQUS_ABAQUSCONVERT_HXX 15 #define LIB_MFRONT_ABAQUS_ABAQUSCONVERT_HXX 16 17 #include"TFEL/Math/General/MathConstants.hxx" 18 19 namespace abaqus{ 20 21 /*! 22 * \brief class defining the convertion from abaqus to mfront for 23 * driving variables 24 * \tparam H: modelling hypothesis 25 */ 26 template<tfel::material::ModellingHypothesis::Hypothesis H> 27 struct UMATImportGradients 28 { 29 //! space dimension 30 static constexpr const unsigned short N = 31 tfel::material::ModellingHypothesisToSpaceDimension<H>::value; 32 /*! 33 * \tparam T: type of the thermodynamique forces 34 * \param[out] s: symmetric tensor to be filled 35 * \param[in] v: values 36 */ 37 template<typename T> 38 static inline void exeabaqus::UMATImportGradients39 exe(tfel::math::stensor<N,T>& e,const AbaqusReal* const v){ 40 e.importVoigt(v); 41 } // end of exe 42 /*! 43 * \tparam T: type of the thermodynamique forces 44 * \param[out] s: symmetric tensor to be filled 45 * \param[in] v: values 46 */ 47 template<typename T> 48 static inline void exeabaqus::UMATImportGradients49 exe(tfel::math::tensor<N,T>& F,const AbaqusReal* const v){ 50 tfel::math::tensor<N,T>::buildFromFortranMatrix(F,v); 51 } // end of exe 52 }; // end of struct UMATImportGradients 53 /*! 54 * \brief partial specialisation of the UMATImportGradients 55 * for the plane stress modelling hypothesis. 56 */ 57 template<> 58 struct UMATImportGradients<tfel::material::ModellingHypothesis::PLANESTRESS> 59 { 60 /*! 61 * \tparam T: type of the thermodynamique forces 62 * \param[out] s: symmetric tensor to be filled 63 * \param[in] v: values 64 */ 65 template<typename T> 66 static inline void exeabaqus::UMATImportGradients67 exe(tfel::math::stensor<2u,T>& e,const AbaqusReal* const v){ 68 constexpr const auto icste = tfel::math::Cste<AbaqusReal>::isqrt2; 69 e[0]=v[0]; 70 e[1]=v[1]; 71 e[2]=AbaqusReal{0}; 72 e[3]=v[2]*icste; 73 } // end of exe 74 /*! 75 * \tparam T: type of the thermodynamique forces 76 * \param[out] s: symmetric tensor to be filled 77 * \param[in] v: values 78 */ 79 template<typename T> 80 static inline void exeabaqus::UMATImportGradients81 exe(tfel::math::tensor<2u,T>& F,const AbaqusReal* const v){ 82 tfel::math::tensor<2u,T>::buildFromFortranMatrix(F,v); 83 } // end of exe 84 }; // end of struct UMATImportGradients 85 /*! 86 * \brief class defining the convertion from abaqus to mfront for 87 * thermodynamic forces 88 * \tparam H: modelling hypothesis 89 */ 90 template<tfel::material::ModellingHypothesis::Hypothesis H> 91 struct UMATImportThermodynamicForces 92 { 93 //! space dimension 94 static constexpr const unsigned short N = 95 tfel::material::ModellingHypothesisToSpaceDimension<H>::value; 96 /*! 97 * \tparam T: type of the thermodynamique forces 98 * \param[out] s: symmetric tensor to be filled 99 * \param[in] v: values 100 */ 101 template<typename T> 102 static inline void exeabaqus::UMATImportThermodynamicForces103 exe(tfel::math::stensor<N,T>& s,const AbaqusReal* const v){ 104 s.importTab(v); 105 } // end of exe 106 }; // end of struct UMATImportThermodynamicForces 107 /*! 108 * \brief partial specialisation of the UMATImportThermodynamicForces 109 * for the plane stress modelling hypothesis. 110 */ 111 template<> 112 struct UMATImportThermodynamicForces<tfel::material::ModellingHypothesis::PLANESTRESS> 113 { 114 /*! 115 * \tparam T: type of the thermodynamique forces 116 * \param[out] s: symmetric tensor to be filled 117 * \param[in] v: values 118 */ 119 template<typename T> 120 static inline void exeabaqus::UMATImportThermodynamicForces121 exe(tfel::math::stensor<2u,T>& s,const AbaqusReal* const v){ 122 constexpr const auto cste = tfel::math::Cste<AbaqusReal>::sqrt2; 123 s[0]=v[0]; 124 s[1]=v[1]; 125 s[2]=AbaqusReal{0}; 126 s[3]=v[2]*cste; 127 } // end of exe 128 }; // end of struct UMATImportThermodynamicForces 129 /*! 130 * \brief class defining the convertion from mfront to abaqus for 131 * thermodynamic forces 132 * \tparam H: modelling hypothesis 133 */ 134 template<tfel::material::ModellingHypothesis::Hypothesis H> 135 struct UMATExportThermodynamicForces 136 { 137 //! space dimension 138 static constexpr const unsigned short N = 139 tfel::material::ModellingHypothesisToSpaceDimension<H>::value; 140 /*! 141 * \tparam T: type of the thermodynamique forces 142 * \param[out] v: values 143 * \param[in] s: symmetric tensor to be exported 144 */ 145 template<typename T> 146 static inline void exeabaqus::UMATExportThermodynamicForces147 exe(AbaqusReal* const v,const tfel::math::stensor<N,T>& s){ 148 s.exportTab(v); 149 } // end of exe 150 }; // end of struct UMATExportThermodynamicForces 151 /*! 152 * \brief partial specialisation of the UMATExportThermodynamicForces 153 * for the plane stress modelling hypothesis. 154 */ 155 template<> 156 struct UMATExportThermodynamicForces<tfel::material::ModellingHypothesis::PLANESTRESS> 157 { 158 /*! 159 * \tparam T: type of the thermodynamique forces 160 * \param[out] v: values 161 * \param[in] s: symmetric tensor to be exported 162 */ 163 template<typename T> 164 static inline void exeabaqus::UMATExportThermodynamicForces165 exe(AbaqusReal* const v,const tfel::math::stensor<2u,T>& s){ 166 constexpr const auto icste = tfel::math::Cste<AbaqusReal>::isqrt2; 167 v[0]=s[0]; 168 v[1]=s[1]; 169 v[2]=s[3]*icste; 170 } // end of exe 171 }; // end of struct UMATExportThermodynamicForces 172 173 } // end of namespace abaqus 174 175 #endif /* LIB_MFRONT_ABAQUS_ABAQUSCONVERT_HXX */ 176