/* and draw the resulting triangles */ void subdividet(GLfloat u1[2], GLfloat u2[2], GLfloat u3[2], float cutoff, int depth) { GLfloat v1[3], v2[3], v3[3], n1[3], n2[3], n3[3]; GLfloat u12[2], u23[2], u31[2]; int i; if(depth == MAXDEPTH || (curv(u1) < cutoff && curv(u2) < cutoff && curv(u3) < cutoff)){ surf(u1,v1,n1); surf(u2,v2,n2); surf(u3,v3,n3); glBegin(GL_TRIANGLES); glNormal3fv(n1); glVertex3fv(v1); //glNormal3fv(n2); glVertex3fv(v2); //glNormal3fv(n3); glVertex3fv(v3); glEnd(); return; } for(i=0;i<2;i++){ u12[i]=(u1[i]+u2[i])/2.0; u23[i]=(u2[i]+u3[i])/2.0; u31[i]=(u1[i]+u3[i])/2.0; } subdividet(u1,u12,u31,cutoff,depth+1); subdividet(u2,u23,u12,cutoff,depth+1); subdividet(u3,u31,u23,cutoff,depth+1); subdividet(u12,u23,u31,cutoff,depth+1); }
void ComputeCosseratIncrementalSmallStrain::computeQpProperties() { RankTwoTensor strain((*_grad_disp[0])[_qp], (*_grad_disp[1])[_qp], (*_grad_disp[2])[_qp]); RankTwoTensor strain_old((*_grad_disp_old[0])[_qp], (*_grad_disp_old[1])[_qp], (*_grad_disp_old[2])[_qp]); RealVectorValue wc_vector((*_wc[0])[_qp], (*_wc[1])[_qp], (*_wc[2])[_qp]); RealVectorValue wc_vector_old((*_wc_old[0])[_qp], (*_wc_old[1])[_qp], (*_wc_old[2])[_qp]); for (unsigned i = 0; i < LIBMESH_DIM; ++i) for (unsigned j = 0; j < LIBMESH_DIM; ++j) for (unsigned k = 0; k < LIBMESH_DIM; ++k) { strain(i, j) += PermutationTensor::eps(i, j, k) * wc_vector(k); strain_old(i, j) += PermutationTensor::eps(i, j, k) * wc_vector_old(k); } _deformation_gradient[_qp] = strain; _deformation_gradient[_qp].addIa(1.0); // Gauss point deformation gradient const RankTwoTensor total_strain_increment = strain - strain_old; _strain_increment[_qp] = total_strain_increment; _strain_increment[_qp] -= _eigenstrain_increment[_qp]; _strain_rate[_qp] = _strain_increment[_qp]/_dt; _total_strain[_qp] = _total_strain_old[_qp] + total_strain_increment; _mechanical_strain[_qp] = _mechanical_strain_old[_qp] + _strain_increment[_qp]; RankTwoTensor curv((*_grad_wc[0])[_qp], (*_grad_wc[1])[_qp], (*_grad_wc[2])[_qp]); RankTwoTensor curv_old((*_grad_wc_old[0])[_qp], (*_grad_wc_old[1])[_qp], (*_grad_wc_old[2])[_qp]); _curvature_increment[_qp] = curv - curv_old; _curvature[_qp] = _curvature_old[_qp] + _curvature_increment[_qp]; }
void LIBeam3dNL :: computeStrainVector(FloatArray &answer, GaussPoint *gp, TimeStep *tStep) { FloatArray xd(3), eps(3), curv(3); // update temp triad this->updateTempTriad(tStep); this->computeXdVector(xd, tStep); // compute eps_xl, gamma_l2, gamma_l3 eps.beTProductOf(tempTc, xd); eps.times(1. / this->l0); eps.at(1) -= 1.0; // update curvature at midpoint this->computeTempCurv(curv, tStep); answer.resize(6); answer.at(1) = eps.at(1); // eps_xl answer.at(2) = eps.at(2); // gamma_l2 answer.at(3) = eps.at(3); // gamma_l3 answer.at(4) = curv.at(1); // kappa_1 answer.at(5) = curv.at(2); // kappa_2 answer.at(6) = curv.at(3); // kappa_3 }
void LIBeam3dNL :: computeTempCurv(FloatArray &answer, TimeStep *tStep) { Material *mat = this->giveMaterial(); IntegrationRule *iRule = integrationRulesArray [ giveDefaultIntegrationRule() ]; GaussPoint *gp = iRule->getIntegrationPoint(0); ; FloatArray ui(3), xd(3), curv(3), ac(3), PrevEpsilon; FloatMatrix sc(3, 3), tmid(3, 3); answer.resize(3); // update curvature at midpoint // first, compute Tmid // ask increments this->computeVectorOf(EID_MomentumBalance, VM_Incremental, tStep, ui); ac.at(1) = 0.5 * ( ui.at(10) - ui.at(4) ); ac.at(2) = 0.5 * ( ui.at(11) - ui.at(5) ); ac.at(3) = 0.5 * ( ui.at(12) - ui.at(6) ); this->computeSMtrx(sc, ac); sc.times(1. / 2.); // compute I+sc sc.at(1, 1) += 1.0; sc.at(2, 2) += 1.0; sc.at(3, 3) += 1.0; tmid.beProductOf(sc, this->tc); // update curvature at centre ac.at(1) = ( ui.at(10) - ui.at(4) ); ac.at(2) = ( ui.at(11) - ui.at(5) ); ac.at(3) = ( ui.at(12) - ui.at(6) ); answer.beTProductOf(tmid, ac); answer.times(1 / this->l0); // ask for previous kappa PrevEpsilon = ( ( StructuralMaterialStatus * ) mat->giveStatus(gp) )->giveStrainVector(); if ( PrevEpsilon.giveSize() ) { answer.at(1) += PrevEpsilon.at(4); answer.at(2) += PrevEpsilon.at(5); answer.at(3) += PrevEpsilon.at(6); } }
int DispBeamColumn2d::getResponse(int responseID, Information &eleInfo) { double V; double L = crdTransf->getInitialLength(); if (responseID == 1) return eleInfo.setVector(this->getResistingForce()); else if (responseID == 12) { P.Zero(); P.addVector(1.0, this->getRayleighDampingForces(), 1.0); return eleInfo.setVector(P); } else if (responseID == 2) { P(3) = q(0); P(0) = -q(0)+p0[0]; P(2) = q(1); P(5) = q(2); V = (q(1)+q(2))/L; P(1) = V+p0[1]; P(4) = -V+p0[2]; return eleInfo.setVector(P); } else if (responseID == 9) { return eleInfo.setVector(q); } else if (responseID == 19) { static Matrix kb(3,3); this->getBasicStiff(kb); return eleInfo.setMatrix(kb); } // Chord rotation else if (responseID == 3) { return eleInfo.setVector(crdTransf->getBasicTrialDisp()); } // Plastic rotation else if (responseID == 4) { static Vector vp(3); static Vector ve(3); const Matrix &kb = this->getInitialBasicStiff(); kb.Solve(q, ve); vp = crdTransf->getBasicTrialDisp(); vp -= ve; return eleInfo.setVector(vp); } // Curvature sensitivity else if (responseID == 5) { /* Vector curv(numSections); const Vector &v = crdTransf->getBasicDispGradient(1); double L = crdTransf->getInitialLength(); double oneOverL = 1.0/L; //const Matrix &pts = quadRule.getIntegrPointCoords(numSections); double pts[2]; pts[0] = 0.0; pts[1] = 1.0; // Loop over the integration points for (int i = 0; i < numSections; i++) { int order = theSections[i]->getOrder(); const ID &code = theSections[i]->getType(); //double xi6 = 6.0*pts(i,0); double xi6 = 6.0*pts[i]; curv(i) = oneOverL*((xi6-4.0)*v(1) + (xi6-2.0)*v(2)); } return eleInfo.setVector(curv); */ Vector curv(numSections); /* // Loop over the integration points for (int i = 0; i < numSections; i++) { int order = theSections[i]->getOrder(); const ID &code = theSections[i]->getType(); const Vector &dedh = theSections[i]->getdedh(); for (int j = 0; j < order; j++) { if (code(j) == SECTION_RESPONSE_MZ) curv(i) = dedh(j); } } */ return eleInfo.setVector(curv); } // Basic deformation sensitivity else if (responseID == 6) { const Vector &dvdh = crdTransf->getBasicDisplSensitivity(1); return eleInfo.setVector(dvdh); } else if (responseID == 7) { //const Matrix &pts = quadRule.getIntegrPointCoords(numSections); double xi[maxNumSections]; beamInt->getSectionLocations(numSections, L, xi); Vector locs(numSections); for (int i = 0; i < numSections; i++) locs(i) = xi[i]*L; return eleInfo.setVector(locs); } else if (responseID == 8) { //const Vector &wts = quadRule.getIntegrPointWeights(numSections); double wt[maxNumSections]; beamInt->getSectionWeights(numSections, L, wt); Vector weights(numSections); for (int i = 0; i < numSections; i++) weights(i) = wt[i]*L; return eleInfo.setVector(weights); } else return Element::getResponse(responseID, eleInfo); }