int 
FourNodeQuadWithSensitivity::getResponse(int responseID, Information &eleInfo)
{
  if (responseID == 1) {

    return eleInfo.setVector(this->getResistingForce());

  } else if (responseID == 2) {

    return eleInfo.setMatrix(this->getTangentStiff());

  } else if (responseID == 3) {

    // Loop over the integration points

    int cnt = 0;
    for (int i = 0; i < 4; i++) {

      // Get material stress response
      const Vector &sigma = theMaterial[i]->getStress();
      P(cnt) = sigma(0);
      P(cnt+1) = sigma(1);
      cnt += 2;

    }
    return eleInfo.setVector(P);
	
  } else

    return -1;
}
示例#2
0
int
ElasticBeam3d::getResponse (int responseID, Information &eleInfo)
{
  double N, V, M1, M2, T;
  double L = theCoordTransf->getInitialLength();
  double oneOverL = 1.0/L;
  static Vector Res(12);
  Res = this->getResistingForce();

  switch (responseID) {
  case 1: // stiffness
    return eleInfo.setMatrix(this->getTangentStiff());
    
  case 2: // global forces
    return eleInfo.setVector(Res);
    
  case 3: // local forces
    // Axial
    N = q(0);
    P(6) =  N;
    P(0) = -N+p0[0];
    
    // Torsion
    T = q(5);
    P(9) =  T;
    P(3) = -T;
    
    // Moments about z and shears along y
    M1 = q(1);
    M2 = q(2);
    P(5)  = M1;
    P(11) = M2;
    V = (M1+M2)*oneOverL;
    P(1) =  V+p0[1];
    P(7) = -V+p0[2];
    
    // Moments about y and shears along z
    M1 = q(3);
    M2 = q(4);
    P(4)  = M1;
    P(10) = M2;
    V = (M1+M2)*oneOverL;
    P(2) = -V+p0[3];
    P(8) =  V+p0[4];

    return eleInfo.setVector(P);
    
  case 4: // basic forces

    return eleInfo.setVector(q);

  case 5:
    return eleInfo.setVector(theCoordTransf->getBasicTrialDisp());

  default:
    return -1;
  }
}
int 
ZeroLengthContact3D::getResponse(int responseID, Information &eleInfo)
{
 if (responseID == 1)
	 return eleInfo.setVector(this->getResistingForce());
 else if (responseID == 2)
	 return eleInfo.setMatrix(this->getTangentStiff());
 else
	 return -1;
}
int

NineFourNodeQuadUP::getResponse(int responseID, Information &eleInfo)

{

	switch (responseID) {



		case 1:

			return eleInfo.setVector(this->getResistingForce());



		case 2:

			return eleInfo.setMatrix(this->getTangentStiff());



		case 3:

			return eleInfo.setMatrix(this->getMass());



		case 4:

			return eleInfo.setMatrix(this->getDamp());



		default:

			return -1;

	}

}
示例#5
0
int XC::Twenty_Node_Brick::getResponse(int responseID, Information &eleInfo)
  {
        static Vector stresses(162);

        if(responseID == 1)
                return eleInfo.setVector(this->getResistingForce());

        else if(responseID == 2)
                return eleInfo.setMatrix(this->getTangentStiff());

    else if(responseID == 3)
        return eleInfo.setMatrix(this->getMass());

    else if(responseID == 4)
        return eleInfo.setMatrix(this->getDamp());

        else if(responseID == 5) {

                // Loop over the integration points
                int cnt = 0;
                for(int i = 0; i < nintu; i++) {

                        // Get material stress response
                        const XC::Vector &sigma = physicalProperties[i]->getStress();
                        stresses(cnt++) = sigma(0);
                        stresses(cnt++) = sigma(1);
                        stresses(cnt++) = sigma(2);
                        stresses(cnt++) = sigma(3);
                        stresses(cnt++) = sigma(4);
                        stresses(cnt++) = sigma(5);
                }
                return eleInfo.setVector(stresses);

        }
        else

                return -1;
}
int
ZeroLengthInterface2D::getResponse(int responseID, Information &eleInfo)
{
 if (responseID == 1)
	 return eleInfo.setVector(this->getResistingForce());
 else if (responseID == 2)
	 return eleInfo.setMatrix(this->getTangentStiff());
 else if (responseID == 3)
	 return eleInfo.setVector(this->pressure);
 else if (responseID == 4)
	 return eleInfo.setVector(this->normal_gap);
 else
	 return -1;
}
int 
AC3D8HexWithSensitivity::getResponse (int responseID, Information &eleInfo)
{
  switch(responseID) {
    case 1:
      return eleInfo.setVector(this->getResistingForce());
      
    case 2:
      return eleInfo.setMatrix(this->getTangentStiff());
    
    default: 
      return -1;
  }
}
示例#8
0
int
BbarBrick::getResponse(int responseID, Information &eleInfo)
{
  static Vector stresses(48);

  if (responseID == 1)
    return eleInfo.setVector(this->getResistingForce());

  else if (responseID == 2)
    return eleInfo.setMatrix(this->getTangentStiff());

  else if (responseID == 3) {

    // Loop over the integration points
    int cnt = 0;
    for (int i = 0; i < 8; i++) {

      // Get material stress response
      const Vector &sigma = materialPointers[i]->getStress();
      stresses(cnt++) = sigma(0);
      stresses(cnt++) = sigma(1);
      stresses(cnt++) = sigma(2);
      stresses(cnt++) = sigma(3);
      stresses(cnt++) = sigma(4);
      stresses(cnt++) = sigma(5);
    }
    return eleInfo.setVector(stresses);
    } else if (responseID == 4) {
    
    // Loop over the integration points
    int cnt = 0;
    for (int i = 0; i < 8; i++) {
      
      // Get material stress response
      const Vector &sigma = materialPointers[i]->getStrain();
      stresses(cnt++) = sigma(0);
      stresses(cnt++) = sigma(1);
      stresses(cnt++) = sigma(2);
      stresses(cnt++) = sigma(3);
      stresses(cnt++) = sigma(4);
      stresses(cnt++) = sigma(5);
    }
    return eleInfo.setVector(stresses);
  }

  else
    return -1;
}
int
ZeroLengthContact2D::getResponse(int responseID, Information &eleInfo)
{
 if (responseID == 1)
	 return eleInfo.setVector(this->getResistingForce());
 else if (responseID == 2)
	 return eleInfo.setMatrix(this->getTangentStiff());
 else if (responseID == 3)
 {//opserr<<"Contact2D getResponse p="<<this->pressure<<endln;
 return eleInfo.setDouble(this->pressure);
 }
 else if (responseID == 4)
  return eleInfo.setDouble(this->gap);

 else
	 return -1;
}
示例#10
0
int
ElasticBeam2d::getResponse (int responseID, Information &eleInfo)
{
  double N, M1, M2, V;
  double L = theCoordTransf->getInitialLength();
  this->getResistingForce();

  switch (responseID) {
  case 1: // stiffness
    return eleInfo.setMatrix(this->getTangentStiff());
    
  case 2: // global forces
    return eleInfo.setVector(this->getResistingForce());
    
  case 3: // local forces
    // Axial
    N = q(0);
    P(3) =  N;
    P(0) = -N+p0[0];
    // Moment
    M1 = q(1);
    M2 = q(2);
    P(2) = M1;
    P(5) = M2;
    // Shear
    V = (M1+M2)/L;
    P(1) =  V+p0[1];
    P(4) = -V+p0[2];
    return eleInfo.setVector(P);
    
  case 4: // basic forces
    return eleInfo.setVector(q);

  case 5:
    return eleInfo.setVector(theCoordTransf->getBasicTrialDisp());

  default:
    return -1;
  }
}
示例#11
0
int 
WheelRail::getResponse(int responseID, Information &eleInfo)
{
	switch (responseID) {
  case 1: // stiffness
    return eleInfo.setMatrix(this->getTangentStiff());
    
  case 2: // activeData
 /*/ 记录激活量
      激活自由度(5个) 激活单元号(1个) commited位置(1个)//*/
	for(int i=0;i<5;i++)
		activeData(i)=activeDof(i);
	activeData(5)=this->activeBeamIndex;
	activeData(6)=currentLocation;
    return eleInfo.setVector(activeData);
    
  case 3:
	/*/ 记录有效单元节点力
    P(5个)//*/
	for(int i=0;i<5;i++)
		localActiveForce(i)=(*P)(activeDof(i));
	return eleInfo.setVector(localActiveForce);
    
  case 4:
	  /*/ 记录接触量
      嵌入量(1个)uF(1个) Fhz(1个) theDeltaY(1个) uUnderWheel(3个)//*/
	contactData(0)=this->deltaU;
	contactData(1)=this->uF;
	contactData(2)=this->Fhz;
	contactData(3)=this->theDeltaY;
	for(int i=0;i<3;i++)
		contactData(i+4)= railDisp(i);
    return eleInfo.setVector(contactData);

  default:
    return -1;
  }
}
示例#12
0
文件: FourNodeQuad.cpp 项目: lcpt/xc
int XC::FourNodeQuad::getResponse(int responseID, Information &eleInfo)
  {
    if(responseID == 1)
      { return eleInfo.setVector(this->getResistingForce()); }
    else if(responseID == 2)
      { return eleInfo.setMatrix(this->getTangentStiff()); }
    else if(responseID == 3)
      {
        // Loop over the integration points
        int cnt = 0;
        for(size_t i= 0;i<physicalProperties.size(); i++)
          {
            // Get material stress response
            const XC::Vector &sigma = physicalProperties[i]->getStress();
            P(cnt) = sigma(0);
            P(cnt+1) = sigma(1);
            cnt += 2;
          }
        return eleInfo.setVector(P);
      }
    else
      return -1;
  }
示例#13
0
int 
DispBeamColumn2d::getResponse(int responseID, Information &eleInfo)
{
  double V;
  double L = crdTransf->getInitialLength();

  if (responseID == 1)
    return eleInfo.setVector(this->getResistingForce());

  else if (responseID == 12) {
    P.Zero();
    P.addVector(1.0, this->getRayleighDampingForces(), 1.0);
    return eleInfo.setVector(P);

  } else if (responseID == 2) {
      P(3) =  q(0);
      P(0) = -q(0)+p0[0];
      P(2) = q(1);
      P(5) = q(2);
      V = (q(1)+q(2))/L;
      P(1) =  V+p0[1];
      P(4) = -V+p0[2];
      return eleInfo.setVector(P);
  }

  else if (responseID == 9) {
    return eleInfo.setVector(q);
  }

  else if (responseID == 19) {
    static Matrix kb(3,3);
    this->getBasicStiff(kb);
    return eleInfo.setMatrix(kb);
  }

  // Chord rotation
  else if (responseID == 3) {
    return eleInfo.setVector(crdTransf->getBasicTrialDisp());
  }

  // Plastic rotation
  else if (responseID == 4) {
    static Vector vp(3);
    static Vector ve(3);
    const Matrix &kb = this->getInitialBasicStiff();
    kb.Solve(q, ve);
    vp = crdTransf->getBasicTrialDisp();
    vp -= ve;
    return eleInfo.setVector(vp);
  }

  // Curvature sensitivity
  else if (responseID == 5) {
    /*
      Vector curv(numSections);
      const Vector &v = crdTransf->getBasicDispGradient(1);
      
      double L = crdTransf->getInitialLength();
      double oneOverL = 1.0/L;
      //const Matrix &pts = quadRule.getIntegrPointCoords(numSections);
      double pts[2];
      pts[0] = 0.0;
      pts[1] = 1.0;
      
      // Loop over the integration points
      for (int i = 0; i < numSections; i++) {
	int order = theSections[i]->getOrder();
	const ID &code = theSections[i]->getType();
	//double xi6 = 6.0*pts(i,0);
	double xi6 = 6.0*pts[i];
	curv(i) = oneOverL*((xi6-4.0)*v(1) + (xi6-2.0)*v(2));
      }
      
      return eleInfo.setVector(curv);
    */

    Vector curv(numSections);

    /*
    // Loop over the integration points
    for (int i = 0; i < numSections; i++) {
      int order = theSections[i]->getOrder();
      const ID &code = theSections[i]->getType();
      const Vector &dedh = theSections[i]->getdedh();
      for (int j = 0; j < order; j++) {
	if (code(j) == SECTION_RESPONSE_MZ)
	  curv(i) = dedh(j);
      }
    }
    */

    return eleInfo.setVector(curv);
  }

  // Basic deformation sensitivity
  else if (responseID == 6) {  
    const Vector &dvdh = crdTransf->getBasicDisplSensitivity(1);
    return eleInfo.setVector(dvdh);
  }

  else if (responseID == 7) {
    //const Matrix &pts = quadRule.getIntegrPointCoords(numSections);
    double xi[maxNumSections];
    beamInt->getSectionLocations(numSections, L, xi);
    Vector locs(numSections);
    for (int i = 0; i < numSections; i++)
      locs(i) = xi[i]*L;
    return eleInfo.setVector(locs);
  }

  else if (responseID == 8) {
    //const Vector &wts = quadRule.getIntegrPointWeights(numSections);
    double wt[maxNumSections];
    beamInt->getSectionWeights(numSections, L, wt);
    Vector weights(numSections);
    for (int i = 0; i < numSections; i++)
      weights(i) = wt[i]*L;
    return eleInfo.setVector(weights);
  }

  else
    return Element::getResponse(responseID, eleInfo);
}
示例#14
0
int 
TrussSection::getResponse(int responseID, Information &eleInfo)
{
    double strain, force;
    static Vector sVec(1);
    static Vector fVec(1);
    static Matrix kVec(1,1);

    switch (responseID) {
  case 1:
      return eleInfo.setVector(this->getResistingForce());

  case 2:
      if (L == 0.0) {
          strain = 0.0;
          force = 0.0;
      } else {

          int order = theSection->getOrder();
          const ID &code = theSection->getType();

          const Vector &s = theSection->getStressResultant();
          force = 0.0;
          int i;
          for (i = 0; i < order; i++) {
              if (code(i) == SECTION_RESPONSE_P)
                  force += s(i);
          }

      }      
      fVec(0) = force;
      return eleInfo.setVector(fVec);    

  case 3:
      if (L == 0.0) {
          strain = 0.0;
      } else {
          strain = this->computeCurrentStrain();
      }
      sVec(0) = L*strain;
      return eleInfo.setVector(sVec);

    case 4:
      if (L == 0.0) {
          force = 0.0;
      } else {

          int order = theSection->getOrder();
          const ID &code = theSection->getType();

          const Matrix &ks = theSection->getSectionTangent();
          force = 0.0;
          int i;
          for (i = 0; i < order; i++) {
	    if (code(i) == SECTION_RESPONSE_P)
	      force += ks(i,i);
          }

      }      
      kVec(0,0) = force/L;
      return eleInfo.setMatrix(kVec);

  default:
      return -1;
    }
}
int 
ElasticForceBeamColumn2d::getResponse(int responseID, Information &eleInfo)
{
  static Vector Se(NEBD);
  static Vector vp(NEBD);
  static Matrix fe(NEBD,NEBD);

  if (responseID == 1)
    return eleInfo.setVector(this->getResistingForce());
  
  else if (responseID == 2) {
    double p0[3]; p0[0] = 0.0; p0[1] = 0.0; p0[2] = 0.0;
    if (numEleLoads > 0)
      this->computeReactions(p0);
    this->computeBasicForces(Se);
    theVector(3) =  Se(0);
    theVector(0) = -Se(0)+p0[0];
    theVector(2) = Se(1);
    theVector(5) = Se(2);
    double V = (Se(1)+Se(2))/crdTransf->getInitialLength();
    theVector(1) =  V+p0[1];
    theVector(4) = -V+p0[2];
    return eleInfo.setVector(theVector);
  }

  // Chord rotation
  else if (responseID == 7) {
    this->computeBasicForces(Se);
    return eleInfo.setVector(Se);
  }
      
  // Chord rotation
  else if (responseID == 3) {
    vp = crdTransf->getBasicTrialDisp();
    return eleInfo.setVector(vp);
  }

  // Plastic rotation
  else if (responseID == 4) {
    this->computeBasicForces(Se);
    this->getInitialFlexibility(fe);
    vp = crdTransf->getBasicTrialDisp();
    vp.addMatrixVector(1.0, fe, Se, -1.0);
    return eleInfo.setVector(vp);
  }

  // Point of inflection
  else if (responseID == 5) {
    double LI = 0.0;
    this->computeBasicForces(Se);
    if (fabs(Se(1)+Se(2)) > DBL_EPSILON) {
      double L = crdTransf->getInitialLength();
      
      LI = Se(1)/(Se(1)+Se(2))*L;
    }

    return eleInfo.setDouble(LI);
  }

  else if (responseID == 7) {
    this->computeBasicForces(Se);
    return eleInfo.setVector(Se);
  }
  else if (responseID == 10) {
    double L = crdTransf->getInitialLength();
    double pts[maxNumSections];
    beamIntegr->getSectionLocations(numSections, L, pts);
    Vector locs(numSections);
    for (int i = 0; i < numSections; i++)
      locs(i) = pts[i]*L;
    return eleInfo.setVector(locs);
  }

  else if (responseID == 11) {
    double L = crdTransf->getInitialLength();
    double wts[maxNumSections];
    beamIntegr->getSectionWeights(numSections, L, wts);
    Vector weights(numSections);
    for (int i = 0; i < numSections; i++)
      weights(i) = wts[i]*L;
    return eleInfo.setVector(weights);
  }

  else if (responseID == 12) {
    static Matrix fb(NEBD,NEBD);
    this->getInitialFlexibility(fb);
    static Matrix kb(NEBD,NEBD);
    fb.Invert(kb);
    return eleInfo.setMatrix(kb);
  }

  else
    return -1;
}