int 
CorotTrussSection::addInertiaLoadToUnbalance(const Vector &accel)
{
    // check for quick return
    if (Lo == 0.0 || rho == 0.0)
        return 0;
    
    // get R * accel from the nodes
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);    
    
    int nodalDOF = numDOF/2;
    
    // want to add ( - fact * M R * accel ) to unbalance
    if (cMass == 0)  {
        double m = 0.5*rho*Lo;
        for (int i=0; i<numDIM; i++) {
            (*theLoad)(i) -= m*Raccel1(i);
            (*theLoad)(i+nodalDOF) -= m*Raccel2(i);
        }
    } else  {
        double m = rho*Lo/6.0;
        for (int i=0; i<numDIM; i++) {
            (*theLoad)(i) -= 2.0*m*Raccel1(i) + m*Raccel2(i);
            (*theLoad)(i+nodalDOF) -= m*Raccel1(i) + 2.0*m*Raccel2(i);
        }
    }
    
    return 0;
}
Exemple #2
0
int EEBeamColumn2d::addInertiaLoadToUnbalance(const Vector &accel)
{
    // check for quick return
    if (L == 0.0 || rho == 0.0)  {
        return 0;
    }

    // get R * accel from the nodes
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);

    if (3 != Raccel1.Size() || 3 != Raccel2.Size())  {
        opserr << "EEBeamColumn2d::addInertiaLoadToUnbalance() - "
               << "matrix and vector sizes are incompatible\n";
        return -1;
    }

    // want to add ( - fact * M R * accel ) to unbalance
    // take advantage of lumped mass matrix
    double m = 0.5*rho*L;
    theLoad(0) -= m * Raccel1(0);
    theLoad(1) -= m * Raccel1(1);
    theLoad(3) -= m * Raccel2(0);
    theLoad(4) -= m * Raccel2(1);

    return 0;
}
int
DispBeamColumn2dWithSensitivity::addInertiaLoadToUnbalance(const Vector &accel)
{
	// Check for a quick return
	if (rho == 0.0)
		return 0;

	// Get R * accel from the nodes
	const Vector &Raccel1 = theNodes[0]->getRV(accel);
	const Vector &Raccel2 = theNodes[1]->getRV(accel);

    if (3 != Raccel1.Size() || 3 != Raccel2.Size()) {
      opserr << "DispBeamColumn2dWithSensitivity::addInertiaLoadToUnbalance matrix and vector sizes are incompatable\n";
      return -1;
    }

	double L = crdTransf->getInitialLength();
	double m = 0.5*rho*L;

    // Want to add ( - fact * M R * accel ) to unbalance
	// Take advantage of lumped mass matrix
	Q(0) -= m*Raccel1(0);
	Q(1) -= m*Raccel1(1);
	Q(3) -= m*Raccel2(0);
	Q(4) -= m*Raccel2(1);

    return 0;
}
int YamamotoBiaxialHDR::addInertiaLoadToUnbalance(const Vector &accel)
{
  // check for quick return
  if (mass == 0.0)  {
    return 0;
  }
  
  // get R * accel from the nodes
  const Vector &Raccel1 = theNodes[0]->getRV(accel);
  const Vector &Raccel2 = theNodes[1]->getRV(accel);
  
  if (6 != Raccel1.Size() || 6 != Raccel2.Size())  {
    opserr << "YamamotoBiaxialHDR::addInertiaLoadToUnbalance() - "
	   << "matrix and vector sizes are incompatible\n";
    return -1;
  }
  
  // want to add ( - fact * M R * accel ) to unbalance
  // take advantage of lumped mass matrix
  double m = 0.5*mass;
  for (int i = 0; i < 3; i++)  {
    theLoad(i)   -= m * Raccel1(i);
    theLoad(i+3) -= m * Raccel2(i);
  }
  
  return 0;
}
Exemple #5
0
int TwoNodeLink::addInertiaLoadToUnbalance(const Vector &accel)
{
    // check for quick return
    if (mass == 0.0)  {
        return 0;
    }    
    
    // get R * accel from the nodes
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);
    
    int numDOF2 = numDOF/2;
    if (numDOF2 != Raccel1.Size() || numDOF2 != Raccel2.Size())  {
        opserr << "TwoNodeLink::addInertiaLoadToUnbalance() - "
            << "matrix and vector sizes are incompatible\n";
        return -1;
    }
    
    // want to add ( - fact * M R * accel ) to unbalance
    // take advantage of lumped mass matrix
    double m = 0.5*mass;
    for (int i=0; i<numDIM; i++)  {
        (*theLoad)(i)         -= m * Raccel1(i);
        (*theLoad)(i+numDOF2) -= m * Raccel2(i);
    }
    
    return 0;
}
int ElastomericBearingBoucWen2d::addInertiaLoadToUnbalance(const Vector &accel)
{
    // check for quick return
    if (mass == 0.0)
        return 0;
    
    // get R * accel from the nodes
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);
    
    if (3 != Raccel1.Size() || 3 != Raccel2.Size())  {
        opserr << "ElastomericBearingBoucWen2d::addInertiaLoadToUnbalance() - "
            << "matrix and vector sizes are incompatible.\n";
        return -1;
    }
    
    // want to add ( - fact * M R * accel ) to unbalance
    // take advantage of lumped mass matrix
    double m = 0.5*mass;
    for (int i=0; i<2; i++)  {
        theLoad(i)   -= m * Raccel1(i);
        theLoad(i+3) -= m * Raccel2(i);
    }
    
    return 0;
}
Exemple #7
0
int EETrussCorot::addInertiaLoadToUnbalance(const Vector &accel)
{
    // check for a quick return
    if (L == 0.0 || rho == 0.0)  {
        return 0;
    }
    
    // get R * accel from the nodes
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);
    
    int nodalDOF = numDOF/2;
    
    if (nodalDOF != Raccel1.Size() || nodalDOF != Raccel2.Size()) {
        opserr <<"EETrussCorot::addInertiaLoadToUnbalance() - "
            << "matrix and vector sizes are incompatible\n";
        return -1;
    }
    
    // want to add ( - fact * M R * accel ) to unbalance
    double m = 0.5*rho*L;
    for (int i=0; i<numDIM; i++) {
        double val1 = Raccel1(i);
        double val2 = Raccel2(i);
        
        // perform - fact * M*(R * accel) // remember M a diagonal matrix
        val1 *= -m;
        val2 *= -m;
        
        (*theLoad)(i) += val1;
        (*theLoad)(i+nodalDOF) += val2;
    }
    
    return 0;
}
int
FourNodeQuadWithSensitivity::addInertiaLoadToUnbalance(const Vector &accel)
{
  int i;
  static double rhoi[4];
  double sum = this->rho;
  for (i = 0; i < 4; i++) {
    rhoi[i] = theMaterial[i]->getRho();
    sum += rhoi[i];
  }

  if (sum == 0.0)
    return 0;

  // Get R * accel from the nodes
  const Vector &Raccel1 = theNodes[0]->getRV(accel);
  const Vector &Raccel2 = theNodes[1]->getRV(accel);
  const Vector &Raccel3 = theNodes[2]->getRV(accel);
  const Vector &Raccel4 = theNodes[3]->getRV(accel);

  if (2 != Raccel1.Size() || 2 != Raccel2.Size() || 2 != Raccel3.Size() ||
      2 != Raccel4.Size()) {
    opserr << "FourNodeQuadWithSensitivity::addInertiaLoadToUnbalance matrix and vector sizes are incompatable\n";
    return -1;
  }

  static double ra[8];

  ra[0] = Raccel1(0);
  ra[1] = Raccel1(1);
  ra[2] = Raccel2(0);
  ra[3] = Raccel2(1);
  ra[4] = Raccel3(0);
  ra[5] = Raccel3(1);
  ra[6] = Raccel4(0);
  ra[7] = Raccel4(1);

  // Compute mass matrix
  this->getMass();

  // Want to add ( - fact * M R * accel ) to unbalance
  // Take advantage of lumped mass matrix
  for (i = 0; i < 8; i++)
    Q(i) += -K(i,i)*ra[i];

  return 0;
}
Exemple #9
0
int 
Tri31::addInertiaLoadToUnbalance(const Vector &accel)
{
	int i;
	static double rhoi[1]; //numgp
	double sum = 0.0;
	for (i = 0; i < numgp; i++) {
            if(rho == 0) {
                rhoi[i] = theMaterial[i]->getRho();
            } else {
                rhoi[i] = rho;
            }
	    sum += rhoi[i];
	}

	if (sum == 0.0)
	return 0;

	// Get R * accel from the nodes
	const Vector &Raccel1 = theNodes[0]->getRV(accel);
	const Vector &Raccel2 = theNodes[1]->getRV(accel);
	const Vector &Raccel3 = theNodes[2]->getRV(accel);

	if (2 != Raccel1.Size() || 2 != Raccel2.Size() || 2 != Raccel3.Size()) {
		opserr << "Tri31::addInertiaLoadToUnbalance matrix and vector sizes are incompatible\n";
	    return -1;
	}

	static double ra[6];

	ra[0] = Raccel1(0);
	ra[1] = Raccel1(1);
	ra[2] = Raccel2(0);
	ra[3] = Raccel2(1);
	ra[4] = Raccel3(0);
	ra[5] = Raccel3(1);

	// Compute mass matrix
	this->getMass();

	// Want to add ( - fact * M R * accel ) to unbalance
	// Take advantage of lumped mass matrix
	for (i = 0; i < 2*numnodes; i++) Q(i) += -K(i,i)*ra[i];

	return 0;
}
Exemple #10
0
int
SSPquadUP::addInertiaLoadToUnbalance(const Vector &accel)
{
	// get mass density from the material
	double density = theMaterial->getRho();

	// do nothing if density is zero
	if (density == 0.0) {
		return 0;
	}

	// Get R * accel from the nodes
	const Vector &Raccel1 = theNodes[0]->getRV(accel);
	const Vector &Raccel2 = theNodes[1]->getRV(accel);
	const Vector &Raccel3 = theNodes[2]->getRV(accel);
	const Vector &Raccel4 = theNodes[3]->getRV(accel);

	if (3 != Raccel1.Size() || 3 != Raccel2.Size() || 3 != Raccel3.Size() || 3 != Raccel4.Size()) {
    	opserr << "SSPquadUP::addInertiaLoadToUnbalance matrix and vector sizes are incompatable\n";
    	return -1;
	}

	static double ra[12];
	ra[0]  = Raccel1(0);
	ra[1]  = Raccel1(1);
	ra[2]  = 0.0;
	ra[3]  = Raccel2(0);
	ra[4]  = Raccel2(1);
	ra[5]  = 0.0;
	ra[6]  = Raccel3(0);
	ra[7]  = Raccel3(1);
	ra[8]  = 0.0;
	ra[9]  = Raccel4(0);
	ra[10] = Raccel4(1);
	ra[11] = 0.0;

	// compute mass matrix
	this->getMass();

	for (int i = 0; i < 8; i++) {
		Q(i) += -mMass(i,i)*ra[i];
	}
	
	return 0;
}
Exemple #11
0
int 
FourNodeQuad3d::addInertiaLoadToUnbalance(const Vector &accel)
{
  int i;
  static double rhoi[4];
  double sum = 0.0;
  for (i = 0; i < 4; i++) {
    rhoi[i] = theMaterial[i]->getRho();
    sum += rhoi[i];
  }
  
  if (sum == 0.0)
    return 0;
  
  // Get R * accel from the nodes
  const Vector &Raccel1 = theNodes[0]->getRV(accel);
  const Vector &Raccel2 = theNodes[1]->getRV(accel);
  const Vector &Raccel3 = theNodes[2]->getRV(accel);
  const Vector &Raccel4 = theNodes[3]->getRV(accel);
  
  static double ra[12];
  
  ra[0] = Raccel1(0);
  ra[1] = Raccel1(1);
  ra[2] = Raccel1(2);
  ra[3] = Raccel2(0);
  ra[4] = Raccel2(1);
  ra[5] = Raccel2(2);
  ra[6] = Raccel3(0);
  ra[7] = Raccel3(1);
  ra[8] = Raccel3(2);
  ra[9] = Raccel4(0);
  ra[10] = Raccel4(1);
  ra[11] = Raccel4(2);
  
  // Compute mass matrix
  this->getMass();
  
  // Want to add ( - fact * M R * accel ) to unbalance
  // Take advantage of lumped mass matrix
  for (i = 0; i < 12; i++)
    Q(i) += -K(i,i)*ra[i];
  
  return 0;
}
int
FourNodeQuadUP::addInertiaLoadToUnbalance(const Vector &accel)
{
    // accel = uDotDotG (see EarthquakePattern.cpp)
    // Get R * accel from the nodes
    const Vector &Raccel1 = nd1Ptr->getRV(accel);
    const Vector &Raccel2 = nd2Ptr->getRV(accel);
    const Vector &Raccel3 = nd3Ptr->getRV(accel);
    const Vector &Raccel4 = nd4Ptr->getRV(accel);

    if (3 != Raccel1.Size() || 3 != Raccel2.Size() || 3 != Raccel3.Size() ||
            3 != Raccel4.Size()) {
        opserr << "FourNodeQuadUP::addInertiaLoadToUnbalance matrix and vector sizes are incompatable\n";
        return -1;
    }

    double ra[12];

    ra[0] = Raccel1(0);
    ra[1] = Raccel1(1);
    ra[2] = 0.;
    ra[3] = Raccel2(0);
    ra[4] = Raccel2(1);
    ra[5] = 0.;
    ra[6] = Raccel3(0);
    ra[7] = Raccel3(1);
    ra[8] = 0.;
    ra[9] = Raccel4(0);
    ra[10] = Raccel4(1);
    ra[11] = 0.;

    // Compute mass matrix
    this->getMass();

    // Want to add ( - fact * M R * accel ) to unbalance
    int i, j;

    for (i = 0; i < 12; i++) {
        for (j = 0; j < 12; j++)
            Q(i) += -K(i,j)*ra[j];
    }

    return 0;
}
Exemple #13
0
//! @brief Adds inertia loads.
int XC::FourNodeQuad::addInertiaLoadToUnbalance(const XC::Vector &accel)
  {
    static Vector rhoi(4);
    rhoi= physicalProperties.getRhoi();
    double sum = this->physicalProperties.getRho();
    for(int i= 0;i<rhoi.Size();i++)
      sum += rhoi[i];

    if(sum == 0.0)
      return 0;

    // Get R * accel from the nodes
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);
    const Vector &Raccel3 = theNodes[2]->getRV(accel);
    const Vector &Raccel4 = theNodes[3]->getRV(accel);

    if(2 != Raccel1.Size() || 2 != Raccel2.Size() || 2 != Raccel3.Size() || 2 != Raccel4.Size())
      {
        std::cerr << "XC::FourNodeQuad::addInertiaLoadToUnbalance matrix and vector sizes are incompatable\n";
        return -1;
      }

    static double ra[8];

    ra[0] = Raccel1(0);
    ra[1] = Raccel1(1);
    ra[2] = Raccel2(0);
    ra[3] = Raccel2(1);
    ra[4] = Raccel3(0);
    ra[5] = Raccel3(1);
    ra[6] = Raccel4(0);
    ra[7] = Raccel4(1);

    // Compute mass matrix
    this->getMass();

    // Want to add ( - fact * M R * accel ) to unbalance
    // Take advantage of lumped mass matrix
    for(int i= 0; i < 2*numNodes(); i++)
      load(i)+= -K(i,i)*ra[i];
    return 0;
  }
Exemple #14
0
int
beam2d02::addInertiaLoadToUnbalance(const Vector &accel)
{
  if (M == 0.0)
    return 0;

  // Get R * accel from the nodes
  const Vector &Raccel1 = theNodes[0]->getRV(accel);
  const Vector &Raccel2 = theNodes[1]->getRV(accel);
	
  // Want to add ( - fact * M R * accel ) to unbalance
  // Take advantage of lumped mass matrix
  load(0) -= M * Raccel1(0);
  load(1) -= M * Raccel1(1);
    
  load(3) -= M * Raccel2(0);    
  load(4) -= M * Raccel2(1);    

  return 0;
}
Exemple #15
0
int
ElasticBeam3d::addInertiaLoadToUnbalance(const Vector &accel)
{
  if (rho == 0.0)
    return 0;

  // get R * accel from the nodes
  const Vector &Raccel1 = theNodes[0]->getRV(accel);
  const Vector &Raccel2 = theNodes[1]->getRV(accel);
	
  if (6 != Raccel1.Size() || 6 != Raccel2.Size()) {
    opserr << "ElasticBeam3d::addInertiaLoadToUnbalance matrix and vector sizes are incompatible\n";
    return -1;
  }

  // want to add ( - fact * M R * accel ) to unbalance
  if (cMass == 0)  {
    // take advantage of lumped mass matrix
    double L = theCoordTransf->getInitialLength();
    double m = 0.5*rho*L;

    Q(0) -= m * Raccel1(0);
    Q(1) -= m * Raccel1(1);
    Q(2) -= m * Raccel1(2);
    
    Q(6) -= m * Raccel2(0);
    Q(7) -= m * Raccel2(1);
    Q(8) -= m * Raccel2(2);
  } else  {
    // use matrix vector multip. for consistent mass matrix
    static Vector Raccel(12);
    for (int i=0; i<6; i++)  {
      Raccel(i)   = Raccel1(i);
      Raccel(i+6) = Raccel2(i);
    }
    Q.addMatrixVector(1.0, this->getMass(), Raccel, -1.0);
  }
  
  return 0;
}
int 
DispBeamColumn2d::addInertiaLoadToUnbalance(const Vector &accel)
{
	// Check for a quick return
	if (rho == 0.0) 
		return 0;

	// Get R * accel from the nodes
	const Vector &Raccel1 = theNodes[0]->getRV(accel);
	const Vector &Raccel2 = theNodes[1]->getRV(accel);

    if (3 != Raccel1.Size() || 3 != Raccel2.Size()) {
      opserr << "DispBeamColumn2d::addInertiaLoadToUnbalance matrix and vector sizes are incompatable\n";
      return -1;
    }

    // want to add ( - fact * M R * accel ) to unbalance
    if (cMass == 0)  {
      // take advantage of lumped mass matrix
      double L = crdTransf->getInitialLength();
      double m = 0.5*rho*L;
      
      Q(0) -= m*Raccel1(0);
      Q(1) -= m*Raccel1(1);
      Q(3) -= m*Raccel2(0);
      Q(4) -= m*Raccel2(1);
    } else  {
      // use matrix vector multip. for consistent mass matrix
      static Vector Raccel(6);
      for (int i=0; i<3; i++)  {
        Raccel(i)   = Raccel1(i);
        Raccel(i+3) = Raccel2(i);
      }
      Q.addMatrixVector(1.0, this->getMass(), Raccel, -1.0);
    }
    
    return 0;
}
Exemple #17
0
int 
TrussSection::addInertiaLoadToUnbalance(const Vector &accel)
{
  // check for a quick return
  if (L == 0.0 || rho == 0.0) 
    return 0;
  
  // get R * accel from the nodes
  const Vector &Raccel1 = theNodes[0]->getRV(accel);
  const Vector &Raccel2 = theNodes[1]->getRV(accel);    
  
  int nodalDOF = numDOF/2;
  
#ifdef _G3DEBUG    
  if (nodalDOF != Raccel1.Size() || nodalDOF != Raccel2.Size()) {
    opserr <<"TrussSection::addInertiaLoadToUnbalance " <<
      "matrix and vector sizes are incompatable\n";
    return -1;
  }
#endif
  
  // want to add ( - fact * M R * accel ) to unbalance
  if (cMass == 0)  {
    double m = 0.5*rho*L;
    for (int i=0; i<dimension; i++) {
      (*theLoad)(i) -= m*Raccel1(i);
      (*theLoad)(i+nodalDOF) -= m*Raccel2(i);
    }
  } else  {
    double m = rho*L/6.0;
    for (int i=0; i<dimension; i++) {
      (*theLoad)(i) -= 2.0*m*Raccel1(i) + m*Raccel2(i);
      (*theLoad)(i+nodalDOF) -= m*Raccel1(i) + 2.0*m*Raccel2(i);
    }
  }
  
  return 0;
}
int ElasticTimoshenkoBeam2d::addInertiaLoadToUnbalance(const Vector &accel)
{
    // check for quick return
    if (rho == 0.0)
        return 0;
    
    // assemble Raccel vector
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);    
    static Vector Raccel(6);
    for (int i=0; i<3; i++)  {
        Raccel(i)   = Raccel1(i);
        Raccel(i+3) = Raccel2(i);
    }
    
    // want to add ( - fact * M R * accel ) to unbalance
    theLoad.addMatrixVector(1.0, M, Raccel, -1.0);
    
    return 0;
}
Exemple #19
0
int 
TrussSection::addInertiaLoadToUnbalance(const Vector &accel)
{
    // check for a quick return
    if (L == 0.0 || rho == 0.0) 
	return 0;

    // get R * accel from the nodes
    const Vector &Raccel1 = theNodes[0]->getRV(accel);
    const Vector &Raccel2 = theNodes[1]->getRV(accel);    

    int nodalDOF = numDOF/2;
    
#ifdef _G3DEBUG    
    if (nodalDOF != Raccel1.Size() || nodalDOF != Raccel2.Size()) {
      opserr << "TrussSection::addInertiaLoadToUnbalance " <<
	"matrix and vector sizes are incompatable\n";
      return -1;
    }
#endif
    
    double M = 0.5*rho*L;
    // want to add ( - fact * M R * accel ) to unbalance
    for (int i=0; i<dimension; i++) {
	double val1 = Raccel1(i);
	double val2 = Raccel2(i);	
	
	// perform - fact * M*(R * accel) // remember M a diagonal matrix
	val1 *= -M;
	val2 *= -M;
	
	(*theLoad)(i) += val1;
	(*theLoad)(i+nodalDOF) += val2;
    }	

    return 0;
}
Exemple #20
0
int 
N4BiaxialTruss::addInertiaLoadToUnbalance(const Vector &accel)
{
	// check for a quick return
	if (L == 0.0 || rho == 0.0) 
	return 0;

	// get R * accel from the nodes
	const Vector &Raccel1 = theNodes[0]->getRV(accel);
	const Vector &Raccel2 = theNodes[1]->getRV(accel);    
	const Vector &Raccel3 = theNodes[2]->getRV(accel);   
	const Vector &Raccel4 = theNodes[3]->getRV(accel);   

	int nodalDOF = numDOF/4;
	
	double M = 0.25*rho*L;
	// want to add ( - fact * M R * accel ) to unbalance
	for (int i=0; i<dimension; i++) {
		double val1 = Raccel1(i);
		double val2 = Raccel2(i);
		double val3 = Raccel3(i);	
		double val4 = Raccel4(i);		

		// perform - fact * M*(R * accel) // remember M a diagonal matrix
		val1 *= -M;
		val2 *= -M;
		val3 *= -M;
		val4 *= -M;
		
		(*theLoad)(i) += val1;
		(*theLoad)(i+  nodalDOF) += val2;
		(*theLoad)(i+2*nodalDOF) += val3;
		(*theLoad)(i+3*nodalDOF) += val4;
	}	

	return 0;
}
Exemple #21
0
int 
	Truss2::addInertiaLoadSensitivityToUnbalance(const Vector &accel, bool somethingRandomInMotions)
{

	if (theLoadSens == 0) {
		theLoadSens = new Vector(numDOF);
	}
	else {
		theLoadSens->Zero();
	}


	if (somethingRandomInMotions) {


		// check for a quick return
		if (L == 0.0 || rho == 0.0) 
			return 0;

		// get R * accel from the nodes
		const Vector &Raccel1 = theNodes[0]->getRV(accel);
		const Vector &Raccel2 = theNodes[1]->getRV(accel);    

		int nodalDOF = numDOF/2;

#ifdef _G3DEBUG    
		if (nodalDOF != Raccel1.Size() || nodalDOF != Raccel2.Size()) {
			opserr << "Truss2::addInertiaLoadToUnbalance " <<
				"matrix and vector sizes are incompatable\n";
			return -1;
		}
#endif

		double M  = 0.5*rho*L;
		// want to add ( - fact * M R * accel ) to unbalance
		for (int i=0; i<dimension; i++) {
			double val1 = Raccel1(i);
			double val2 = Raccel2(i);	

			// perform - fact * M*(R * accel) // remember M a diagonal matrix
			val1 *= M;
			val2 *= M;

			(*theLoadSens)(i) = val1;
			(*theLoadSens)(i+nodalDOF) = val2;
		}	
	}
	else {

		// check for a quick return
		if (L == 0.0 || rho == 0.0) 
			return 0;

		// get R * accel from the nodes
		const Vector &Raccel1 = theNodes[0]->getRV(accel);
		const Vector &Raccel2 = theNodes[1]->getRV(accel);    

		int nodalDOF = numDOF/2;

#ifdef _G3DEBUG    
		if (nodalDOF != Raccel1.Size() || nodalDOF != Raccel2.Size()) {
			opserr << "Truss2::addInertiaLoadToUnbalance " <<
				"matrix and vector sizes are incompatable\n";
			return -1;
		}
#endif

		double massDerivative = 0.0;
		if (parameterID == 2) {
			massDerivative = 0.5*L;
		}

		// want to add ( - fact * M R * accel ) to unbalance
		for (int i=0; i<dimension; i++) {
			double val1 = Raccel1(i);
			double val2 = Raccel2(i);	

			// perform - fact * M*(R * accel) // remember M a diagonal matrix

			val1 *= massDerivative;
			val2 *= massDerivative;

			(*theLoadSens)(i) = val1;
			(*theLoadSens)(i+nodalDOF) = val2;
		}	
	}
	return 0;
}