int TimoshenkoSection3d::setTrialSectionDeformation (const Vector &deforms) { int res = 0; e = deforms; kData[0] = 0.0; kData[1] = 0.0; kData[2] = 0.0; kData[3] = 0.0; kData[4] = 0.0; kData[5] = 0.0; kData[6] = 0.0; kData[7] = 0.0; kData[8] = 0.0; sData[0] = 0.0; sData[1] = 0.0; sData[2] = 0.0; int loc = 0; double d0 = deforms(0); double d1 = deforms(1); double d2 = deforms(2); for (int i = 0; i < numFibers; i++) { NDMaterial *theMat = theMaterials[i]; double y = matData[loc++] - yBar; double z = matData[loc++] - zBar; double A = matData[loc++]; // determine material strain and set it double strain = d0 + y*d1 + z*d2; Vector eps(3); eps(0) = strain; res = theMat->setTrialStrain(eps); const Vector &stress = theMat->getStress(); const Matrix &tangent = theMat->getTangent(); double value = tangent(0,0) * A; double vas1 = y*value; double vas2 = z*value; double vas1as2 = vas1*z; kData[0] += value; kData[1] += vas1; kData[2] += vas2; kData[4] += vas1 * y; kData[5] += vas1as2; kData[8] += vas2 * z; double fs0 = stress(0) * A; sData[0] += fs0; sData[1] += fs0 * y; sData[2] += fs0 * z; } kData[3] = kData[1]; kData[6] = kData[2]; kData[7] = kData[5]; return res; }
int TimoshenkoSection3d::revertToStart(void) { // revert the fibers to start int err = 0; kData[0] = 0.0; kData[1] = 0.0; kData[2] = 0.0; kData[3] = 0.0; kData[4] = 0.0; kData[5] = 0.0; kData[6] = 0.0; kData[7] = 0.0; kData[8] = 0.0; sData[0] = 0.0; sData[1] = 0.0; sData[2] = 0.0; int loc = 0; for (int i = 0; i < numFibers; i++) { NDMaterial *theMat = theMaterials[i]; double y = matData[loc++] - yBar; double z = matData[loc++] - zBar; double A = matData[loc++]; // invoke revertToStart on the material err += theMat->revertToStart(); const Matrix &tangent = theMat->getTangent(); const Vector &stress = theMat->getStress(); double value = tangent(0,0) * A; double vas1 = y*value; double vas2 = z*value; double vas1as2 = vas1*z; kData[0] += value; kData[1] += vas1; kData[2] += vas2; kData[4] += vas1 * y; kData[5] += vas1as2; kData[8] += vas2 * z; double fs0 = stress(0) * A; sData[0] += fs0; sData[1] += fs0 * y; sData[2] += fs0 * z; } kData[3] = kData[1]; kData[6] = kData[2]; kData[7] = kData[5]; return err; }
double TzLiq1::getEffectiveStress(void) { // Default value for meanStress double meanStress = meanConsolStress; // if theDomain pointer is nonzero, then set pointers to attached soil elements. // if(theDomain != 0) { Element *theElement1 = theDomain->getElement(solidElem1); Element *theElement2 = theDomain->getElement(solidElem2); if (theElement1 == 0 || theElement2 == 0) { opserr << "WARNING solid element not found in getEffectiveStress" << endln; opserr << "TzLiq1: " << endln; opserr << "Adjacent solidElems: " << solidElem1 << ", " << solidElem2 << endln; exit(-1); } // Check that the class tags for the solid elements are either for a FourNodeQuad object, a FourNodeQuadUP object, // a 9_4_QuadUP object, a SSPquadUP object, or a SSPquad object if(theElement1->getClassTag()!=ELE_TAG_FourNodeQuad && theElement1->getClassTag()!=ELE_TAG_FourNodeQuadUP && theElement1->getClassTag()!=ELE_TAG_Nine_Four_Node_QuadUP && theElement1->getClassTag()!=ELE_TAG_SSPquadUP && theElement1->getClassTag()!=ELE_TAG_SSPquad) { opserr << "Element: " << theElement1->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } if(theElement2->getClassTag()!=ELE_TAG_FourNodeQuad && theElement2->getClassTag()!=ELE_TAG_FourNodeQuadUP && theElement2->getClassTag()!=ELE_TAG_Nine_Four_Node_QuadUP && theElement2->getClassTag()!=ELE_TAG_SSPquadUP && theElement2->getClassTag()!=ELE_TAG_SSPquad) { opserr << "Element: " << theElement2->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } double excessPorePressure = 0.0; meanStress = 0.0; // get mean stress from element1 if it is a FourNodeQuad object if(theElement1->getClassTag()==ELE_TAG_FourNodeQuad) { // It's safe to cast *theElement1 onto the FourNodeQuad class because we already // checked the class tags. FourNodeQuad *theElement1 = (FourNodeQuad *)(theDomain->getElement(solidElem1)); // If the element is a quad, check that the class tag for the material at each gauss point is 100 for FluidSolidPorous object meanStress = 0.0; for(int i=0;i<4;i++) { NDMaterial *NDM = theElement1->theMaterial[i]; if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM); meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure); } } // get mean stress from element2 if it is a FourNodeQuad object if(theElement2->getClassTag()==ELE_TAG_FourNodeQuad) { // It's safe to cast *theElement1 onto the FourNodeQuad class because we already // checked the class tags. FourNodeQuad *theElement2 = (FourNodeQuad *)(theDomain->getElement(solidElem2)); for(int i=0;i<4;i++) { NDMaterial *NDM = theElement2->theMaterial[i]; if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM); meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure); } } // get mean stress from element1 if it is a FourNodeQuadUP object if(theElement1->getClassTag()==ELE_TAG_FourNodeQuadUP) { // It's safe to cast *theElement1 onto the FourNodeQuadUP class because we already checked the class tags. FourNodeQuadUP *theElement1 = (FourNodeQuadUP *)(theDomain->getElement(solidElem1)); meanStress=0.0; for(int i=0;i<4;i++) { NDMaterial *NDM = theElement1->theMaterial[i]; if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) { InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement1->theMaterial); if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } } else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]); } } // get mean stress from element 2 if it is a FourNodeQuadUP object if(theElement2->getClassTag()==ELE_TAG_FourNodeQuadUP) { // It's safe to cast *theElement2 onto the FourNodeQuadUP class because we already checked the class tags. FourNodeQuadUP *theElement2 = (FourNodeQuadUP *)(theDomain->getElement(solidElem2)); for(int i=0;i<4;i++) { NDMaterial *NDM = theElement2->theMaterial[i]; if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) { InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement2->theMaterial); if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } } else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]); } } // get mean stress from element1 if it is a 9_4_QuadUP object if(theElement1->getClassTag()==ELE_TAG_Nine_Four_Node_QuadUP) { // It's safe to cast *theElement1 onto the 9_4_QuadUP class because we already checked the class tags. NineFourNodeQuadUP *theElement1 = (NineFourNodeQuadUP *)(theDomain->getElement(solidElem1)); meanStress=0.0; for(int i=0;i<9;i++) { NDMaterial *NDM = theElement1->theMaterial[i]; if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) { InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement1->theMaterial); if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } } else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } meanStress += 1.0/18.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]); } } // get mean stress from element2 if it is a 9_4_QuadUP object if(theElement2->getClassTag()==ELE_TAG_Nine_Four_Node_QuadUP) { // It's safe to cast *theElement2 onto the 9_4_QuadUP class because we already checked the class tags. NineFourNodeQuadUP *theElement2 = (NineFourNodeQuadUP *)(theDomain->getElement(solidElem2)); for(int i=0;i<9;i++) { NDMaterial *NDM = theElement2->theMaterial[i]; if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) { InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement2->theMaterial); if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } } else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } meanStress += 1.0/18.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]); } } // get mean stress from element1 if it is a SSPquadUP object if(theElement1->getClassTag()==ELE_TAG_SSPquadUP) { // It's safe to cast *theElement1 onto the SSPquadUP class because we already checked the class tags. SSPquadUP *theElement1 = (SSPquadUP *)(theDomain->getElement(solidElem1)); meanStress = 0.0; NDMaterial *NDM = theElement1->theMaterial; if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) { InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement1->theMaterial); if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } } else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag()!=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]); } // get mean stress from element 2 if it is a SSPquadUP object if(theElement2->getClassTag()==ELE_TAG_SSPquadUP) { // It's safe to cast *theElement1 onto the SSPquadUP class because we already checked the class tags. SSPquadUP *theElement2 = (SSPquadUP *)(theDomain->getElement(solidElem2)); NDMaterial *NDM = theElement2->theMaterial; if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) { InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement2->theMaterial); if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) { opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } } else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag()!=ND_TAG_PressureDependMultiYield02){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]); } // get mean stress from element1 if it is a SSPquad object if(theElement1->getClassTag()==ELE_TAG_SSPquad) { // It's safe to cast *theElement1 onto the SSPquad class because we already checked the class tags. SSPquad *theElement1 = (SSPquad *)(theDomain->getElement(solidElem1)); // If the element is a SSPquad, check that the class tag for the material at each gauss point is FluidSolidPorous object meanStress = 0.0; NDMaterial *NDM = theElement1->theMaterial; if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM); meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure); } // get mean stress from element2 if it is a SSPquad object if(theElement2->getClassTag()==ELE_TAG_SSPquad) { // It's safe to cast *theElement2 onto the SSPquad class because we already checked the class tags. SSPquad *theElement2 = (SSPquad *)(theDomain->getElement(solidElem2)); // If the element is a SSPquad, check that the class tag for the material at each gauss point is FluidSolidPorous object NDMaterial *NDM = theElement2->theMaterial; if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){ opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln; exit(-1); } FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM); meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure); } } return meanStress; }