StaticSensitivityIntegrator.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 2001, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** Reliability module developed by:                                   **
00020 **   Terje Haukaas (haukaas@ce.berkeley.edu)                          **
00021 **   Armen Der Kiureghian (adk@ce.berkeley.edu)                       **
00022 **                                                                    **
00023 ** ****************************************************************** */
00024                                                                         
00025 // $Revision: 1.3 $
00026 // $Date: 2003/03/04 00:46:02 $
00027 // $Source: /usr/local/cvs/OpenSees/SRC/reliability/FEsensitivity/StaticSensitivityIntegrator.cpp,v $
00028 
00029 
00030 //
00031 // Written by Terje Haukaas (haukaas@ce.berkeley.edu)
00032 //
00033 
00034 #include <SensitivityIntegrator.h>
00035 #include <StaticSensitivityIntegrator.h>
00036 #include <FE_Element.h>
00037 #include <LinearSOE.h>
00038 #include <AnalysisModel.h>
00039 #include <Vector.h>
00040 #include <DOF_Group.h>
00041 #include <FE_EleIter.h>
00042 #include <DOF_GrpIter.h>
00043 #include <LoadPattern.h>
00044 #include <LoadPatternIter.h>
00045 #include <Domain.h>
00046 #include <Node.h>
00047 #include <DOF_Group.h>
00048 #include <classTags.h>
00049 
00050 
00051 StaticSensitivityIntegrator::StaticSensitivityIntegrator(AnalysisModel *theModel, LinearSOE *theLinSOE)
00052 :SensitivityIntegrator(), StaticIntegrator(INTEGRATOR_TAGS_StaticSensitivity),
00053 theAnalysisModel(theModel),theSOE(theLinSOE)
00054 {
00055 }
00056 
00057 
00058 StaticSensitivityIntegrator::~StaticSensitivityIntegrator()
00059 {
00060 }
00061 
00062 
00063 
00064 
00065 
00066 int
00067 StaticSensitivityIntegrator::formEleResidual(FE_Element *theEle)
00068 {
00069         theEle->zeroResidual();
00070         theEle->addResistingForceSensitivity(gradNumber); 
00071 
00072         return 0;
00073 }
00074 
00075 
00076 
00077 
00078 int 
00079 StaticSensitivityIntegrator::formIndependentSensitivityRHS()
00080 {
00081         // For now everything is done each time in the static case
00082         return 0;
00083 }
00084 
00085 
00086 int 
00087 StaticSensitivityIntegrator::formSensitivityRHS(int passedGradNumber)
00088 {
00089         // Set a couple of data members
00090         gradNumber = passedGradNumber;
00091 
00092 
00093         // Loop through elements
00094         FE_Element *elePtr;
00095         FE_EleIter &theEles = theAnalysisModel->getFEs();    
00096         while((elePtr = theEles()) != 0) {
00097                 theSOE->addB(  elePtr->getResidual(this),  elePtr->getID()  );
00098         }
00099 
00100         // Loop through the loadPatterns and add the dPext/dh contributions
00101         Vector oneDimVectorWithOne(1);
00102         oneDimVectorWithOne(0) = 1.0;
00103         ID oneDimID(1);
00104         Node *aNode;
00105         DOF_Group *aDofGroup;
00106         int nodeNumber, dofNumber, relevantID, i, sizeRandomLoads, numRandomLoads;
00107         LoadPattern *loadPatternPtr;
00108         Domain *theDomain = theAnalysisModel->getDomainPtr();
00109         LoadPatternIter &thePatterns = theDomain->getLoadPatterns();
00110     while((loadPatternPtr = thePatterns()) != 0) {
00111                 const Vector &randomLoads = loadPatternPtr->getExternalForceSensitivity(gradNumber);
00112                 sizeRandomLoads = randomLoads.Size();
00113                 if (sizeRandomLoads == 1) {
00114                         // No random loads in this load pattern
00115                 }
00116                 else {
00117                         // Random loads: add contributions to the 'B' vector
00118                         numRandomLoads = (int)(sizeRandomLoads/2);
00119                         for (i=0; i<numRandomLoads*2; i=i+2) {
00120                                 nodeNumber = (int)randomLoads(i);
00121                                 dofNumber = (int)randomLoads(i+1);
00122                                 aNode = theDomain->getNode(nodeNumber);
00123                                 aDofGroup = aNode->getDOF_GroupPtr();
00124                                 const ID &anID = aDofGroup->getID();
00125                                 relevantID = anID(dofNumber-1);
00126                                 oneDimID(0) = relevantID;
00127                                 theSOE->addB(oneDimVectorWithOne, oneDimID);
00128                         }
00129                 }
00130         }
00131 
00132         return 0;
00133 }
00134                 
00135 
00136 
00137 
00138 int
00139 StaticSensitivityIntegrator::saveSensitivity(const Vector &v, int gradNum, int numGrads)
00140 {
00141 
00142     DOF_GrpIter &theDOFGrps = theAnalysisModel->getDOFs();
00143     DOF_Group   *dofPtr;
00144 
00145         Vector *vNewPtr = new Vector(v.Size());
00146         (*vNewPtr) = v;
00147     while ( (dofPtr = theDOFGrps() ) != 0)  {
00148                 dofPtr->saveSensitivity(vNewPtr,0,0,gradNum,numGrads);
00149         }
00150 
00151         delete vNewPtr;
00152     
00153     return 0;
00154 }
00155 
00156 
00157 
00158 int 
00159 StaticSensitivityIntegrator::commitSensitivity(int gradNum, int numGrads)
00160 {
00161 
00162         // Loop through the FE_Elements and set unconditional sensitivities
00163     FE_Element *elePtr;
00164     FE_EleIter &theEles = theAnalysisModel->getFEs();    
00165     while((elePtr = theEles()) != 0) {
00166                 elePtr->commitSensitivity(gradNum, numGrads);
00167         }
00168 
00169         return 0;
00170 }
00171 
00172 
00173 
00174 
00175 
00176 int 
00177 StaticSensitivityIntegrator::newStep(void)
00178 {
00179         return 0;
00180 }
00181 int 
00182 StaticSensitivityIntegrator::update(const Vector &deltaU)
00183 {
00184         return 0;
00185 }
00186 int 
00187 StaticSensitivityIntegrator::setDeltaLambda(double newDeltaLambda)
00188 {
00189         return 0;
00190 }
00191 int 
00192 StaticSensitivityIntegrator::sendSelf(int commitTag, Channel &theChannel)
00193 {
00194         return 0;
00195 }
00196 int 
00197 StaticSensitivityIntegrator::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
00198 {
00199         return 0;
00200 }
00201 void 
00202 StaticSensitivityIntegrator::Print(OPS_Stream &s, int flag)  
00203 {
00204 }
00205 
00206 
00207 
00208 
00209 

Generated on Mon Oct 23 15:05:26 2006 for OpenSees by doxygen 1.5.0