00001
00012 #ifndef _ELASTIC_TRUSS_2D_BASSO_H_
00013 #define _ELASTIC_TRUSS_2D_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 ElasticTruss2D : public StructuralFormulation {
00034
00035 public:
00036
00037
00038
00039
00043 ElasticTruss2D( 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 = 2;
00048 this->fMat = material;
00049 Initialize(a);
00050 CheckElements();
00051 }
00052
00053 ~ElasticTruss2D() { }
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 ElasticTruss2D::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;
00087 ke(0,0)=k*ls*ls; ke(0,1)=k*ls*ms; ke(0,2)=-ke(0,0); ke(0,4)=-ke(0,1);
00088 ke(1,0)=ke(0,1); ke(1,1)=k*ms*ms; ke(1,3)=-ke(1,0); ke(1,4)=-ke(1,1);
00089 ke(2,0)=ke(0,2); ke(2,1)=ke(1,2); ke(2,2)= ke(0,0); ke(2,3)= ke(0,1);
00090 ke(3,0)=ke(0,3); ke(3,1)=ke(1,3); ke(3,2)= ke(2,3); ke(3,3)= ke(1,1);
00091 }
00092
00093 void ElasticTruss2D::GetElementMassMatrix( nMatrix &me, list<Element>::const_iterator eItr )
00094 {
00095 Numeric L=sqrt( pow(x2-x1,2) + pow(y2-y1,2) + pow(z2-z1,2) );
00096 Numeric mn=0.5*mArea*L*fMat->Density();
00097
00098 me(0,0)=mn/3; me(0,1)=0.0; me(0,2)=mn/6; me(0,3)=0.0;
00099 me(1,0)=0.0; me(1,1)=me(0,0); me(1,2)=0.0; me(1,3)=me(0,2);
00100 me(2,0)=me(0,2); me(2,1)=0.0; me(2,2)=me(0,0); me(2,3)=0.0;
00101 me(3,0)=0.0; me(3,1)=me(0,2); me(3,2)=0.0; me(3,3)=me(0,0);
00102 }
00103
00104 void ElasticTruss2D::Initialize( const Numeric a )
00105 {
00106 this->mArea = a;
00107 resize( this->activeLocalDofs, this->mSdim );
00108 this->activeLocalDofs[0]=kDISPx;
00109 this->activeLocalDofs[1]=kDISPy;
00110 }
00111
00112 void ElasticTruss2D::CheckElements() const
00113 {
00114 list< Element >::const_iterator eItr;
00115 for ( eItr=this->fElement->begin(); eItr!=this->fElement->end(); ++eItr )
00116 if ( eItr->Type()!=kLINE2 )
00117 WarningMessage("ElasticTruss2D",
00118 "Elements must be kLINE2; other elements will be ignored");
00119 }
00120
00121
00122
00123 }
00124
00125 #endif