📄 plelemlq.cpp
字号:
Mm->givestrain (lcid,ipp,cncomp[jj],eps); // block of stiffness matrix of material dmatblock (ii,jj,d,dd); // stress contributions mxv (dd,eps,auxsig); // summation of contributions addv (auxsig,sig,sig); destrm (dd); destrv (eps); } // storage of block of stress Mm->storestress (lcid,ipp,cncomp[ii],sig); ipp++; } } destrv (w); destrv (gp); destrv (auxsig); destrv (sig); }}/** 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 planeelemlq::nod_stresses_ip (long lcid,long eid,long ri,long ci){ long i,j,ipp; ivector ipnum(nne),nod(nne); vector sig(tncomp); // numbers of integration points closest to nodes // (function is from the file GEFEL/ordering.cpp) ipp=Mt->elements[eid].ipp[ri][ci]; nodip_planelq (ipp,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); } }/** function computes nodal stresses directly @param lcid - load case id @param eid - element id @param stra - array for strain components JK, 25.9.2004*/void planeelemlq::nod_stresses_comp (long lcid,long eid,long ri,long ci,double **stra,double **stre){ long i,j,ipp; vector eps(tncomp),sig(tncomp); matrix d(tncomp,tncomp); // number of the first integration point on the element ipp=Mt->elements[eid].ipp[ri][ci]; // stiffness matrix of the material Mm->matstiff (d,ipp); // loop over nodes for (i=0;i<nne;i++){ for (j=0;j<eps.n;j++){ eps[j]=stra[i][j]; } mxv (d,eps,sig); for (j=0;j<eps.n;j++){ stre[i][j]=sig[j]; } }}void planeelemlq::stresses (long lcid,long eid,long ri,long ci){ long i,naep,ncp,sid; vector coord,sig; // computation of blocks of stresses at integration points res_ip_stresses (lcid,eid); 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 (2,coord); for (i=0;i<naep;i++){ Mm->stre.give_aepcoord (sid,i,coord); if (Mp->stressaver==0) //appval (coord[0],coord[1],0,ncp,sig,stre); if (Mp->stressaver==1) //appstress (lcid,eid,coord[0],coord[1],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 planeelemlq::stresses (%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 planeelemlq::nod_eqother_ip (long lcid,long eid,long ri,long ci){ long i,j,ipp,ncompo; ivector ipnum(nne),nod(nne); vector eqother; // numbers of integration points closest to nodes // (function is from the file GEFEL/ordering.cpp) ipp=Mt->elements[eid].ipp[ri][ci]; nodip_planelq (ipp,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 strains to the node j=nod[i]; Mt->nodes[j].storeother (lcid,0,ncompo,eqother); destrv (eqother); }}/** function computes load %matrix of the plane stress rectangular finite element with bilinear approximation functions load vector is obtained after premultiplying load %matrix by nodal load values @param eid - number of element @param lm - load %matrix @param x,y - node coordinates JK, 25.7.2001*/void planeelemlq::load_matrix (long eid,matrix &lm,vector &x,vector &y){ long i,j; double jac,xi,eta,w1,w2,thick; ivector nodes(nne); vector w(intordmm),gp(intordmm),t(nne); matrix n(napfun,ndofe); Mt->give_elemnodes (eid,nodes); Mc->give_thickness (eid,nodes,t); gauss_points (gp.a,w.a,intordmm); fillm (0.0,lm); for (i=0;i<intordmm;i++){ xi=gp[i]; w1=w[i]; for (j=0;j<intordmm;j++){ eta=gp[j]; w2=w[j]; jac_2d (jac,x,y,xi,eta); bf_matrix (n,xi,eta); thick = approx (xi,eta,t); jac*=w1*w2*thick; nnj (lm.a,n.a,jac,n.m,n.n); } } }/** function computes load %matrix of the plane stress rectangular finite element with bilinear approximation functions load vector is obtained after premultiplying load %matrix by nodal load values @param eid - number of element @param lm - load %matrix JK, 25.7.2001*/void planeelemlq::res_load_matrix (long eid,matrix &lm){ long transf; ivector nodes(nne); vector x(nne),y(nne); Mt->give_node_coord2d (x,y,eid); load_matrix (eid,lm,x,y); // transformation of load matrix // (in the case of nodal coordinate systems) Mt->give_elemnodes (eid,nodes); transf = Mt->locsystems (nodes); if (transf>0){ matrix tmat (ndofe,ndofe); transf_matrix (nodes,tmat); glmatrixtransf (lm,tmat); }}/** 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, 27.11.2006*/void planeelemlq::compute_nlstress (long lcid,long eid,long ri,long ci){ long i,j,ii,jj,ipp; for (ii=0;ii<nb;ii++){ for (jj=0;jj<nb;jj++){ if (intordsm[ii][jj]==0) continue; ipp=Mt->elements[eid].ipp[ri+ii][ci+jj]; for (i=0;i<intordsm[ii][jj];i++){ for (j=0;j<intordsm[ii][jj];j++){ // computation of correct stresses if (Mp->strcomp==1) Mm->computenlstresses (ipp); ipp++; } } } }}/** 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, 27.11.2006*/void planeelemlq::compute_nonloc_nlstress (long lcid,long eid,long ri,long ci){ long i,j,ii,jj,ipp; for (ii=0;ii<nb;ii++){ for (jj=0;jj<nb;jj++){ if (intordsm[ii][jj]==0) continue; ipp=Mt->elements[eid].ipp[ri+ii][ci+jj]; for (i=0;i<intordsm[ii][jj];i++){ for (j=0;j<intordsm[ii][jj];j++){ // computation of correct stresses if (Mp->strcomp==1) Mm->compnonloc_nlstresses (ipp); ipp++; } } } }}/** 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, 27.11.2006*/void planeelemlq::compute_eigstress (long lcid,long eid,long ri,long ci){ long i,j,ii,jj,ipp; vector eigstr(tncomp),sig(tncomp); matrix d(tncomp,tncomp); for (ii=0;ii<nb;ii++){ for (jj=0;jj<nb;jj++){ if (intordsm[ii][jj]==0) continue; ipp=Mt->elements[eid].ipp[ri+ii][ci+jj]; for (i=0;i<intordsm[ii][jj];i++){ for (j=0;j<intordsm[ii][jj];j++){ Mm->giveeigstrain (ipp,eigstr); // matrix of stiffness of the material Mm->matstiff (d,ipp); mxv (d,eigstr,sig); Mm->storeeigstress (ipp,sig); ipp++; } } } }}/** 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, 27.11.2006*/void planeelemlq::elem_integration (integratedquant iq,long lcid,long eid,long ri,long ci,vector &nv,vector &x,vector &y){ long i,j,ii,ipp; double xi,eta,jac,thick; ivector nodes(nne); vector w,gp,t(nne),ipv,contr(ndofe); matrix gm; Mc->give_thickness (eid,nodes,t); fillv (0.0,nv); for (ii=0;ii<nb;ii++){ allocv (intordsm[ii][ii],gp); allocv (intordsm[ii][ii],w); allocm (ncomp[ii],ndofe,gm); allocv (ncomp[ii],ipv); gauss_points (gp.a,w.a,intordsm[ii][ii]); ipp=Mt->elements[eid].ipp[ri+ii][ci+ii]; for (i=0;i<intordsm[ii][ii];i++){ xi=gp[i]; for (j=0;j<intordsm[ii][ii];j++){ eta=gp[j]; thick = approx (xi,eta,t); switch (iq){ case locstress:{ // stress reading from integration point Mm->givestress (lcid,ipp,cncomp[ii],ipv); break; } case nonlocstress:{ // stress reading from integration point Mm->givestress (lcid,ipp,cncomp[ii],ipv); break; } case eigstress:{ // eigenstress reading from integration point Mm->giveeigstress (ipp,ncomp[ii],cncomp[ii],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_block (gm,ii,x,y,xi,eta,jac); // contribution to the nodal values mtxv (gm,ipv,contr); cmulv (jac*w[i]*w[j]*thick,contr); // summation addv(contr,nv,nv); ipp++; } } destrm (gm); destrv (ipv); destrv (w); destrv (gp); }}/** function computes contributions from eigenstrains to the right hand side @param lcid - load case id @param eid - element id @param nfor - %vector of internal forces JK, 28.7.2001*/void planeelemlq::res_eigstrain_forces (long lcid,long eid,vector &nfor){ long transf; ivector nodes (nne); vector v(ndofe),x(nne),y(nne); Mt->give_node_coord2d (x,y,eid); eigstrain_forces (lcid,eid,0,0,nfor,x,y); // transformation of nodal forces // (in the case of nodal coordinate systems) Mt->give_elemnodes (eid,nodes); transf = Mt->locsystems (nodes); if (transf>0){ matrix tmat (ndofe,ndofe); transf_matrix (nodes,tmat); //globloctransf (nfor,v,tmat); glvectortransf (nfor,v,tmat); copyv (v,nfor); }}/** function computes contributions from eigenstrains to the right hand side @param eid - element id @param ri,ci - row and column indices @param ifor - vector of nodal forces @param x,y - vectors of nodal coordinates JK, 28.7.2001*/void planeelemlq::eigstrain_forces (long lcid,long eid,long ri,long ci,vector &nfor,vector &x,vector &y){ integratedquant iq; iq=eigstress; // 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 internal forces (from correct stresses) @param lcid - number of load case @param eid - element id @param ri,ci - row and column indices @param ifor - vector of internal forces @param x,y - vectors of nodal coordinates JK, 28.7.2001*/void planeelemlq::gl_internal_forces (long lcid,long eid,long ri,long ci,vector &ifor,vector &x,vector &y){ integratedquant iq; iq=locstress; // computation of stresses compute_nlstress (lcid,eid,ri,ci); // integration of stresses over the element elem_integration (iq,lcid,eid,ri,ci,ifor,x,y);}/** function computes internal forces (from correct stresses) @param lcid - number of load case @param eid - element id @param ri,ci - row and column indices @param ifor - vector of internal forces @param x,y - vectors of nodal coordinates JK, 22.9.2005*/void planeelemlq::gnl_internal_forces (long lcid,long eid,long ri,long ci,vector &ifor,vector &x,vector &y){ long i,j,k,ipp; double xi,eta,jac,thick; ivector cn(ndofe),nodes(nne); vector w,gp,t(nne),sig(tncomp),contr(ndofe),r(ndofe); matrix gm(tncomp,ndofe); // element nodeds Mt->give_elemnodes (eid,nodes); // thickness of element Mc->give_thickness (eid,nodes,t); // code numbers of element Mt->give_code_numbers (eid,cn.a); // nodal displacements eldispl (lcid,eid,r.a,cn.a,ndofe); fillv (0.0,ifor); // array for coordinates of integration points allocv (intordsm[0][0],gp); // array for weights of integration points allocv (intordsm[0][0],w); // coordinates and weights of integration points gauss_points (gp.a,w.a,intordsm[0][0]); // number of the first integration point on element ipp=Mt->elements[eid].ipp[ri][ci]; for (i=0;i<intordsm[0][0];i++){ xi=gp[i]; for (j=0;j<intordsm[0][0];j++){ eta=gp[j]; // thickness at integration point thick = approx (xi,eta,t); // computation of stress if (Mp->strcomp==1) Mm->computenlstresses (ipp); Mm->givestress (lcid,ipp,sig); // strain-displacement (geometric) matrix gngeom_matrix (gm,r,x,y,xi,eta,jac); mtxv (gm,sig,contr); cmulv (jac*w[i]*w[j]*thick,contr); for (k=0;k<contr.n;k++){ ifor[k]+=contr[k]; } ipp++; } } destrv (w); destrv (gp);}/** function computes internal forces @param lcid - load case id @param eid - element id @param ifor - %vector of internal forces JK, 22.9.2005*/void planeelemlq::res_internal_forces (long lcid,long eid,vector &ifor){ long transf;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -