Ejemplo n.º 1
0
int 
IncrementalIntegrator::addModalDampingForce(void)
{
  int res = 0;
  
  if (modalDampingValues == 0)
    return 0;

  int numModes = modalDampingValues->Size();
  const Vector &eigenvalues = theAnalysisModel->getEigenvalues();
  
  if (eigenvalues.Size() < numModes) 
    numModes = eigenvalues.Size();

  Vector dampingForces(theSOE->getNumEqn());

  dampingForces.Zero();

  for (int i=0; i<numModes; i++) {

    DOF_GrpIter &theDOFs1 = theAnalysisModel->getDOFs();
    DOF_Group *dofPtr;
    double beta = 0.0;
    double eigenvalue = eigenvalues(i); // theEigenSOE->getEigenvalue(i+1);
    double wn = 0.;
    if (eigenvalue > 0)
      wn = sqrt(eigenvalue);

    while ((dofPtr = theDOFs1()) != 0) { 
      beta += dofPtr->getDampingBetaFactor(i, (*modalDampingValues)(i), wn);
    }
    
    DOF_GrpIter &theDOFs2 = theAnalysisModel->getDOFs();
    while ((dofPtr = theDOFs2()) != 0) { 
      if (theSOE->addB(dofPtr->getDampingBetaForce(i, beta),dofPtr->getID()) <0) {
	opserr << "WARNING IncrementalIntegrator::failed in dofPtr";
	res = -1;
      }    
    }
  }

  return res;
}
Ejemplo n.º 2
0
int 
IncrementalIntegrator::setupModal(const Vector *modalDampingValues)
{
  int numModes = modalDampingValues->Size();

  const Vector &eigenvalues = theAnalysisModel->getEigenvalues();
  int numEigen = eigenvalues.Size();

  if (numEigen < numModes) 
    numModes = numEigen;

  int numDOF = theSOE->getNumEqn();

  if (eigenValues == 0 || *eigenValues != eigenvalues) {
    if (eigenValues != 0)
      delete eigenValues;
    if (eigenVectors != 0)
      delete [] eigenVectors;
    if (dampingForces != 0)
      delete dampingForces;
    if (mV != 0)
      delete mV;
    if (tmpV1 != 0)
      delete tmpV1;
    if (tmpV2 != 0)
      delete tmpV2;
    
    eigenValues = new Vector(eigenvalues);
    dampingForces = new Vector(numDOF);
    eigenVectors = new double[numDOF*numModes];
    mV = new Vector(numDOF);
    tmpV1 = new Vector(numDOF);
    tmpV2 = new Vector(numDOF);

    DOF_GrpIter &theDOFs2 = theAnalysisModel->getDOFs();
    DOF_Group *dofPtr;
    while ((dofPtr = theDOFs2()) != 0) { 
      const Matrix &dofEigenvectors =dofPtr->getEigenvectors();
      const ID &dofID = dofPtr->getID();
      for (int j=0; j<numModes; j++) {
	for (int i=0; i<dofID.Size(); i++) {
	  int id = dofID(i);
	  if (id >= 0) 
	    eigenVectors[j*numDOF + id] = dofEigenvectors(i,j);
	}
      }
    }

    double *eigenVectors2 = new double[numDOF*numModes];

    for (int i=0; i<numModes; i++) {
      double *eigenVectorI = &eigenVectors[numDOF*i];    
      double *mEigenVectorI = &eigenVectors2[numDOF*i];    
      Vector v1(eigenVectorI,numDOF);
      Vector v2(mEigenVectorI,numDOF);
      this->doMv(v1, v2);    
    }
    eigenVectors = eigenVectors2;
  }

  return 0;
}