int
TimoshenkoSection3d::setTrialSectionDeformation (const Vector &deforms)
{
  int res = 0;
  e = deforms;

  kData[0] = 0.0; kData[1] = 0.0; kData[2] = 0.0; kData[3] = 0.0;
  kData[4] = 0.0; kData[5] = 0.0; kData[6] = 0.0; kData[7] = 0.0;
  kData[8] = 0.0; 
  sData[0] = 0.0; sData[1] = 0.0;  sData[2] = 0.0; 

  int loc = 0;

  double d0 = deforms(0);
  double d1 = deforms(1);
  double d2 = deforms(2);

  for (int i = 0; i < numFibers; i++) {
    NDMaterial *theMat = theMaterials[i];
    double y = matData[loc++] - yBar;
    double z = matData[loc++] - zBar;
    double A = matData[loc++];

    // determine material strain and set it
    double strain = d0 + y*d1 + z*d2;

    Vector eps(3);
    eps(0) = strain;
    res = theMat->setTrialStrain(eps);

    const Vector &stress = theMat->getStress();
    const Matrix &tangent = theMat->getTangent();

    double value = tangent(0,0) * A;
    double vas1 = y*value;
    double vas2 = z*value;
    double vas1as2 = vas1*z;

    kData[0] += value;
    kData[1] += vas1;
    kData[2] += vas2;
    
    kData[4] += vas1 * y;
    kData[5] += vas1as2;
    
    kData[8] += vas2 * z; 

    double fs0 = stress(0) * A;

    sData[0] += fs0;
    sData[1] += fs0 * y;
    sData[2] += fs0 * z;
  }

  kData[3] = kData[1];
  kData[6] = kData[2];
  kData[7] = kData[5];

  return res;
}
int
TimoshenkoSection2d::sendSelf(int commitTag, Channel &theChannel)
{
  int res = 0;

  // create an id to send objects tag and numFibers, 
  //     size 3 so no conflict with matData below if just 1 fiber
  static ID data(3);
  data(0) = this->getTag();
  data(1) = numFibers;
  int dbTag = this->getDbTag();
  res += theChannel.sendID(dbTag, commitTag, data);
  if (res < 0) {
    opserr <<  "TimoshenkoSection2d::sendSelf - failed to send ID data\n";
    return res;
  }    

  if (numFibers != 0) {
    
    // create an id containingg classTag and dbTag for each material & send it
    ID materialData(2*numFibers);
    for (int i=0; i<numFibers; i++) {
      NDMaterial *theMat = theMaterials[i];
      materialData(2*i) = theMat->getClassTag();
      int matDbTag = theMat->getDbTag();
      if (matDbTag == 0) {
	matDbTag = theChannel.getDbTag();
	if (matDbTag != 0)
	  theMat->setDbTag(matDbTag);
      }
      materialData(2*i+1) = matDbTag;
    }    
    
    res += theChannel.sendID(dbTag, commitTag, materialData);
    if (res < 0) {
      opserr <<  "TimoshenkoSection2d::sendSelf - failed to send material data\n";
      return res;
    }    

    // send the fiber data, i.e. area and loc
    Vector fiberData(matData, 3*numFibers);
    res += theChannel.sendVector(dbTag, commitTag, fiberData);
    if (res < 0) {
      opserr <<  "TimoshenkoSection2d::sendSelf - failed to send material data\n";
      return res;
    }    

    // now invoke send(0 on all the materials
    for (int j=0; j<numFibers; j++)
      theMaterials[j]->sendSelf(commitTag, theChannel);

  }

  return res;
}
Beispiel #3
0
// constructors:
WSection2d::WSection2d(int tag, NDMaterial &theMat,
		       double D, double Tw, double Bf, double Tf,
		       int Nfdw, int Nftf, double shape, double flag):
  SectionForceDeformation(tag, SEC_TAG_WSection2d),
  theFibers(0), yFibers(0), AFibers(0), e(6),
  d(D), tw(Tw), bf(Bf), tf(Tf), nfdw(Nfdw), nftf(Nftf), shapeFactor(shape)
{
  int numFibers = nfdw + 2*nftf;
  
  theFibers = new NDMaterial*[numFibers];
  yFibers   = new double[numFibers];
  AFibers   = new double[numFibers];
  
  for (int i = 0; i < numFibers; i++) {
    theFibers[i] = flag ? theMat.getCopy("BeamFiber") :
      theMat.getCopy("TimoshenkoFiber");
    if (theFibers[i] == 0)
      opserr << "WSection2d::WSection2d -- failed to get copy of beam fiber" << endln;
  }
  
  double dw = d-2*tf;
  
  double a_f = bf*tf/nftf;
  double a_w = dw*tw/nfdw;
  
  int loc = 0;
  
  double yIncr  = tf/nftf;
  double yStart = 0.5*d - 0.5*yIncr;
  
  for (loc = 0; loc < nftf; loc++) {
    AFibers[loc] = AFibers[numFibers-loc-1] = a_f;
    yFibers[loc] = yStart - yIncr*loc;
    yFibers[numFibers-loc-1] = -yFibers[loc];
  }
  
  yIncr  = dw/nfdw;
  yStart = 0.5*dw - 0.5*yIncr;
  
  int count = 0;
  
  for ( ; loc < numFibers-nftf; loc++, count++) {
    AFibers[loc] = a_w;
    yFibers[loc] = yStart - yIncr*count;
  }
  
  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
  code(2) = SECTION_RESPONSE_MY;
  code(3) = SECTION_RESPONSE_VY;
  code(4) = SECTION_RESPONSE_VZ;
  code(5) = SECTION_RESPONSE_T;
}
int
TimoshenkoSection3d::revertToStart(void)
{
  // revert the fibers to start    
  int err = 0;


  kData[0] = 0.0; kData[1] = 0.0; kData[2] = 0.0; kData[3] = 0.0;
  kData[4] = 0.0; kData[5] = 0.0; kData[6] = 0.0; kData[7] = 0.0;
  kData[8] = 0.0; 
  sData[0] = 0.0; sData[1] = 0.0;  sData[2] = 0.0; 

  int loc = 0;

  for (int i = 0; i < numFibers; i++) {
    NDMaterial *theMat = theMaterials[i];
    double y = matData[loc++] - yBar;
    double z = matData[loc++] - zBar;
    double A = matData[loc++];

    // invoke revertToStart on the material
    err += theMat->revertToStart();

    const Matrix &tangent = theMat->getTangent();
    const Vector &stress = theMat->getStress();

    double value = tangent(0,0) * A;
    double vas1 = y*value;
    double vas2 = z*value;
    double vas1as2 = vas1*z;

    kData[0] += value;
    kData[1] += vas1;
    kData[2] += vas2;
    
    kData[4] += vas1 * y;
    kData[5] += vas1as2;
    
    kData[8] += vas2 * z; 

    double fs0 = stress(0) * A;
    sData[0] += fs0;
    sData[1] += fs0 * y;
    sData[2] += fs0 * z;
  }

  kData[3] = kData[1];
  kData[6] = kData[2];
  kData[7] = kData[5];

  return err;
}
Beispiel #5
0
ZeroLengthND::ZeroLengthND(int tag, int dim, int Nd1, int Nd2, 
	       const Vector& x, const Vector& yprime, 
		   NDMaterial &theNDmat) : 
Element(tag, ELE_TAG_ZeroLengthND),
connectedExternalNodes(2),
dimension(dim), numDOF(0), 
transformation(3,3), A(0), v(0), e(0.0), K(0), P(0),
end1Ptr(0), end2Ptr(0), theNDMaterial(0), the1DMaterial(0), order(0)
{
	// Obtain copy of Nd material model
	theNDMaterial = theNDmat.getCopy();
	
	if (theNDMaterial == 0) {
		opserr << "ZeroLengthND::zeroLengthND-- failed to get copy of NDMaterial\n";
		exit(-1);
	}
	// Get the material order
	order = theNDMaterial->getOrder();

	// Check material order
	if (order < 2 || order > 3) {
		opserr << "ZeroLengthND::  -- NDMaterial not of order 2 or 3\n";
		exit(-1);
	}

	// Set up the transformation matrix of direction cosines
	this->setUp(Nd1, Nd2, x, yprime);
}
//full constructor
PlateFromPlaneStressMaterialThermal::PlateFromPlaneStressMaterialThermal(    
				   int tag, NDMaterial &ndMat, double g ) :
NDMaterial( tag, ND_TAG_PlateFromPlaneStressMaterialThermal ),
strain(5),gmod(g)
{
  theMat = ndMat.getCopy("PlaneStress") ;
}
//full constructor
ConstantPressureVolumeQuad :: ConstantPressureVolumeQuad( 
                            int tag, 
                  	    int node1,
			    int node2,
			    int node3,
			    int node4,
			    NDMaterial &theMaterial ) :
Element( tag, ELE_TAG_ConstantPressureVolumeQuad ),
connectedExternalNodes(4), load(0)
{
  connectedExternalNodes(0) = node1 ;
  connectedExternalNodes(1) = node2 ;
  connectedExternalNodes(2) = node3 ;
  connectedExternalNodes(3) = node4 ;

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

      materialPointers[i] = theMaterial.getCopy("AxiSymmetric2D") ;

      if (materialPointers[i] == 0) {
	opserr << "ConstantPressureVolumeQuad::constructor - failed to get a material of type: AxiSymmetric2D\n";
	exit(-1);
      } //end if
      
  } //end for i 

}
Beispiel #8
0
GenericSectionNd::GenericSectionNd(int tag, NDMaterial &m, const ID &mCode)
:SectionForceDeformation(tag,SEC_TAG_GenericNd),
otherDbTag(0), theModel(0), code(0)
{
    theModel = m.getCopy();

    if (theModel == 0) {
		g3ErrorHandler->fatal("%s -- failed to get copy of material model",
			"GenericSectionNd::GenericSectionNd");
    }

	order = theModel->getOrder();

	code = new ID(mCode);

	if (code == 0) {
		g3ErrorHandler->fatal("%s -- failed to allocate section ID",
			"GenericSectionNd::GenericSectionNd");
	}

    if (order != code->Size()) {
		g3ErrorHandler->warning("%s -- code size does not match order of material model",
			"GenericSectionNd::GenericSectionNd");
    }
}
NineFourNodeQuadUP::NineFourNodeQuadUP(int tag, 
	int nd1, int nd2, int nd3, int nd4,int nd5, int nd6, int nd7, int nd8,int nd9,
	NDMaterial &m, const char *type, double t, double bulk, double r,
		  double p1, double p2, double b1, double b2)
:Element (tag, ELE_TAG_Nine_Four_Node_QuadUP), 
  theMaterial(0), connectedExternalNodes(9), 
  Ki(0), Q(22), thickness(t), kc(bulk), rho(r)
{
    this->shapeFunction(wu, nintu, nenu, 0);
/*	for( int L = 0; L < nintu; L++) {
		for( int j = 0; j < nenu; j++) {
		printf("%5d %5d %15.6e %15.6e %15.6e\n", L+1, j+1,
			shlu[0][j][L],shlu[1][j][L],shlu[2][j][L]);
		}
	}
	exit(-1);
*/
    this->shapeFunction(wp, nintp, nenp, 1);
    this->shapeFunction(wp, nintp, nenu, 2);

	// Body forces
	b[0] = b1;
	b[1] = b2;
	// Permeabilities
    perm[0] = p1;
    perm[1] = p2;

    // Allocate arrays of pointers to NDMaterials
    theMaterial = new NDMaterial *[nintu];
    
    if (theMaterial == 0) {
      opserr << "NineFourNodeQuadUP::NineFourNodeQuadUP - failed allocate material model pointer\n";
      exit(-1);
    }

    for (int i = 0; i < nintu; i++) {
      
      // Get copies of the material model for each integration point
      theMaterial[i] = m.getCopy(type);
      
      // Check allocation
      if (theMaterial[i] == 0) {
	     opserr << "NineFourNodeQuadUP::NineFourNodeQuadUP -- failed to get a copy of material model\n";
	     exit(-1);
      }
    }

    // Set connected external node IDs
    connectedExternalNodes(0) = nd1;
    connectedExternalNodes(1) = nd2;
    connectedExternalNodes(2) = nd3;
    connectedExternalNodes(3) = nd4;
    connectedExternalNodes(4) = nd5;
    connectedExternalNodes(5) = nd6;
    connectedExternalNodes(6) = nd7;
    connectedExternalNodes(7) = nd8;
    connectedExternalNodes(8) = nd9;
}
Beispiel #10
0
FourNodeQuadUP::FourNodeQuadUP(int tag, int nd1, int nd2, int nd3, int nd4,
                               NDMaterial &m, const char *type, double t, double bulk,
                               double r, double p1, double p2, double b1, double b2, double p)
    :Element (tag, ELE_TAG_FourNodeQuadUP),
     theMaterial(0), connectedExternalNodes(4),
     nd1Ptr(0), nd2Ptr(0), nd3Ptr(0), nd4Ptr(0), Ki(0),
     Q(12), pressureLoad(12), applyLoad(0), thickness(t), kc(bulk), rho(r), pressure(p),
     end1InitDisp(0),end2InitDisp(0),end3InitDisp(0),end4InitDisp(0)
{
    pts[0][0] = -0.5773502691896258;
    pts[0][1] = -0.5773502691896258;
    pts[1][0] =  0.5773502691896258;
    pts[1][1] = -0.5773502691896258;
    pts[2][0] =  0.5773502691896258;
    pts[2][1] =  0.5773502691896258;
    pts[3][0] = -0.5773502691896258;
    pts[3][1] =  0.5773502691896258;

    wts[0] = 1.0;
    wts[1] = 1.0;
    wts[2] = 1.0;
    wts[3] = 1.0;

    // Body forces
    b[0] = b1;
    b[1] = b2;
    // Permeabilities
    perm[0] = p1;
    perm[1] = p2;

    // Allocate arrays of pointers to NDMaterials
    theMaterial = new NDMaterial *[4];

    if (theMaterial == 0) {
        opserr << "FourNodeQuadUP::FourNodeQuadUP - failed allocate material model pointer\n";
        exit(-1);
    }

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

        // Get copies of the material model for each integration point
        theMaterial[i] = m.getCopy(type);

        // Check allocation
        if (theMaterial[i] == 0) {
            opserr << "FourNodeQuadUP::FourNodeQuadUP -- failed to get a copy of material model\n";
            exit(-1);
        }
    }

    // Set connected external node IDs
    connectedExternalNodes(0) = nd1;
    connectedExternalNodes(1) = nd2;
    connectedExternalNodes(2) = nd3;
    connectedExternalNodes(3) = nd4;
}
PlaneStressFiberMaterial::PlaneStressFiberMaterial(int tag, NDMaterial &theMat)
: NDMaterial(tag, ND_TAG_PlaneStressFiberMaterial),
Tstrain22(0.0), Cstrain22(0.0), twoDtgLastCommit(3,3), theMaterial(0), strain(2)
{
  // Get a copy of the material
  theMaterial = theMat.getCopy();
  
  if (theMaterial == 0) {
    opserr << "PlaneStressFiberMaterial::PlaneStressFiberMaterial -- failed to get copy of material\n";
    exit(-1);
  }
}
Beispiel #12
0
Tri31::Tri31(int tag, int nd1, int nd2, int nd3,
	     NDMaterial &m, const char *type, double t,
	     double p, double r, double b1, double b2)
:Element (tag, ELE_TAG_Tri31), 
  theMaterial(0), connectedExternalNodes(3), 
 Q(6), pressureLoad(6), thickness(t), pressure(p), rho(r), Ki(0)
{
	pts[0][0] = 0.333333333333333;
	pts[0][1] = 0.333333333333333;

	wts[0] = 0.5;

	if (strcmp(type,"PlaneStrain") != 0 && strcmp(type,"PlaneStress") != 0
	    && strcmp(type,"PlaneStrain2D") != 0 && strcmp(type,"PlaneStress2D") != 0) {
			opserr << "Tri31::Tri31 -- improper material type: " << type << "for Tri31\n";
	        exit(-1);
	}

	// Body forces
	b[0] = b1;
	b[1] = b2;

	numgp = 1;
	numnodes = 3;

    // Allocate arrays of pointers to NDMaterials
    theMaterial = new NDMaterial *[numgp];
    
    if (theMaterial == 0) {
      opserr << "Tri31::Tri31 - failed allocate material model pointer\n";
      exit(-1);
    }

	int i;
    for (i = 0; i < numgp; i++) {
		// Get copies of the material model for each integration point
        theMaterial[i] = m.getCopy(type);
			
        // Check allocation
        if (theMaterial[i] == 0) {
	   	    opserr << "Tri31::Tri31 -- failed to get a copy of material model\n";
	        exit(-1);
        }
    }

    // Set connected external node IDs
    connectedExternalNodes(0) = nd1;
    connectedExternalNodes(1) = nd2;
    connectedExternalNodes(2) = nd3;
    
    for (i=0; i<numnodes; i++) theNodes[i] = 0;
}
Beispiel #13
0
// full constructor
SSPquad::SSPquad(int tag, int Nd1, int Nd2, int Nd3, int Nd4, NDMaterial &theMat,
                 const char *type, double thick, double b1, double b2)
    :Element(tag,ELE_TAG_SSPquad),
     theMaterial(0),
     mExternalNodes(SSPQ_NUM_NODE),
     mTangentStiffness(SSPQ_NUM_DOF,SSPQ_NUM_DOF),
     mInternalForces(SSPQ_NUM_DOF),
     Q(SSPQ_NUM_DOF),
     mMass(SSPQ_NUM_DOF,SSPQ_NUM_DOF),
     mNodeCrd(2,4),
     mStrain(3),
     mStress(3),
     Mmem(3,SSPQ_NUM_DOF),
     Kmem(SSPQ_NUM_DOF,SSPQ_NUM_DOF),
     Kstab(SSPQ_NUM_DOF,SSPQ_NUM_DOF),
     mThickness(thick),
     applyLoad(0)
{
    mExternalNodes(0) = Nd1;
    mExternalNodes(1) = Nd2;
    mExternalNodes(2) = Nd3;
    mExternalNodes(3) = Nd4;

    mThickness = thick;

    b[0] = b1;
    b[1] = b2;

    appliedB[0] = 0.0;
    appliedB[1] = 0.0;

    // get copy of the material object
    NDMaterial *theMatCopy = theMat.getCopy(type);
    if (theMatCopy != 0) {
        theMaterial = (NDMaterial *)theMatCopy;
    } else {
        opserr << "SSPquad::SSPquad - failed to get copy of material model\n";;
    }

    // check material
    if (theMaterial == 0) {
        opserr << "SSPquad::SSPquad - failed to allocate material model pointer\n";
        exit(-1);
    }

    // check the type
    if (strcmp(type,"PlaneStrain") != 0 && strcmp(type,"PlaneStress") != 0) {
        opserr << "SSPquad::SSPquad - improper material type: " << type << "for SSPquad\n";
        exit(-1);
    }
}
const Matrix&
TimoshenkoSection3d::getInitialTangent(void)
{
  kData[0] = 0.0; kData[1] = 0.0; kData[2] = 0.0; kData[3] = 0.0;
  kData[4] = 0.0; kData[5] = 0.0; kData[6] = 0.0; kData[7] = 0.0;
  kData[8] = 0.0; 

  int loc = 0;

  for (int i = 0; i < numFibers; i++) {
    NDMaterial *theMat = theMaterials[i];
    double y = matData[loc++] - yBar;
    double z = matData[loc++] - zBar;
    double A = matData[loc++];

    const Matrix &tangent = theMat->getTangent();

    double value = tangent(0,0) * A;
    double vas1 = y*value;
    double vas2 = z*value;
    double vas1as2 = vas1*z;

    kData[0] += value;
    kData[1] += vas1;
    kData[2] += vas2;
    
    kData[4] += vas1 * y;
    kData[5] += vas1as2;
    
    kData[8] += vas2 * z; 
  }

  kData[3] = kData[1];
  kData[6] = kData[2];
  kData[7] = kData[5];

  return *ks;
}
//full constructor
MembranePlateFiberSection::MembranePlateFiberSection(    
				   int tag, 
                                   double thickness, 
                                   NDMaterial &Afiber ) :
SectionForceDeformation( tag, SEC_TAG_MembranePlateFiberSection ),
strainResultant(8)
{
  this->h  = thickness ;

  int i ;
  for ( i = 0; i < numFibers; i++ )
      theFibers[i] = Afiber.getCopy( "PlateFiber" ) ;

}
Beispiel #16
0
BeamFiberMaterial::BeamFiberMaterial(int tag, NDMaterial &theMat)
: NDMaterial(tag, ND_TAG_BeamFiberMaterial),
Tstrain22(0.0), Tstrain33(0.0), Tgamma23(0.0),
Cstrain22(0.0), Cstrain33(0.0), Cgamma23(0.0),
theMaterial(0), strain(3)

{
  // Get a copy of the material
  theMaterial = theMat.getCopy("ThreeDimensional");
  
  if (theMaterial == 0) {
    opserr << "BeamFiberMaterial::BeamFiberMaterial -- failed to get copy of material\n";
    exit(-1);
  }
}
Beispiel #17
0
// constructor:
BiaxialFiber2d::BiaxialFiber2d(int tag, 
                                 NDMaterial &theMat,
                                 double Area, double position):
                                 Fiber(tag, FIBER_TAG_Biaxial2d),
                                 theMaterial(0), area(Area), y(-position)
{
  theMaterial = theMat.getCopy("BeamFiber2d");  // get a copy of the MaterialModel
  
  if (theMaterial == 0) {
    opserr <<"BiaxialFiber2d::BiaxialFiber2d  -- failed to get copy of NDMaterial\n";
    exit(-1);
  }
  
  if (code(0) != SECTION_RESPONSE_P) {
    code(0) = SECTION_RESPONSE_P;
    code(1) = SECTION_RESPONSE_MZ;
	code(2) = SECTION_RESPONSE_VY;
  }
}
Beispiel #18
0
//*********************************************************************
//full constructor
BbarBrick::BbarBrick(  int tag,
                         int node1,
                         int node2,
   	                 int node3,
                         int node4,
                         int node5,
                         int node6,
                         int node7,
			 int node8,
			 NDMaterial &theMaterial,
			 double b1, double b2, double b3) :
Element( tag, ELE_TAG_BbarBrick ),
connectedExternalNodes(8), applyLoad(0), load(0), Ki(0)
{
  connectedExternalNodes(0) = node1 ;
  connectedExternalNodes(1) = node2 ;
  connectedExternalNodes(2) = node3 ;
  connectedExternalNodes(3) = node4 ;

  connectedExternalNodes(4) = node5 ;
  connectedExternalNodes(5) = node6 ;
  connectedExternalNodes(6) = node7 ;
  connectedExternalNodes(7) = node8 ;

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

      materialPointers[i] = theMaterial.getCopy("ThreeDimensional") ;

      if (materialPointers[i] == 0) {
	  opserr <<"BbarBrick::constructor - failed to get a material of type: ThreeDimensional\n";
	  exit(-1);
      } //end if

  } //end for i

  // Body forces
  b[0] = b1;
  b[1] = b2;
  b[2] = b3;
}
Beispiel #19
0
BiaxialFiber3d::BiaxialFiber3d(int tag, 
                NDMaterial &theMat,
                double Area, const Vector &position, double perpTheta)
               :Fiber(tag, FIBER_TAG_Biaxial3d),
                area(Area), R(perpTheta)
{
	theMaterial = theMat.getCopy("BeamFiber2d");  // get a copy of the MaterialModel

	if (theMaterial == 0) {
	  opserr << "BiaxialFiber3d::BiaxialFiber3d -- failed to get copy of NDMaterial\n";
	  exit(-1);
	}
	
  if (code(0) != SECTION_RESPONSE_P) {
    code(0) = SECTION_RESPONSE_P;
    code(1) = SECTION_RESPONSE_MZ;
	code(2) = SECTION_RESPONSE_VY;
  }

	as[0] = -position(0);
	as[1] =  position(1);

}
Beispiel #20
0
//full constructor
NineNodeMixedQuad :: NineNodeMixedQuad( int tag, 
					int node1,
					int node2,
					int node3,
					int node4,
					int node5,
					int node6,
					int node7,
					int node8,
					int node9,
					NDMaterial &theMaterial ) :
Element( tag, ELE_TAG_NineNodeMixedQuad ),
connectedExternalNodes(9) , load(0), Ki(0)
{
  connectedExternalNodes(0) = node1 ;
  connectedExternalNodes(1) = node2 ;
  connectedExternalNodes(2) = node3 ;
  connectedExternalNodes(3) = node4 ;
  connectedExternalNodes(4) = node5 ;
  connectedExternalNodes(5) = node6 ;
  connectedExternalNodes(6) = node7 ;
  connectedExternalNodes(7) = node8 ;
  connectedExternalNodes(8) = node9 ;

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

    materialPointers[i] = theMaterial.getCopy("AxiSymmetric2D") ;
    
    if (materialPointers[i] == 0) {

      opserr << "NineNodeMixedQuad::constructor() - failed to get a material of type: AxiSymmetric2D\n";
    } //end if
      
  } //end for i 
}
Beispiel #21
0
int
TimoshenkoSection2d::addFiber(Fiber &newFiber)
{
  // need to create larger arrays
  int newSize = numFibers+1;
  NDMaterial **newArray = new NDMaterial *[newSize]; 
  double *newMatData = new double [3 * newSize];
  if (newArray == 0 || newMatData == 0) {
    opserr <<"TimoshenkoSection2d::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[3*i] = matData[3*i];
    newMatData[3*i+1] = matData[3*i+1];
	newMatData[3*i+2] = matData[3*i+2];
  }

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

  if (newArray[numFibers] == 0) {
    opserr <<"TimoshenkoSection2d::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 Qy = 0.0;
  double A  = 0.0;

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

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

  return 0;
}
Beispiel #22
0
double 
TzLiq1::getEffectiveStress(void)
{
	// Default value for meanStress
	double meanStress = meanConsolStress;

	// if theDomain pointer is nonzero, then set pointers to attached soil elements.
	//
	if(theDomain != 0)
	{	
		Element *theElement1 = theDomain->getElement(solidElem1);
		Element *theElement2 = theDomain->getElement(solidElem2);
		if (theElement1 == 0 || theElement2 == 0) {
			opserr << "WARNING solid element not found in getEffectiveStress" << endln;
			opserr << "TzLiq1: " << endln;
			opserr << "Adjacent solidElems: " << solidElem1 << ", " << solidElem2 << endln;
			exit(-1);
		}

		// Check that the class tags for the solid elements are either for a FourNodeQuad object, a FourNodeQuadUP object, 
		// a 9_4_QuadUP object, a SSPquadUP object, or a SSPquad object
		if(theElement1->getClassTag()!=ELE_TAG_FourNodeQuad && theElement1->getClassTag()!=ELE_TAG_FourNodeQuadUP && 
		   theElement1->getClassTag()!=ELE_TAG_Nine_Four_Node_QuadUP && theElement1->getClassTag()!=ELE_TAG_SSPquadUP && theElement1->getClassTag()!=ELE_TAG_SSPquad)
		{
			opserr << "Element: " << theElement1->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
			exit(-1);
		}
		if(theElement2->getClassTag()!=ELE_TAG_FourNodeQuad && theElement2->getClassTag()!=ELE_TAG_FourNodeQuadUP && 
		   theElement2->getClassTag()!=ELE_TAG_Nine_Four_Node_QuadUP && theElement2->getClassTag()!=ELE_TAG_SSPquadUP && theElement2->getClassTag()!=ELE_TAG_SSPquad)
		{
			opserr << "Element: " << theElement2->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
			exit(-1);
		}

		double excessPorePressure = 0.0;
		meanStress = 0.0;
		
		// get mean stress from element1 if it is a FourNodeQuad object
		if(theElement1->getClassTag()==ELE_TAG_FourNodeQuad)
		{
			// It's safe to cast *theElement1 onto the FourNodeQuad class because we already
			// checked the class tags.
			FourNodeQuad *theElement1 = (FourNodeQuad *)(theDomain->getElement(solidElem1));
			
			// If the element is a quad, check that the class tag for the material at each gauss point is 100 for FluidSolidPorous object
			meanStress = 0.0;
			for(int i=0;i<4;i++)
			{
				NDMaterial *NDM = theElement1->theMaterial[i];
				if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
					exit(-1);
				}
				FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM);
				meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure);
			}
		}
		// get mean stress from element2 if it is a FourNodeQuad object
		if(theElement2->getClassTag()==ELE_TAG_FourNodeQuad)
		{
			// It's safe to cast *theElement1 onto the FourNodeQuad class because we already
			// checked the class tags.
			FourNodeQuad *theElement2 = (FourNodeQuad *)(theDomain->getElement(solidElem2));
			for(int i=0;i<4;i++)
			{
				NDMaterial *NDM = theElement2->theMaterial[i];
				if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
					exit(-1);
				}
				FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM);
				meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure);
			}
		}

		// get mean stress from element1 if it is a FourNodeQuadUP object
		if(theElement1->getClassTag()==ELE_TAG_FourNodeQuadUP) {
			// It's safe to cast *theElement1 onto the FourNodeQuadUP class because we already checked the class tags.
			FourNodeQuadUP *theElement1 = (FourNodeQuadUP *)(theDomain->getElement(solidElem1));
			meanStress=0.0;
			
			for(int i=0;i<4;i++) {
				NDMaterial *NDM = theElement1->theMaterial[i];
				if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) {
					InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement1->theMaterial);
					if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) {
						opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				    	exit(-1);
					}
				} else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02){
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
					exit(-1);
				}
				meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]);
			}
		}
		// get mean stress from element 2 if it is a FourNodeQuadUP object
		if(theElement2->getClassTag()==ELE_TAG_FourNodeQuadUP) {
			// It's safe to cast *theElement2 onto the FourNodeQuadUP class because we already checked the class tags.
			FourNodeQuadUP *theElement2 = (FourNodeQuadUP *)(theDomain->getElement(solidElem2));
			for(int i=0;i<4;i++) {
				NDMaterial *NDM = theElement2->theMaterial[i];
				if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) {
					InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement2->theMaterial);
					if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) {
						opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				    	exit(-1);
					}
				} else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02){
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
					exit(-1);
				}
				meanStress += 1.0/8.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]);
			}
		}

		// get mean stress from element1 if it is a 9_4_QuadUP object
		if(theElement1->getClassTag()==ELE_TAG_Nine_Four_Node_QuadUP) {
			// It's safe to cast *theElement1 onto the 9_4_QuadUP class because we already checked the class tags.
			NineFourNodeQuadUP *theElement1 = (NineFourNodeQuadUP *)(theDomain->getElement(solidElem1));
			meanStress=0.0;
			
			for(int i=0;i<9;i++) {
				NDMaterial *NDM = theElement1->theMaterial[i];
				if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) {
					InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement1->theMaterial);
					if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) {
						opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				    	exit(-1);
					}
				} else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02){
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
					exit(-1);
				}
				meanStress += 1.0/18.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]);
			}
		}
		// get mean stress from element2 if it is a 9_4_QuadUP object
		if(theElement2->getClassTag()==ELE_TAG_Nine_Four_Node_QuadUP) {
            // It's safe to cast *theElement2 onto the 9_4_QuadUP class because we already checked the class tags.
			NineFourNodeQuadUP *theElement2 = (NineFourNodeQuadUP *)(theDomain->getElement(solidElem2));
			for(int i=0;i<9;i++) {
				NDMaterial *NDM = theElement2->theMaterial[i];
				if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) {
					InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement2->theMaterial);
					if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) {
						opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				    	exit(-1);
					}
				} else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag() !=ND_TAG_PressureDependMultiYield02) {
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
					exit(-1);
				}
				meanStress += 1.0/18.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]);
			}
		}

		// get mean stress from element1 if it is a SSPquadUP object
		if(theElement1->getClassTag()==ELE_TAG_SSPquadUP) {
			// It's safe to cast *theElement1 onto the SSPquadUP class because we already checked the class tags.
			SSPquadUP *theElement1 = (SSPquadUP *)(theDomain->getElement(solidElem1));
			meanStress = 0.0;
			
			NDMaterial *NDM = theElement1->theMaterial;
			if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) {
				InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement1->theMaterial);
				if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) {
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				    exit(-1);
				}
			} else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag()!=ND_TAG_PressureDependMultiYield02) {
				opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				exit(-1);
			}
			meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]);
		}
		// get mean stress from element 2 if it is a SSPquadUP object
		if(theElement2->getClassTag()==ELE_TAG_SSPquadUP) {
			// It's safe to cast *theElement1 onto the SSPquadUP class because we already checked the class tags.
			SSPquadUP *theElement2 = (SSPquadUP *)(theDomain->getElement(solidElem2));
			
			NDMaterial *NDM = theElement2->theMaterial;
			if(NDM->getClassTag()==ND_TAG_InitialStateAnalysisWrapper) {
				InitialStateAnalysisWrapper *NDM = (InitialStateAnalysisWrapper *)(theElement2->theMaterial);
				if(NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getMainClassTag()!=ND_TAG_PressureDependMultiYield02) {
					opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				    exit(-1);
				}
			} else if(NDM->getClassTag()!=ND_TAG_PressureDependMultiYield && NDM->getClassTag()!=ND_TAG_PressureDependMultiYield02){
				opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				exit(-1);
			}
			meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1]);
		}

		// get mean stress from element1 if it is a SSPquad object
		if(theElement1->getClassTag()==ELE_TAG_SSPquad) {
			// It's safe to cast *theElement1 onto the SSPquad class because we already checked the class tags.
			SSPquad *theElement1 = (SSPquad *)(theDomain->getElement(solidElem1));
			
			// If the element is a SSPquad, check that the class tag for the material at each gauss point is FluidSolidPorous object
			meanStress = 0.0;
				
			NDMaterial *NDM = theElement1->theMaterial;
			if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){
				opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				exit(-1);
			}
			FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM);
			meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure);
		}
		// get mean stress from element2 if it is a SSPquad object
		if(theElement2->getClassTag()==ELE_TAG_SSPquad) {
			// It's safe to cast *theElement2 onto the SSPquad class because we already checked the class tags.
			SSPquad *theElement2 = (SSPquad *)(theDomain->getElement(solidElem2));
			
			// If the element is a SSPquad, check that the class tag for the material at each gauss point is FluidSolidPorous object
			NDMaterial *NDM = theElement2->theMaterial;
			if(NDM->getClassTag()!=ND_TAG_FluidSolidPorousMaterial){
				opserr << "Material: " << NDM->getTag() << " cannot be used to read effective stress for a TzLiq1 material." << endln;
				exit(-1);
			}
			FluidSolidPorousMaterial *theFSPM = (FluidSolidPorousMaterial *)(NDM);
			meanStress += 1.0/2.0*(2.0/3.0*(NDM->getStress())[0] + 1.0/3.0*(NDM->getStress())[1] - theFSPM->trialExcessPressure);
		}
		
	}

	return meanStress;
}
FourNodeQuadWithSensitivity::FourNodeQuadWithSensitivity(int tag, int nd1, int nd2, int nd3, int nd4,
			   NDMaterial &m, const char *type, double t,
			   double p, double r, double b1, double b2)
:Element (tag, ELE_TAG_FourNodeQuadWithSensitivity),
  theMaterial(0), connectedExternalNodes(4), 
  Q(8), pressureLoad(8), applyLoad(0), thickness(t), rho(r), pressure(p), Ki(0)
{
	pts[0][0] = -0.5773502691896258;
	pts[0][1] = -0.5773502691896258;
	pts[1][0] =  0.5773502691896258;
	pts[1][1] = -0.5773502691896258;
	pts[2][0] =  0.5773502691896258;
	pts[2][1] =  0.5773502691896258;
	pts[3][0] = -0.5773502691896258;
	pts[3][1] =  0.5773502691896258;

	wts[0] = 1.0;
	wts[1] = 1.0;
	wts[2] = 1.0;
	wts[3] = 1.0;

	if (strcmp(type,"PlaneStrain") != 0 && strcmp(type,"PlaneStress") != 0
	    && strcmp(type,"PlaneStrain2D") != 0 && strcmp(type,"PlaneStress2D") != 0) {
	  opserr << "FourNodeQuadWithSensitivity::FourNodeQuadWithSensitivity -- improper material type: " << type << "for FourNodeQuadWithSensitivity\n";
	  exit(-1);
	}

	// Body forces
	b[0] = b1;
	b[1] = b2;

    // Allocate arrays of pointers to NDMaterials
    theMaterial = new NDMaterial *[4];

    if (theMaterial == 0) {
      opserr << "FourNodeQuadWithSensitivity::FourNodeQuadWithSensitivity - failed allocate material model pointer\n";
      exit(-1);
    }

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

      // Get copies of the material model for each integration point
      theMaterial[i] = m.getCopy(type);

      // Check allocation
      if (theMaterial[i] == 0) {
	opserr << "FourNodeQuadWithSensitivity::FourNodeQuadWithSensitivity -- failed to get a copy of material model\n";
	exit(-1);
      }
    }

    // Set connected external node IDs
    connectedExternalNodes(0) = nd1;
    connectedExternalNodes(1) = nd2;
    connectedExternalNodes(2) = nd3;
    connectedExternalNodes(3) = nd4;

    for (i=0; i<4; i++)
      theNodes[i] = 0;

// AddingSensitivity:BEGIN ////////////////////////////////
	parameterID = 0;
// AddingSensitivity:END /////////////////////////////////
}
TwentyEightNodeBrickUP::TwentyEightNodeBrickUP(int tag,

					       int node1,

					       int node2,

					       int node3,

					       int node4,

					       int node5,

					       int node6,

					       int node7,

					       int node8,

					       int node9,

					       int node10,

					       int node11,

					       int node12,

					       int node13,

					       int node14,

					       int node15,

					       int node16,

					       int node17,

					       int node18,

					       int node19,

					       int node20,

					       NDMaterial &theMaterial, double bulk, double rhof,

					       double p1, double p2, double p3,

					       double b1, double b2, double b3) :Element( tag, ELE_TAG_Twenty_Eight_Node_BrickUP ),

connectedExternalNodes(20), applyLoad(0), load(0), Ki(0), kc(bulk), rho(rhof)

{

	connectedExternalNodes(0) = node1 ;

	connectedExternalNodes(1) = node2 ;

	connectedExternalNodes(2) = node3 ;

	connectedExternalNodes(3) = node4 ;

	connectedExternalNodes(4) = node5 ;

	connectedExternalNodes(5) = node6 ;

	connectedExternalNodes(6) = node7 ;

	connectedExternalNodes(7) = node8 ;

	connectedExternalNodes(8) = node9 ;

	connectedExternalNodes(9) = node10 ;

	connectedExternalNodes(10) = node11 ;

	connectedExternalNodes(11) = node12 ;

	connectedExternalNodes(12) = node13 ;

	connectedExternalNodes(13) = node14 ;

	connectedExternalNodes(14) = node15 ;

	connectedExternalNodes(15) = node16 ;

	connectedExternalNodes(16) = node17 ;

	connectedExternalNodes(17) = node18 ;

	connectedExternalNodes(18) = node19 ;

	connectedExternalNodes(19) = node20 ;



	int i ;

    // Allocate arrays of pointers to NDMaterials

    materialPointers = new NDMaterial *[nintu];



    if (materialPointers == 0) {

      opserr << "TwentyEightNodeBrickUP::TwentyEightNodeBrickUP - failed allocate material model pointer\n";

      exit(-1);

    }

    for ( i=0; i<nintu; i++ ) {



      materialPointers[i] = theMaterial.getCopy("ThreeDimensional") ;



      if (materialPointers[i] == 0) {

	opserr <<"TwentyEightNodeBrickUP::constructor - failed to get a material of type: ThreeDimensional\n";

	exit(-1);

      } //end if



    } //end for i



    // Body forces

    b[0] = b1;

    b[1] = b2;

    b[2] = b3;

    // Permeabilities

    perm[0] = p1;

    perm[1] = p2;

    perm[2] = p3;

    //printf("b %15.6e %15.6e %15.6e perm %15.6e %15.6e %15.6e\n", b1, b2,b3,p1,p2,p3);

    // calculate local shape functions and derivatives

    compuLocalShapeFunction();



}
Beispiel #25
0
// full constructor
SSPquadUP::SSPquadUP(int tag, int Nd1, int Nd2, int Nd3, int Nd4, NDMaterial &theMat, 
                              double thick, double Kf, double Rf, double k1, double k2,
							  double eVoid, double alpha, double b1, double b2)
  :Element(tag,ELE_TAG_SSPquadUP),
  	theMaterial(0),
	mExternalNodes(SQUP_NUM_NODE),
	mTangentStiffness(SQUP_NUM_DOF,SQUP_NUM_DOF),
	mInternalForces(SQUP_NUM_DOF),
	Q(SQUP_NUM_DOF),
	mMass(SQUP_NUM_DOF,SQUP_NUM_DOF),
	mDamp(SQUP_NUM_DOF,SQUP_NUM_DOF),
	mNodeCrd(2,4),
	dN(4,2),
	Mmem(3,8),
	Kstab(8,8),
	mSolidK(8,8),
	mSolidM(8,8),
	mPerm(4,4),
	mThickness(thick),
	fBulk(Kf),
	fDens(Rf),
	mAlpha(alpha),
	mPorosity(0),
	applyLoad(0)
{
	mExternalNodes(0) = Nd1;
	mExternalNodes(1) = Nd2;
	mExternalNodes(2) = Nd3;
	mExternalNodes(3) = Nd4;
		
	mThickness = thick;
	fBulk      = Kf;
	fDens      = Rf;
	mAlpha     = alpha;

	b[0] = b1;
	b[1] = b2;
	
	appliedB[0] = 0.0;
	appliedB[1] = 0.0;

	perm[0] = k1;
	perm[1] = k2;

	mPorosity = eVoid/(1.0 + eVoid);

	const char *type = "PlaneStrain";

	// get copy of the material object
	NDMaterial *theMatCopy = theMat.getCopy(type);
	if (theMatCopy != 0) {
		theMaterial = (NDMaterial *)theMatCopy;
	} else {
		opserr << "SSPquadUP::SSPquadUP - failed to get copy of material model\n";;
	}

	// check material
	if (theMaterial == 0) {
		opserr << "SSPquadUP::SSPquadUP - failed to allocate material model pointer\n";
		exit(-1);
	}
}
Beispiel #26
0
// constructors
BeamContact2D::BeamContact2D(int tag, int Nd1, int Nd2, int NdS, int NdL, NDMaterial &theMat,
                             double width, double tolG, double tolF, int cSwitch)
  :Element(tag,ELE_TAG_BeamContact2D),
    theMaterial(0),
	mExternalNodes(BC2D_NUM_NODE),
	mTangentStiffness(BC2D_NUM_DOF, BC2D_NUM_DOF),
	mInternalForces(BC2D_NUM_DOF),
	mEye1(BC2D_NUM_DIM, BC2D_NUM_DIM),
	mEyeS(BC2D_NUM_DIM, BC2D_NUM_DIM),
	mg_xi(BC2D_NUM_DIM),
	mNormal(BC2D_NUM_DIM),
	mShape(4),
	mDshape(4),
	mBn(BC2D_NUM_DOF-2),
	mBs(BC2D_NUM_DOF-2),
	ma_1(BC2D_NUM_DIM),
	mb_1(BC2D_NUM_DIM),
	mc_1(BC2D_NUM_DIM),
	mIcrd_a(BC2D_NUM_DIM),
	mIcrd_b(BC2D_NUM_DIM),
	mIcrd_s(BC2D_NUM_DIM),
    mDcrd_a(BC2D_NUM_DIM),
	mDcrd_b(BC2D_NUM_DIM),
	mDcrd_s(BC2D_NUM_DIM),
	mDisp_a_n(3),
	mDisp_b_n(3),
	mIniContact(cSwitch)
{
    mExternalNodes(0) = Nd1;
	mExternalNodes(1) = Nd2;
	mExternalNodes(2) = NdS;
	mExternalNodes(3) = NdL;

	mRadius = width/2;
	mGapTol = tolG;
	mForceTol = tolF;
	mIniContact = cSwitch;

	if (mIniContact == 0) {
		inContact          = true;
		was_inContact      = true;
		to_be_released     = false;
		should_be_released = false;
		in_bounds          = true;
	} else {
		inContact          = false;
		was_inContact      = false;
		to_be_released     = false;
		should_be_released = false;
		in_bounds          = true;
	}

	mGap    = 0.0;
	mLambda = 0.0;

	// get copy of the material object
	NDMaterial *theMatCopy = theMat.getCopy("ContactMaterial2D");
	if (theMatCopy != 0) {
	  theMaterial = (ContactMaterial2D *)theMatCopy;
	} else {
	  opserr << "BeamContact2D::BeamContact2D - material needs to be of type ContactMaterial2D for ele: " << this->getTag() << endln;
	}

	// check material
	if (theMaterial == 0) {
	  opserr << "BeamContact2D::BeamContact2D - failed allocate material model pointer\n";
	  exit(-1);
	}
}
TotalLagrangianFD8NodeBrick::TotalLagrangianFD8NodeBrick(int tag,

int node_numb_1,  int node_numb_2,  int node_numb_3,  int node_numb_4,

int node_numb_5,  int node_numb_6,  int node_numb_7,  int node_numb_8,

NDMaterial &m, double b1, double b2, double b3)

:Element(tag, ELE_TAG_TotalLagrangianFD8NodeBrick ),

 theMaterial(0), connectedExternalNodes(NumNodes), Q(0), bf(NumDof), Ki(0)

{

      connectedExternalNodes( 0) = node_numb_1;

      connectedExternalNodes( 1) = node_numb_2;

      connectedExternalNodes( 2) = node_numb_3;

      connectedExternalNodes( 3) = node_numb_4;

      connectedExternalNodes( 4) = node_numb_5;

      connectedExternalNodes( 5) = node_numb_6;

      connectedExternalNodes( 6) = node_numb_7;

      connectedExternalNodes( 7) = node_numb_8;



      bf(0) = b1;

      bf(1) = b2;

      bf(2) = b3;



      theMaterial = new NDMaterial *[NumTotalGaussPts];



      if (theMaterial == 0) {

       opserr<<"FiniteDeformationElastic3D::FiniteDeformationElastic3D -- failed allocate material model pointer\n";

       exit(-1);

      }

      

      int i;

      for (i=0; i<NumTotalGaussPts; i++) {

       theMaterial[i] = m.getCopy();

       if (theMaterial[i] == 0) {

        opserr<<"FiniteDeformationElastic3D::FiniteDeformationElastic3D -- failed allocate material model pointer\n";

        exit(-1);

       }

      }



      rho = m.getRho();



      for (i=0; i<NumNodes; i++) theNodes[i] = 0;



}
Beispiel #28
0
// constructors:
TimoshenkoSection2d::TimoshenkoSection2d(int tag, int num, Fiber **fibers):
  SectionForceDeformation(tag, SEC_TAG_TimoshenkoSection2d),
  numFibers(num), theMaterials(0), matData(0), yh(0.0), zh(0.0),
  yBar(0.0), zBar(0.0), e(3), eCommit(3), s(0), ks(0)
{
  if (numFibers != 0) {
  
    theMaterials = new NDMaterial*[numFibers];
    if (theMaterials == 0) {
 	   opserr << "TimoshenkoSection2d::TimoshenkoSection2d -- failed to allocate Material pointers\n";
 	   exit(-1);
    }
    
    matData = new double [numFibers*3];
    if (matData == 0) {
 	   opserr << "TimoshenkoSection2d::TimoshenkoSection2d -- failed to allocate double array for material data\n";
 	   exit(-1);
    }
    
    double Qz = 0.0;
    double Qy = 0.0;
    double a  = 0.0;
    double yHmin=0, zHmin=0, yHmax=0, zHmax=0;
	NDMaterial *theMat;
    for (int i = 0; i < numFibers; i++) {
	  double yLoc, zLoc, Area;
	  fibers[i]->getFiberLocation(yLoc, zLoc);
	  Area = fibers[i]->getArea();
	  theMat = fibers[i]->getNDMaterial();
	  if (theMat == 0) {
	    opserr << "TimoshenkoSection3d::TimoshenkoSection3d -- failed to get fiber information" << endln;
	  }
      
 	  Qz += yLoc*Area;
 	  Qy += zLoc*Area;
 	  a  += Area;
      
 	  matData[i*3] = yLoc;
 	  matData[i*3+1] = zLoc;
 	  matData[i*3+2] = Area;
      
      theMaterials[i] = theMat->getCopy("BeamFiber2d") ; // theMat.getCopy("TimoshenkoFiber");
      if (theMaterials[i] == 0)
         opserr << "TimoshenkoSection2d::TimoshenkoSection2d -- failed to get copy of beam fiber" << endln;

	  if (yLoc < yHmin ) yHmin=yLoc;
	  if (zLoc < zHmin ) zHmin=zLoc;
	  if (yLoc > yHmax ) yHmax=yLoc;
	  if (zLoc > zHmax ) zHmax=zLoc;
    }
    yBar = Qz/a;
    zBar = Qy/a;
	zh   = yHmax - yHmin;
	yh   = zHmax - zHmin;
  } 
  
  s = new Vector(sData, 3);
  ks = new Matrix(kData, 3, 3);

  for (int i=0; i<9; i++)
	kData[i] = 0.0;
  for (int i=0; i<3; i++)
	sData[i] = 0.0;
  
  code(0) = SECTION_RESPONSE_P;
  code(1) = SECTION_RESPONSE_MZ;
  code(2) = SECTION_RESPONSE_VY;

}
Beispiel #29
0
// constructors
BeamContact2Dp::BeamContact2Dp(int tag, int Nd1, int Nd2, int NdS, NDMaterial &theMat, double width, double pen, int cSwitch)
  :Element(tag,ELE_TAG_BeamContact2Dp),
    theMaterial(0),
	mExternalNodes(BC2D_NUM_NODE),
	mTangentStiffness(BC2D_NUM_DOF, BC2D_NUM_DOF),
	mInternalForces(BC2D_NUM_DOF),
	mEye1(BC2D_NUM_DIM, BC2D_NUM_DIM),
	mEyeS(BC2D_NUM_DIM, BC2D_NUM_DIM),
	mg_xi(BC2D_NUM_DIM),
	mNormal(BC2D_NUM_DIM),
	mShape(4),
	mDshape(4),
	mBn(BC2D_NUM_DOF),
	mBs(BC2D_NUM_DOF),
	ma_1(BC2D_NUM_DIM),
	mb_1(BC2D_NUM_DIM),
	mc_1(BC2D_NUM_DIM),
	mIcrd_a(BC2D_NUM_DIM),
	mIcrd_b(BC2D_NUM_DIM),
	mIcrd_s(BC2D_NUM_DIM),
    mDcrd_a(BC2D_NUM_DIM),
	mDcrd_b(BC2D_NUM_DIM),
	mDcrd_s(BC2D_NUM_DIM),
	mDisp_a_n(3),
	mDisp_b_n(3)
{
    mExternalNodes(0) = Nd1;
	mExternalNodes(1) = Nd2;
	mExternalNodes(2) = NdS;
	
	// input parameters
	mRadius     = width/2.0;
	mPenalty    = pen;
	mIniContact = cSwitch;

	// initialize contact state
	if (mIniContact == 0) {
		inContact          = true;
		was_inContact      = true;
		in_bounds          = true;
	} else {
		inContact          = false;
		was_inContact      = false;
		in_bounds          = true;
	}

	// initialize penetration function and contact force
	mGap    = 0.0;
	mLambda = 0.0;

	// get copy of the material object
	NDMaterial *theMatCopy = theMat.getCopy("ContactMaterial2D");
	if (theMatCopy != 0) {
	  theMaterial = (ContactMaterial2D *)theMatCopy;
	} else {
	  opserr << "BeamContact2Dp::BeamContact2Dp - material needs to be of type ContactMaterial2D for ele: " << this->getTag() << endln;
	}

	// check material
	if (theMaterial == 0) {
	  opserr << "BeamContact2Dp::BeamContact2Dp - failed allocate material model pointer\n";
	  exit(-1);
	}
}