// // resisting force //////////////////////////////////////////////////////////////////////////// const Vector& Quad4FiberOverlay::getResistingForce() { P.Zero(); //const Vector &disp1 = theNodes[0]->getTrialDisp(); //const Vector &disp2 = theNodes[1]->getTrialDisp(); //const Vector &disp3 = theNodes[2]->getTrialDisp(); //const Vector &disp4 = theNodes[3]->getTrialDisp(); //Vector u(8); //u(0) = disp1(0); //u(1) = disp1(1); //u(2) = disp2(0); //u(3) = disp2(1); //u(4) = disp3(0); //u(5) = disp3(1); //u(6) = disp4(0); //u(7) = disp4(1); //this->getTangentStiff(); //P = FiberK ^ u; // opserr << "finished resisting force" << endln; for (int ip = 0; ip<2; ip++) { this->getEltBb(pts[ip][0],pts[ip][1]); for (int i = 0; i < SL_NUM_DOF; i++){ P(i) += Lf/2.0*Af*wts[ip]*Bb(i)*theMaterial->getStress(); } } return P; }
double Quad4FiberOverlay::computeCurrentStrain() { // determine the current strain given trial displacements at nodes u.Zero(); const Vector &disp1 = theNodes[0]->getTrialDisp(); const Vector &disp2 = theNodes[1]->getTrialDisp(); const Vector &disp3 = theNodes[2]->getTrialDisp(); const Vector &disp4 = theNodes[3]->getTrialDisp(); u[0] = disp1(0); u[1] = disp1(1); u[2] = disp2(0); u[3] = disp2(1); u[4] = disp3(0); u[5] = disp3(1); u[6] = disp4(0); u[7] = disp4(1); // Loop over the integration points strain = 0; for(int ip = 0; ip < 2; ip++) { //This llop calculates twice the strain, since it is adding the strain at two GP... this->getEltBb(pts[ip][0],pts[ip][1]); for (int i = 0; i < SL_NUM_DOF; i++) { strain += Bb(i)*u(i); } } strain = strain/2.0; //Since it was calculated twice. this function should be redeveloped return strain; }
const Matrix& Quad4FiberOverlay::getTangentStiff() { FiberK.Zero(); double Ef = theMaterial->getTangent(); for (int ip = 0; ip<2; ip++) { this->getEltBb(pts[ip][0],pts[ip][1]); for (int i = 0; i < SL_NUM_DOF; i++){ for (int j = 0; j < SL_NUM_DOF; j++){ FiberK(i,j) += Lf/2.0*Af*Ef*wts[ip]*Bb(i) * Bb(j); //opserr << "K = " << "(" <<i<<","<<j<<") ="<<FiberK(i,j) << endln; } } } return FiberK; }
void ProcessEquiSpacedOutput::GenOrthoModes( int n, const Array<OneD,const NekDouble> &phys, Array<OneD, NekDouble> &coeffs) { LocalRegions::ExpansionSharedPtr e; e = m_f->m_exp[0]->GetExp(n); switch(e->DetShapeType()) { case LibUtilities::eTriangle: { int np0 = e->GetBasis(0)->GetNumPoints(); int np1 = e->GetBasis(1)->GetNumPoints(); int np = max(np0,np1); // to ensure points are correctly projected to np need // to increase the order slightly of coordinates LibUtilities::PointsKey pa(np+1,e->GetPointsType(0)); LibUtilities::PointsKey pb(np,e->GetPointsType(1)); Array<OneD, NekDouble> tophys(np*(np+1)); LibUtilities::BasisKey Ba(LibUtilities::eOrtho_A,np,pa); LibUtilities::BasisKey Bb(LibUtilities::eOrtho_B,np,pb); StdRegions::StdTriExp OrthoExp(Ba,Bb); // interpolate points to new phys points! LibUtilities::Interp2D(e->GetBasis(0)->GetBasisKey(), e->GetBasis(1)->GetBasisKey(), phys,Ba,Bb,tophys); OrthoExp.FwdTrans(tophys,coeffs); break; } case LibUtilities::eQuadrilateral: { int np0 = e->GetBasis(0)->GetNumPoints(); int np1 = e->GetBasis(1)->GetNumPoints(); int np = max(np0,np1); LibUtilities::PointsKey pa(np+1,e->GetPointsType(0)); LibUtilities::PointsKey pb(np+1,e->GetPointsType(1)); Array<OneD, NekDouble> tophys((np+1)*(np+1)); LibUtilities::BasisKey Ba(LibUtilities::eOrtho_A,np,pa); LibUtilities::BasisKey Bb(LibUtilities::eOrtho_A,np,pb); StdRegions::StdQuadExp OrthoExp(Ba,Bb); // interpolate points to new phys points! LibUtilities::Interp2D(e->GetBasis(0)->GetBasisKey(), e->GetBasis(1)->GetBasisKey(), phys,Ba,Bb,tophys); OrthoExp.FwdTrans(phys,coeffs); break; } default: ASSERTL0(false,"Shape needs setting up"); break; } }
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; }