📄 barel2d.cpp
字号:
/** function computes stress at integration points @param lcid - load case id @param eid - element id JK*/void barel2d::res_ip_stresses (long lcid,long eid){ ip_stresses (lcid,eid,0,0);}/** function computes stress at integration points @param lcid - load case id @param eid - element id @param ri - row index @param ci - column index 10.5.2002*/void barel2d::ip_stresses (long lcid,long eid,long ri,long ci){ long ipid; ipid=Mt->elements[eid].ipp[ri][ci]; // computation of correct stresses if (Mp->strcomp==1) Mm->computenlstresses (ipid);}/** function computes stress at integration points @param lcid - load case id @param eid - element id @param ri - row index @param ci - column index 10.5.2002*/void barel2d::ip_elast_stresses (long lcid,long eid,long ri,long ci){ long i,ipid; vector eps(tncomp),sig(tncomp); matrix d(tncomp,tncomp); ipid=Mt->elements[eid].ipp[ri][ci]; for (i=0;i<intordsm[0][0];i++){ // stiffness matrix of material Mm->matstiff (d,ipid); // strain Mm->givestrain (lcid,ipid,eps); // stress computation mxv (d,eps,sig); // storage of stress Mm->storestress (lcid,ipid,sig); ipid++; }}/** function computes stresses at nodes of element @param lcid - load case id @param eid - element id @param ri,ci - row and column indices 10.5.2002*/void barel2d::nod_stresses_ip (long lcid,long eid,long ri,long ci){ long i,j,ipid; ivector ipnum(nne),nod(nne); vector sig(tncomp); // numbers of integration points closest to nodes // (function is from the file GEFEL/ordering.cpp) ipid=Mt->elements[eid].ipp[ri][ci]; nodip_bar (ipid,intordsm[0][0],ipnum); // node numbers of the element Mt->give_elemnodes (eid,nod); for (i=0;i<nne;i++){ // stresses at the closest integration point Mm->givestress (lcid,ipnum[i],sig); // storage of stresses to the node j=nod[i]; Mt->nodes[j].storestress (lcid,0,sig); }}void barel2d::stresses (long lcid,long eid,long ri,long ci){ long i,naep,ncp,sid; vector coord,sig; switch (Mm->stre.tape[eid]){ case nowhere:{ break; } case intpts:{ //allip_stresses (lcid,eid,ri,ci); break; } case enodes:{ nod_stresses_ip (lcid,eid,ri,ci); break; } case userdefined:{ // number of auxiliary element points naep = Mm->stre.give_naep (eid); ncp = Mm->stre.give_ncomp (eid); sid = Mm->stre.give_sid (eid); allocv (ncp,sig); allocv (1,coord); for (i=0;i<naep;i++){ Mm->stre.give_aepcoord (sid,i,coord); if (Mp->stressaver==0) //appval (coord[0],0,ncp,sig,stre); if (Mp->stressaver==1) //appstress (lcid,eid,coord[0],0,ncp,sig); Mm->stre.storevalues(lcid,eid,i,sig); } destrv (sig); destrv (coord); break; } default:{ fprintf (stderr,"\n\n unknown stress point is required in function barelq2d::stresses (file %s, line %d).\n",__FILE__,__LINE__); } }}/** function computes other values in nodes of element @param lcid - load case id @param eid - element id 10.5.2002*/void barel2d::nod_eqother_ip (long lcid,long eid,long ri,long ci){ long i,j,ipid,ncompo; ivector ipnum(nne),nod(nne); vector eqother; // numbers of integration points closest to nodes // (function is from the file GEFEL/ordering.cpp) ipid=Mt->elements[eid].ipp[ri][ci]; nodip_bar (ipid,intordsm[0][0],ipnum); // node numbers of the element Mt->give_elemnodes (eid,nod); for (i=0;i<nne;i++){ ncompo = Mm->givencompeqother (ipnum[i],0); allocv (ncompo,eqother); Mm->giveeqother (ipnum[i],0,ncompo,eqother.a); // storage of other values to the node j=nod[i]; Mt->nodes[j].storeother (lcid,0,ncompo,eqother); destrv (eqother); }}/** function computes internal forces @param lcid - load case id @param eid - element id @param ri,ci - row and column indices @param ifor - vector of internal forces 12.8.2001*/void barel2d::internal_forces (long lcid,long eid,long ri,long ci,vector &ifor){ integratedquant iq; iq=locstress; vector x(nne),y(nne); // computation of stresses compute_nlstress (lcid,eid,ri,ci); Mt->give_node_coord2d (x,y,eid); // integration of stresses over the element elem_integration (iq,lcid,eid,ri,ci,ifor,x,y);}/** function computes resulting internal forces @param lcid - load case id @param eid - element id @param ifor - %vector of internal forces 12.8.2001*/void barel2d::res_internal_forces (long lcid,long eid,vector &ifor){ internal_forces (lcid,eid,0,0,ifor);}void barel2d::intpointval (long eid,vector &nodval,vector &ipval){ long ii,jj,i,k,ipp; double xi; vector w,gp; k=0; for (ii = 0; ii < nb; ii++) { for (jj = 0; jj < nb; jj++) { ipp=Mt->elements[eid].ipp[ii][jj]; if (intordsm[ii][jj] == 0) continue; allocv (intordsm[ii][jj],gp); allocv (intordsm[ii][jj],w); gauss_points (gp.a,w.a,intordsm[ii][jj]); for (i = 0; i < intordsm[ii][jj]; i++) { xi=gp[i]; // value in integration point ipval[k] = approx (xi,nodval); k++; ipp++; } destrv (gp); destrv (w); } }}void barel2d::inicipval(long eid, long ri, long ci, matrix &nodval, inictype *ictn){ long i, j, k, ipp; long ii, jj, nv = nodval.n; long nstra; double xi, ipval; vector w, gp, anv(nne); nstra = 0; for (j = 0; j < nv; j++) // for all initial values { for(i = 0; i < nne; i++) // for all nodes on element anv[i] = nodval[i][j]; for (ii = 0; ii < nb; ii++) { for (jj = 0; jj < nb; jj++) { ipp=Mt->elements[eid].ipp[ri+ii][ci+jj]; if (intordsm[ii][jj] == 0) continue; allocv (intordsm[ii][jj],gp); allocv (intordsm[ii][jj],w); gauss_points (gp.a,w.a,intordsm[ii][jj]); for (k = 0; k < intordsm[ii][jj]; k++) { xi=gp[k]; // value in integration point ipval = approx (xi,anv); if ((ictn[i] & inistrain) && (j < Mm->ip[ipp].ncompstr)) { Mm->ip[ipp].strain[j] += ipval; ipp++; continue; } if ((ictn[i] & inistress) && (j < nstra + Mm->ip[ipp].ncompstr)) { Mm->ip[ipp].stress[j] += ipval; ipp++; continue; } if ((ictn[i] & iniother) && (j < nv)) { Mm->ip[ipp].other[j] += ipval; ipp++; continue; } ipp++; } destrv (gp); destrv (w); } } if (ictn[i] & inistrain) nstra++; }}void barel2d::res_eigstrain_forces (long lcid,long eid,vector &nfor){ //vector gx(nne),gy(nne),x(nne); //Mt->give_node_coord2d (gx,gy,eid); //giveloccoord (gx,gy,x); //temp_forces (lcid,eid,0,0,nfor,x); eigstrain_forces (lcid,eid,0,0,nfor);}/** function computes nodal forces caused by temperature changes @param eid - element id @param ri,ci - row and column indices @param nfor - array containing nodal forces @param x,y - nodal coordinates 30.11.2002, JK*/void barel2d::eigstrain_forces (long lcid,long eid,long ri,long ci,vector &nfor){ integratedquant iq; iq=eigstress; vector x(nne),y(nne); Mt->give_node_coord2d (x,y,eid); // computation of eigenstresses compute_eigstress (lcid,eid,ri,ci); // integration of stresses over the element elem_integration (iq,lcid,eid,ri,ci,nfor,x,y);}/** function computes correct stresses at integration points on element @param lcid - number of load case @param eid - element id @param ri,ci - row and column indices JK, 30.11.2006*/void barel2d::compute_nlstress (long lcid,long eid,long ri,long ci){ long ipid; ipid=Mt->elements[eid].ipp[ri][ci]; // computation of correct stresses if (Mp->strcomp==1) Mm->computenlstresses (ipid); }/** function computes nonlocal correct stresses at integration points on element @param lcid - number of load case @param eid - element id @param ri,ci - row and column indices JK, 30.11.2006*/void barel2d::compute_nonloc_nlstress (long lcid,long eid,long ri,long ci){ long ipid; ipid=Mt->elements[eid].ipp[ri][ci]; // computation of correct stresses if (Mp->strcomp==1) Mm->compnonloc_nlstresses (ipid); }/** function computes nonlocal correct stresses at integration points on element @param lcid - number of load case @param eid - element id @param ri,ci - row and column indices JK, 30.11.2006*/void barel2d::compute_eigstress (long lcid,long eid,long ri,long ci){ long ipid; vector eigstr(tncomp),sig(tncomp); matrix d(tncomp,tncomp); ipid=Mt->elements[eid].ipp[ri][ci]; Mm->giveeigstrain (ipid,eigstr); // matrix of stiffness of the material Mm->matstiff (d,ipid); mxv (d,eigstr,sig); Mm->storeeigstress (ipid,sig); //ipid++;}/** function integrates selected quantity over the finite element it results in nodal values @param iq - type of integrated quantity (see alias.h) @param lcid - number of load case @param eid - element id @param ri,ci - row and column indices @param nv - nodal values @param x,y - node coordinates JK, 30.11.2006*/void barel2d::elem_integration (integratedquant iq,long lcid,long eid,long ri,long ci,vector &nv,vector &x,vector &y){ long ipid; double s,c,l,a; ivector nodes(nne); vector ipv(tncomp),contr(ndofe); matrix gm(tncomp,ndofe); // length of the element l=sqrt ((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0])); if (l<Mp->zero){ fprintf (stderr,"\n\n zero length of the %ld truss element",eid); fprintf (stderr,"\n in function barel2d::elem_integration (file %s, line %d).\n",__FILE__,__LINE__); } s=(y[1]-y[0])/l; c=(x[1]-x[0])/l; ipid=Mt->elements[eid].ipp[ri][ci]; switch (iq){ case locstress:{ // stress reading from integration point Mm->givestress (lcid,ipid,ipv); break; } case nonlocstress:{ // stress reading from integration point Mm->givestress (lcid,ipid,ipv); break; } case eigstress:{ // eigenstress reading from integration point Mm->giveeigstress (ipid,ipv); break; } default:{ fprintf (stderr,"\n\n unknown type of quantity is required in function plelemqq::elem_integration (file %s, line %d).\n",__FILE__,__LINE__); } } // strain-displacement (geometric) matrix geom_matrix (gm,s,c,l); // contribution to the nodal values mtxv (gm,ipv,contr); // area of bar cross-section Mc->give_area (eid,a); cmulv (a*l,contr); // summation addv(contr,nv,nv); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -