Example #1
0
void
ElasticBeam2d::Print(OPS_Stream &s, int flag)
{
  // to update forces!
  this->getResistingForce();

  if (flag == -1) {
    int eleTag = this->getTag();
    s << "EL_BEAM\t" << eleTag << "\t";
    s << 0 << "\t" << 0 << "\t" << connectedExternalNodes(0) << "\t" << connectedExternalNodes(1) ;
    s << "0\t0.0000000\n";
  } else {
    this->getResistingForce();
    s << "\nElasticBeam2d: " << this->getTag() << endln;
    s << "\tConnected Nodes: " << connectedExternalNodes ;
    s << "\tCoordTransf: " << theCoordTransf->getTag() << endln;
    s << "\tmass density:  " << rho << ", cMass: " << cMass << endln;
    double P  = q(0);
    double M1 = q(1);
    double M2 = q(2);
    double L = theCoordTransf->getInitialLength();
    double V = (M1+M2)/L;
    s << "\tEnd 1 Forces (P V M): " << -P+p0[0]
      << " " << V+p0[1] << " " << M1 << endln;
    s << "\tEnd 2 Forces (P V M): " << P
      << " " << -V+p0[2] << " " << M2 << endln;
  }
}
ZeroLengthContact2D::ZeroLengthContact2D(int tag,
					 int Nd1, int Nd2,
					 double Knormal, double Ktangent,
					 double frictionRatio,  const Vector& normal )
  :Element(tag,ELE_TAG_ZeroLengthContact2D),
   connectedExternalNodes(numberNodes),
   N(2*numberNodes), T(2*numberNodes), ContactNormal(2),
   Ki(0), load(0)
{
    // ensure the connectedExternalNode ID is of correct size & set values
    if (connectedExternalNodes.Size() != 2)
      opserr << "FATAL ZeroLength::setUp - failed to create an ID of correct size\n";
    connectedExternalNodes(0) = Nd1;
    connectedExternalNodes(1) = Nd2;

	// assign Kn, Kt, fs
	Kn = Knormal;
	Kt = Ktangent;
	fs = frictionRatio;

	// assign outward contact normal of master block
 	ContactNormal(0) = normal(0)/normal.Norm();
	ContactNormal(1) = normal(1)/normal.Norm();

    // set stick point cords in LOCAL basis
	stickPt = 0;

	// initialized contact flag be zero
	ContactFlag=0;

	gap_n  = 0 ;
	lambda =0;   // add for augmented lagrange
	pressure=0;  // add for augmented lagrange
}
Example #3
0
//  Construct element with one unidirectional material (numMaterials1d=1)
CoupledZeroLength::CoupledZeroLength(int tag,
			 int Nd1, int Nd2, 
			 UniaxialMaterial &theMat,
			 int direction1, int direction2,
			 int doRayleigh)
  :Element(tag,ELE_TAG_CoupledZeroLength),     
   connectedExternalNodes(2),
   dimension(0), numDOF(0), transformation(3,3), useRayleighDamping(doRayleigh),
   theMatrix(0), theVector(0),
   theMaterial(0), dirn1(direction1), dirn2(direction2), d0(0), v0(0)
{
  // allocate memory for numMaterials1d uniaxial material models
  theMaterial = theMat.getCopy();
  if ( theMaterial == 0) {
    opserr << "FATAL CoupledZeroLength::CoupledZeroLength - failed to create a 1d  material\n";
    exit(-1);
  }

  // initialize uniaxial materials and directions and check for valid values
  if (direction1 < 0 || direction1 > 5 || direction2 < 0 || direction2 > 5) {
    opserr << "FATAL: CoupledZeroLength::CoupledZeroLength - invalid diection\n";
    exit(-1);
  }

  connectedExternalNodes(0) = Nd1;
  connectedExternalNodes(1) = Nd2;
  dX = 0.0;
  dY = 0.0;
  fX = 0.0;
  fY = 0.0;
}
Example #4
0
void YamamotoBiaxialHDR::Print(OPS_Stream &s, int flag)
{
  
  if (flag == 0)  {
    // print everything
    s << "Element: " << this->getTag(); 
    s << "  type: YamamotoBiaxialHDR  iNode: " << connectedExternalNodes(0);
    s << "                            jNode: " << connectedExternalNodes(1) << endln;
    
    s << "Input parameters: " << endln;
    s << "  Tp: " << tp << endln;
    s << "  DDo: " << ddo << endln;
    s << "  DDi: " << ddi << endln;
    s << "  Hr: " << hr << endln;
    s << "  Cr: " << cr << endln;
    s << "  Cs: " << cs << endln;
    
    // determine resisting forces in global system
    //s << "  resisting force: " << this->getResistingForce() << endln;
    //s << "  Disp-x: " << this->getStrain(0) << endln;
    //s << "  Force-x: " << this->getStress(0) << endln;
    //s << "  Stiff-x: " << this->getTangent(0) << endln;
    //s << "  StiffInit-x: " << this->getInitialTangent(0) << endln;
    //s << "  Disp-y: " << this->getStrain(1) << endln;
    //s << "  Force-y: " << this->getStress(1) << endln;
    //s << "  Stiff-y: " << this->getTangent(1) << endln;
    //s << "  StiffInit-y: " << this->getInitialTangent(1) << endln;

  } else if (flag == 1)  {
    // does nothing
  }
}
Example #5
0
void
TPB1D::Print(OPS_Stream &s, int flag)
{
    // compute the strain and axial force in the member
    if (flag == 0) { // print everything
	s << "Element: " << this->getTag(); 
	s << " type: TPB1D  iNode: " << connectedExternalNodes(0);
	s << " jNode: " << connectedExternalNodes(1) << endln;
	s << " direction: " << direction << "\n";
	opserr << " mu1: " << mu[0] << endln;
	opserr << " mu2: " << mu[1]<< endln;
	opserr << " mu3: " << mu[2]<< endln;
	
	opserr << " R1: " << R[0]<< endln;
	opserr << " R2: " << R[1]<< endln;
	opserr << " R3: " << R[2]<< endln;

	opserr << " h1: " << h[0]<< endln;
	opserr << " h2: " << h[1]<< endln;
	opserr << " h3: " << h[2]<< endln;
	
	opserr << " D1: " << D[0]<< endln;
	opserr << " D2: " << D[1]<< endln;
	opserr << " D3: " << D[2]<< endln;

	opserr << " d1: " << d[0]<< endln;
	opserr << " d2: " << d[1]<< endln;
	opserr << " d3: " << d[2]<< endln;

	s << "\tMaterial: \n";
	s << *(theMaterial);
    }
}
Example #6
0
void GenericClient::Print(OPS_Stream &s, int flag)
{
    int i;
    if (flag == OPS_PRINT_CURRENTSTATE) {
        // print everything
        s << "Element: " << this->getTag() << endln;
        s << "  type: GenericClient" << endln;
        for (i=0; i<numExternalNodes; i++ )
            s << "  Node" << i+1 << ": " << connectedExternalNodes(i);
        s << endln;
        s << "  ipAddress: " << machineInetAddr
            << ", ipPort: " << port << endln;
        s << "  addRayleigh: " << addRayleigh << endln;
        // determine resisting forces in global system
        s << "  resisting force: " << this->getResistingForce() << endln;
    }

    if (flag == OPS_PRINT_PRINTMODEL_JSON) {
        s << "\t\t\t{";
        s << "\"name\": " << this->getTag() << ", ";
        s << "\"type\": \"GenericClient\", ";
        s << "\"nodes\": [";
        for (i = 0; i < numExternalNodes - 1; i++)
            s << connectedExternalNodes(i) << ", ";
        s << connectedExternalNodes(numExternalNodes) << "], ";
        s << "\"ipAddress\": " << machineInetAddr << ", ";
        s << "\"ipPort\": " << port << ", ";
        s << "\"addRayleigh\": " << addRayleigh << "}";
    }
}
Example #7
0
void
	Truss2::Print(OPS_Stream &s, int flag)
{
	// compute the strain and axial force in the member
	double strain, force;
	strain = theMaterial->getStrain();
	force = A * theMaterial->getStress();

	if (flag == 0) { // print everything
		s << "Element: " << this->getTag(); 
		s << " type: Truss2  iNode: " << connectedExternalNodes(0);
		s << " jNode: " << connectedExternalNodes(1);
		s << " Area: " << A << " Mass/Length: " << rho;

		s << " \n\t strain: " << strain;
		s << " axial load: " <<  force;
		if (L != 0.0) {
			int numDOF2 = numDOF/2;
			double temp;
			for (int i = 0; i < dimension; i++) {
				temp = cosX[i]*force;
				(*theVector)(i) = -temp;
				(*theVector)(i+numDOF2) = temp;
			}
			s << " \n\t unbalanced load: " << *theVector;	
		}

		s << " \t Material: " << *theMaterial;
		s << endln;
	} else if (flag == 1) {
		s << this->getTag() << "  " << strain << "  ";
		s << force << endln;
	}
}
Example #8
0
void
TrussSection::Print(OPS_Stream &s, int flag)
{
    // compute the strain and axial force in the member
    double strain, force;
    if (L == 0.0) {
	strain = 0;
	force = 0.0;
    } else {
		strain = this->computeCurrentStrain();
        force = 0.0;

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

		Vector e (order);
	
		int i;
		for (i = 0; i < order; i++) {
			if (code(i) == SECTION_RESPONSE_P)
				e(i) = strain;
		}
	
		theSection->setTrialSectionDeformation(e);
    
		const Vector &s = theSection->getStressResultant();
		for (i = 0; i < order; i++) {
			if (code(i) == SECTION_RESPONSE_P)
				force += s(i);
		}
    }
    
    double temp;
    int numDOF2 = numDOF/2;
	if (theVector != 0) {
		for (int i=0; i<dimension; i++) {
			temp = force*cosX[i];
			(*theVector)(i) = -force;
			(*theVector)(i+numDOF2) = force;
		}
	}
    
    if (flag == 0) { // print everything
	s << "Element: " << this->getTag(); 
	s << " type: TrussSection  iNode: " << connectedExternalNodes(0);
	s << " jNode: " << connectedExternalNodes(1);
	s << " Mass density/length: " << rho;
	s << " cMass: " << cMass;

	s << " \n\t strain: " << strain;
	s << " axial load: " << force;
	if (theVector != 0) 
	    s << " \n\t unbalanced load: " << *theVector;	
	s << " \t Section: " << *theSection;
	s << endln;
    } else if (flag == 1) {
	s << this->getTag() << "  " << strain << "  ";
	s << force << endln;
    }
}
Example #9
0
// constructor:
//  responsible for allocating the necessary space needed by each object
//  and storing the tags of the truss end nodes.
PY_Macro2D::PY_Macro2D(int tag,
		   int node1,
		   int node2,
		   double _K,
		   double _py,
		   double _a,
		   double _b,
		   double _g,
		   double _m1,
		   double _m2,
		   double _w1,
		   double _p1,
		   double _S1,
		   double _beta,
		   double _s1,
		   double _tolerance,
		   int _maxNumIter)
 :Element(tag, ELE_TAG_PY_MACRO2D),
  K(_K), py(_py), a(_a), b(_b), g(_g), m1(_m1), m2(_m2),
  w1(_w1), p1(_p1), S1(_S1), beta(_beta), s1(_s1), 
  tolerance(_tolerance), maxNumIter(_maxNumIter),
  Ttangent(0.0), Tforce(0.0), Tz(0.0), TU(0.0), TW(0.0), TS(1.0), TS0(1.0), CW(0.0), CS(1.0), CS0(1.0), 
  Ctangent(0.0), Cforce(0.0), Cz(0.0), CU(0.0), Tt(0.0), Ct(0.0), trans(1,4),
  connectedExternalNodes(2)
{
  connectedExternalNodes(0) = node1;
  connectedExternalNodes(1) = node2;

  // set node pointers to NULL
  for (int i=0; i<2; i++)
    theNodes[i] = 0;
}
Example #10
0
// constructor:
//  responsible for allocating the necessary space needed by each object
//  and storing the tags of the CorotTruss end nodes.
CorotTruss::CorotTruss(int tag, int dim,
			   int Nd1, int Nd2, 
			   UniaxialMaterial &theMat,
			   double a, double r)
  :Element(tag,ELE_TAG_CorotTruss),     
  theMaterial(0), connectedExternalNodes(2),
  numDOF(0), numDIM(dim),
  Lo(0.0), Ln(0.0), 
  A(a), rho(r), R(3,3),
  theMatrix(0), theVector(0)
{
  // get a copy of the material and check we obtained a valid copy
  theMaterial = theMat.getCopy();
  if (theMaterial == 0) {
    opserr << "FATAL CorotTruss::CorotTruss - " <<  tag <<
      "failed to get a copy of material with tag " << theMat.getTag() << endln;
    exit(-1);
  }
  
  // ensure the connectedExternalNode ID is of correct size & set values
  if (connectedExternalNodes.Size() != 2) {
    opserr << "FATAL CorotTruss::CorotTruss - " <<  tag <<
      "failed to create an ID of size 2\n";
    exit(-1);
  }
  
  connectedExternalNodes(0) = Nd1;
  connectedExternalNodes(1) = Nd2;        

  // set node pointers to NULL
  theNodes[0] = 0;
  theNodes[1] = 0;
}
Example #11
0
void
PY_Macro2D::Print(OPS_Stream &s, int flag)
{
  s << "Element: " << this->getTag();
  s << " type: PY_Macro2D  iNode: " << connectedExternalNodes(0);
  s << " jNode: " << connectedExternalNodes(1) << endln;
}
Example #12
0
int
ElasticBeam3d::recvSelf(int cTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
  int res = 0;
  static Vector data(17);

  res += theChannel.recvVector(this->getDbTag(), cTag, data);
  if (res < 0) {
    opserr << "ElasticBeam3d::recvSelf -- could not receive data Vector\n";
    return res;
  }
  
  A = data(0);
  E = data(1); 
  G = data(2); 
  Jx = data(3); 
  Iy = data(4); 
  Iz = data(5);     
  rho = data(6);
  cMass = (int)data(7);
  this->setTag((int)data(8));
  connectedExternalNodes(0) = (int)data(9);
  connectedExternalNodes(1) = (int)data(10);
  
  alphaM = data(13);
  betaK = data(14);
  betaK0 = data(15);
  betaKc = data(16);
  
  // Check if the CoordTransf is null; if so, get a new one
  int crdTag = (int)data(11);
  if (theCoordTransf == 0) {
    theCoordTransf = theBroker.getNewCrdTransf(crdTag);
    if (theCoordTransf == 0) {
      opserr << "ElasticBeam3d::recvSelf -- could not get a CrdTransf3d\n";
      exit(-1);
    }
  }
  
  // Check that the CoordTransf is of the right type; if not, delete
  // the current one and get a new one of the right type
  if (theCoordTransf->getClassTag() != crdTag) {
    delete theCoordTransf;
    theCoordTransf = theBroker.getNewCrdTransf(crdTag);
    if (theCoordTransf == 0) {
      opserr << "ElasticBeam3d::recvSelf -- could not get a CrdTransf3d\n";
      exit(-1);
    }
  }
  
  // Now, receive the CoordTransf
  theCoordTransf->setDbTag((int)data(12));
  res += theCoordTransf->recvSelf(cTag, theChannel, theBroker);
  if (res < 0) {
    opserr << "ElasticBeam3d::recvSelf -- could not receive CoordTransf\n";
    return res;
  }
  
  return res;
}
Example #13
0
// constructor:
//  responsible for allocating the necessary space needed by each object
//  and storing the tags of the CorotTrussSection end nodes.
CorotTrussSection::CorotTrussSection(int tag, int dim,
			   int Nd1, int Nd2, 
			   SectionForceDeformation &theSec,
			   double r, int damp, int cm)
  :Element(tag,ELE_TAG_CorotTrussSection),     
  theSection(0), connectedExternalNodes(2),
  numDOF(0), numDIM(dim), Lo(0.0), Ln(0.0),
  rho(r), doRayleighDamping(damp), cMass(cm),
  R(3,3), theLoad(0), theMatrix(0), theVector(0)
{
  // get a copy of the material and check we obtained a valid copy
  theSection = theSec.getCopy();
  if (theSection == 0) {
    opserr << "FATAL CorotTrussSection::CorotTrussSection - " << tag << 
      "failed to get a copy of material with tag " << theSec.getTag() << endln;
    exit(-1);
  }
  
  // ensure the connectedExternalNode ID is of correct size & set values
  if (connectedExternalNodes.Size() != 2) {
    opserr << "FATAL CorotTrussSection::CorotTrussSection - " <<  tag <<
      "failed to create an ID of size 2\n";
    exit(-1);
  }
  
  connectedExternalNodes(0) = Nd1;
  connectedExternalNodes(1) = Nd2;        

  // set node pointers to NULL
  for (int i=0; i<2; i++)
    theNodes[i] = 0;
}
Example #14
0
ElasticBeam3d::ElasticBeam3d(int tag, double a, double e, double g, 
			     double jx, double iy, double iz, int Nd1, int Nd2, 
			     CrdTransf &coordTransf, double r, int cm, int sectTag)
  :Element(tag,ELE_TAG_ElasticBeam3d), 
  A(a), E(e), G(g), Jx(jx), Iy(iy), Iz(iz), rho(r), cMass(cm), sectionTag(sectTag),
  Q(12), q(6), connectedExternalNodes(2), theCoordTransf(0)
{
  connectedExternalNodes(0) = Nd1;
  connectedExternalNodes(1) = Nd2;
  
  theCoordTransf = coordTransf.getCopy3d();
  
  if (!theCoordTransf) {
    opserr << "ElasticBeam3d::ElasticBeam3d -- failed to get copy of coordinate transformation\n";
    exit(-1);
  }

  q0[0] = 0.0;
  q0[1] = 0.0;
  q0[2] = 0.0;
  q0[3] = 0.0;
  q0[4] = 0.0;

  p0[0] = 0.0;
  p0[1] = 0.0;
  p0[2] = 0.0;
  p0[3] = 0.0;
  p0[4] = 0.0;

  // set node pointers to NULL
  for (int i=0; i<2; i++)
    theNodes[i] = 0;      
}
Example #15
0
// responsible for allocating the necessary space needed
// by each object and storing the tags of the end nodes.
EETrussCorot::EETrussCorot(int tag, int dim, int Nd1, int Nd2,
    ExperimentalSite *site, bool iM, int addRay, double r)
    : ExperimentalElement(tag, ELE_TAG_EETrussCorot, site),
    numDIM(dim), numDOF(0), connectedExternalNodes(2),
    iMod(iM), addRayleigh(addRay), rho(r), L(0.0), Ln(0.0), R(3,3),
    theMatrix(0), theVector(0), theLoad(0),
    db(0), vb(0), ab(0), t(0),
    dbDaq(0), vbDaq(0), abDaq(0), qDaq(0), tDaq(0),
    dbCtrl(1), vbCtrl(1), abCtrl(1),
    kbInit(1,1), tLast(0.0), firstWarning(true)
{
    // ensure the connectedExternalNode ID is of correct size & set values
    if (connectedExternalNodes.Size() != 2)  {
        opserr << "EETrussCorot::EETrussCorot() - element: "
            <<  tag << " failed to create an ID of size 2\n";
        exit(-1);
    }
    
    connectedExternalNodes(0) = Nd1;
    connectedExternalNodes(1) = Nd2;
    
    // set node pointers to NULL
    theNodes[0] = 0;
    theNodes[1] = 0;
    
    // set the data size for the experimental site
    sizeCtrl = new ID(OF_Resp_All);
    sizeDaq = new ID(OF_Resp_All);
    
    (*sizeCtrl)[OF_Resp_Disp]  = 1;
    (*sizeCtrl)[OF_Resp_Vel]   = 1;
    (*sizeCtrl)[OF_Resp_Accel] = 1;
    (*sizeCtrl)[OF_Resp_Time]  = 1;
    
    (*sizeDaq)[OF_Resp_Disp]   = 1;
    (*sizeDaq)[OF_Resp_Vel]    = 1;
    (*sizeDaq)[OF_Resp_Accel]  = 1;
    (*sizeDaq)[OF_Resp_Force]  = 1;
    (*sizeDaq)[OF_Resp_Time]   = 1;
    
    theSite->setSize(*sizeCtrl, *sizeDaq);
    
    // allocate memory for trial response vectors
    db = new Vector(1);
    vb = new Vector(1);
    ab = new Vector(1);
    t  = new Vector(1);
    
    // allocate memory for daq response vectors
    dbDaq = new Vector(1);
    vbDaq = new Vector(1);
    abDaq = new Vector(1);
    qDaq  = new Vector(1);
    tDaq  = new Vector(1);
    
    // initialize additional vectors
    dbCtrl.Zero();
    vbCtrl.Zero();
    abCtrl.Zero();
}
//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 

}
Example #17
0
ElasticBeam2d::ElasticBeam2d(int tag, double a, double e, double i, 
			     int Nd1, int Nd2, CrdTransf &coordTransf,
			     double Alpha, double depth, double r, int cm)
  :Element(tag,ELE_TAG_ElasticBeam2d), 
  A(a), E(e), I(i), alpha(Alpha), d(depth), rho(r), cMass(cm),
  Q(6), q(3), connectedExternalNodes(2), theCoordTransf(0)
{
  connectedExternalNodes(0) = Nd1;
  connectedExternalNodes(1) = Nd2;
    
  theCoordTransf = coordTransf.getCopy2d();
    
  if (!theCoordTransf) {
    opserr << "ElasticBeam2d::ElasticBeam2d -- failed to get copy of coordinate transformation\n";
    exit(01);
  }

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

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

  // set node pointers to NULL
  theNodes[0] = 0;
  theNodes[1] = 0;
}
Example #18
0
ElastomericBearing2d::ElastomericBearing2d(int tag, int Nd1, int Nd2,
    double ke, double fy, double alpha, UniaxialMaterial **materials,
    const Vector _y, const Vector _x, double sdI, int addRay, double m)
    : Element(tag, ELE_TAG_ElastomericBearing2d),
    connectedExternalNodes(2),
    k0(0.0), qYield(0.0), k2(0.0), x(_x), y(_y),
    shearDistI(sdI), addRayleigh(addRay), mass(m),
    L(0.0), ub(3), ubPlastic(0.0), qb(3), kb(3,3), ul(6),
    Tgl(6,6), Tlb(3,6), ubPlasticC(0.0), kbInit(3,3)
{
    // ensure the connectedExternalNode ID is of correct size & set values
    if (connectedExternalNodes.Size() != 2)  {
        opserr << "ElastomericBearing2d::ElastomericBearing2d() - element: "
            << this->getTag() << " - failed to create an ID of size 2.\n";
    }
    
    connectedExternalNodes(0) = Nd1;
    connectedExternalNodes(1) = Nd2;
    
    // set node pointers to NULL
    for (int i=0; i<2; i++)
        theNodes[i] = 0;
    
    // initialize parameters
    k0 = (1.0-alpha)*ke;
    qYield = (1.0-alpha)*fy;
    k2 = alpha*ke;
    
    // check material input
    if (materials == 0)  {
        opserr << "ElastomericBearing2d::ElastomericBearing2d() - "
            << "null material array passed.\n";
        exit(-1);
    }
    
    // get copies of the uniaxial materials
    for (int i=0; i<2; i++)  {
        if (materials[i] == 0) {
            opserr << "ElastomericBearing2d::ElastomericBearing2d() - "
                "null uniaxial material pointer passed.\n";
            exit(-1);
        }
        theMaterials[i] = materials[i]->getCopy();
        if (theMaterials[i] == 0) {
            opserr << "ElastomericBearing2d::ElastomericBearing2d() - "
                << "failed to copy uniaxial material.\n";
            exit(-1);
        }
    }
    
    // initialize initial stiffness matrix
    kbInit.Zero();
    kbInit(0,0) = theMaterials[0]->getInitialTangent();
    kbInit(1,1) = ke;
    kbInit(2,2) = theMaterials[1]->getInitialTangent();
    
    // initialize other variables
    this->revertToStart();
}
Example #19
0
int
CoupledZeroLength::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
{
  int res = 0;
  
  int dataTag = this->getDbTag();

  // CoupledZeroLength creates an ID, receives the ID and then sets the 
  // internal data with the data in the ID

  static ID idData(10);

  res += theChannel.recvID(dataTag, commitTag, idData);
  if (res < 0) {
    opserr << "CoupledZeroLength::recvSelf -- failed to receive ID data\n";
			    
    return res;
  }

  res += theChannel.recvMatrix(dataTag, commitTag, transformation);
  if (res < 0) {
    opserr << "CoupledZeroLength::recvSelf -- failed to receive transformation Matrix\n";
			    
    return res;
  }

  this->setTag(idData(0));
  dimension = idData(1);
  numDOF = idData(2);
  connectedExternalNodes(0) = idData(3);
  connectedExternalNodes(1) = idData(4);
  useRayleighDamping = idData(5);
  dirn1 = idData(6);
  dirn1 = idData(7);

  int matDbTag = idData(8);
  int matClassTag = idData(9);

  // If null, get a new one from the broker
  if (theMaterial == 0 || theMaterial->getClassTag() != matClassTag) {
    if (theMaterial != 0)
      delete theMaterial;

    theMaterial = theBroker.getNewUniaxialMaterial(matClassTag);
    if (theMaterial == 0) {
	opserr << "CoupledZeroLength::recvSelf  -- failed to allocate new Material " << endln;
	return -1;
    }
  }

  // Receive the materials
  theMaterial->setDbTag(matDbTag);
  res = theMaterial->recvSelf(commitTag, theChannel, theBroker);
  if (res < 0) {
    opserr << "CoupledZeroLength::recvSelf  -- failed to receive new Material1d " << endln;
  }
  
  return res;
}
Example #20
0
DispBeamColumn2d::DispBeamColumn2d(int tag, int nd1, int nd2,
				   int numSec, SectionForceDeformation **s,
				   BeamIntegration& bi,
				   CrdTransf &coordTransf, double r, int cm)
:Element (tag, ELE_TAG_DispBeamColumn2d), 
 numSections(numSec), theSections(0), crdTransf(0), beamInt(0),
  connectedExternalNodes(2),
  Q(6), q(3), rho(r), cMass(cm), parameterID(0)
{
  // Allocate arrays of pointers to SectionForceDeformations
  theSections = new SectionForceDeformation *[numSections];
    
  if (theSections == 0) {
    opserr << "DispBeamColumn2d::DispBeamColumn2d - failed to allocate section model pointer\n";
    exit(-1);
  }

  for (int i = 0; i < numSections; i++) {
    
    // Get copies of the material model for each integration point
    theSections[i] = s[i]->getCopy();
    
    // Check allocation
    if (theSections[i] == 0) {
      opserr << "DispBeamColumn2d::DispBeamColumn2d -- failed to get a copy of section model\n";
      exit(-1);
    }
  }
  
  beamInt = bi.getCopy();
  
  if (beamInt == 0) {
    opserr << "DispBeamColumn2d::DispBeamColumn2d - failed to copy beam integration\n";
    exit(-1);
  }

  crdTransf = coordTransf.getCopy2d();
  
  if (crdTransf == 0) {
    opserr << "DispBeamColumn2d::DispBeamColumn2d - failed to copy coordinate transformation\n";
    exit(-1);
  }
  
  // Set connected external node IDs
  connectedExternalNodes(0) = nd1;
  connectedExternalNodes(1) = nd2;

  theNodes[0] = 0;
  theNodes[1] = 0;
  
  q0[0] = 0.0;
  q0[1] = 0.0;
  q0[2] = 0.0;
  
  p0[0] = 0.0;
  p0[1] = 0.0;
  p0[2] = 0.0;
}
Example #21
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;
}
Example #22
0
int
ZeroLengthSection::sendSelf(int commitTag, Channel &theChannel)
{
	int res = 0;

	// note: we don't check for dataTag == 0 for Element
	// objects as that is taken care of in a commit by the Domain
	// object - don't want to have to do the check if sending data
	int dataTag = this->getDbTag();

	// ZeroLengthSection packs its data into an ID and sends this to theChannel
	// along with its dbTag and the commitTag passed in the arguments
	static ID idData(9);

	idData(0) = this->getTag();
	idData(1) = dimension;
	idData(2) = numDOF;
	idData(3) = order;
	idData(4) = connectedExternalNodes(0);
	idData(5) = connectedExternalNodes(1);
	idData(6) = theSection->getClassTag();
	
	int secDbTag = theSection->getDbTag();
	if (secDbTag == 0) {
		secDbTag = theChannel.getDbTag();
		if (secDbTag != 0)
			theSection->setDbTag(secDbTag);
	}
	idData(7) = secDbTag;
	idData(8) = useRayleighDamping;


	res += theChannel.sendID(dataTag, commitTag, idData);
	if (res < 0) {
	  opserr << "ZeroLengthSection::sendSelf -- failed to send ID data\n";
			
		return res;
	}

	// Send the 3x3 direction cosine matrix, have to send it since it is only set
	// in the constructor and not setDomain()
	res += theChannel.sendMatrix(dataTag, commitTag, transformation);
	if (res < 0) {
	  opserr << "ZeroLengthSection::sendSelf -- failed to send transformation Matrix\n";
	  return res;
	}

	// Send the section
	res += theSection->sendSelf(commitTag, theChannel);
	if (res < 0) {
	  opserr << "ZeroLengthSection::sendSelf -- failed to send Section\n";
	  return res;
	}

	return res;
}
Example #23
0
// to set a link to the enclosing Domain and to set the node pointers.
void GenericClient::setDomain(Domain *theDomain)
{
    // check Domain is not null - invoked when object removed from a domain
    int i;
    if (!theDomain)  {
        for (i=0; i<numExternalNodes; i++)
            theNodes[i] = 0;
        return;
    }
    
    // first set the node pointers
    for (i=0; i<numExternalNodes; i++)
        theNodes[i] = theDomain->getNode(connectedExternalNodes(i));
    
    // if can't find all - send a warning message
    for (i=0; i<numExternalNodes; i++)  {
        if (!theNodes[i])  {
            opserr << "GenericClient::setDomain() - Nd" << i << ": " 
                << connectedExternalNodes(i) << " does not exist in the "
                << "model for GenericClient ele: " << this->getTag() << endln;
            return;
        }
    }
    
    // now determine the number of dof
    numDOF = 0;
    for (i=0; i<numExternalNodes; i++)  {
        numDOF += theNodes[i]->getNumberDOF();
    }
    
    // set the basicDOF ID
    int j, k = 0, ndf = 0;
    for (i=0; i<numExternalNodes; i++)  {
        for (j=0; j<theDOF[i].Size(); j++)  {
            basicDOF(k) = ndf + theDOF[i](j);
            k++;
        }
        ndf += theNodes[i]->getNumberDOF();
    }
    
    // set the matrix and vector sizes and zero them
    theMatrix.resize(numDOF,numDOF);
    theMatrix.Zero();
    theVector.resize(numDOF);
    theVector.Zero();
    theLoad.resize(numDOF);
    theLoad.Zero();
    theInitStiff.resize(numDOF,numDOF);
    theInitStiff.Zero();
    theMass.resize(numDOF,numDOF);
    theMass.Zero();
    
    // call the base class method
    this->DomainComponent::setDomain(theDomain);
}
Example #24
0
int 
NineNodeMixedQuad::sendSelf (int commitTag, Channel &theChannel)
{
  int res = 0;
  
  // note: we don't check for dataTag == 0 for Element
  // objects as that is taken care of in a commit by the Domain
  // object - don't want to have to do the check if sending data
  int dataTag = this->getDbTag();
  

  // Now quad sends the ids of its materials
  int matDbTag;
  
  static ID idData(28);
  
  int i;
  for (i = 0; i < 9; i++) {
    idData(i) = materialPointers[i]->getClassTag();
    matDbTag = materialPointers[i]->getDbTag();
    // NOTE: we do have to ensure that the material has a database
    // tag if we are sending to a database channel.
    if (matDbTag == 0) {
      matDbTag = theChannel.getDbTag();
			if (matDbTag != 0)
			  materialPointers[i]->setDbTag(matDbTag);
    }
    idData(i+9) = matDbTag;
  }
  
  idData(18) = this->getTag();
  idData(19) = connectedExternalNodes(0);
  idData(20) = connectedExternalNodes(1);
  idData(21) = connectedExternalNodes(2);
  idData(22) = connectedExternalNodes(3);
  idData(23) = connectedExternalNodes(4);
  idData(24) = connectedExternalNodes(5);
  idData(25) = connectedExternalNodes(6);
  idData(26) = connectedExternalNodes(7);
  idData(27) = connectedExternalNodes(8);


  res += theChannel.sendID(dataTag, commitTag, idData);
  if (res < 0) {
    opserr << "WARNING NineNodeMixedQuad::sendSelf() - " << this->getTag() << " failed to send ID\n";
      
    return res;
  }

  // Finally, quad asks its material objects to send themselves
  for (i = 0; i < 9; i++) {
    res += materialPointers[i]->sendSelf(commitTag, theChannel);
    if (res < 0) {
      opserr << "WARNING NineNodeMixedQuad::sendSelf() - " << this->getTag() << " failed to send its Material\n";
      return res;
    }
  }
  
  return res;
}
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;
}
Example #26
0
void
beam2d02::Print(OPS_Stream &s, int flag)
{
    // compute current state
    this->getResistingForce();
    
    s << "Element: " << this->getTag(); 
    s << " type: beam2d02  iNode: " << connectedExternalNodes(0);    
    s << " jNode: " << connectedExternalNodes(1);
    s << " Area: " << A << " E: " << E << " I: " << I << endln;
    s << " resisting Force: " << rForce;
}
Example #27
0
int
ModElasticBeam2d::sendSelf(int cTag, Channel &theChannel)
{
  int res = 0;

    static Vector data(19);
    
    data(0) = A;
    data(1) = E; 
    data(2) = I; 
    data(3) = rho;
    data(4) = cMass;
    data(5) = this->getTag();
    data(6) = connectedExternalNodes(0);
    data(7) = connectedExternalNodes(1);
    data(8) = theCoordTransf->getClassTag();
    	
    int dbTag = theCoordTransf->getDbTag();
    
    if (dbTag == 0) {
      dbTag = theChannel.getDbTag();
      if (dbTag != 0)
	theCoordTransf->setDbTag(dbTag);
    }

    data(9) = dbTag;
    data(10) = alpha;
    data(11) = d;

    data(12) = alphaM;
    data(13) = betaK;
    data(14) = betaK0;
    data(15) = betaKc;
 //added by Dimitrios Lignos   
	data(16) = K11;
	data(17) = K33;
	data(18) = K44;
    // Send the data vector
    res += theChannel.sendVector(this->getDbTag(), cTag, data);
    if (res < 0) {
      opserr << "ModElasticBeam2d::sendSelf -- could not send data Vector\n";
      return res;
    }

    // Ask the CoordTransf to send itself
    res += theCoordTransf->sendSelf(cTag, theChannel);
    if (res < 0) {
      opserr << "ModElasticBeam2d::sendSelf -- could not send CoordTransf\n";
      return res;
    }
    
    return res;
}
void
ZeroLengthContact3D::Print(OPS_Stream &s, int flag)
{
    if (flag == 0) { // print everything
	s << "Element: " << this->getTag(); 
	s << " type: ZeroLengthContact3D  iNode: " << connectedExternalNodes(0);
	s << " jNode: " << connectedExternalNodes(1) << endln;
    } else if (flag == 1) {
	s << this->getTag() << endln;
    } 

}
Example #29
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;
}
void
ElasticForceBeamColumn2d::setDomain(Domain *theDomain)
{
  // check Domain is not null - invoked when object removed from a domain
  if (theDomain == 0) {
    theNodes[0] = 0;
    theNodes[1] = 0;
    
    opserr << "ElasticForceBeamColumn2d::setDomain:  theDomain = 0 ";
  }

  // get pointers to the nodes
  
  int Nd1 = connectedExternalNodes(0);  
  int Nd2 = connectedExternalNodes(1);
  
  theNodes[0] = theDomain->getNode(Nd1);
  theNodes[1] = theDomain->getNode(Nd2);  
  
  if (theNodes[0] == 0) {
    opserr << "ElasticForceBeamColumn2d::setDomain: Nd1: ";
    opserr << Nd1 << "does not exist in model\n";
  }
  
  if (theNodes[1] == 0) {
    opserr << "ElasticForceBeamColumn2d::setDomain: Nd2: ";
    opserr << Nd2 << "does not exist in model\n";
  }
  
  // call the DomainComponent class method 
  this->DomainComponent::setDomain(theDomain);
  
  // ensure connected nodes have correct number of dof's
  int dofNode1 = theNodes[0]->getNumberDOF();
  int dofNode2 = theNodes[1]->getNumberDOF();
  
  if ((dofNode1 != NND) || (dofNode2 != NND)) {
    opserr << "ElasticForceBeamColumn2d::setDomain(): Nd2 or Nd1 incorrect dof ";
  }
   
  // initialize the transformation
  if (crdTransf->initialize(theNodes[0], theNodes[1])) {
    opserr << "ElasticForceBeamColumn2d::setDomain(): Error initializing coordinate transformation";  
  }
    
  // get element length
  double L = crdTransf->getInitialLength();
  if (L == 0.0) {
    opserr << "ElasticForceBeamColumn2d::setDomain(): Zero element length:" << this->getTag();  
  }
}