1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/constltp_axw.h,v 1.4 2017/01/12 14:46:09 masarati Exp $ */ 2 /* 3 * MBDyn (C) is a multibody analysis code. 4 * http://www.mbdyn.org 5 * 6 * Copyright (C) 1996-2017 7 * 8 * Pierangelo Masarati <masarati@aero.polimi.it> 9 * Paolo Mantegazza <mantegazza@aero.polimi.it> 10 * 11 * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano 12 * via La Masa, 34 - 20156 Milano, Italy 13 * http://www.aero.polimi.it 14 * 15 * Changing this copyright notice is forbidden. 16 * 17 * This program is free software; you can redistribute it and/or modify 18 * it under the terms of the GNU General Public License as published by 19 * the Free Software Foundation (version 2 of the License). 20 * 21 * 22 * This program is distributed in the hope that it will be useful, 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 * GNU General Public License for more details. 26 * 27 * You should have received a copy of the GNU General Public License 28 * along with this program; if not, write to the Free Software 29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 */ 31 32 /* Legami costitutivi */ 33 34 #ifndef CONSTLTP_AXW_H 35 #define CONSTLTP_AXW_H 36 37 #include "constltp_impl.h" 38 39 /* AxialCLWrapper - begin */ 40 41 class AxialCLWrapper 42 : public ConstitutiveLaw<Vec3, Mat3x3> { 43 private: 44 ConstitutiveLaw<doublereal, doublereal> *m_pCL; 45 const Vec3 m_v; 46 Vec3 m_F_0; 47 Mat3x3 m_FDE_0; 48 49 public: AxialCLWrapper(ConstitutiveLaw<doublereal,doublereal> * pCL,const Vec3 & v)50 AxialCLWrapper(ConstitutiveLaw<doublereal, doublereal> *pCL, const Vec3& v) 51 : m_pCL(pCL), m_v(v), m_F_0(v), m_FDE_0(v.Tens()) 52 { 53 NO_OP; 54 }; 55 56 virtual ~AxialCLWrapper(void)57 ~AxialCLWrapper(void) { 58 NO_OP; 59 }; 60 GetConstLawType(void)61 ConstLawType::Type GetConstLawType(void) const { 62 return m_pCL->GetConstLawType(); 63 }; 64 65 virtual pCopy(void)66 ConstitutiveLaw<Vec3, Mat3x3>* pCopy(void) const { 67 ConstitutiveLaw<Vec3, Mat3x3>* pCL = 0; 68 69 SAFENEWWITHCONSTRUCTOR(pCL, 70 AxialCLWrapper, 71 AxialCLWrapper(m_pCL->pCopy(), m_v)); 72 73 return pCL; 74 }; 75 76 virtual std::ostream& Restart(std::ostream & out)77 Restart(std::ostream& out) const { 78 out << "axial wrap, " << m_v << ", "; 79 return m_pCL->Restart(out); 80 }; 81 82 virtual void 83 Update(const Vec3& Eps, const Vec3& EpsPrime = mb_zero<Vec3>()) { 84 ConstitutiveLaw<Vec3, Mat3x3>::Epsilon = Eps; 85 ConstitutiveLaw<Vec3, Mat3x3>::EpsilonPrime = EpsPrime; 86 87 m_pCL->Update(m_v*Eps, m_v*EpsPrime); 88 89 ConstitutiveLaw<Vec3, Mat3x3>::F = m_F_0*m_pCL->GetF(); 90 91 if (GetConstLawType() & ConstLawType::ELASTIC) { 92 ConstitutiveLaw<Vec3, Mat3x3>::FDE = m_FDE_0*m_pCL->GetFDE(); 93 } 94 95 if (GetConstLawType() & ConstLawType::VISCOUS) { 96 ConstitutiveLaw<Vec3, Mat3x3>::FDEPrime = m_FDE_0*m_pCL->GetFDEPrime(); 97 } 98 }; 99 100 virtual void AfterConvergence(const Vec3& Eps, const Vec3& EpsPrime = mb_zero<Vec3>()) { 101 m_pCL->AfterConvergence(m_v*Eps, m_v*EpsPrime); 102 }; 103 }; 104 105 struct AxialCLR : public ConstitutiveLawRead<Vec3, Mat3x3> { 106 virtual ConstitutiveLaw<Vec3, Mat3x3> * ReadAxialCLR107 Read(const DataManager* pDM, MBDynParser& HP, ConstLawType::Type& CLType) { 108 Vec3 v(HP.GetVec3()); 109 doublereal d = v.Norm(); 110 v /= d; 111 112 ConstitutiveLaw<Vec3, Mat3x3>* pCL = 0; 113 SAFENEWWITHCONSTRUCTOR(pCL, 114 AxialCLWrapper, 115 AxialCLWrapper(HP.GetConstLaw1D(CLType), v)); 116 117 return pCL; 118 }; 119 }; 120 121 /* AxialCLWrapper - end */ 122 123 #endif // CONSTLTP_IMPL_H 124