//============================================================== tensor EightNode_Brick_u_p::getGaussPts(void) { int dimensions1[] = {Num_TotalGaussPts,Num_Dim}; tensor Gs(2, dimensions1, 0.0); int dimensions2[] = {Num_Nodes}; tensor shp(1, dimensions2, 0.0); double r = 0.0; double s = 0.0; double t = 0.0; int i, j, where; int GP_c_r, GP_c_s, GP_c_t; for( GP_c_r = 0 ; GP_c_r < Num_IntegrationPts; GP_c_r++ ) { r = pts[GP_c_r]; for( GP_c_s = 0 ; GP_c_s < Num_IntegrationPts; GP_c_s++ ) { s = pts[GP_c_s]; for( GP_c_t = 0 ; GP_c_t < Num_IntegrationPts; GP_c_t++ ) { t = pts[GP_c_t]; where = (GP_c_r*Num_IntegrationPts+GP_c_s)*Num_IntegrationPts+GP_c_t; shp = shapeFunction(r,s,t); for (i=0; i<Num_Nodes; i++) { const Vector& T_Crds = theNodes[i]->getCrds(); for (j=0; j<Num_Dim; j++) { Gs.val(where+1, j+1) += shp.cval(i+1) * T_Crds(j); } } } } } return Gs; }
//====================================================================== const Vector& EightNode_Brick_u_p::getForceU () { static Vector PpU(Num_ElemDof); int U_dim[] = {Num_Nodes,Num_Dim}; tensor Ut(2,U_dim,0.0); int bf_dim[] = {Num_Dim}; tensor bftensor(1,bf_dim,0.0); bftensor.val(1) = bf(0); bftensor.val(2) = bf(1); bftensor.val(3) = bf(2); double r = 0.0; double rw = 0.0; double s = 0.0; double sw = 0.0; double t = 0.0; double tw = 0.0; double weight = 0.0; double det_of_Jacobian = 0.0; tensor Jacobian; tensor h; double rho_0 = (1.0-nf)*rho_s + nf*rho_f; int GP_c_r, GP_c_s, GP_c_t; for( GP_c_r = 0 ; GP_c_r < Num_IntegrationPts; GP_c_r++ ) { r = pts[GP_c_r]; rw = wts[GP_c_r]; for( GP_c_s = 0 ; GP_c_s < Num_IntegrationPts; GP_c_s++ ) { s = pts[GP_c_s]; sw = wts[GP_c_s]; for( GP_c_t = 0 ; GP_c_t < Num_IntegrationPts; GP_c_t++ ) { t = pts[GP_c_t]; tw = wts[GP_c_t]; Jacobian = this->Jacobian_3D(r,s,t); det_of_Jacobian = Jacobian.determinant(); h = shapeFunction(r,s,t); weight = rw * sw * tw * det_of_Jacobian; Ut += h("a")*bftensor("i") *(weight*rho_0); } } } PpU.Zero(); int i, j; for (i=0; i<Num_Nodes; i++) { for (j=0; j<Num_Dim; j++) { PpU(i*Num_Dof +j) = Ut.cval(i+1, j+1); } } return PpU; }
//====================================================================== double EightNode_Brick_u_p::getPorePressure(double x1, double x2, double x3) { double pp = 0.0; int i; for (i=0; i<Num_Nodes; i++) { const Vector& T_disp = theNodes[i]->getTrialDisp(); pp += shapeFunction(x1,x2,x3).cval(i+1) * T_disp(3); } return pp; }
//====================================================================== tensor EightNode_Brick_u_p::getStiffnessTensorQ( ) { int K1_dim[] = {Num_Nodes, Num_Dim, Num_Nodes}; tensor K1(3,K1_dim,0.0); tensor Kk1(3,K1_dim,0.0); double r = 0.0; double rw = 0.0; double s = 0.0; double sw = 0.0; double t = 0.0; double tw = 0.0; double weight = 0.0; double det_of_Jacobian = 1.0; int h_dim[] = {Num_Nodes,Num_Dim}; tensor h(2, h_dim, 0.0); tensor Jacobian; tensor dhGlobal; int GP_c_r, GP_c_s, GP_c_t; for( GP_c_r = 0 ; GP_c_r < Num_IntegrationPts; GP_c_r++ ) { r = pts[GP_c_r]; rw = wts[GP_c_r]; for( GP_c_s = 0 ; GP_c_s < Num_IntegrationPts; GP_c_s++ ) { s = pts[GP_c_s]; sw = wts[GP_c_s]; for( GP_c_t = 0 ; GP_c_t < Num_IntegrationPts; GP_c_t++ ) { t = pts[GP_c_t]; tw = wts[GP_c_t]; Jacobian = this->Jacobian_3D(r,s,t); det_of_Jacobian = Jacobian.determinant(); weight = rw * sw * tw * det_of_Jacobian ; h = shapeFunction(r,s,t); dhGlobal = this->dh_Global(r,s,t); Kk1 = dhGlobal("ai")*h("k"); K1 += Kk1*(weight*alpha); } } } return K1; }
//====================================================================== tensor EightNode_Brick_u_p::getMassTensorM1() { int M1_dim[] = {Num_Nodes,Num_Nodes}; tensor M1(2,M1_dim,0.0); tensor Mm1(2,M1_dim,0.0); double r = 0.0; double rw = 0.0; double s = 0.0; double sw = 0.0; double t = 0.0; double tw = 0.0; double weight = 0.0; double det_of_Jacobian = 1.0; tensor h; tensor Jacobian; double rho_0 = (1.0-nf)*rho_s + nf*rho_f; int GP_c_r, GP_c_s, GP_c_t; for( GP_c_r = 0 ; GP_c_r < Num_IntegrationPts; GP_c_r++ ) { r = pts[GP_c_r]; rw = wts[GP_c_r]; for( GP_c_s = 0 ; GP_c_s < Num_IntegrationPts; GP_c_s++ ) { s = pts[GP_c_s]; sw = wts[GP_c_s]; for( GP_c_t = 0 ; GP_c_t < Num_IntegrationPts; GP_c_t++ ) { t = pts[GP_c_t]; tw = wts[GP_c_t]; Jacobian = this->Jacobian_3D(r,s,t); det_of_Jacobian = Jacobian.determinant(); h = shapeFunction(r,s,t); weight = rw * sw * tw * det_of_Jacobian; Mm1 = h("m")*h("n"); M1 += Mm1*(weight*rho_0); } } } return M1; }
//====================================================================== tensor EightNode_Brick_u_p::getDampingTensorS( ) { int C2_dim[] = {Num_Nodes, Num_Nodes}; tensor C2(2,C2_dim,0.0); tensor Cc2(2,C2_dim,0.0); double r = 0.0; double rw = 0.0; double s = 0.0; double sw = 0.0; double t = 0.0; double tw = 0.0; double weight = 0.0; double det_of_Jacobian = 1.0; tensor Jacobian; tensor h; double Qqinv = (alpha-nf)/ks + nf/kf; int GP_c_r, GP_c_s, GP_c_t; for( GP_c_r = 0 ; GP_c_r < Num_IntegrationPts; GP_c_r++ ) { r = pts[GP_c_r]; rw = wts[GP_c_r]; for( GP_c_s = 0 ; GP_c_s < Num_IntegrationPts; GP_c_s++ ) { s = pts[GP_c_s]; sw = wts[GP_c_s]; for( GP_c_t = 0 ; GP_c_t < Num_IntegrationPts; GP_c_t++ ) { t = pts[GP_c_t]; tw = wts[GP_c_t]; h = shapeFunction(r,s,t); Jacobian = this->Jacobian_3D(r,s,t); det_of_Jacobian = Jacobian.determinant(); weight = rw * sw * tw * det_of_Jacobian; Cc2 = h("a")*h("k"); C2 += Cc2*(weight*Qqinv); } } } return C2; }
double XC::FourNodeQuad::detJ(const double &xi,const double &eta) const { return shapeFunction(GaussPoint(Pos2d(xi,eta),0)); }
tensor TotalLagrangianFD8NodeBrick::getBodyForce(void) { int B_dim[] = {NumNodes,NumDof}; tensor Bb(2,B_dim,0.0); double r = 0.0; double rw = 0.0; double s = 0.0; double sw = 0.0; double t = 0.0; double tw = 0.0; int where = 0; int GP_c_r, GP_c_s, GP_c_t; double weight = 0.0; int h_dim[] = {20}; tensor h(1, h_dim, 0.0); int dh_dim[] = {NumNodes,NumDof}; tensor dh(2, dh_dim, 0.0); int bodyforce_dim[] = {3}; tensor bodyforce(1, bodyforce_dim, 0.0); double det_of_Jacobian = 0.0; tensor Jacobian; tensor JacobianINV; bodyforce.val(1) = bf(0); bodyforce.val(2) = bf(1); bodyforce.val(3) = bf(2); for( GP_c_r = 0 ; GP_c_r < NumIntegrationPts ; GP_c_r++ ) { r = pts[GP_c_r ]; rw = wts[GP_c_r ]; for( GP_c_s = 0 ; GP_c_s < NumIntegrationPts ; GP_c_s++ ) { s = pts[GP_c_s ]; sw = wts[GP_c_s ]; for( GP_c_t = 0 ; GP_c_t < NumIntegrationPts ; GP_c_t++ ) { t = pts[GP_c_t ]; tw = wts[GP_c_t ]; where =(GP_c_r * NumIntegrationPts + GP_c_s) * NumIntegrationPts + GP_c_t; h = shapeFunction(r,s,t); dh = shapeFunctionDerivative(r,s,t); Jacobian = this->Jacobian_3D(r,s,t); det_of_Jacobian = Jacobian.determinant(); weight = rw * sw * tw * det_of_Jacobian; Bb = Bb + h("P") * bodyforce("i") * rho *weight; Bb.null_indices(); } } } return Bb; }