1 /*     CalculiX - A 3-dimensional finite element program                 */
2 /*              Copyright (C) 1998-2021 Guido Dhondt                          */
3 
4 /*     This program is free software; you can redistribute it and/or     */
5 /*     modify it under the terms of the GNU General Public License as    */
6 /*     published by the Free Software Foundation(version 2);    */
7 /*                    */
8 
9 /*     This program is distributed in the hope that it will be useful,   */
10 /*     but WITHOUT ANY WARRANTY; without even the implied warranty of    */
11 /*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the      */
12 /*     GNU General Public License for more details.                      */
13 
14 /*     You should have received a copy of the GNU General Public License */
15 /*     along with this program; if not, write to the Free Software       */
16 /*     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.         */
17 
18 #include <stdio.h>
19 #include <math.h>
20 #include <string.h>
21 #include <stdlib.h>
22 #include "CalculiX.h"
23 
24 #define max(a,b) ((a) >= (b) ? (a) : (b))
25 
crackpropagation(ITG ** ipkonp,ITG ** konp,char ** lakonp,ITG * ne,ITG * nk,char * jobnamec,ITG * nboun,ITG * iamboun,double * xboun,ITG * nload,char * sideload,ITG * iamload,ITG * nforc,ITG * iamforc,double * xforc,ITG * ithermal,double * t1,ITG * iamt1,double ** cop,ITG * nkon,ITG * mi,ITG ** ielmatp,char * matname,char * output,ITG * nmat,char * set,ITG * nset,ITG * istartset,ITG * iendset,ITG * ialset,ITG * jmax,double * timepar,ITG * nelcon,double * elcon,ITG * ncmat_,ITG * ntmat_,ITG * istep,char * filab,ITG * nmethod)26 void crackpropagation(ITG **ipkonp,ITG **konp,char **lakonp,ITG *ne,ITG *nk,
27 		      char *jobnamec,ITG *nboun,ITG *iamboun,double *xboun,
28 		      ITG *nload,char *sideload,ITG *iamload,ITG *nforc,
29 		      ITG *iamforc,double *xforc,ITG *ithermal,double *t1,
30 		      ITG *iamt1,double **cop,ITG *nkon,ITG *mi,ITG **ielmatp,
31 		      char *matname,char *output,ITG *nmat,char *set,ITG *nset,
32 		      ITG *istartset,ITG *iendset,ITG *ialset,ITG *jmax,
33 		      double *timepar,ITG *nelcon,double *elcon,ITG *ncmat_,
34 		      ITG *ntmat_,ITG *istep,char *filab,ITG *nmethod){
35 
36   char *lakon=NULL,filabnew[6]="    I",description[13]="            ",
37     *param=NULL;
38 
39   ITG *kontri=NULL,ntri,*iedg=NULL,*ipoed=NULL,*ieled=NULL,nedg,
40     *ibounedg=NULL,nbounedg,*ibounnod=NULL,nbounnod,*iedno=NULL,
41     *integerglob=NULL,iglob=0,*ifront=NULL,nfront,*ifrontrel=NULL,
42     *ifront2=NULL,*ifrontrel2=NULL,*istartfront=NULL,*iendfront=NULL,
43     nnfront,*istartcrackfro=NULL,*iendcrackfro=NULL,ncrack,i,j,
44     *ibounnod2=NULL,*istartcrackbou=NULL,*iendcrackbou=NULL,imat,
45     *isubsurffront=NULL,*iedno2=NULL,nkold,*ipkon=NULL,*kon=NULL,
46     *iresort=NULL,*inum=NULL,kode=1,nstate_=0,iinc,ier=0,
47     mode=-1,noddiam=-1,*inotr=NULL,ntrans,*ielorien=NULL,norien,*ipneigh=NULL,
48     *neigh=NULL,ngraph=1,mortar=0,*ielprop=NULL,*ielmat=NULL,icritic=0,
49     *ifrontprop=NULL,*ifronteq=NULL,*istartfronteq=NULL,*iendfronteq=NULL,
50     nfronteq,ncyc,*idist=NULL,ncrconst,nstep,nproc,ncrtem,law,
51     *iincglob=NULL,nparam,ncyctot,ieqspace;
52 
53   double *doubleglob=NULL,sigma=0.,*stress=NULL,*xt=NULL,*xn=NULL,*xa=NULL,
54     *xplanecrack=NULL,*acrack=NULL,*xk1=NULL,*xk2=NULL,*xk3=NULL,
55     *xkeq=NULL,*phi=NULL,*psi=NULL,*co=NULL,*da=NULL,*stress2=NULL,*v=NULL,
56     *stn=NULL,*een=NULL,*fn=NULL,time=0.,*epn=NULL,*enern=NULL,*sti=NULL,
57     *xstaten=NULL,*qfn=NULL,*trab=NULL,*orab=NULL,*vr=NULL,*vi=NULL,
58     *stnr=NULL,*stni=NULL,*vmax=NULL,*stnmax=NULL,*veold=NULL,*ener=NULL,
59     *cs=NULL,*eenmax=NULL,*fnr=NULL,*fni=NULL,*emn=NULL,*thicke=NULL,*qfx=NULL,
60     *cdn=NULL,*cdnr=NULL,*cdni=NULL,*prop=NULL,*costruc=NULL,*costruc2=NULL,
61     *dadn=NULL,*wk1glob=NULL,*wk2glob=NULL,*wk3glob=NULL,*dkeqglob=NULL,
62     *phiglob=NULL,*dadnglob=NULL,*dnglob=NULL,*charlen,damax,*crcon=NULL,
63     *angle=NULL,*xnplane=NULL,*xaplane=NULL,*posfront=NULL,*dist=NULL,
64     *a=NULL,*amin=NULL,*shape=NULL,*dk=NULL,*p=NULL,*temp=NULL,*temp2=NULL,
65     *crconloc=NULL,datarget,phimax,*xm=NULL,*xb=NULL,*acrackglob=NULL,
66     *wk1=NULL,*wk2=NULL,*wk3=NULL,*xkeqmin=NULL,*xkeqmax=NULL,*domstep=NULL,
67     *dkeq=NULL,*domphi=NULL,*xkeqminglob=NULL,*xkeqmaxglob=NULL,
68     *domstepglob=NULL;
69 
70   co=*cop;lakon=*lakonp;ipkon=*ipkonp;kon=*konp;ielmat=*ielmatp;
71 
72   damax=timepar[0];
73   phimax=timepar[1]*atan(1.)/45.;
74   imat=(ITG)(floor(timepar[2]));
75   nproc=(ITG)(floor(timepar[3]));
76   //  nproc=3;
77 
78   /* storing the crack propagation data in crcon */
79 
80   crackpropdata(jobnamec,nelcon,elcon,&crcon,&ncrconst,&ncrtem,&imat,
81 		matname,ntmat_,ncmat_,&param,&nparam,&law);
82 
83   /* reading the master file
84      nstep<0: frequency results
85      nstep>=0: static results
86   */
87 
88   nstep=0;
89   getuncrackedresults(&jobnamec[396],&integerglob,&doubleglob,nboun,iamboun,
90 		      xboun,nload,sideload,iamload,&iglob,nforc,iamforc,xforc,
91 		      ithermal,nk,t1,iamt1,&sigma,&nstep);
92 
93   NNEW(wk1glob,double,3**nk);
94   NNEW(wk2glob,double,3**nk);
95   NNEW(wk3glob,double,3**nk);
96   NNEW(xkeqminglob,double,3**nk);
97   NNEW(xkeqmaxglob,double,3**nk);
98   NNEW(dkeqglob,double,3**nk);
99   NNEW(phiglob,double,3**nk);
100   NNEW(dadnglob,double,3**nk);
101   NNEW(dnglob,double,3**nk);
102   NNEW(acrackglob,double,3**nk);
103   NNEW(iincglob,ITG,3**nk);
104   NNEW(domstepglob,double,3**nk);
105 
106   ncyctot=0;
107 
108   /* loop over crack propagation increments */
109 
110   for(iinc=0;iinc<jmax[0];iinc++){
111 
112     printf("Increment %d\n\n",iinc+1);
113 
114     /* catalogue all triangles belonging to the crack(s)
115        they are supposed to be of type S3 */
116 
117     NNEW(kontri,ITG,3**ne);
118 
119     FORTRAN(cattri,(ne,lakon,ipkon,kon,kontri,&ntri));
120 
121     RENEW(kontri,ITG,3*ntri);
122 
123     /* catalogue all edges of the crack(s) */
124 
125     NNEW(ipoed,ITG,*nk);
126     NNEW(iedg,ITG,9*ntri+3);
127     NNEW(ieled,ITG,6*ntri);
128 
129     FORTRAN(catedges_crackprop,(ipoed,iedg,&ntri,ieled,kontri,&nedg,&ier));
130     if(ier==1) break;
131 
132     RENEW(iedg,ITG,3*nedg);
133     RENEW(ieled,ITG,2*nedg);
134 
135     /* check for the boundary edges and boundary nodes of the
136        shell mesh (= crack shape(s)) */
137 
138     NNEW(ibounedg,ITG,nedg);
139     NNEW(ibounnod,ITG,nedg);
140     NNEW(iedno,ITG,2*nedg);
141 
142     FORTRAN(extern_crackprop,(ieled,&nedg,ibounedg,&nbounedg,ibounnod,
143 			      &nbounnod,iedg,iedno));
144 
145     RENEW(ibounedg,ITG,nbounedg);
146     RENEW(ibounnod,ITG,nbounnod);
147     RENEW(iedno,ITG,2*nbounnod);
148 
149     /* interpolating the stress in all boundary nodes
150        determining the boundary crack nodes inside the structure */
151 
152     NNEW(temp,double,nstep*nbounnod);
153     NNEW(stress,double,6*nstep*nbounnod);
154     NNEW(ifront,ITG,nbounnod);
155     NNEW(ifrontrel,ITG,nbounnod);
156     NNEW(costruc,double,3*nbounnod);
157 
158     FORTRAN(interpolextnodes,(ibounnod,&nbounnod,co,doubleglob,integerglob,
159 			      stress,ifront,&nfront,ifrontrel,costruc,
160 			      temp,&nstep));
161 
162     RENEW(ifront,ITG,nfront);
163     RENEW(ifrontrel,ITG,nfront);
164 
165     /* determining the internal boundary nodes
166        sorting them according to adjacency
167        add the nodes immediately outside the structure */
168 
169     NNEW(ifront2,ITG,3*nfront);
170     NNEW(ifrontrel2,ITG,3*nfront);
171     NNEW(istartfront,ITG,nfront);
172     NNEW(iendfront,ITG,nfront);
173     RENEW(ifront,ITG,3*nfront);
174     RENEW(ifrontrel,ITG,3*nfront);
175     NNEW(istartcrackfro,ITG,nfront);
176     NNEW(iendcrackfro,ITG,nfront);
177     NNEW(ibounnod2,ITG,nbounnod);
178     NNEW(iresort,ITG,nbounnod);
179     NNEW(istartcrackbou,ITG,nfront);
180     NNEW(iendcrackbou,ITG,nfront);
181     NNEW(isubsurffront,ITG,nfront);
182     NNEW(iedno2,ITG,2*nbounnod);
183     NNEW(temp2,double,nstep*6*nbounnod);
184     NNEW(stress2,double,nstep*6*nbounnod);
185     NNEW(costruc2,double,3*nbounnod);
186 
187     /* determine the order of the nodes along the crack front(s) */
188 
189     FORTRAN(adjacentbounodes,(ifront,ifrontrel,&nfront,iedno,iedg,&nnfront,
190 			      ifront2,ifrontrel2,ibounnod,&nbounnod,istartfront,
191 			      iendfront,ibounedg,istartcrackfro,iendcrackfro,
192 			      &ncrack,ibounnod2,istartcrackbou,iendcrackbou,
193 			      isubsurffront,iedno2,stress,stress2,iresort,
194 			      ieled,kontri,costruc,costruc2,temp,temp2,&nstep,
195 			      &ier));
196     if(ier==1) break;
197 
198     SFREE(iresort);
199     RENEW(ifront,ITG,nfront);
200     RENEW(ifrontrel,ITG,nfront);
201     RENEW(istartfront,ITG,nnfront);
202     RENEW(iendfront,ITG,nnfront);
203     RENEW(istartcrackfro,ITG,ncrack);
204     RENEW(iendcrackfro,ITG,ncrack);
205     RENEW(istartcrackbou,ITG,ncrack);
206     RENEW(iendcrackbou,ITG,ncrack);
207     RENEW(isubsurffront,ITG,nfront);
208     SFREE(ifront2);SFREE(ifrontrel2);SFREE(ibounnod2);SFREE(iedno2);
209     SFREE(stress2);SFREE(temp2);SFREE(costruc2);
210 
211     NNEW(xt,double,3*nfront);
212     NNEW(xn,double,3*nstep*nfront);
213     NNEW(xa,double,3*nstep*nfront);
214 
215     NNEW(angle,double,nnfront);
216 
217     /* determine a local coordinate system in each front node based on
218        the local stress tensor */
219 
220     FORTRAN(createlocalsys,(&nnfront,istartfront,iendfront,ifront,co,xt,xn,xa,
221 			    &nfront,ifrontrel,stress,iedno,ibounedg,ieled,
222 			    kontri,isubsurffront,istartcrackfro,iendcrackfro,
223 			    &ncrack,angle,&nstep,&ier));
224     if(ier==1) break;
225 
226     NNEW(xplanecrack,double,4*nstep*ncrack);
227     //    NNEW(xplanecrack,double,4*nstep*nnfront);
228     NNEW(xnplane,double,3*nstep*nfront);
229     NNEW(xaplane,double,3*nstep*nfront);
230     NNEW(xm,double,3*nfront);
231     NNEW(xb,double,3*nfront);
232 
233     /* determine a mean crack plane for each crack based on the
234        maximum principal stress plane */
235 
236     FORTRAN(crackplane,(&ncrack,istartcrackfro,iendcrackfro,ifront,co,xa,
237 			xplanecrack,istartcrackbou,iendcrackbou,
238 			ibounnod,xn,xt,ifrontrel,iedno,ibounedg,ieled,kontri,
239 			&nfront,costruc,xnplane,xaplane,&nstep,xm,xb));
240     SFREE(xnplane);SFREE(xplanecrack);
241 
242     /* copy xm and xb into xn and xa, respectively */
243 
244     RENEW(xn,double,3*nfront);
245     RENEW(xa,double,3*nfront);
246     memcpy(xn,xm,sizeof(double)*3*nfront);
247     memcpy(xa,xb,sizeof(double)*3*nfront);
248     SFREE(xm);SFREE(xb);
249 
250     /* determine a crack length for each front node*/
251 
252     NNEW(acrack,double,nstep*nfront);
253     NNEW(posfront,double,nfront);
254     FORTRAN(cracklength,(&ncrack,istartcrackfro,iendcrackfro,co,istartcrackbou,
255 			 iendcrackbou,costruc,ibounnod,xt,acrack,istartfront,
256 			 iendfront,&nnfront,isubsurffront,ifrontrel,
257 			 ifront,posfront,xaplane,doubleglob,integerglob,
258 			 &nstep,&nproc,&iinc,acrackglob,&ier));
259     if(ier==1) break;
260 
261     SFREE(xaplane);
262 
263     NNEW(dist,double,nfront);
264     NNEW(idist,ITG,nfront);
265     NNEW(a,double,nstep*nfront);
266     //    NNEW(amin,double,ncrack);
267 
268     FORTRAN(cracklength_smoothing,(&nnfront,isubsurffront,istartfront,
269 				   iendfront,ifrontrel,costruc,dist,a,
270 				   istartcrackfro,iendcrackfro,acrack,amin,
271 				   &nfront,&ncrack,idist,&nstep));
272 
273     SFREE(dist);SFREE(idist);SFREE(a);
274 
275     /* calculating the shape factors F=K/(sigma*sqrt(pi*a)) */
276 
277     NNEW(shape,double,3*nfront);
278 
279     FORTRAN(crackshape,(&nnfront,ifront,istartfront,iendfront,isubsurffront,
280 			angle,posfront,shape));
281 
282     SFREE(angle);SFREE(posfront);
283 
284     /* calculating the stress intensity factors */
285 
286     NNEW(xk1,double,nstep*nfront);
287     NNEW(xk2,double,nstep*nfront);
288     NNEW(xk3,double,nstep*nfront);
289     NNEW(xkeq,double,nstep*nfront);
290     NNEW(phi,double,nstep*nfront);
291     NNEW(psi,double,nstep*nfront);
292 
293     FORTRAN(stressintensity,(&nfront,ifrontrel,stress,xt,xn,xa,xk1,xk2,
294 			     xk3,xkeq,phi,psi,acrack,shape,&nstep));
295 
296     SFREE(shape);SFREE(psi);
297 
298     /* smoothing the equivalent k-factors and deflection angles */
299 
300     NNEW(dist,double,nfront);
301     NNEW(idist,ITG,nfront);
302     NNEW(dk,double,nstep*nfront);
303     NNEW(p,double,nstep*nfront);
304 
305     FORTRAN(stressintensity_smoothing,(&nnfront,isubsurffront,istartfront,
306 				       iendfront,ifrontrel,costruc,dist,
307 				       istartcrackfro,iendcrackfro,xkeq,phi,
308 				       &nfront,&ncrack,dk,p,idist,&phimax,
309 				       &nstep));
310 
311     SFREE(dist);SFREE(idist);SFREE(dk);SFREE(p);
312 
313     /* determine the target crack propagation increment */
314 
315     FORTRAN(calcdatarget,(ifront,co,&nnfront,istartfront,iendfront,
316 			  isubsurffront,&damax,&datarget,acrack,&nstep));
317 
318     /* propagate the nodes at the crack front(s)
319        (generate new nodes) */
320 
321     nkold=*nk;
322     NNEW(da,double,nfront);
323     RENEW(co,double,3*(*nk+nfront));
324     NNEW(dadn,double,nfront);
325     NNEW(wk1,double,nfront);
326     NNEW(wk2,double,nfront);
327     NNEW(wk3,double,nfront);
328     NNEW(xkeqmin,double,nfront);
329     NNEW(xkeqmax,double,nfront);
330     NNEW(dkeq,double,nfront);
331     NNEW(domstep,double,nfront);
332     NNEW(domphi,double,nfront);
333     NNEW(ifrontprop,ITG,nfront);
334 
335     NNEW(crconloc,double,ncrconst);
336 
337     FORTRAN(crackrate,(&nfront,ifrontrel,xkeq,phi,ifront,dadn,&ncyc,
338 		       &icritic,&datarget,crcon,temp,
339 		       &ncrtem,crconloc,&ncrconst,xk1,xk2,xk3,&nstep,
340 		       acrack,wk1,wk2,wk3,xkeqmin,xkeqmax,
341 		       dkeq,domstep,domphi,param,&nparam,&law,&ier));
342     if(ier==1) break;
343 
344     ncyctot+=ncyc;
345 
346     SFREE(crconloc);SFREE(xkeq);SFREE(phi);SFREE(xk1);SFREE(xk2);SFREE(xk3);
347 
348     FORTRAN(crackprop,(ifrontrel,ibounnod,domphi,da,co,costruc,nk,xa,
349 		       xn,&nnfront,istartfront,iendfront,doubleglob,
350 		       integerglob,isubsurffront,dadn,&ncyc,
351 		       ifrontprop,&nstep,acrack,acrackglob,&datarget,
352 		       &ieqspace,iincglob,&iinc));
353 
354     SFREE(xn);SFREE(xa);
355 
356     /* calculate the mesh characteristic length for each front
357        and the new equally spread nodes on the propagated front(s) */
358 
359     NNEW(ifronteq,ITG,2*nfront);
360     NNEW(istartfronteq,ITG,nnfront);
361     NNEW(iendfronteq,ITG,nnfront);
362 
363     /* the assumption is made, that no more than 2*nfront equally
364        spaced nodes are necessary for the propagated front */
365 
366     RENEW(co,double,3*(*nk+2*nfront));
367     RENEW(acrackglob,double,*nk+2*nfront);
368     RENEW(iincglob,ITG,*nk+2*nfront);
369     if(iinc==0){
370       NNEW(charlen,double,ncrack);
371 
372       FORTRAN(characteristiclength,(co,istartcrackfro,iendcrackfro,&ncrack,
373 				    ifront,charlen,&datarget));
374     }
375 
376     /* next lines of no equal spacing is desired */
377 
378     if(ieqspace==0){
379 
380       RENEW(ifronteq,ITG,nfront);
381       memcpy(&ifronteq[0],&ifrontprop[0],sizeof(ITG)*nfront);
382       memcpy(&istartfronteq[0],&istartfront[0],sizeof(ITG)*nnfront);
383       memcpy(&iendfronteq[0],&iendfront[0],sizeof(ITG)*nnfront);
384       nfronteq=nfront;
385 
386     }else{
387 
388     /* next lines of equal spacing is desired */
389 
390       FORTRAN(eqspacednodes,(co,istartfront,iendfront,&nnfront,
391 			     ifrontprop,nk,&nfront,ifronteq,charlen,
392 			     istartfronteq,iendfronteq,&nfronteq,
393 			     acrackglob,&ier,iendcrackfro,iincglob,
394 			     &iinc,dnglob,&ncyctot));
395       if(ier==1) break;
396     }
397 
398     RENEW(acrackglob,double,3*(*nk+nfront));
399     RENEW(iincglob,ITG,3*(*nk+nfront));
400     RENEW(ifronteq,ITG,nfronteq);
401 
402     /* update the crack mesh topology (generate new crack elements) */
403 
404     RENEW(lakon,char,8*(*ne+(nfronteq+nfront)));
405     RENEW(ipkon,ITG,*ne+(nfronteq+nfront));
406     RENEW(ielmat,ITG,mi[2]*(*ne+(nfronteq+nfront)));
407     for(i=mi[2]**ne;i<mi[2]*(*ne+(nfronteq+nfront));i++){ielmat[i]=0.;}
408     RENEW(kon,ITG,*nkon+9*(*ne+(nfronteq+nfront)));
409 
410     FORTRAN(extendmesh,(&nnfront,istartfront,iendfront,ifront,&nkold,ne,
411 			nkon,lakon,ipkon,kon,isubsurffront,co,ifronteq,
412 			istartfronteq,iendfronteq,&nfront,&nfronteq));
413 
414     RENEW(lakon,char,8**ne);
415     RENEW(ipkon,ITG,*ne);
416     RENEW(ielmat,ITG,mi[2]**ne);
417     RENEW(kon,ITG,*nkon);
418 
419     /* storing the local crack results into global nodal fields */
420 
421     RENEW(wk1glob,double,3*(*nk+nfront));
422     RENEW(wk2glob,double,3*(*nk+nfront));
423     RENEW(wk3glob,double,3*(*nk+nfront));
424     RENEW(xkeqminglob,double,3*(*nk+nfront));
425     RENEW(xkeqmaxglob,double,3*(*nk+nfront));
426     RENEW(dkeqglob,double,3*(*nk+nfront));
427     RENEW(phiglob,double,3*(*nk+nfront));
428     RENEW(dadnglob,double,3*(*nk+nfront));
429     RENEW(dnglob,double,3*(*nk+nfront));
430     RENEW(iincglob,ITG,3*(*nk+nfront));
431     RENEW(domstepglob,double,3*(*nk+nfront));
432 
433     FORTRAN(globalcrackresults,(&nfront,ifront,wk1,wk2,wk3,dkeq,domphi,dadn,
434 				&ncyctot,wk1glob,wk2glob,wk3glob,dkeqglob,
435 				phiglob,dadnglob,dnglob,acrack,acrackglob,
436 				&nstep,xkeqmin,xkeqmax,xkeqminglob,xkeqmaxglob,
437 				&iinc,iincglob,domstep,domstepglob));
438 
439     SFREE(kontri);SFREE(ipoed);SFREE(iedg);SFREE(ieled);SFREE(ibounedg);
440     SFREE(ibounnod);SFREE(iedno);SFREE(stress);SFREE(ifront);SFREE(ifrontrel);
441     SFREE(istartfront);SFREE(iendfront);SFREE(xt);
442     SFREE(istartcrackfro);SFREE(iendcrackfro);SFREE(temp);
443     SFREE(istartcrackbou);SFREE(iendcrackbou);
444     SFREE(isubsurffront);SFREE(acrack);
445     SFREE(dkeq);SFREE(da);SFREE(costruc);
446     SFREE(dadn);SFREE(ifrontprop);SFREE(ifronteq);SFREE(istartfronteq);
447     SFREE(iendfronteq);SFREE(wk1);SFREE(wk2);SFREE(wk3);SFREE(xkeqmin);
448     SFREE(xkeqmax);SFREE(domstep);SFREE(domphi);
449 
450     if(icritic>0){
451 	printf("WARNING: Exit because a critical value for dkeq is reached along the crack front \n");
452 	printf("Number of iteration= %d\n" ,(iinc+1));
453 	break;
454     }else if(icritic<0){
455 	printf("WARNING: Exit because no crack propagation anywhere along the crack front \n");
456 	printf("Number of iteration= %d\n" ,(iinc+1));
457 	break;
458     }else if(icritic<0){
459     }
460 
461   }
462 
463   SFREE(crcon);SFREE(integerglob);SFREE(doubleglob);
464 
465   for(j=0;j<*ne;j++){
466     if(strcmp1(&lakon[8*j+6],"L")==0) lakon[8*j+6]='A';
467   }
468 
469   NNEW(inum,ITG,*nk);
470   for(j=0;j<*nk;j++){
471     inum[j]=1;
472   }
473 
474   /* storing the global mesh and the triangulation of the crack(s):
475      shells must be stored as 2D-triangles */
476 
477   filab[4]='I';
478   frd(co,nk,kon,ipkon,lakon,ne,v,stn,inum,nmethod,
479       &kode,filab,een,t1,fn,&time,epn,ielmat,matname,enern,xstaten,
480       &nstate_,istep,&iinc,ithermal,qfn,&mode,&noddiam,trab,inotr,
481       &ntrans,orab,ielorien,&norien,description,ipneigh,neigh,
482       mi,sti,vr,vi,stnr,stni,vmax,stnmax,&ngraph,veold,ener,ne,
483       cs,set,nset,istartset,iendset,ialset,eenmax,fnr,fni,emn,
484       thicke,jobnamec,output,qfx,cdn,&mortar,cdnr,cdni,nmat,
485       ielprop,prop,sti);
486 
487   /* storing the crack propagation fields in frd-format */
488 
489   if(strcmp1(&filab[4611],"KEQ ")==0){
490     crackfrd(nk,&ngraph,&noddiam,cs,&kode,inum,nmethod,&time,istep,&iinc,&mode,
491 	     description,set,nset,istartset,iendset,ialset,jobnamec,output,
492 	     dkeqglob,wk1glob,wk2glob,wk3glob,phiglob,dadnglob,dnglob,
493 	     acrackglob,xkeqminglob,xkeqmaxglob,iincglob,domstepglob);
494   }
495 
496   SFREE(wk1glob);SFREE(wk2glob);SFREE(wk3glob);SFREE(dkeqglob);
497   SFREE(phiglob);SFREE(dadnglob);SFREE(dnglob);SFREE(xkeqminglob);
498   SFREE(inum);SFREE(charlen);SFREE(acrackglob);SFREE(xkeqmaxglob);
499   SFREE(iincglob);SFREE(domstepglob);
500 
501   *cop=co;*lakonp=lakon;*ipkonp=ipkon;*konp=kon;*ielmatp=ielmat;
502 
503   return;
504 }
505