61 ITG i0,ir,ip,ic,il,ig,ia,iest,iest1=0,iest2=0,iconvergence,idivergence,
62 ngraph=1,k,*ipneigh=NULL,*neigh=NULL,*inum=NULL,id,istart,iend,inew,
63 i,j,mt=mi[1]+1,iexceed,
66 double df,dc,db,dd,ran,can,rap,ea,cae,ral,da,*vr=NULL,*vi=NULL,*stnr=NULL,
67 *stni=NULL,*vmax=NULL,*stnmax=NULL,*cs=NULL,
c1[2],c2[2],reftime,
68 *fn=NULL,*eenmax=NULL,*fnr=NULL,*fni=NULL,*qfx=NULL,*cdn=NULL,
69 *cdnr=NULL,*cdni=NULL,tmp, maxdecay=0.0, r_rel,cetol;
80 if ((*iflagact==1)&&(*mortar!=1)){
81 if(ctrl[0]<*iit+4)ctrl[0]=*iit+4;
82 if(ctrl[1]<*iit+8)ctrl[1]=*iit+8;
86 i0=ctrl[0];ir=ctrl[1];ip=ctrl[2];ic=ctrl[3];il=ctrl[4];ig=ctrl[5];
87 ia=ctrl[7];df=ctrl[10];dc=ctrl[11];db=ctrl[12];da=ctrl[13];dd=ctrl[16];
88 ran=ctrl[18];can=ctrl[19];rap=ctrl[22];
89 ea=ctrl[23];cae=ctrl[24];ral=ctrl[25];
94 if(*mortar==1){ig+=12;il+=12;}
106 if(qa[2]>0.){idivergence=1;}
110 if(*iit<=ip){c1[0]=ran;}
118 if(ram1[0]<ram2[0]){ram2[0]=ram1[0];}
122 if(*iit<=ip){c1[1]=ran;}
130 if(ram1[1]<ram2[1]){ram2[1]=ram1[1];}
138 if((*iit>1)&&(ram[0]<=c1[0]*qam[0])&&(*iflagact==0)&&
139 ((*nmethod!=-1)||(qa[3]<=cetol))&&
140 ((cam[0]<=c2[0]*uam[0])||
141 (((ram[0]*cam[0]<c2[0]*uam[0]*ram2[0])||(ram[0]<=ral*qam[0])||
142 (qa[0]<=ea*qam[0]))&&(*ntg==0))||
143 (cam[0]<1.e-8))) iconvergence=1;
149 if((ram[1]<=c1[1]*qam[1])&&
151 ((cam[1]<=c2[1]*uam[1])||
152 (((ram[1]*cam[1]<c2[1]*uam[1]*ram2[1])||(ram[1]<=ral*qam[1])||
153 (qa[1]<=ea*qam[1]))&&(*ntg==0))||
154 (cam[1]<1.e-8)))iconvergence=1;
160 if(((*iit>1)&&(ram[0]<=c1[0]*qam[0])&&
161 ((*nmethod!=-1)||(qa[3]<=cetol))&&
162 ((cam[0]<=c2[0]*uam[0])||
163 (((ram[0]*cam[0]<c2[0]*uam[0]*ram2[0])||(ram[0]<=ral*qam[0])||
164 (qa[0]<=ea*qam[0]))&&(*ntg==0))||
166 ((ram[1]<=c1[1]*qam[1])&&
168 ((cam[1]<=c2[1]*uam[1])||
169 (((ram[1]*cam[1]<c2[1]*uam[1]*ram2[1])||(ram[1]<=ral*qam[1])||
170 (qa[1]<=ea*qam[1]))&&(*ntg==0))||
171 (cam[1]<1.e-8))))iconvergence=1;
180 printf(
"\n restoring the elastic contact stifnesses to their original values \n\n");
202 if((*nmethod==4)&&(*ithermal<2)&&(*uncoupled==0)&&(iconvergence==1)&&(*ne==*ne0)&&(*neini==*ne0)&&(*idrct==0)) {
207 *emax=
max(*emax,fabs(energy[0]-energystartstep[0]));
208 *emax=
max(*emax,fabs(energy[1]));
209 *emax=
max(*emax,fabs(*allwk));
214 *r_abs=energy[0]+energy[1]+energy[2]+energy[3]-*energyref-*allwk-*dampwk;
218 if(fabs(*r_abs)>=*enetoll/4) {
224 maxdecay=*enetoll/2*(1+sqrt(*theta));
228 r_rel=*r_abs/(*emax);
229 if(r_rel<=-maxdecay) {
235 if(r_rel<=-0.9*maxdecay) {
246 if((*nmethod==4)&&(*ithermal<2)&&(*uncoupled==0)&&(iconvergence==1)&&((*ne!=*ne0)||(*neini!=*ne0))){
256 *emax=
max(*emax,fabs(energy[0]-energystartstep[0]));
257 *emax=
max(*emax,fabs(energy[1]));
258 *emax=
max(*emax,fabs(*allwk));
262 maxdecay=*enetoll/2*(1+sqrt(*theta));
265 tmin,tper,&idivergence,
266 &iforceincsize,istab,dtheta,r_abs,energy,energyini,
267 allwk,allwkini,dampwk,dampwkini,emax,mortar,
280 if((*ne==*ne0)&&(*neini>*ne0)&&(idivergence==0)){
281 *r_abs=fabs(energy[0]+energy[1]+energy[2]+energy[3]-*energyref-*allwk-*dampwk);
282 tmp=1.3*(2.0*(*r_abs)/(*emax))/(1.0+sqrt(*theta));
283 *enetoll=
max(*enetoll,tmp);
284 printf(
"\n Adaption of the max-decay boundary, enetoll = %f \n",*enetoll);
292 if((iconvergence==1)&&(*ne<=*neini)){
293 tmp=energy[0]+energy[1]+energy[2]+energy[3]-*energyref-*allwk-*dampwk;
296 printf(
"\n Adaption of the energy residual in persistent contact, \n");
297 printf(
" an increasing trend has been detected.\n");
308 if((iconvergence==1)&&(idivergence==0)){
315 for(k=0;k<*nk;++k){t1[k]=vold[mt*k];}
318 printf(
" thermal convergence\n\n");
330 *theta=*theta+*dtheta;
338 veold[mt*i+j]=(vold[mt*i+j]-vini[mt*i+j])/(*dtime);
345 if(iforceincsize==1){
347 *dthetaref=*sizemaxinc;
348 printf(
" convergence; new increment size is forced to %e\n\n",*dtheta**tper);
353 else if((*iit>il)&&(*idrct==0)){
355 *dtheta=*dthetaref*db;
357 printf(
" convergence; the increment size is decreased to %e\n\n",*dtheta**tper);
359 printf(
"\n *ERROR: increment size smaller than minimum\n");
360 printf(
" best solution and residuals are in the frd file\n\n");
361 NNEW(fn,
double,mt**nk);
362 NNEW(inum,
ITG,*nk);
for(k=0;k<*nk;k++) inum[k]=1;
364 nk,sti,stn,ipkon,inum,kon,lakon,ne,mi,orab,
365 ielorien,co,itg,ntg,vold,ielmat,thicke,ielprop,prop));
369 frd(co,nk,kon,ipkon,lakon,ne,vold,stn,inum,nmethod,
370 kode,filab,een,t1act,fn,ttime,epn,ielmat,matname,enern,
371 xstaten,nstate_,istep,iinc,ithermal,qfn,mode,noddiam,
372 trab,inotr,ntrans,orab,ielorien,norien,description,
373 ipneigh,neigh,mi,sti,vr,vi,stnr,stni,vmax,stnmax,
374 &ngraph,veold,ener,ne,cs,
set,nset,istartset,iendset,
375 ialset,eenmax,fnr,fni,emn,thicke,jobnamec,output,qfx,
376 cdn,mortar,cdnr,cdni,nmat);
382 printf(
"convergence\n\n");}
388 if((*istab==1)&&(*idrct==0)){
389 *dtheta=*dthetaref*dd;
391 printf(
" convergence; the increment size is increased to %e\n\n",*dtheta**tper);
395 printf(
" convergence\n\n");
401 printf(
" convergence\n\n");
408 if((*dtheta>*sizemaxinc)&&(*idrct==0)){
411 printf(
" the increment size exceeds thetamax and is decreased to %e\n\n",*dtheta**tper);
416 if(*dtheta>=1.-*theta){
417 if(*dtheta>1.-*theta){iexceed=1;}
else{iexceed=0;}
421 printf(
" the increment size exceeds the remainder of the step and is decreased to %e\n\n",*dtheta**tper);
427 if((*itpamp>0)&&(*idrct==0)){
433 if(namta[3**itpamp-1]<0){
434 reftime=*ttime+*time+*dtheta**tper;
436 reftime=*time+*dtheta**tper;
438 istart=namta[3**itpamp-3];
439 iend=namta[3**itpamp-2];
451 if((*inext==inew)&&(inew<=iend)){
452 if(amta[2*inew-2]-reftime<1.e-6**tper){inew++;}
459 if(namta[3**itpamp-1]<0){
460 *dtheta=(amta[2**inext-2]-*ttime-*time)/(*tper);
462 *dtheta=(amta[2**inext-2]-*time)/(*tper);
466 printf(
" the increment size exceeds a time point and is decreased to %e\n\n",*dtheta**tper);
476 if(((*iit>ic)&&(*mortar==0))||((*mortar>1)&&(*iit>200))){
477 printf(
"\n *ERROR: too many iterations needed\n");
478 printf(
" best solution and residuals are in the frd file\n\n");
482 NNEW(fn,
double,mt**nk);
483 NNEW(inum,
ITG,*nk);
for(k=0;k<*nk;k++) inum[k]=1;
485 ipkon,inum,kon,lakon,ne,mi,orab,ielorien,co,itg,ntg,vold,
486 ielmat,thicke,ielprop,prop));
490 frd(co,nk,kon,ipkon,lakon,ne,vold,stn,inum,nmethod,
491 kode,filab,een,t1act,fn,ttime,epn,ielmat,matname,enern,
492 xstaten,nstate_,istep,iinc,ithermal,qfn,mode,noddiam,
493 trab,inotr,ntrans,orab,ielorien,norien,description,
494 ipneigh,neigh,mi,sti,vr,vi,stnr,stni,vmax,stnmax,
495 &ngraph,veold,ener,ne,cs,
set,nset,istartset,iendset,
496 ialset,eenmax,fnr,fni,emn,thicke,jobnamec,output,qfx,cdn,
497 mortar,cdnr,cdni,nmat);
509 if((*iit>=i0)||(fabs(ram[0])>1.e20)||(fabs(cam[0])>1.e20)||
510 (fabs(ram[1])>1.e20)||(fabs(cam[1])>1.e20)||
511 ((cam[2]<1.e30)&&(cam[2]>*deltmx))||(idivergence==1)||
513 if((*ithermal!=2)&&(*mortar!=1)){
514 if((ram1[0]>ram2[0])&&(ram[0]>ram2[0])&&(ram[0]>c1[0]*qam[0]))
518 if((*ithermal!=2)&&(*mortar==1)){
521 printf(
"divergence allowed: residual force too large\n");
522 if((ram1[0]>ram2[0])&&(ram[0]>ram2[0])&&(ram[0]>c1[0]*qam[0]))
529 printf(
"divergence allowed: number of contact elements stabilized\n");
530 if((ram1[0]>ram2[0])&&(ram[0]>ram2[0])&&(ram[0]>c1[0]*qam[0])){
531 if(cam[0]<=c2[0]*uam[0]){
539 if(((
ITG)ram[6]*(
ITG)ram1[6]<0)&&((
ITG)ram1[6]*(
ITG)ram2[6]<0)){
541 if(((ram[4]>0.98*ram1[4])&&(ram[4]<1.02*ram1[4]))&&
542 ((ram[4]>0.98*ram2[4])&&(ram[4]<1.02*ram2[4]))){
543 printf(
"divergence allowed: repetitive pattern detected\n");
544 if((ram1[0]>ram2[0])&&(ram[0]>ram2[0])&&(ram[0]>c1[0]*qam[0]))
553 if((idivergence==0)&&((*nmethod==-1)&&(qa[3]>cetol))) idivergence=2;
560 if((ram1[1]>ram2[1])&&(ram[1]>ram2[1])&&(ram[1]>c1[1]*qam[1]))
568 if((cam[2]<1.e30)&&(cam[2]>*deltmx)) idivergence=2;
573 if((*mortar<=1)||((*mortar>1)&&(*iit>200))) {
577 printf(
"\n *ERROR: solution seems to diverge; please try \n");
578 printf(
" automatic incrementation; program stops\n");
579 printf(
" best solution and residuals are in the frd file\n\n");
584 NNEW(fn,
double,mt**nk);
585 NNEW(inum,
ITG,*nk);
for(k=0;k<*nk;k++) inum[k]=1;
587 sti,stn,ipkon,inum,kon,lakon,ne,mi,orab,
588 ielorien,co,itg,ntg,vold,ielmat,thicke,ielprop,prop));
592 frd(co,nk,kon,ipkon,lakon,ne,vold,stn,inum,nmethod,
593 kode,filab,een,t1act,fn,ttime,epn,ielmat,matname,enern,
594 xstaten,nstate_,istep,iinc,ithermal,qfn,mode,noddiam,
595 trab,inotr,ntrans,orab,ielorien,norien,description,
596 ipneigh,neigh,mi,sti,vr,vi,stnr,stni,vmax,stnmax,
597 &ngraph,veold,ener,ne,cs,
set,nset,istartset,iendset,
598 ialset,eenmax,fnr,fni,emn,thicke,jobnamec,output,qfx,cdn,
599 mortar,cdnr,cdni,nmat);
609 *dtheta=*dtheta*qa[2];
610 printf(
"increment size decrease requested by a material user routine (through pnewdt)\n\n");
613 if((*mortar!=1)||(*icutb!=0)){
614 if(iforceincsize != 1){
622 *dtheta=*dtheta*cetol/qa[3]*da;
624 *dtheta=*dtheta**deltmx/cam[2]*da;
629 printf(
" divergence; the increment size is decreased to %e\n",*dtheta**tper);
630 printf(
" the increment is reattempted\n\n");
644 printf(
"\n *ERROR: increment size smaller than minimum\n");
645 printf(
" best solution and residuals are in the frd file\n\n");
646 NNEW(fn,
double,mt**nk);
647 NNEW(inum,
ITG,*nk);
for(k=0;k<*nk;k++) inum[k]=1;
649 nk,sti,stn,ipkon,inum,kon,lakon,ne,mi,orab,
650 ielorien,co,itg,ntg,vold,ielmat,thicke,ielprop,prop));
654 frd(co,nk,kon,ipkon,lakon,ne,vold,stn,inum,nmethod,
655 kode,filab,een,t1act,fn,ttime,epn,ielmat,matname,enern,
656 xstaten,nstate_,istep,iinc,ithermal,qfn,mode,noddiam,
657 trab,inotr,ntrans,orab,ielorien,norien,description,
658 ipneigh,neigh,mi,sti,vr,vi,stnr,stni,vmax,stnmax,
659 &ngraph,veold,ener,ne,cs,
set,nset,istartset,iendset,
660 ialset,eenmax,fnr,fni,emn,thicke,jobnamec,output,qfx,cdn,
661 mortar,cdnr,cdni,nmat);
669 printf(
"\n reducing the constant stiffnesses by a factor of 100 \n\n");
675 printf(
"\n *ERROR: too many cutbacks\n");
676 printf(
" best solution and residuals are in the frd file\n\n");
677 NNEW(fn,
double,mt**nk);
678 NNEW(inum,
ITG,*nk);
for(k=0;k<*nk;k++) inum[k]=1;
680 nk,sti,stn,ipkon,inum,kon,lakon,ne,mi,orab,
681 ielorien,co,itg,ntg,vold,ielmat,thicke,ielprop,prop));
685 frd(co,nk,kon,ipkon,lakon,ne,vold,stn,inum,nmethod,
686 kode,filab,een,t1act,fn,ttime,epn,ielmat,matname,enern,
687 xstaten,nstate_,istep,iinc,ithermal,qfn,mode,noddiam,
688 trab,inotr,ntrans,orab,ielorien,norien,description,
689 ipneigh,neigh,mi,sti,vr,vi,stnr,stni,vmax,stnmax,
690 &ngraph,veold,ener,ne,cs,
set,nset,istartset,iendset,
691 ialset,eenmax,fnr,fni,emn,thicke,jobnamec,output,qfx,cdn,
692 mortar,cdnr,cdni,nmat);
717 iest1=(
ITG)ceil(*iit+log(ran*qam[0]/(ram[0]))/
718 log(ram[0]/(ram1[0])));
721 iest2=(
ITG)ceil(*iit+log(ran*qam[1]/(ram[1]))/
722 log(ram[1]/(ram1[1])));
724 if(iest1>iest2){iest=iest1;}
else{iest=iest2;}
725 if((iest>0)&&(*mortar!=1)){
726 printf(
" estimated number of iterations till convergence = %" ITGFORMAT "\n",
729 if((((iest>ic)||(*iit==ic))&&(*mortar!=1))||((*mortar==1)&&(*iit==60))){
732 if((*mortar!=1)||(*icutb!=0)) *dtheta=*dtheta*dc;
734 printf(
" too slow convergence; the increment size is decreased to %e\n",*dtheta**tper);
735 printf(
" the increment is reattempted\n\n");
748 printf(
"\n *ERROR: increment size smaller than minimum\n");
749 printf(
" best solution and residuals are in the frd file\n\n");
750 NNEW(fn,
double,mt**nk);
751 NNEW(inum,
ITG,*nk);
for(k=0;k<*nk;k++) inum[k]=1;
753 nk,sti,stn,ipkon,inum,kon,lakon,ne,mi,orab,
754 ielorien,co,itg,ntg,vold,ielmat,thicke,ielprop,prop));
758 frd(co,nk,kon,ipkon,lakon,ne,vold,stn,inum,nmethod,
759 kode,filab,een,t1act,fn,ttime,epn,ielmat,matname,enern,
760 xstaten,nstate_,istep,iinc,ithermal,qfn,mode,noddiam,
761 trab,inotr,ntrans,orab,ielorien,norien,description,
762 ipneigh,neigh,mi,sti,vr,vi,stnr,stni,vmax,stnmax,
763 &ngraph,veold,ener,ne,cs,
set,nset,istartset,iendset,
764 ialset,eenmax,fnr,fni,emn,thicke,jobnamec,output,qfx,cdn,
765 mortar,cdnr,cdni,nmat);
773 printf(
"\n reducing the constant stiffnesses by a factor of 100 \n\n");
778 printf(
"\n *ERROR: too many cutbacks\n");
779 printf(
" best solution and residuals are in the frd file\n\n");
780 NNEW(fn,
double,mt**nk);
781 NNEW(inum,
ITG,*nk);
for(k=0;k<*nk;k++) inum[k]=1;
783 nk,sti,stn,ipkon,inum,kon,lakon,ne,mi,orab,
784 ielorien,co,itg,ntg,vold,ielmat,thicke,ielprop,prop));
788 frd(co,nk,kon,ipkon,lakon,ne,vold,stn,inum,nmethod,
789 kode,filab,een,t1act,fn,ttime,epn,ielmat,matname,enern,
790 xstaten,nstate_,istep,iinc,ithermal,qfn,mode,noddiam,
791 trab,inotr,ntrans,orab,ielorien,norien,description,
792 ipneigh,neigh,mi,sti,vr,vi,stnr,stni,vmax,stnmax,
793 &ngraph,veold,ener,ne,cs,
set,nset,istartset,iendset,
794 ialset,eenmax,fnr,fni,emn,thicke,jobnamec,output,qfx,cdn,
795 mortar,cdnr,cdni,nmat);
816 printf(
" no convergence\n\n");
subroutine checkimpacts(ne, neini, temax, sizemaxinc, energyref, tmin, tper, idivergence, iforceincsize, istab, dtheta, r_abs, energy, energyini, allwk, allwkini, dampwk, dampwkini, emax, mortar, maxdecay, enetoll)
Definition: checkimpacts.f:23
#define ITGFORMAT
Definition: CalculiX.h:52
void frd(double *co, ITG *nk, ITG *kon, ITG *ipkon, char *lakon, ITG *ne0, double *v, double *stn, ITG *inum, ITG *nmethod, ITG *kode, char *filab, double *een, double *t1, double *fn, double *time, double *epn, ITG *ielmat, char *matname, double *enern, double *xstaten, ITG *nstate_, ITG *istep, ITG *iinc, ITG *ithermal, double *qfn, ITG *mode, ITG *noddiam, double *trab, ITG *inotr, ITG *ntrans, double *orab, ITG *ielorien, ITG *norien, char *description, ITG *ipneigh, ITG *neigh, ITG *mi, double *stx, double *vr, double *vi, double *stnr, double *stni, double *vmax, double *stnmax, ITG *ngraph, double *veold, double *ener, ITG *ne, double *cs, char *set, ITG *nset, ITG *istartset, ITG *iendset, ITG *ialset, double *eenmax, double *fnr, double *fni, double *emn, double *thicke, char *jobnamec, char *output, double *qfx, double *cdn, ITG *mortar, double *cdnr, double *cdni, ITG *nmat)
Definition: frd.c:32
subroutine df(x, u, uprime, rpar, nev)
Definition: subspace.f:133
subroutine writesummary(istep, j, icutb, l, ttime, time, dtime)
Definition: writesummary.f:20
subroutine storeresidual(nactdof, b, fn, filab, ithermal, nk, sti, stn, ipkon, inum, kon, lakon, ne, mi, orab, ielorien, co, itg, ntg, vold, ielmat, thicke, ielprop, prop)
Definition: storeresidual.f:22
void FORTRAN(actideacti,(char *set, ITG *nset, ITG *istartset, ITG *iendset, ITG *ialset, char *objectset, ITG *ipkon, ITG *ibject, ITG *ne))
static double * c1
Definition: mafillvcompmain.c:30
subroutine stop()
Definition: stop.f:20
subroutine writesummarydiv(istep, j, icutb, l, ttime, time, dtime)
Definition: writesummarydiv.f:20
subroutine identamta(amta, reftime, istart, iend, id)
Definition: identamta.f:26
#define ITG
Definition: CalculiX.h:51
#define max(a, b)
Definition: checkconvergence.c:32
#define NNEW(a, b, c)
Definition: CalculiX.h:39