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

📄 shellq.cpp

📁 Finite element program for mechanical problem. It can solve various problem in solid problem
💻 CPP
📖 第 1 页 / 共 2 页
字号:
     delete [] strap[i];   }   delete [] strap;      //  contribution from triangular plate element  strap = new double* [nne];  for (i=0;i<nne;i++){    strap[i] = new double [tncompd];  }  //Q4pl->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 shellq::appstrain (long lcid,long eid,double xi, double eta,vector &eps){  //  contribution from triangular plane element with rotational degrees of freedom  //Perlq->appstrain (lcid,eid,xi,eta,0,tncomps,eps);      //  contribution from triangular plate element  //Q4pl->appstrain (lcid,eid,xi,eta,2,tncompd,eps);}  void shellq::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];    }  }  //Perlq->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];    }  }  //Q4pl->allip_strains (strap,lcid,eid,0,0);  for (i=0;i<nne;i++){    delete [] strap[i];    }  delete [] strap;}  void shellq::strains (long lcid,long eid){  long i,naep,ncp,sid;  double **stra,xi,eta;  vector coord,eps;    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);      xi=coord[0];eta=coord[1];      if (Mp->strainaver==0)		appval (xi,eta,eps,stra);      if (Mp->strainaver==1)		appstrain (lcid,eid,xi,eta,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 shellq::res_mainip_stresses (long lcid,long eid){}  void shellq::nod_stresses (long lcid,long eid){    //  contribution from triangular plane element with rotational degrees of freedom  Perlq->nod_stresses (lcid,eid,0,0);      //  contribution from triangular plate element  //Q4pl->nod_stresses (lcid,eid,2,2);}void shellq::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  Perlq->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];    }  }  //Q4pl->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 shellq::appstress (long lcid,long eid,double xi, double eta,vector &sig){  //  contribution from triangular plane element with rotational degrees of freedom  Perlq->appstress (lcid,eid,xi,eta,0,tncomps,sig);      //  contribution from triangular plate element  //Q4pl->appstress (lcid,eid,xi,eta,2,tncompd,sig);}  void shellq::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  Perlq->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  //Q4pl->allip_stresses (stre,lcid,eid,0,0);  for (i=0;i<nne;i++){    delete [] strep[i];    }  delete [] strep;}  void shellq::stresses (long lcid,long eid){  long i,naep,ncp,sid;  double **stra,**stre,xi,eta;  vector 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);      xi=coord[0];eta=coord[1];      if (Mp->stressaver==0)	   appval (xi,eta,sig,stre);      if (Mp->stressaver==1)        appstress (lcid,eid,xi,eta,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 shellq::inicipval(long eid, long ri, long ci, matrix &nodval, inictype *ictn){  long i, j, k, l, ipp;  long ii, jj, nv = nodval.n;  long nstra;  double xi, eta;//  double 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];          for (l = 0; l < intordsm[ii][jj]; l++)          {            eta=gp[l];            //  value in integration point//            ipval = approx (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 (gp);  destrv (w);      }    }    if (ictn[i] & inistrain) nstra++;  }}

⌨️ 快捷键说明

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