00001
00012 #ifndef _ELASTIC_TRUSS_3D_BASSO_H_
00013 #define _ELASTIC_TRUSS_3D_BASSO_H_
00014
00015
00016
00017
00018 #include "basso.h"
00019 #include "StructuralFormulation.h"
00020 #include "MatElastic.h"
00021 #include "basic_fem_operations.h"
00022
00023 namespace basso {
00024
00025
00026
00033 class ElasticTruss3D : public StructuralFormulation {
00034
00035 public:
00036
00037
00038
00039
00043 ElasticTruss3D( list< Element > &elem, const Array< Node > &nodes, DofMap &dofmap,
00044 const Material *material, const Numeric a )
00045 : StructuralFormulation( elem, nodes, dofmap, kSTRESS1D )
00046 {
00047 this->mSdim = 3;
00048 this->fMat = material;
00049 Initialize(a);
00050 CheckElements();
00051 }
00052
00053 ~ElasticTruss3D() { }
00054
00055
00056
00057
00058
00059
00060 protected:
00062 virtual void GetElementStiffnessMatrix( nMatrix &ke, list<Element>::const_iterator eItr );
00063
00065 virtual void GetElementMassMatrix( nMatrix &me, list<Element>::const_iterator eItr );
00066
00069 void CheckElements() const;
00070
00071 virtual void Initialize( const Numeric a );
00072
00073 private:
00074 Numeric mArea;
00075
00076 };
00077
00078 void ElasticTruss3D::GetElementStiffnessMatrix( nMatrix &ke, list<Element>::const_iterator eItr )
00079 {
00080 Numeric x1=this->fNode[ eItr->Node(0) ].x(), x2=this->fNode[ eItr->Node(1) ].x(),
00081 y1=this->fNode[ eItr->Node(0) ].y(), y2=this->fNode[ eItr->Node(1) ].y(),
00082 z1=this->fNode[ eItr->Node(0) ].z(), z2=this->fNode[ eItr->Node(1) ].z();
00083 Numeric L=sqrt( pow(x2-x1,2) + pow(y2-y1,2) + pow(z2-z1,2) );
00084 Numeric k=mArea*fMat->YoungsModulus()/L;
00085
00086 Numeric ls=(x2-x1)/L, ms=(y2-y1)/L, ns=(z2-z1)/L;
00087 ke(0,0)=k*ls*ls; ke(0,1)=k*ls*ms; ke(0,2)=k*ls*ns; ke(0,3)=-k(0,0); ke(0,4)=-ke(0,1); ke(0,5)=-ke(0,2);
00088 ke(1,0)=ke(0,1); ke(1,1)=k*ms*ms; ke(1,2)=k*ms*ns; ke(1,3)=-k(1,0); ke(1,4)=-ke(1,1); ke(1,5)=-ke(1,2);
00089 ke(2,0)=ke(0,2); ke(2,1)=ke(1,2); ke(2,2)=k*ns*ns; ke(2,3)=-k(2,0); ke(2,4)=-ke(2,1); ke(2,5)=-ke(2,2);
00090 ke(3,0)=ke(0,3); ke(3,1)=ke(1,3); ke(3,2)=ke(2,3); ke(3,3)= k(0,0); ke(3,4)= ke(0,1); ke(3,5)= ke(0,2);
00091 ke(4,0)=ke(0,4); ke(4,1)=ke(1,4); ke(4,2)=ke(2,4); ke(4,3)= k(3,4); ke(4,4)= ke(1,1); ke(4,5)= ke(1,2);
00092 ke(5,0)=ke(0,5); ke(5,1)=ke(1,5); ke(5,2)=ke(2,5); ke(5,3)= k(3,5); ke(5,4)= ke(4,5); ke(5,5)= ke(2,2);
00093
00094 }
00095
00096 void ElasticTruss3D::GetElementMassMatrix( nMatrix &me, list<Element>::const_iterator eItr )
00097 {
00098 Numeric L=sqrt( pow(x2-x1,2) + pow(y2-y1,2) + pow(z2-z1,2) );
00099 Numeric mn=0.5*mArea*L*fMat->Density();
00100
00101 me(0,0)=mn/3; me(0,1)=0.0; me(0,2)=0.0; me(0,3)=mn/6; me(0,4)=0.0; me(0,5)=0.0;
00102 me(1,0)=0.0; me(1,1)=me(0,0); me(1,2)=0.0; me(1,3)=0.0; me(1,4)=me(0,2); me(1,5)=0.0;
00103 me(2,0)=0.0; me(2,1)=0.0; me(2,2)=me(0,0); me(2,3)=0.0; me(2,4)=0.0; me(2,5)=me(0,2);
00104 me(3,0)=me(0,2); me(3,1)=0.0; me(3,2)=0.0; me(3,3)=me(0,0); me(3,4)=0.0; me(3,5)=0.0;
00105 me(4,0)=0.0; me(4,1)=me(0,2); me(4,2)=0.0; me(4,3)=0.0; me(4,4)=me(0,0); me(4,5)=0.0;
00106 me(5,0)=0.0; me(5,1)=0.0; me(5,2)=me(0,2); me(5,3)=0.0; me(5,4)=0.0; me(5,5)=me(0,0);
00107
00108 }
00109
00110 void ElasticTruss3D::Initialize( const Numeric a )
00111 {
00112 this->mArea = a;
00113 resize( this->activeLocalDofs, this->mSdim );
00114 this->activeLocalDofs[0]=kDISPx;
00115 this->activeLocalDofs[1]=kDISPy;
00116 this->activeLocalDofs[2]=kDISPz;
00117 }
00118
00119 void ElasticTruss3D::CheckElements() const
00120 {
00121 list< Element >::const_iterator eItr;
00122 for ( eItr=this->fElement->begin(); eItr!=this->fElement->end(); ++eItr )
00123 if ( eItr->Type()!=kLINE2 )
00124 WarningMessage("ElasticTruss3D","Elements must be kLINE2; other elements will be ignored");
00125 }
00126
00127
00128
00129 }
00130
00131 #endif