📄 quadhex.cpp
字号:
for (i=0;i<nne;i++){ // geometric matrix geom_matrix (gm,x,y,z,nxi[i],neta[i],nzeta[i],jac); // strain computation mxv (gm,r,eps); for (j=0;j<eps.n;j++){ stra[i][j]=eps[j]; } }}void quadhex::strains (long lcid,long eid,long ri,long ci){ long i,naep,ncp,sid; vector coord,eps; switch (Mm->stra.tape[eid]){ case nowhere:{ break; } case intpts:{ //allip_strains (lcid,eid); break; } case enodes:{ break; } case userdefined:{ // number of auxiliary element points naep = Mm->stra.give_naep (eid); ncp = Mm->stra.give_ncomp (eid); sid = Mm->stra.give_sid (eid); allocv (ncp,eps); allocv (3,coord); for (i=0;i<naep;i++){ Mm->stra.give_aepcoord (sid,i,coord); if (Mp->strainaver==0) //appval (coord[0],coord[1],coord[2],0,ncp,eps,stra); if (Mp->strainaver==1) //appstrain (lcid,eid,coord[0],coord[1],coord[2],0,ncp,eps); Mm->stra.storevalues(lcid,eid,i,eps); } destrv (eps); destrv (coord); break; } default:{ fprintf (stderr,"\n\n unknown strain point is required in function planeelemlq::strains (%s, line %d).\n",__FILE__,__LINE__); } }}/** function computes stresses at integration points of element @param lcid - load case id @param eid - element id JK, 10.5.2002*/void quadhex::res_ip_stresses (long lcid,long eid){ ip_stresses (lcid,eid,0,0);}/** function computes stresses at integration points of element stresses are computed by material models @param lcid - load case id @param eid - element id @param ri - row index @param ci - column index 10.5.2002, JK*/void quadhex::ip_stresses (long lcid,long eid,long ri,long ci){ long i,j,k,ipp; ipp=Mt->elements[eid].ipp[ri][ci]; for (i=0;i<intordsm[0][0];i++){ for (j=0;j<intordsm[0][0];j++){ for (k=0;k<intordsm[0][0];k++){ // computation of correct stresses if (Mp->strcomp==1) Mm->computenlstresses (ipp); ipp++; } } }}/** function computes stresses at integration points of element stresses are computed from strains with the help of elastic stiffness @param lcid - load case id @param eid - element id @param ri - row index @param ci - column index JK, 10.5.2002*/void quadhex::ip_elast_stresses (long lcid,long eid,long ri,long ci){ long i,j,k,ipp; vector gp,w,eps,sig(tncomp); matrix gm(tncomp,ndofe),d(tncomp,tncomp); allocv (intordsm[0][0],gp); allocv (intordsm[0][0],w); gauss_points (gp.a,w.a,intordsm[0][0]); ipp=Mt->elements[eid].ipp[ri][ci]; for (i=0;i<intordsm[0][0];i++){ for (j=0;j<intordsm[0][0];j++){ for (k=0;k<intordsm[0][0];k++){ // stiffness matrix of the material Mm->matstiff (d,ipp); // strains Mm->givestrain (lcid,ipp,eps); // elastic stresses mxv (d,eps,sig); Mm->storestress (lcid,ipp,sig); ipp++; } } } destrv (w); destrv (gp);}/** function computes stresses at nodes of element @param lcid - load case id @param eid - element id @param ri,ci - row and column indices JK, 27.9.2005*/void quadhex::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_quadhex (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 stresses in nodes @param lcid - load case id @param eid - element id @param ri,ci - row and column indices @param stra - @param stre - 10.5.2002*/void quadhex::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 quadhex::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:{ 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 (3,coord); for (i=0;i<naep;i++){ Mm->stre.give_aepcoord (sid,i,coord); if (Mp->stressaver==0) //appval (coord[0],coord[1],coord[2],0,ncp,sig,stre); if (Mp->stressaver==1) //appstress (lcid,eid,coord[0],coord[1],coord[2],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 @param ri,ci - row and column indices JK, 24.10.2005*/void quadhex::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_quadhex (ipp,intordsm[0][0],ipnum); // node numbers of the element Mt->give_elemnodes (eid,nod); for (i=0;i<nne;i++){ // strains at the closest integration point //Mm->givestrain (lcid,ipnum[i],eps); 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 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 quadhex::compute_nlstress (long lcid,long eid,long ri,long ci){ long i,j,k,ipp; ipp=Mt->elements[eid].ipp[ri][ci]; for (i=0;i<intordsm[0][0];i++){ for (j=0;j<intordsm[0][0];j++){ for (k=0;k<intordsm[0][0];k++){ // 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 quadhex::compute_nonloc_nlstress (long lcid,long eid,long ri,long ci){ long i,j,k,ipp; ipp=Mt->elements[eid].ipp[ri][ci]; for (i=0;i<intordsm[0][0];i++){ for (j=0;j<intordsm[0][0];j++){ for (k=0;k<intordsm[0][0];k++){ // 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 quadhex::compute_eigstress (long lcid,long eid,long ri,long ci){ long i,j,k,ipp; vector eigstr(tncomp),sig(tncomp); matrix d(tncomp,tncomp); ipp=Mt->elements[eid].ipp[ri][ci]; for (i=0;i<intordsm[0][0];i++){ for (j=0;j<intordsm[0][0];j++){ for (k=0;k<intordsm[0][0];k++){ 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 JK, 27.11.2006*/void quadhex::elem_integration (integratedquant iq,long lcid,long eid,long ri,long ci,vector &nv){ long i,j,k,ipp; double xi,eta,zeta,jac; vector x(nne),y(nne),z(nne),w,gp,ipv(tncomp),contr(ndofe); matrix gm(tncomp,ndofe); Mt->give_node_coord3d (x,y,z,eid); fillv (0.0,nv); allocv (intordsm[0][0],gp); allocv (intordsm[0][0],w); gauss_points (gp.a,w.a,intordsm[0][0]); 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]; for (k=0;k<intordsm[0][0];k++){ zeta=gp[k]; switch (iq){ case locstress:{ // stress reading from integration point Mm->givestress (lcid,ipp,ipv); break; } case nonlocstress:{ // stress reading from integration point Mm->givestress (lcid,ipp,ipv); break; } case eigstress:{ // eigenstress reading from integration point Mm->giveeigstress (ipp,ipv); break; } default:{ fprintf (stderr,"\n\n unknown type of quantity is required in function quadhex::elem_integration (file %s, line %d).\n",__FILE__,__LINE__); } } // strain-displacement (geometric) matrix geom_matrix (gm,x,y,z,xi,eta,zeta,jac); // contribution to the internal forces mtxv (gm,ipv,contr); cmulv (jac*w[i]*w[j]*w[k],contr); // summation addv (contr,nv,nv); ipp++; } } } destrv (w); destrv (gp); }/** function computes internal forces @param lcid - number of load case @param eid - element id @param ri,ci - row and column indices @param ifor - vector of internal forces JK, 28.7.2001*/void quadhex::internal_forces (long lcid,long eid,long ri,long ci,vector &ifor){ 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);}/** function computes internal forces (from correct stresses) @param lcid - number of load case @param eid - element id @param ifor - %vector of internal forces JK, 24.9.2005*/void quadhex::res_internal_forces (long lcid,long eid,vector &ifor){ long transf; ivector nodes (nne); vector v(ndofe); internal_forces (lcid,eid,0,0,ifor); // 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 (ifor,v,tmat); glvectortransf (ifor,v,tmat); copyv (v,ifor); }}/** function computes contributions from eigenstrains to the right hand side @param eid - element id @param ifor - %vector of internal forces JK, 17.8.2004*/void quadhex::res_eigstrain_forces (long lcid,long eid,vector &nfor){ long transf; ivector nodes (nne); vector v(ndofe); eigstrain_forces (lcid,eid,0,0,nfor); // 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 nfor - %vector of nodal forces JK, 17.8.2004*/void quadhex::eigstrain_forces (long lcid,long eid,long ri,long ci,vector &nfor){ 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);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -