//send back the tangent const XC::Matrix &XC::PlateFiberMaterial::getTangent(void) const { static XC::Matrix dd11(5,5); static XC::Matrix dd12(5,1); static XC::Matrix dd21(1,5); static XC::Matrix dd22(1,1); static XC::Matrix dd22invdd21(1,5); static XC::Matrix threeDtangentCopy(6,6); const XC::Matrix &threeDtangent = theMaterial->getTangent(); //swap matrix indices to sort out-of-plane components int i,j, ii, jj; for(i=0; i<6; i++) { ii = this->indexMap(i); for(j=0; j<6; j++) { jj = this->indexMap(j); threeDtangentCopy(ii,jj) = threeDtangent(i,j); }//end for j }//end for i dd22(0,0) = threeDtangentCopy(5,5); for(i=0; i<5; i++) { dd12(i,0) = threeDtangentCopy(i,5); dd21(0,i) = threeDtangentCopy(5,i); for(int j=0; j<5; j++) dd11(i,j) = threeDtangentCopy(i,j); }//end for i //int Solve(const XC::Vector &V, XC::Vector &res) const; //int Solve(const XC::Matrix &M, XC::Matrix &res) const; //condensation dd22.Solve(dd21, dd22invdd21); this->tangent = dd11; this->tangent -= (dd12*dd22invdd21); return this->tangent; }
const Matrix& BeamFiberMaterial::getInitialTangent() { const Matrix &threeDtangent = theMaterial->getInitialTangent(); static Matrix dd11(3,3); dd11(0,0) = threeDtangent(0,0); dd11(1,0) = threeDtangent(3,0); dd11(2,0) = threeDtangent(5,0); dd11(0,1) = threeDtangent(0,3); dd11(1,1) = threeDtangent(3,3); dd11(2,1) = threeDtangent(5,3); dd11(0,2) = threeDtangent(0,5); dd11(1,2) = threeDtangent(3,5); dd11(2,2) = threeDtangent(5,5); static Matrix dd12(3,3); dd12(0,0) = threeDtangent(0,1); dd12(1,0) = threeDtangent(3,1); dd12(2,0) = threeDtangent(5,1); dd12(0,1) = threeDtangent(0,2); dd12(1,1) = threeDtangent(3,2); dd12(2,1) = threeDtangent(5,2); dd12(0,2) = threeDtangent(0,4); dd12(1,2) = threeDtangent(3,4); dd12(2,2) = threeDtangent(5,4); static Matrix dd21(3,3); dd21(0,0) = threeDtangent(1,0); dd21(1,0) = threeDtangent(2,0); dd21(2,0) = threeDtangent(4,0); dd21(0,1) = threeDtangent(1,3); dd21(1,1) = threeDtangent(2,3); dd21(2,1) = threeDtangent(4,3); dd21(0,2) = threeDtangent(1,5); dd21(1,2) = threeDtangent(2,5); dd21(2,2) = threeDtangent(4,5); static Matrix dd22(3,3); dd22(0,0) = threeDtangent(1,1); dd22(1,0) = threeDtangent(2,1); dd22(2,0) = threeDtangent(4,1); dd22(0,1) = threeDtangent(1,2); dd22(1,1) = threeDtangent(2,2); dd22(2,1) = threeDtangent(4,2); dd22(0,2) = threeDtangent(1,4); dd22(1,2) = threeDtangent(2,4); dd22(2,2) = threeDtangent(4,4); //int Solve(const Vector &V, Vector &res) const; //int Solve(const Matrix &M, Matrix &res) const; //condensation static Matrix dd22invdd21(3,3); dd22.Solve(dd21, dd22invdd21); //this->tangent = dd11; //this->tangent -= (dd12*dd22invdd21); dd11.addMatrixProduct(1.0, dd12, dd22invdd21, -1.0); tangent = dd11; return tangent; }
const Vector& BeamFiberMaterial::getStressSensitivity(int gradIndex, bool conditional) { const Vector &threeDstress = theMaterial->getStressSensitivity(gradIndex, conditional); stress(0) = threeDstress(0); stress(1) = threeDstress(3); stress(2) = threeDstress(5); const Matrix &threeDtangent = theMaterial->getTangent(); static Matrix dd12(3,3); dd12(0,0) = threeDtangent(0,1); dd12(1,0) = threeDtangent(3,1); dd12(2,0) = threeDtangent(5,1); dd12(0,1) = threeDtangent(0,2); dd12(1,1) = threeDtangent(3,2); dd12(2,1) = threeDtangent(5,2); dd12(0,2) = threeDtangent(0,4); dd12(1,2) = threeDtangent(3,4); dd12(2,2) = threeDtangent(5,4); static Matrix dd22(3,3); dd22(0,0) = threeDtangent(1,1); dd22(1,0) = threeDtangent(2,1); dd22(2,0) = threeDtangent(4,1); dd22(0,1) = threeDtangent(1,2); dd22(1,1) = threeDtangent(2,2); dd22(2,1) = threeDtangent(4,2); dd22(0,2) = threeDtangent(1,4); dd22(1,2) = threeDtangent(2,4); dd22(2,2) = threeDtangent(4,4); static Vector sigma2(3); sigma2(0) = threeDstress(1); sigma2(1) = threeDstress(2); sigma2(2) = threeDstress(4); static Vector dd22sigma2(3); dd22.Solve(sigma2,dd22sigma2); stress.addMatrixVector(1.0, dd12, dd22sigma2, -1.0); return stress; }
//receive the strain int BeamFiberMaterial::setTrialStrain(const Vector &strainFromElement) { static const double tolerance = 1.0e-08; strain(0) = strainFromElement(0); strain(1) = strainFromElement(1); strain(2) = strainFromElement(2); //newton loop to solve for out-of-plane strains double norm; static Vector condensedStress(3); static Vector strainIncrement(3); static Vector threeDstrain(6); static Matrix dd22(3,3); int count = 0; const int maxCount = 20; double norm0; do { //set three dimensional strain threeDstrain(0) = this->strain(0); threeDstrain(1) = this->Tstrain22; threeDstrain(2) = this->Tstrain33; threeDstrain(3) = this->strain(1); threeDstrain(4) = this->Tgamma23; threeDstrain(5) = this->strain(2); if (theMaterial->setTrialStrain(threeDstrain) < 0) { opserr << "BeamFiberMaterial::setTrialStrain - setStrain failed in material with strain " << threeDstrain; return -1; } //three dimensional stress const Vector &threeDstress = theMaterial->getStress(); //three dimensional tangent const Matrix &threeDtangent = theMaterial->getTangent(); //NDmaterial strain order = 11, 22, 33, 12, 23, 31 //BeamFiberMaterial strain order = 11, 12, 31, 22, 33, 23 condensedStress(0) = threeDstress(1); condensedStress(1) = threeDstress(2); condensedStress(2) = threeDstress(4); dd22(0,0) = threeDtangent(1,1); dd22(1,0) = threeDtangent(2,1); dd22(2,0) = threeDtangent(4,1); dd22(0,1) = threeDtangent(1,2); dd22(1,1) = threeDtangent(2,2); dd22(2,1) = threeDtangent(4,2); dd22(0,2) = threeDtangent(1,4); dd22(1,2) = threeDtangent(2,4); dd22(2,2) = threeDtangent(4,4); //set norm norm = condensedStress.Norm(); if (count == 0) norm0 = norm; //condensation dd22.Solve(condensedStress, strainIncrement); //update out of plane strains this->Tstrain22 -= strainIncrement(0); this->Tstrain33 -= strainIncrement(1); this->Tgamma23 -= strainIncrement(2); } while (count++ < maxCount && norm > tolerance); return 0; }
const Matrix& BeamFiberMaterial2d::getInitialTangent() { static Matrix dd11(2,2); static Matrix dd12(2,4); static Matrix dd21(4,2); static Matrix dd22(4,4); static Matrix dd22invdd21(4,4); static Matrix threeDtangentCopy(6,6); const Matrix &threeDtangent = theMaterial->getInitialTangent(); //swap matrix indices to sort out-of-plane components int i, j , ii, jj; for (i=0; i<6; i++) { ii = this->indexMap(i); for (j=0; j<6; j++) { jj = this->indexMap(j); threeDtangentCopy(ii,jj) = threeDtangent(i,j); }//end for j }//end for i for (i=0; i<3; i++) { for (j=0; j<3; j++) { //dd11(i,j) = threeDtangentCopy(i, j ); //dd12(i,j) = threeDtangentCopy(i, j+3); //dd21(i,j) = threeDtangentCopy(i+3,j ); //dd22(i,j) = threeDtangentCopy(i+3,j+3); } } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) dd11(i,j) = threeDtangentCopy(i,j); for (i = 0; i < 2; i++) for (j = 0; j < 4; j++) dd12(i,j) = threeDtangentCopy(i,j+2); for (i = 0; i < 4; i++) for (j = 0; j < 2; j++) dd21(i,j) = threeDtangentCopy(i+2,j); for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) dd22(i,j) = threeDtangentCopy(i+2,j+2); //int Solve(const Vector &V, Vector &res) const; //int Solve(const Matrix &M, Matrix &res) const; //condensation dd22.Solve(dd21, dd22invdd21); this->tangent = dd11; this->tangent -= (dd12*dd22invdd21); return this->tangent; }