Beispiel #1
0
void   XC::Twenty_Node_Brick::formInertiaTerms( int tangFlag ) const
{
        static double xsj ;  // determinant jacaobian matrix
        int i, j, k, m;
        double Nrho;

        //zero mass
        mass.Zero( ) ;

        //compute basis vectors and local nodal coordinates
        computeBasis( ) ;
        //gauss loop to compute and save shape functions
        for( i = 0; i < nintu; i++ ) {
                // compute Jacobian and global shape functions
                Jacobian3d(i, xsj, 0);
                //volume element to also be saved
                dvolu[i] = wu[i] * xsj ;
        } // end for i

        // Compute consistent mass matrix
        for(i = 0; i < nenu; i++) {
                for(j = 0; j < nenu; j++) {
                        for(m = 0; m < nintu; m++) {
                                Nrho = dvolu[m]*mixtureRho(m)*shgu[3][i][m]*shgu[3][j][m];
                                for( k = 0; k < 3; k++) {
                                        mass(i*3+k,j*3+k) += Nrho;
                                }
                        }
                }
        }

}
const Matrix&
FourNodeQuadUP::getMass()
{
    K.Zero();

    int i, j, m, i1, j1;
    double Nrho;

    // Determine Jacobian for this integration point
    this->shapeFunction();


    // Compute an ad hoc lumped mass matrix
    /*for (i = 0; i < 4; i++) {

      // average material density
      tmp = mixtureRho(i);

      for (int alpha = 0, ia = 0; alpha < 4; alpha++, ia += 3) {
        Nrho = shp[2][alpha][i]*dvol[i]*tmp;
        K(ia,ia) += Nrho;
        K(ia+1,ia+1) += Nrho;
      }
    }*/

    // Compute consistent mass matrix
    for (i = 0, i1 = 0; i < 12; i += 3, i1++) {
        for (j = 0, j1 = 0; j < 12; j += 3, j1++) {
            for (m = 0; m < 4; m++) {
                Nrho = dvol[m]*mixtureRho(m)*shp[2][i1][m]*shp[2][j1][m];
                K(i,j) += Nrho;
                K(i+1,j+1) += Nrho;
            }
        }
    }

    // Compute compressibility matrix
    double vol = dvol[0] + dvol[1] + dvol[2] + dvol[3];
    double oneOverKc = 1./kc;

    for (i = 2; i < 12; i += 3) {
        i1 = (i-2) / 3;
        for (j = 2; j < 12; j += 3) {
            j1 = (j-2) / 3;
            //K(i,j) = -vol*oneOverKc*shpBar[2][i1]*shpBar[2][j1];
            for (m = 0; m < 4; m++) {
                K(i,j) += -dvol[m]*oneOverKc*shp[2][i1][m]*shp[2][j1][m];
            }
        }
    }

    /*for (i = 2; i < 12; i += 3) {
      i1 = (i-2) / 3;
      K(i,i) = -vol*oneOverKc*shpBar[2][i1];
    }*/
    return K;
}
const Vector&
NineFourNodeQuadUP::getResistingForce()
{
  P.Zero();
  
  int i, j, jk;

  // Determine Jacobian for this integration point
  this->globalShapeFunction(dvolu, wu, nintu, nenu, 0); 
  this->globalShapeFunction(dvolp, wp, nintp, nenp, 1); 
  
  // Loop over the integration points
  for (i = 0; i < nintu; i++) {

    // Get material stress response
    const Vector &sigma = theMaterial[i]->getStress();
    
    // Perform numerical integration on internal force
    //P = P + (B^ sigma) * intWt(i)*intWt(j) * detJ;
    //P.addMatrixTransposeVector(1.0, B, sigma, intWt(i)*intWt(j)*detJ);
	for (j = 0; j < nenu; j++) {
		if (j<nenp) jk = j*3;
	    if (j>=nenp) jk = nenp*3 + (j-nenp)*2;

        P(jk) += dvolu[i]*(shgu[0][j][i]*sigma(0) + shgu[1][j][i]*sigma(2));      
        P(jk+1) += dvolu[i]*(shgu[1][j][i]*sigma(1) + shgu[0][j][i]*sigma(2));
      
        // Subtract equiv. body forces from the nodes
        //P = P - (N^ b) * intWt(i)*intWt(j) * detJ;
        //P.addMatrixTransposeVector(1.0, N, b, -intWt(i)*intWt(j)*detJ);
        double r = mixtureRho(i);
        P(jk) -= dvolu[i]*(shgu[2][j][i]*r*b[0]);
        P(jk+1) -= dvolu[i]*(shgu[2][j][i]*r*b[1]);
    }
  }
//  opserr<<"K -body"<<P<<endln;
  
  // Subtract fluid body force
  for (j = 0; j < nenp; j++) {
	 jk = j*3+2;
     for (i = 0; i < nintp; i++) {
        P(jk) += dvolp[i]*rho*(perm[0]*b[0]*shgp[0][j][i] +
                 perm[1]*b[1]*shgp[1][j][i]);
     }
  }

//  opserr<<"K -fluid "<<P<<endln;

  // Subtract other external nodal loads ... P_res = P_int - P_ext
  //P = P - Q;
  P.addVector(1.0, Q, -1.0);
  
  return P;
}
const Matrix&
NineFourNodeQuadUP::getMass()
{
  K.Zero();
  
  int i, j, m, ik, jk;
  double Nrho;
  
  // Determine Jacobian for this integration point
  this->globalShapeFunction(dvolu, wu, nintu, nenu, 0); 

  // Compute consistent mass matrix
  for (i = 0; i < nenu; i++) {
	  if (i<nenp) ik = i*3;
      if (i>=nenp) ik = nenp*3 + (i-nenp)*2;

	  for (j = 0; j < nenu; j++) {
		  if (j<nenp) jk = j*3;
	      if (j>=nenp) jk = nenp*3 + (j-nenp)*2;

          for (m = 0; m < nintu; m++) {
              Nrho = dvolu[m]*mixtureRho(m)*shgu[2][i][m]*shgu[2][j][m];
              K(ik,jk) += Nrho;
              K(ik+1,jk+1) += Nrho;
		  }
	  }
  }
  
  // Compute compressibility matrix
  double oneOverKc = 1./kc;
  this->globalShapeFunction(dvolp, wp, nintp, nenp, 1); 
  
  for (i = 0; i < nenp; i++) {
       ik = i*3+2;

       for (j = 0; j < nenp; j++) {
	       jk = j*3+2;

           for (m = 0; m < nintp; m++) {
	          K(ik,jk) += -dvolp[m]*oneOverKc*shgp[2][i][m]*shgp[2][j][m];
	  }
    }
  }

  return K;
}
Beispiel #5
0
//get residual
const XC::Vector &XC::Twenty_Node_Brick::getResistingForce(void) const
  {
        int i, j, k, k1;
        double xsj;
        static XC::Matrix B(6, 3);
        double volume = 0.;

//        printf("calling getResistingForce()\n");
        resid.Zero();

        //compute basis vectors and local nodal coordinates
        computeBasis( ) ;
        //gauss loop to compute and save shape functions
        for( i = 0; i < nintu; i++ ) {
                // compute Jacobian and global shape functions
                Jacobian3d(i, xsj, 0);
                //volume element to also be saved
                dvolu[i] = wu[i] * xsj ;
                volume += dvolu[i];
        } // end for i
        //printf("volume = %f\n", volume);

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

                // Get material stress response
                const XC::Vector &sigma = physicalProperties[i]->getStress();

                // Perform numerical integration on internal force
                //P = P + (B^ sigma) * intWt(i)*intWt(j) * detJ;
                //P.addMatrixTransposeVector(1.0, B, sigma, intWt(i)*intWt(j)*detJ);
                for(j = 0; j < nenu; j++) {

                        B(0,0) = shgu[0][j][i];
                        B(0,1) = 0.;
                        B(0,2) = 0.;
                        B(1,0) = 0.;
                        B(1,1) = shgu[1][j][i];
                        B(1,2) = 0.;
                        B(2,0) = 0.;
                        B(2,1) = 0.;
                        B(2,2) = shgu[2][j][i];
                        B(3,0) = shgu[1][j][i];
                        B(3,1) = shgu[0][j][i];
                        B(3,2) = 0.;
                        B(4,0) = 0.;
                        B(4,1) = shgu[2][j][i];
                        B(4,2) = shgu[1][j][i];
                        B(5,0) = shgu[2][j][i];
                        B(5,1) = 0.;
                        B(5,2) = shgu[0][j][i];


                        for(k = 0; k < 3; k++) {
                                for(k1 = 0; k1 < 6; k1++)
                                        resid(j*3+k) += dvolu[i]*(B(k1,k)*sigma(k1));
                        }
                        // Subtract equiv. body forces from the nodes
                        //P = P - (N^ b) * intWt(i)*intWt(j) * detJ;
                        //P.addMatrixTransposeVector(1.0, N, b, -intWt(i)*intWt(j)*detJ);
                        double r = mixtureRho(i);
                        resid(j*3) -= dvolu[i]*(shgu[3][j][i]*r*bf[0]);
                        resid(j*3+1) -= dvolu[i]*(shgu[3][j][i]*r*bf[1]);
                        resid(j*3+2) -= dvolu[i]*(shgu[3][j][i]*r*bf[2]);
                }
        }

        // Subtract other external nodal loads ... P_res = P_int - P_ext
//        std::cerr<<"resid before:"<<resid<<std::endl;

        if(!load.isEmpty())
          resid-= load;

//        std::cerr<<"resid "<<resid<<std::endl;

    if(isDead())
      resid*=dead_srf;
    return resid ;
  }
void   TwentyEightNodeBrickUP::formInertiaTerms( int tangFlag )

{

	static double xsj ;  // determinant jacaobian matrix

	int i, j, k, ik, m, jk;

	double Nrho;



	//zero mass

	mass.Zero( ) ;



	//compute basis vectors and local nodal coordinates

	computeBasis( ) ;

	//gauss loop to compute and save shape functions

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

		// compute Jacobian and global shape functions

		Jacobian3d(i, xsj, 0);

		//volume element to also be saved

		dvolu[i] = wu[i] * xsj ;

	} // end for i

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

		// compute Jacobian and global shape functions

		Jacobian3d(i, xsj, 1);

		//volume element to also be saved

		dvolp[i] = wp[i] * xsj ;

	} // end for i



	// Compute consistent mass matrix

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

		if (i<nenp)

			ik = i*4;

		else

			ik = nenp*4 + (i-nenp)*3;



		for (j = 0; j < nenu; j++) {

			if (j<nenp)

				jk = j*4;

			else

				jk = nenp*4 + (j-nenp)*3;



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

				Nrho = dvolu[m]*mixtureRho(m)*shgu[3][i][m]*shgu[3][j][m];

				for( k = 0; k < 3; k++) {

					mass(ik+k,jk+k) += Nrho;

				}

			}

		}

	}



	// Compute compressibility matrix

	double oneOverKc = 1./kc;

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

		ik = i*4+3;



		for (j = 0; j < nenp; j++) {

			jk = j*4+3;



			for (m = 0; m < nintp; m++) {

				mass(ik,jk) += -dvolp[m]*oneOverKc*shgp[3][i][m]*shgp[3][j][m];

			}

		}

	}

}
const Vector&  TwentyEightNodeBrickUP::getResistingForce( )

{

	int i, j, jk, k, k1;

	double xsj;

	static Matrix B(6, 3);

	double volume = 0.;



//	printf("calling getResistingForce()\n");

	resid.Zero();



	//compute basis vectors and local nodal coordinates

	computeBasis( ) ;

	//gauss loop to compute and save shape functions

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

		// compute Jacobian and global shape functions

		Jacobian3d(i, xsj, 0);

		//volume element to also be saved

		dvolu[i] = wu[i] * xsj ;

		volume += dvolu[i];

	} // end for i

	//printf("volume = %f\n", volume);

	volume = 0.;

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

		// compute Jacobian and global shape functions

		Jacobian3d(i, xsj, 1);

		//volume element to also be saved

		dvolp[i] = wp[i] * xsj ;

		volume += dvolp[i];

	} // end for i

	//printf("volume = %f\n", volume);



	// Loop over the integration points

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



		// Get material stress response

		const Vector &sigma = materialPointers[i]->getStress();



		// Perform numerical integration on internal force

		//P = P + (B^ sigma) * intWt(i)*intWt(j) * detJ;

		//P.addMatrixTransposeVector(1.0, B, sigma, intWt(i)*intWt(j)*detJ);

		for (j = 0; j < nenu; j++) {

			if (j<nenp)

				jk = j*4;

			else

				jk = nenp*4 + (j-nenp)*3;



			B(0,0) = shgu[0][j][i];

			B(0,1) = 0.;

			B(0,2) = 0.;

			B(1,0) = 0.;

			B(1,1) = shgu[1][j][i];

			B(1,2) = 0.;

			B(2,0) = 0.;

			B(2,1) = 0.;

			B(2,2) = shgu[2][j][i];

			B(3,0) = shgu[1][j][i];

			B(3,1) = shgu[0][j][i];

			B(3,2) = 0.;

			B(4,0) = 0.;

			B(4,1) = shgu[2][j][i];

			B(4,2) = shgu[1][j][i];

			B(5,0) = shgu[2][j][i];

			B(5,1) = 0.;

			B(5,2) = shgu[0][j][i];





			for(k = 0; k < 3; k++) {

				for(k1 = 0; k1 < 6; k1++)

					resid(jk+k) += dvolu[i]*(B(k1,k)*sigma(k1));

			}

			// Subtract equiv. body forces from the nodes

			//P = P - (N^ b) * intWt(i)*intWt(j) * detJ;

			//P.addMatrixTransposeVector(1.0, N, b, -intWt(i)*intWt(j)*detJ);

			double r = mixtureRho(i);

			if (applyLoad == 0) {
				resid(jk) -= dvolu[i]*(shgu[3][j][i]*r*b[0]);
				resid(jk+1) -= dvolu[i]*(shgu[3][j][i]*r*b[1]);
				resid(jk+2) -= dvolu[i]*(shgu[3][j][i]*r*b[2]);
			} else {
				resid(jk) -= dvolu[i]*(shgu[3][j][i]*r*appliedB[0]);
				resid(jk+1) -= dvolu[i]*(shgu[3][j][i]*r*appliedB[1]);
				resid(jk+2) -= dvolu[i]*(shgu[3][j][i]*r*appliedB[2]);
			}

		}

	}



	// Subtract fluid body force

	for (j = 0; j < nenp; j++) {

		jk = j*4+3;

		for (i = 0; i < nintp; i++) {
			
			if (applyLoad == 0) {
				resid(jk) += dvolp[i]*rho*(perm[0]*b[0]*shgp[0][j][i] +
							 perm[1]*b[1]*shgp[1][j][i] + perm[2]*b[2]*shgp[2][j][i]);
			} else {
				resid(jk) += dvolp[i]*rho*(perm[0]*appliedB[0]*shgp[0][j][i] +
							 perm[1]*appliedB[1]*shgp[1][j][i] + perm[2]*appliedB[2]*shgp[2][j][i]);
			}

		}

	}



	// Subtract other external nodal loads ... P_res = P_int - P_ext

//	opserr<<"resid before:"<<resid<<endln;



	if (load != 0)

		resid -= *load;



//	opserr<<"resid "<<resid<<endln;



	return resid ;

}
const Vector&
FourNodeQuadUP::getResistingForce()
{
    P.Zero();

    // Determine Jacobian for this integration point
    this->shapeFunction();
    double vol = dvol[0] + dvol[1] + dvol[2] + dvol[3];

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

        // Get material stress response
        const Vector &sigma = theMaterial[i]->getStress();

        // Perform numerical integration on internal force
        //P = P + (B^ sigma) * intWt(i)*intWt(j) * detJ;
        //P.addMatrixTransposeVector(1.0, B, sigma, intWt(i)*intWt(j)*detJ);
        for (int alpha = 0, ia = 0; alpha < 4; alpha++, ia += 3) {

            P(ia) += dvol[i]*(shp[0][alpha][i]*sigma(0) + shp[1][alpha][i]*sigma(2));

            P(ia+1) += dvol[i]*(shp[1][alpha][i]*sigma(1) + shp[0][alpha][i]*sigma(2));

            // Subtract equiv. body forces from the nodes
            //P = P - (N^ b) * intWt(i)*intWt(j) * detJ;
            //P.addMatrixTransposeVector(1.0, N, b, -intWt(i)*intWt(j)*detJ);

            double r = mixtureRho(i);
            if (applyLoad == 0) {
                P(ia) -= dvol[i]*(shp[2][alpha][i]*r*b[0]);
                P(ia+1) -= dvol[i]*(shp[2][alpha][i]*r*b[1]);
            } else {
                P(ia) -= dvol[i]*(shp[2][alpha][i]*r*appliedB[0]);
                P(ia+1) -= dvol[i]*(shp[2][alpha][i]*r*appliedB[1]);
            }
        }
    }

    // Subtract fluid body force
    for (int alpha = 0, ia = 0; alpha < 4; alpha++, ia += 3) {
        //P(ia+2) += vol*rho*(perm[0]*b[0]*shpBar[0][alpha]
        //		+perm[1]*b[1]*shpBar[1][alpha]);
        for (i = 0; i < 4; i++) {
            if (applyLoad == 0) {
                P(ia+2) += dvol[i]*rho*(perm[0]*b[0]*shp[0][alpha][i] +
                                        perm[1]*b[1]*shp[1][alpha][i]);
            } else {
                P(ia+2) += dvol[i]*rho*(perm[0]*appliedB[0]*shp[0][alpha][i] +
                                        perm[1]*appliedB[1]*shp[1][alpha][i]);
            }
        }
    }

    // Subtract pressure loading from resisting force
    if (pressure != 0.0) {
        //P = P + pressureLoad;
        P.addVector(1.0, pressureLoad, -1.0);
    }

    // Subtract other external nodal loads ... P_res = P_int - P_ext
    //P = P - Q;
    P.addVector(1.0, Q, -1.0);

    return P;
}