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;
}
Пример #2
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;
}
Пример #3
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;
}
Пример #4
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;
}
Пример #5
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;
  }
Пример #6
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;
}