Example #1
0
// constructors:
FiberSection3d::FiberSection3d(int tag, int num, Fiber **fibers): 
  SectionForceDeformation(tag, SEC_TAG_FiberSection3d),
  numFibers(num), sizeFibers(num), theMaterials(0), matData(0),
  QzBar(0.0), QyBar(0.0), Abar(0.0), yBar(0.0), zBar(0.0), sectionIntegr(0), e(3), s(0), ks(0)
{
  if (numFibers != 0) {
    theMaterials = new UniaxialMaterial *[numFibers];

    if (theMaterials == 0) {
      opserr << "FiberSection3d::FiberSection3d -- failed to allocate Material pointers\n";
      exit(-1);
    }

    matData = new double [numFibers*3];

    if (matData == 0) {
      opserr << "FiberSection3d::FiberSection3d -- failed to allocate double array for material data\n";
      exit(-1);
    }

    for (int i = 0; i < numFibers; i++) {
      Fiber *theFiber = fibers[i];
      double yLoc, zLoc, Area;
      theFiber->getFiberLocation(yLoc, zLoc);
      Area = theFiber->getArea();

      QzBar += yLoc*Area;
      QyBar += zLoc*Area;
      Abar  += Area;

      matData[i*3] = yLoc;
      matData[i*3+1] = zLoc;
      matData[i*3+2] = Area;
      UniaxialMaterial *theMat = theFiber->getMaterial();
      theMaterials[i] = theMat->getCopy();

      if (theMaterials[i] == 0) {
	opserr << "FiberSection3d::FiberSection3d -- failed to get copy of a Material\n";
	exit(-1);
      }
    }

    yBar = QzBar/Abar;
    zBar = QyBar/Abar;
  }

  s = new Vector(sData, 3);
  ks = new Matrix(kData, 3, 3);

  sData[0] = 0.0;
  sData[1] = 0.0;
  sData[2] = 0.0;

  for (int i=0; i<9; i++)
    kData[i] = 0.0;

  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
  code(2) = SECTION_RESPONSE_MY;
}
Example #2
0
int
FiberSection2d::addFiber(Fiber &newFiber)
{
  // need to create larger arrays
  int newSize = numFibers+1;
  UniaxialMaterial **newArray = new UniaxialMaterial *[newSize]; 
  double *newMatData = new double [2 * newSize];
  if (newArray == 0 || newMatData == 0) {
    opserr <<"FiberSection2d::addFiber -- failed to allocate Fiber pointers\n";
    return -1;
  }

  // copy the old pointers and data
  int i;
  for (i = 0; i < numFibers; i++) {
    newArray[i] = theMaterials[i];
    newMatData[2*i] = matData[2*i];
    newMatData[2*i+1] = matData[2*i+1];
  }

  // set the new pointers and data
  double yLoc, zLoc, Area;
  newFiber.getFiberLocation(yLoc, zLoc);
  Area = newFiber.getArea();
  newMatData[numFibers*2] = yLoc;
  newMatData[numFibers*2+1] = Area;
  UniaxialMaterial *theMat = newFiber.getMaterial();
  newArray[numFibers] = theMat->getCopy();

  if (newArray[numFibers] == 0) {
    opserr <<"FiberSection2d::addFiber -- failed to get copy of a Material\n";
    delete [] newMatData;
    return -1;
  }

  numFibers++;

  if (theMaterials != 0) {
    delete [] theMaterials;
    delete [] matData;
  }

  theMaterials = newArray;
  matData = newMatData;

  double Qz = 0.0;
  double A  = 0.0;

  // Recompute centroid
  for (i = 0; i < numFibers; i++) {
    yLoc = -matData[2*i];
    Area = matData[2*i+1];
    A  += Area;
    Qz += yLoc*Area;
  }

  yBar = Qz/A;

  return 0;
}
Example #3
0
// constructors:
FiberSection2d::FiberSection2d(int tag, int num, Fiber **fibers): 
  SectionForceDeformation(tag, SEC_TAG_FiberSection2d),
  numFibers(num), theMaterials(0), matData(0),
  yBar(0.0), sectionIntegr(0), e(2), eCommit(2), s(0), ks(0), dedh(2)
{
  if (numFibers != 0) {
    theMaterials = new UniaxialMaterial *[numFibers];

    if (theMaterials == 0) {
      opserr << "FiberSection2d::FiberSection2d -- failed to allocate Material pointers";
      exit(-1);
    }

    matData = new double [numFibers*2];

    if (matData == 0) {
      opserr << "FiberSection2d::FiberSection2d -- failed to allocate double array for material data\n";
      exit(-1);
    }


    double Qz = 0.0;
    double A  = 0.0;
    
    for (int i = 0; i < numFibers; i++) {
      Fiber *theFiber = fibers[i];
      double yLoc, zLoc, Area;
      theFiber->getFiberLocation(yLoc, zLoc);
      Area = theFiber->getArea();
      A  += Area;
      Qz += yLoc*Area;
      matData[i*2] = yLoc;
      matData[i*2+1] = Area;
      UniaxialMaterial *theMat = theFiber->getMaterial();
      theMaterials[i] = theMat->getCopy();

      if (theMaterials[i] == 0) {
	opserr << "FiberSection2d::FiberSection2d -- failed to get copy of a Material\n";
	exit(-1);
      }
    }    

    yBar = Qz/A;  
  }

  s = new Vector(sData, 2);
  ks = new Matrix(kData, 2, 2);

  sData[0] = 0.0;
  sData[1] = 0.0;

  kData[0] = 0.0;
  kData[1] = 0.0;
  kData[2] = 0.0;
  kData[3] = 0.0;

  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
}
Example #4
0
int
FiberSection2d::addFiber(Fiber &newFiber)
{
  // need to create larger arrays
  if(numFibers == sizeFibers) {
      int newsize = 2*sizeFibers;
      if(newsize == 0) newsize = 30;
      UniaxialMaterial **newArray = new UniaxialMaterial *[newsize]; 
      double *newMatData = new double [2 * newsize];
      if (newArray == 0 || newMatData == 0) {
	  opserr <<"FiberSection2d::addFiber -- failed to allocate Fiber pointers\n";
	  return -1;
      }

      // copy the old pointers and data
      int i;
      for (i = 0; i < sizeFibers; i++) {
	  newArray[i] = theMaterials[i];
	  newMatData[2*i] = matData[2*i];
	  newMatData[2*i+1] = matData[2*i+1];
      }

      // initialize new memory
      for(i = sizeFibers; i<newsize; i++) {
	  newArray[i] = 0;
	  newMatData[2*i] = 0.0;
	  newMatData[2*i+1] = 0.0;
      }

      sizeFibers = newsize;

      // set new memory
      if (theMaterials != 0) {
	  delete [] theMaterials;
	  delete [] matData;
      }

      theMaterials = newArray;
      matData = newMatData;
  }

  // set the new pointers and data
  double yLoc, zLoc, Area;
  newFiber.getFiberLocation(yLoc, zLoc);
  Area = newFiber.getArea();
  matData[numFibers*2] = yLoc;
  matData[numFibers*2+1] = Area;
  UniaxialMaterial *theMat = newFiber.getMaterial();
  theMaterials[numFibers] = theMat->getCopy();

  if(theMaterials[numFibers] == 0) {
    opserr <<"FiberSection2d::addFiber -- failed to get copy of a Material\n";
    return -1;
  }

  numFibers++;

  // Recompute centroid
  ABar += Area;
  QzBar += yLoc*Area;
  yBar = QzBar/ABar;

  return 0;
}
// constructors:
RCFTSTLFiberSection3D::RCFTSTLFiberSection3D(int tag, int num, Fiber **fibers, double gj): 
  SectionForceDeformation(tag, SEC_TAG_RCFTSTLFiberSection3D),
  numFibers(num), theMaterials(0), matData(0),
  yBar(0.0), zBar(0.0), e(4), eCommit(4), GJ(gj)
{
  ofstream stlfib;
  stlfib.open("stlfib.dat",ios::app);
  double EA = 0.0;
  double EQz = 0.0;
  double EQy = 0.0;
  double EIz = 0.0;
  double EIy = 0.0;
  double EIyz = 0.0;
  
  double Es = 0.0;    
  if (numFibers != 0) {
    theMaterials = new UniaxialMaterial *[numFibers];

    if (theMaterials == 0) {
      opserr << "RCFTSTLFiberSection3D::RCFTSTLFiberSection3D -- failed to allocate Material pointers\n";
      exit(-1);
    }

    matData = new double [numFibers*3];

    if (matData == 0) {
      opserr << "RCFTSTLFiberSection3D::RCFTSTLFiberSection3D -- failed to allocate double array for material data\n";
      exit(-1);
    }
    double Qz = 0.0;
    double Qy = 0.0;
    double A  = 0.0;
   
    for (int i = 0; i < numFibers; i++) {
      Fiber *theFiber = fibers[i];
      double yLoc, zLoc, Area;
      theFiber->getFiberLocation(yLoc, zLoc);
      Area = theFiber->getArea();
      UniaxialMaterial *theMat = theFiber->getMaterial();
      
      stlfib<<i<<"  "<<yLoc<<"  "<<zLoc<<"  "<<Area<<endl;
      Es = theMat->getInitialTangent();
      Qz += yLoc*Area;
      Qy += zLoc*Area;
      A  += Area;
      EQz += yLoc*Area*Es;
      EQy += zLoc*Area*Es;
      EA  += Area*Es;
      EIz += yLoc*yLoc*Area*Es;
      EIy += zLoc*zLoc*Area*Es;
      EIyz += yLoc*zLoc*Area*Es;
      
      matData[i*3] = -yLoc;
      matData[i*3+1] = zLoc;
      matData[i*3+2] = Area;
      theMaterials[i] = theMat->getCopy();

      if (theMaterials[i] == 0) {
	opserr << "RCFTSTLFiberSection3D::RCFTFiberSection3D -- failed to get copy of a Material\n";
	exit(-1);
      }
    }

    yBar = -Qz/A;
    zBar = Qy/A;
  }

  ks.Zero();

  ks(0,0) = EA;
  ks(0,1) = ks(1,0) = -EQz;
  ks(0,2) = ks(2,0) = -EQy;
  ks(1,1) = EIz;
  ks(2,2) = EIy;
  ks(2,1) = ks(1,2) = EIyz;
  ks(3,3) = GJ;

  //ks(0,0) = 449602.6;
  //ks(0,1) = ks(1,0) = 0.0;
  //ks(0,2) = ks(2,0) = 0.0;
  //ks(1,1) = 6968845.86;
  //ks(2,2) = 6968845.86;
  //ks(2,1) = ks(1,2) = 0.0;
  //ks(3,3) = GJ;

  //ks(0,0) = 1000.0;
  //ks(0,1) = ks(1,0) = 0.0;
  //ks(0,2) = ks(2,0) = 0.0;
  //ks(1,1) = 1.0;
  //ks(2,2) = 1.0;
  //ks(2,1) = ks(1,2) = 0.0;
  //ks(3,3) = GJ;

  //ks(0,0) = 300000.0;
  //ks(0,1) = ks(1,0) = 0.0;
  //ks(0,2) = ks(2,0) = 0.0;
  //ks(1,1) = 3000000.0;
  //ks(2,2) = 3000000.0;
  //ks(2,1) = ks(1,2) = 0.0;
  //ks(3,3) = GJ;

  //ks(0,0) = 43200000.0;
  //ks(0,1) = ks(1,0) = 0.0;
  //ks(0,2) = ks(2,0) = 0.0;
  //ks(1,1) = 14400000.0;
  //ks(2,2) = 14400000.0;
  //ks(2,1) = ks(1,2) = 0.0;
  //ks(3,3) = GJ;
  
  //ks(0,0) = 449509.3;
  //ks(0,1) = ks(1,0) = 0.0;
  //ks(0,2) = ks(2,0) = 0.0;
  //ks(1,1) = 6967684.16;
  //ks(2,2) = 6967684.16;
  //ks(2,1) = ks(1,2) = 0.0;
  //ks(3,3) = GJ;

  sData[0] = 0.0;
  sData[1] = 0.0;
  sData[2] = 0.0;

  kData[0] = EA;
  kData[1] = -EQz;
  kData[2] = EIyz;
  kData[3] = 0.0;
  kData[4] = -EQz;
  kData[5] = EIz;
  kData[6] = -EQy;
  kData[7] = 0.0;
  kData[8] = EIyz;
  kData[9] = -EQy;
  kData[10] = EIy;
  kData[11] = 0.0;
  kData[12] = 0.0;
  kData[13] = 0.0;
  kData[14] = 0.0;
  kData[15] = GJ;

  //kData[0] = 43200000.0;
  //kData[1] = 0.0;
  //kData[2] = 0.0;
  //kData[3] = 0.0;
  //kData[4] = 0.0;
  //kData[5] = 14400000.0;
  //kData[6] = 0.0;
  //kData[7] = 0.0;
  //kData[8] = 0.0;
  //kData[9] = 0.0;
  //kData[10] = 14400000.0;
  //kData[11] = 0.0;
  //kData[12] = 0.0;
  //kData[13] = 0.0;
  //kData[14] = 0.0;
  //kData[15] = GJ;

  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
  code(2) = SECTION_RESPONSE_MY;
  code(3) = SECTION_RESPONSE_T;
}
// constructors:
FiberSection3dThermal::FiberSection3dThermal(int tag, int num, Fiber **fibers): 
  SectionForceDeformation(tag, SEC_TAG_FiberSection3dThermal),
  numFibers(num), theMaterials(0), matData(0),
  yBar(0.0), zBar(0.0), e(3), eCommit(3), s(0), ks(0), sT(0)
{
  if (numFibers != 0) {
    theMaterials = new UniaxialMaterial *[numFibers];

    if (theMaterials == 0) {
      opserr << "FiberSection3dThermal::FiberSection3dThermal -- failed to allocate Material pointers\n";
      exit(-1);
    }

    matData = new double [numFibers*3];

    if (matData == 0) {
      opserr << "FiberSection3dThermal::FiberSection3dThermal -- failed to allocate double array for material data\n";
      exit(-1);
    }

    double Qz = 0.0;
    double Qy = 0.0;
    double A  = 0.0;
    
    for (int i = 0; i < numFibers; i++) {
      Fiber *theFiber = fibers[i];
      double yLoc, zLoc, Area;
      theFiber->getFiberLocation(yLoc, zLoc);
      Area = theFiber->getArea();
      Qz += yLoc*Area;
      Qy += zLoc*Area;
      A  += Area;

      matData[i*3] = -yLoc;
      matData[i*3+1] = zLoc;
      matData[i*3+2] = Area;
      UniaxialMaterial *theMat = theFiber->getMaterial();
      theMaterials[i] = theMat->getCopy();

      if (theMaterials[i] == 0) {
	opserr << "FiberSection3dThermal::FiberSection3dThermal -- failed to get copy of a Material\n";
	exit(-1);
      }
    }

    yBar = -Qz/A;
    zBar = Qy/A;
  }

  s = new Vector(sData, 3);
  ks = new Matrix(kData, 3, 3);

  sData[0] = 0.0;
  sData[1] = 0.0;
  sData[2] = 0.0;

  for (int i=0; i<9; i++)
    kData[i] = 0.0;

  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
  code(2) = SECTION_RESPONSE_MY;

 // AddingSensitivity:BEGIN ////////////////////////////////////
  parameterID = 0;
  SHVs=0;
  // AddingSensitivity:END //////////////////////////////////////
  //J.Jiang add to see fiberLocsZ[i] = zLoc;
  sT = new Vector(sTData, 3);
  sTData[0] = 0.0;             
  sTData[1] = 0.0; 
  sTData[2] = 0.0;
   
  //An array storing the current fiber Temperature and Maximum Temperature and intializing it.
  Fiber_T = new double [1000];
  for (int i = 0;i<1000; i++) {
	   Fiber_T[i] = 0;
   } 
  Fiber_TMax = new double [1000];
  for (int i = 0;i<1000; i++) {
	   Fiber_TMax[i] = 0;
   }  
}