⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shelltr.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
📖 第 1 页 / 共 2 页
字号:
   }   delete [] strap;      //  contribution from triangular plate element  strap = new double* [nne];  for (i=0;i<nne;i++){    strap[i] = new double [tncompd];  }  Dkt->elem_strains (strap,lcid,eid,2,2);  fprintf (Out,"\n\n strains na desce (prvek %ld)",eid);  for (i=0;i<nne;i++){    fprintf (Out,"\n uzel %ld",i);    for (j=0;j<tncompd;j++){      fprintf (Out,"   %f",strap[i][j]);    }  }  for (i=0;i<nne;i++){    for (j=0;j<tncompd;j++){     stra[i][j+tncomps] = strap[i][j];    }  }  for (i=0;i<nne;i++){     delete [] strap[i];  }  delete [] strap;    fprintf (Out,"\n\n strain v elem_str u prvku cislo %ld",eid);  for (i=0;i<nne;i++){   fprintf (Out,"\n");   for (j=0;j<tncomp;j++){    fprintf (Out," %20.10e",stra[i][j]);   }  }}  void shelltr::appstrain (long lcid,long eid,vector &l,vector &eps){  //  contribution from triangular plane element with rotational degrees of freedom  Perlt->appstrain (lcid,eid,l[0],l[1],0,tncomps,eps);      //  contribution from triangular plate element  Dkt->appstrain (lcid,eid,l,2,tncompd,eps);}  void shelltr::allip_strains (double **stra,long lcid,long eid){  long i,j;  double **strap;  strap = new double* [nne];  for (i=0;i<nne;i++){    strap[i] = new double [tncomps];  }  //  contribution from triangular plane element with rotational degrees of freedom  for (i=0;i<nne;i++){    for (j=0;j<tncomps;j++){     strap[i][j] = stra[i][j];    }  }  Perlt->allip_strains (strap,lcid,eid,0,0);  for (i=0;i<nne;i++){    delete [] strap[i];    }  delete [] strap;//  contribution from triangular plate element  strap = new double* [nne];  for (i=0;i<nne;i++){    strap[i] = new double [tncomps];  }  for (i=0;i<nne;i++){    for (j=0;j<tncompd;j++){     strap[i][j] = stra[i][j+tncomps];    }  }  Dkt->allip_strains (strap,lcid,eid,0,0);  for (i=0;i<nne;i++){    delete [] strap[i];    }  delete [] strap;}  void shelltr::strains (long lcid,long eid){  long i,naep,ncp,sid;  double **stra;  vector coord,eps,l(3);    if (Mp->strainaver==0){    stra = new double* [nne];    for (i=0;i<nne;i++){      stra[i] = new double [tncomp];    }    elem_strains (stra,lcid,eid);  }  switch (Mm->stra.tape[eid]){  case nowhere:{    break;  }  case intpts:{    allip_strains (stra,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 (2,coord);    for (i=0;i<naep;i++){      Mm->stra.give_aepcoord (sid,i,coord);      l[0]=coord[0];l[1]=coord[1];l[2]=1-coord[1]-coord[2];      if (Mp->strainaver==0)		appval (l,eps,stra);      if (Mp->strainaver==1)		appstrain (lcid,eid,l,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 planeelemlt::strains (%s, line %d).\n",__FILE__,__LINE__);  }  }  if (Mp->strainaver==0){    for (i=0;i<nne;i++){      delete [] stra[i];    }    delete [] stra;  }}void shelltr::res_mainip_stresses (long lcid,long eid){}  void shelltr::nod_stresses (long lcid,long eid){    //  contribution from triangular plane element with rotational degrees of freedom  Perlt->nod_stresses (lcid,eid,0,0);      //  contribution from triangular plate element  Dkt->nod_stresses (lcid,eid,2,2);}void shelltr::elem_stresses (double **stra,double **stre,long lcid,long eid){  long i,j;  double **strap,**strep;  //  contribution from triangular plane element with rotational degrees of freedom  strap = new double* [nne];  strep = new double* [nne];  for (i=0;i<nne;i++){    strap[i] = new double [tncomps];    strep[i] = new double [tncompd];  }  for (i=0;i<nne;i++){    for (j=0;j<tncomps;j++){     strap[i][j] = stra[i][j];    }  }  //  contribution from triangular plane element with rotational degrees of freedom  Perlt->elem_stresses (strap,strep,lcid,eid,0,0);  for (i=0;i<nne;i++){    for (j=0;j<tncomps;j++){     stre[i][j] = strep[i][j];    }  }  for (i=0;i<nne;i++){     delete [] strap[i];     delete [] strep[i];   }   delete [] strap;   delete [] strep;      //  contribution from triangular plate element  strap = new double* [nne];  strep = new double* [nne];  for (i=0;i<nne;i++){    strap[i] = new double [tncomps];    strep[i] = new double [tncompd];  }  for (i=0;i<nne;i++){    for (j=0;j<tncompd;j++){     strap[i][j] = stra[i][j+tncomps];    }  }  Dkt->elem_stresses (strap,strep,lcid,eid,2,2);  for (i=0;i<nne;i++){    for (j=0;j<tncompd;j++){     stre[i][j+tncomps] = strep[i][j];    }  }  for (i=0;i<nne;i++){     delete [] strap[i];     delete [] strep[i];   }   delete [] strap;   delete [] strep;}  void shelltr::appstress (long lcid,long eid,vector &l,vector &sig){  //  contribution from triangular plane element with rotational degrees of freedom  Perlt->appstress (lcid,eid,l[0],l[1],0,tncomps,sig);      //  contribution from triangular plate element  Dkt->appstress (lcid,eid,l,2,tncompd,sig);}  void shelltr::allip_stresses (double **stre,long lcid,long eid){  long i,j;  double **strep;  strep = new double* [nne];  for (i=0;i<nne;i++){    strep[i] = new double [tncomps];  }  //  contribution from triangular plane element with rotational degrees of freedom  for (i=0;i<nne;i++){    for (j=0;j<tncomps;j++){     strep[i][j] = stre[i][j];    }  }  //  contribution from triangular plane element with rotational degrees of freedom  Perlt->allip_stresses (strep,lcid,eid,0,0);  for (i=0;i<nne;i++){    delete [] strep[i];    }  delete [] strep;//  contribution from triangular plate element  strep = new double* [nne];  for (i=0;i<nne;i++){    strep[i] = new double [tncompd];  }  for (i=0;i<nne;i++){    for (j=0;j<tncompd;j++){     strep[i][j] = stre[i][j+tncomps];    }  }      //  contribution from triangular plate element  Dkt->allip_stresses (stre,lcid,eid,0,0);  for (i=0;i<nne;i++){    delete [] strep[i];    }  delete [] strep;}  void shelltr::stresses (long lcid,long eid){  long i,naep,ncp,sid;  double **stra,**stre;  vector l(3),coord,sig;    if (Mp->stressaver==0){    stra = new double* [nne];    stre = new double* [nne];    for (i=0;i<nne;i++){      stra[i] = new double [tncomp];      stre[i] = new double [tncomp];    }    elem_strains (stra,lcid,eid);    elem_stresses (stra,stre,lcid,eid);  }  switch (Mm->stre.tape[eid]){  case nowhere:{    break;  }  case intpts:{    allip_stresses (stre,lcid,eid);    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 (2,coord);    for (i=0;i<naep;i++){      Mm->stre.give_aepcoord (sid,i,coord);      l[0]=coord[0];l[1]=coord[1];l[2]=1-coord[1]-coord[2];      if (Mp->stressaver==0)	   appval (l,sig,stre);      if (Mp->stressaver==1)        appstress (lcid,eid,l,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 planeelemrotlt::stresses (%s, line %d).\n",__FILE__,__LINE__);  }  }  if (Mp->stressaver==0){    for (i=0;i<nne;i++){      delete [] stra[i];      delete [] stre[i];    }    delete [] stra;    delete [] stre;  }}void shelltr::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, eta;//  double ipval;  vector w, gp1, gp2, 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],gp1);        allocv (intordsm[ii][jj],gp2);        allocv (intordsm[ii][jj],w);        gauss_points_tr (gp1.a, gp2.a, w.a, intordsm[ii][jj]);        for (k = 0; k < intordsm[ii][jj]; k++)        {          xi=gp1[k];          eta=gp2[k];          //  value in integration point//          ipval = approx_nat (xi,eta,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(gp1);  destrv (gp2);  destrv (w);      }    }    if (ictn[i] & inistrain) nstra++;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -