DAMASK with grid solvers  Revision: v2.0.3-2204-gdb1f2151
The Düsseldorf Advanced Material Simulation Kit with Grid Solvers
grid_damage_spectral.f90
Go to the documentation of this file.
1 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90"
2 # 1 "<built-in>"
3 # 1 "<command-line>"
4 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90"
5 !--------------------------------------------------------------------------------------------------
10 !--------------------------------------------------------------------------------------------------
12 
13 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h" 1
14 !
15 ! Include file for Fortran use of the SNES package in 1
16 !
17 
18 
19 
20 
21 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h" 1
22 !
23 !
24 ! Include file for Fortran use of the KSP package in 1
25 !
26 
27 
28 
29 
30 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h" 1
31 !
32 !
33 ! Include file for Fortran use of the PC (preconditioner) package in 1
34 !
35 
36 
37 
38 
39 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 1
40 !
41 !
42 ! Include file for Fortran use of the Mat package in 1
43 !
44 
45 
46 
47 
48 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 1
49 !
50 !
51 ! Include file for Fortran use of the Vec package in 1
52 !
53 
54 
55 
56 
57 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscao.h" 1
58 !
59 !
60 ! Include file for Fortran use of the AO (application ordering) package in 1
61 !
62 
63 
64 
65 
66 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 1
67 !
68 !
69 ! Include file for Fortran use of the IS (index set) package in 1
70 !
71 
72 
73 
74 
75 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 1
76 !
77 !
78 ! Part of the base include file for Fortran use of 1.
79 ! Note: This file should contain only define statements and
80 ! not the declaration of variables.
81 
82 ! No spaces for #defines as some compilers (PGI) also adds
83 ! those additional spaces during preprocessing - bad for fixed format
84 !
85 
86 
87 
88 # 1 "/opt/petsc-3.10.3/Intel-18.4-IntelMPI-2018/include/petscconf.h" 1
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163 
164 
165 
166 
167 
168 
169 
170 
171 
172 
173 
174 
175 
176 
177 
178 
179 
180 
181 
182 
183 
184 
185 
186 
187 
188 
189 
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
209 
210 
211 
212 
213 
214 
215 
216 
217 
218 
219 
220 
221 
222 
223 
224 
225 
226 
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 
238 
239 
240 
241 
242 
243 
244 
245 
246 
247 
248 
249 
250 
251 
252 
253 
254 
255 
256 
257 
258 
259 
260 
261 
262 
263 
264 
265 
266 
267 
268 
269 
270 
271 
272 
273 
274 
275 
276 
277 
278 
279 
280 
281 
282 
283 
284 
285 
286 
287 
288 
289 
290 
291 
292 
293 
294 
295 
296 
297 
298 
299 
300 
301 
302 
303 
304 
305 
306 
307 
308 
309 
310 
311 
312 
313 
314 
315 
316 
317 
318 
319 
320 
321 
322 
323 
324 
325 
326 
327 
328 
329 
330 
331 
332 
333 
334 
335 
336 
337 
338 
339 
340 
341 
342 
343 
344 
345 
346 
347 
348 
349 
350 
351 
352 
353 
354 
355 
356 
357 
358 
359 
360 
361 
362 
363 
364 
365 
366 
367 
368 
369 
370 
371 
372 
373 
374 
375 
376 
377 
378 
379 
380 
381 
382 
383 
384 
385 
386 
387 
388 
389 
390 
391 
392 
393 
394 
395 
396 
397 
398 
399 
400 
401 
402 
403 
404 
405 
406 
407 
408 
409 
410 
411 
412 
413 
414 
415 
416 
417 
418 
419 
420 
421 
422 
423 
424 
425 
426 
427 
428 
429 
430 
431 
432 
433 
434 
435 
436 
437 
438 
439 
440 
441 
442 
443 
444 
445 
446 
447 
448 
449 
450 
451 
452 
453 
454 
455 
456 
457 
458 
459 
460 
461 
462 
463 
464 
465 
466 
467 
468 
469 
470 
471 
472 
473 
474 
475 
476 
477 
478 
479 
480 
481 
482 
483 
484 
485 
486 
487 
488 
489 
490 
491 
492 
493 
494 
495 
496 
497 
498 
499 
500 
501 
502 
503 
504 
505 
506 
507 
508 
509 
510 
511 
512 
513 
514 
515 
516 
517 
518 
519 
520 
521 
522 
523 
524 
525 
526 
527 
528 
529 
530 
531 
532 
533 
534 
535 
536 
537 
538 
539 
540 
541 
542 
543 
544 
545 
546 
547 
548 
549 
550 
551 
552 
553 
554 
555 
556 
557 
558 
559 
560 
561 
562 
563 
564 
565 
566 
567 
568 
569 
570 
571 
572 
573 
574 
575 
576 
577 
578 
579 
580 
581 
582 
583 
584 
585 
586 
587 
588 
589 
590 
591 
592 
593 
594 
595 
596 
597 
598 
599 
600 
601 
602 
603 
604 
605 
606 
607 
608 
609 
610 
611 
612 
613 
614 
615 
616 
617 
618 
619 
620 
621 
622 
623 
624 
625 
626 
627 
628 
629 
630 
631 
632 
633 
634 
635 
636 
637 
638 
639 
640 
641 
642 
643 
644 
645 
646 
647 
648 
649 
650 
651 
652 
653 
654 
655 
656 
657 
658 
659 
660 
661 
662 
663 
664 
665 
666 
667 
668 
669 
670 
671 
672 
673 
674 
675 
676 
677 
678 
679 
680 
681 
682 
683 
684 
685 
686 
687 
688 
689 
690 
691 
692 
693 
694 
695 
696 
697 
698 
699 
700 
701 
702 
703 
704 
705 
706 
707 
708 
709 
710 
711 
712 
713 
714 
715 
716 
717 
718 
719 
720 
721 
722 
723 
724 
725 
726 
727 
728 
729 
730 
731 
732 
733 
734 
735 
736 
737 
738 
739 
740 
741 
742 
743 
744 
745 
746 
747 
748 
749 
750 
751 
752 
753 
754 
755 
756 
757 
758 
759 
760 
761 
762 
763 
764 
765 
766 
767 
768 
769 
770 
771 
772 
773 
774 
775 
776 
777 
778 
779 
780 
781 
782 
783 
784 
785 
786 
787 
788 
789 
790 
791 
792 
793 
794 
795 
796 
797 
798 
799 
800 
801 
802 
803 
804 
805 
806 
807 
808 
809 
810 
811 
812 
813 
814 
815 
816 
817 
818 
819 
820 
821 
822 
823 
824 
825 
826 
827 
828 
829 
830 
831 
832 
833 
834 
835 
836 
837 
838 
839 
840 
841 
842 
843 
844 
845 
846 
847 
848 
849 
850 
851 
852 
853 
854 
855 
856 
857 
858 
859 
860 
861 
862 
863 
864 
865 
866 
867 
868 
869 
870 
871 
872 
873 
874 
875 
876 
877 
878 
879 
880 
881 
882 
883 
884 
885 
886 
887 
888 
889 
890 
891 
892 
893 
894 
895 
896 
897 
898 
899 
900 
901 
902 
903 
904 
905 
906 
907 
908 
909 
910 
911 
912 
913 
914 
915 
916 
917 
918 
919 
920 
921 
922 
923 
924 
925 
926 
927 
928 
929 
930 
931 
932 
933 
934 
935 
936 
937 
938 
939 
940 
941 
942 
943 
944 
945 
946 
947 
948 
949 
950 
951 
952 
953 
954 
955 
956 
957 
958 
959 
960 
961 
962 
963 
964 
965 
966 
967 
968 
969 
970 
971 
972 
973 
974 
975 
976 
977 
978 
979 
980 
981 
982 
983 
984 
985 
986 
987 
988 
989 
990 
991 
992 
993 
994 
995 
996 
997 
998 
999 
1000 
1001 
1002 
1003 
1004 
1005 
1006 
1007 
1008 
1009 
1010 
1011 
1012 
1013 
1014 
1015 
1016 
1017 
1018 
1019 
1020 
1021 
1022 
1023 
1024 
1025 
1026 
1027 
1028 
1029 
1030 
1031 
1032 
1033 
1034 
1035 
1036 
1037 
1038 
1039 
1040 
1041 
1042 
1043 
1044 
1045 
1046 
1047 
1048 
1049 
1050 
1051 
1052 
1053 
1054 
1055 
1056 
1057 
1058 
1059 
1060 
1061 
1062 
1063 
1064 
1065 
1066 
1067 
1068 
1069 
1070 
1071 
1072 
1073 
1074 
1075 
1076 
1077 
1078 
1079 
1080 
1081 
1082 
1083 
1084 
1085 
1086 
1087 
1088 
1089 
1090 
1091 
1092 
1093 
1094 
1095 
1096 
1097 
1098 
1099 
1100 
1101 
1102 
1103 
1104 
1105 
1106 
1107 
1108 
1109 
1110 
1111 
1112 
1113 
1114 
1115 
1116 
1117 
1118 
1119 
1120 
1121 
1122 
1123 
1124 
1125 
1126 
1127 
1128 
1129 
1130 
1131 
1132 
1133 
1134 
1135 
1136 
1137 
1138 
1139 
1140 
1141 
1142 
1143 
1144 
1145 
1146 
1147 
1148 
1149 
1150 
1151 
1152 
1153 
1154 
1155 
1156 
1157 
1158 
1159 
1160 
1161 
1162 
1163 
1164 
1165 
1166 
1167 
1168 
1169 
1170 
1171 
1172 
1173 
1174 
1175 
1176 
1177 
1178 
1179 
1180 
1181 
1182 
1183 
1184 
1185 
1186 
1187 
1188 
1189 
1190 
1191 
1192 
1193 
1194 
1195 
1196 
1197 
1198 
1199 
1200 
1201 
1202 
1203 
1204 
1205 
1206 
1207 
1208 
1209 
1210 
1211 
1212 
1213 
1214 
1215 
1216 
1217 
1218 
1219 
1220 
1221 
1222 
1223 
1224 
1225 
1226 
1227 
1228 
1229 
1230 
1231 
1232 
1233 
1234 
1235 
1236 
1237 
1238 
1239 
1240 
1241 
1242 
1243 
1244 
1245 
1246 
1247 
1248 
1249 
1250 
1251 
1252 
1253 
1254 
1255 
1256 
1257 
1258 
1259 
1260 
1261 
1262 
1263 
1264 
1265 
1266 
1267 
1268 
1269 
1270 
1271 
1272 
1273 
1274 
1275 
1276 
1277 
1278 
1279 
1280 
1281 
1282 
1283 
1284 
1285 
1286 
1287 
1288 
1289 
1290 
1291 
1292 
1293 
1294 
1295 
1296 # 13 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1297 
1298 
1299 
1300 
1301 # 1 "/opt/petsc-3.10.3/include/petscversion.h" 1
1302 
1303 
1304 
1305 
1306 
1307 
1308 
1309 
1310 
1311 
1312 
1313 
1314 
1315 
1316 
1317 
1318 
1319 
1320 
1321 
1322 
1323 
1324 
1325 
1326 
1327 
1328 
1329 
1330 
1331 
1332 
1333 
1334 
1335 
1336 
1337 
1338 
1339 
1340 
1341 
1342 
1343 
1344 
1345 
1346 
1347 # 17 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1348 
1349 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h" 1
1350 !
1351 ! Include file for Fortran use of the PetscViewer package in 1
1352 !
1353 
1354 
1355 
1356 
1357 
1358 
1359 
1360 
1361 
1362 
1363 
1364 
1365 
1366 # 31 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h"
1367 
1368 # 18 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1369 
1370 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h" 1
1371 
1372 !
1373 ! Include file for Fortran error codes
1374 ! These are also in include/petscerror.h
1375 !
1376 
1377 
1378 
1379 # 24 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1380 
1381 # 38 "/opt/petsc-3.10.3/include/petsc/finclude/petscerror.h"
1382 
1383 
1384 
1385 
1386 
1387 
1388 
1389 
1390 
1391 
1392 
1393 
1394 
1395 
1396 
1397 
1398 # 19 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1399 
1400 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petsclog.h" 1
1401 !
1402 ! No includes needed for logging
1403 # 20 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1404 
1405 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscbag.h" 1
1406 !
1407 !
1408 ! Include file for Fortran use of the Bag package in 1
1409 !
1410 
1411 
1412 
1413 
1414 
1415 !
1416 ! End of Fortran include file for the IS package in 1
1417 
1418 # 21 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h" 2
1419 
1420 !
1421 ! The real*8,complex*16 notatiton is used so that the
1422 ! 1 double/complex variables are not affected by
1423 ! compiler options like -r4,-r8, sometimes invoked
1424 ! by the user. NAG compiler does not like integer*4,real*8
1425 
1426 # 41 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1427 
1428 
1429 
1430 
1431 
1432 
1433 
1434 
1435 
1436 # 63 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1437 
1438 
1439 
1440 
1441 
1442 
1443 !
1444 
1445 
1446 
1447 
1448 
1449 !
1450 # 85 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1451 !
1452 
1453 
1454 
1455 
1456 
1457 
1458 !
1459 
1460 
1461 
1462 
1463 !
1464 
1465 !
1466 
1467 
1468 !
1469 # 128 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1470 
1471 # 150 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1472 !
1473 ! Macro for templating between real and complex
1474 !
1475 # 174 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1476 
1477 
1478 
1479 
1480 
1481 
1482 
1483 
1484 
1485 !
1486 ! Allows the matrix Fortran Kernels to work with single precision
1487 ! matrix data structures
1488 !
1489 
1490 !
1491 ! PetscLogDouble variables are used to contain double precision numbers
1492 ! that are not used in the numerical computations, but rather in logging,
1493 ! timing etc.
1494 !
1495 
1496 
1497 !
1498 ! Macros for error checking
1499 !
1500 
1501 
1502 
1503 
1504 
1505 
1506 
1507 
1508 # 215 "/opt/petsc-3.10.3/include/petsc/finclude/petscsys.h"
1509 
1510 
1511 
1512 
1513 
1514 
1515 
1516 
1517 
1518 
1519 
1520 
1521 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 2
1522 
1523 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscviewer.h" 1
1524 !
1525 ! Include file for Fortran use of the type(tPetscViewer) package in 1
1526 !
1527 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 2
1528 
1529 
1530 
1531 
1532 
1533 
1534 
1535 
1536 
1537 
1538 
1539 
1540 
1541 
1542 
1543 
1544 
1545 
1546 
1547 
1548 
1549 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscao.h" 2
1550 
1551 
1552 
1553 
1554 
1555 
1556 
1557 
1558 
1559 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 2
1560 
1561 
1562 
1563 
1564 
1565 
1566 
1567 
1568 
1569 
1570 
1571 
1572 
1573 # 30 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h"
1574 
1575 
1576 
1577 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 2
1578 
1579 
1580 
1581 
1582 
1583 # 49 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1584 
1585 
1586 
1587 
1588 
1589 
1590 
1591 
1592 
1593 
1594 
1595 
1596 
1597 # 71 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1598 !
1599 ! Matrix types
1600 !
1601 # 115 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1602 
1603 # 140 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1604 
1605 !
1606 ! MatMFFDType values
1607 !
1608 
1609 
1610 
1611 !
1612 ! MatSolverTypes
1613 !
1614 # 168 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h"
1615 
1616 !
1617 ! GPU Storage Formats for CUSPARSE
1618 !
1619 
1620 
1621 
1622 !
1623 ! sparsity reducing ordering for STRUMPACK
1624 !
1625 
1626 
1627 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h" 2
1628 
1629 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 1
1630 
1631 !
1632 ! Include file for Fortran use of the DM package in 1
1633 !
1634 
1635 
1636 
1637 
1638 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 1
1639 !
1640 !
1641 ! Include file for Fortran use of the type(tIS) (index set) package in 1
1642 !
1643 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 2
1644 
1645 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 1
1646 !
1647 !
1648 ! Include file for Fortran use of the type(tVec) package in 1
1649 !
1650 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 2
1651 
1652 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 1
1653 !
1654 !
1655 ! Include file for Fortran use of the type(tMat) package in 1
1656 !
1657 # 11 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 2
1658 
1659 
1660 
1661 
1662 
1663 
1664 
1665 
1666 
1667 
1668 
1669 # 32 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h"
1670 
1671 
1672 # 47 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h"
1673 
1674 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h" 2
1675 
1676 
1677 
1678 # 26 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h"
1679 !
1680 ! GAMG types
1681 !
1682 
1683 
1684 !
1685 ! Various preconditioners
1686 !
1687 # 74 "/opt/petsc-3.10.3/include/petsc/finclude/petscpc.h"
1688 
1689 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h" 2
1690 
1691 
1692 
1693 
1694 # 21 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h"
1695 !
1696 ! Various Krylov subspace methods
1697 !
1698 # 57 "/opt/petsc-3.10.3/include/petsc/finclude/petscksp.h"
1699 !
1700 ! Various Initial guesses for Krylov subspace methods
1701 !
1702 # 8 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h" 2
1703 
1704 
1705 
1706 
1707 
1708 # 30 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h"
1709 
1710 !
1711 ! character*(80)
1712 !
1713 # 47 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h"
1714 
1715 !
1716 ! character*(80)
1717 !
1718 
1719 
1720 
1721 
1722 
1723 
1724 
1725 !
1726 ! integer(kind=selected_int_kind(5))
1727 !
1728 
1729 
1730 
1731 
1732 
1733 
1734 !
1735 ! character*(80)
1736 !
1737 # 78 "/opt/petsc-3.10.3/include/petsc/finclude/petscsnes.h"
1738 
1739 
1740 
1741 # 9 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90" 2
1742 
1743 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 1
1744 
1745 !
1746 ! Include file for Fortran use of the 'da' (distributed array) package in 1
1747 !
1748 
1749 
1750 
1751 
1752 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscis.h" 1
1753 !
1754 !
1755 ! Include file for Fortran use of the type(tIS) (index set) package in 1
1756 !
1757 # 9 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1758 
1759 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscvec.h" 1
1760 !
1761 !
1762 ! Include file for Fortran use of the type(tVec) package in 1
1763 !
1764 # 10 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1765 
1766 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscmat.h" 1
1767 !
1768 !
1769 ! Include file for Fortran use of the type(tMat) package in 1
1770 !
1771 # 11 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1772 
1773 # 1 "/opt/petsc-3.10.3/include/petsc/finclude/petscdm.h" 1
1774 
1775 !
1776 ! Include file for Fortran use of the type(tDM) package in 1
1777 !
1778 # 12 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h" 2
1779 
1780 
1781 
1782 
1783 
1784 !
1785 ! DMDA_LOCAL_INFO_SIZE is one large than the size incase the DA is larger than an integer (on 64 bit systems).
1786 ! non-int fields are not accessiable from fortran.
1787 !
1788 # 39 "/opt/petsc-3.10.3/include/petsc/finclude/petscdmda.h"
1789 
1790 
1791 
1792 
1793 
1794 
1795 
1796 
1797 
1798 
1799 
1800 
1801 
1802 # 10 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/grid/grid_damage_spectral.f90" 2
1803  use petscdmda
1804  use petscsnes
1805 
1806  use prec
1807  use spectral_utilities
1809  use damage_nonlocal
1810  use numerics
1811 
1812  implicit none
1813  private
1814 
1815 !--------------------------------------------------------------------------------------------------
1816 ! derived types
1817  type(tsolutionparams), private :: params
1818 
1819 !--------------------------------------------------------------------------------------------------
1820 ! 1 data
1821  type(tsnes), private :: damage_snes
1822  type(tvec), private :: solution_vec
1823  integer(kind=selected_int_kind(5)), private :: xstart, xend, ystart, yend, zstart, zend
1824  real(preal), private, dimension(:,:,:), allocatable :: &
1825  phi_current, & !< field of current damage
1826  phi_lastinc, & !< field of previous damage
1827  phi_staginc
1828 
1829 !--------------------------------------------------------------------------------------------------
1830 ! reference diffusion tensor, mobility etc.
1831  integer, private :: totaliter = 0
1832  real(preal), dimension(3,3), private :: k_ref
1833  real(preal), private :: mu_ref
1834 
1835  public :: &
1839  private :: &
1840  formresidual
1841 
1842 contains
1843 
1844 !--------------------------------------------------------------------------------------------------
1846 ! ToDo: Restart not implemented
1847 !--------------------------------------------------------------------------------------------------
1848 subroutine grid_damage_spectral_init
1850  integer(kind=selected_int_kind(5)), dimension(0:worldsize-1) :: localk
1851  type(tdm) :: damage_grid
1852  type(tvec) :: ubound, lbound
1853  integer(kind=selected_int_kind(5)) :: ierr
1854  character(len=pStringLen) :: snes_type
1855 
1856  write(6,'(/,a)') ' <<<+- grid_spectral_damage init -+>>>'
1857 
1858  write(6,'(/,a)') ' Shanthraj et al., Handbook of Mechanics of Materials, 2019'
1859  write(6,'(a)') ' https://doi.org/10.1007/978-981-10-6855-3_80'
1860 
1861 !--------------------------------------------------------------------------------------------------
1862 ! set default and user defined options for 1
1863  call petscoptionsinsertstring(petsc_null_options,'-damage_snes_type newtonls -damage_snes_mf &
1864  &-damage_snes_ksp_ew -damage_ksp_type fgmres',ierr)
1865  if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1866  call petscoptionsinsertstring(petsc_null_options,trim(petsc_options),ierr)
1867  if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1868 
1869 !--------------------------------------------------------------------------------------------------
1870 ! initialize solver specific parts of 1
1871  call snescreate(petsc_comm_world,damage_snes,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1872  call snessetoptionsprefix(damage_snes,'damage_',ierr);if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1873  localk = 0
1874  localk(worldrank) = grid3
1875  call mpi_allreduce(mpi_in_place,localk,worldsize,mpi_integer,mpi_sum,petsc_comm_world,ierr)
1876  call dmdacreate3d(petsc_comm_world, &
1877  dm_boundary_none, dm_boundary_none, dm_boundary_none, & ! cut off stencil at boundary
1878  dmda_stencil_box, & ! Moore (26) neighborhood around central point
1879  grid(1),grid(2),grid(3), & ! global grid
1880  1, 1, worldsize, &
1881  1, 0, & ! #dof (damage phase field), ghost boundary width (domain overlap)
1882  [grid(1)],[grid(2)],localk, & ! local grid
1883  damage_grid,ierr) ! handle, error
1884  if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1885  call snessetdm(damage_snes,damage_grid,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif ! connect snes to da
1886  call dmsetfromoptions(damage_grid,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1887  call dmsetup(damage_grid,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1888  call dmcreateglobalvector(damage_grid,solution_vec,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif ! global solution vector (grid x 1, i.e. every def grad tensor)
1889  call dmdasnessetfunctionlocal(damage_grid,insert_values,formresidual,petsc_null_snes,ierr) ! residual vector of same shape as solution vector
1890  if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1891  call snessetfromoptions(damage_snes,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif ! pull it all together with additional CLI arguments
1892  call snesgettype(damage_snes,snes_type,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1893  if (trim(snes_type) == 'vinewtonrsls' .or. &
1894  trim(snes_type) == 'vinewtonssls') then
1895  call dmgetglobalvector(damage_grid,lbound,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1896  call dmgetglobalvector(damage_grid,ubound,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1897  call vecset(lbound,0.0_preal,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1898  call vecset(ubound,1.0_preal,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1899  call snesvisetvariablebounds(damage_snes,lbound,ubound,ierr) ! variable bounds for variational inequalities like contact mechanics, damage etc.
1900  call dmrestoreglobalvector(damage_grid,lbound,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1901  call dmrestoreglobalvector(damage_grid,ubound,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1902  endif
1903 
1904 !--------------------------------------------------------------------------------------------------
1905 ! init fields
1906  call dmdagetcorners(damage_grid,xstart,ystart,zstart,xend,yend,zend,ierr)
1907  if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1908  xend = xstart + xend - 1
1909  yend = ystart + yend - 1
1910  zend = zstart + zend - 1
1911  allocate(phi_current(grid(1),grid(2),grid3), source=1.0_preal)
1912  allocate(phi_lastinc(grid(1),grid(2),grid3), source=1.0_preal)
1913  allocate(phi_staginc(grid(1),grid(2),grid3), source=1.0_preal)
1914  call vecset(solution_vec,1.0_preal,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1915 
1916 !--------------------------------------------------------------------------------------------------
1917 ! damage reference diffusion update
1918  call updatereference
1919 
1920 end subroutine grid_damage_spectral_init
1921 
1922 
1923 !--------------------------------------------------------------------------------------------------
1925 !--------------------------------------------------------------------------------------------------
1926 function grid_damage_spectral_solution(timeinc,timeinc_old) result(solution)
1928  real(preal), intent(in) :: &
1929  timeinc, & !< increment in time for current solution
1930  timeinc_old
1931  integer :: i, j, k, cell
1932  type(tsolutionstate) :: solution
1933  integer(kind=selected_int_kind(5)) :: devnull
1934  real(kind=selected_real_kind(10)) :: phi_min, phi_max, stagnorm, solnnorm
1935 
1936  integer(kind=selected_int_kind(5)) :: ierr
1937  integer(kind=selected_int_kind(5)) :: reason
1938 
1939  solution%converged =.false.
1940 
1941 !--------------------------------------------------------------------------------------------------
1942 ! set module wide availabe data
1943  params%timeinc = timeinc
1944  params%timeincOld = timeinc_old
1945 
1946  call snessolve(damage_snes,petsc_null_vec,solution_vec,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1947  call snesgetconvergedreason(damage_snes,reason,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1948 
1949  if (reason < 1) then
1950  solution%converged = .false.
1951  solution%iterationsNeeded = itmax
1952  else
1953  solution%converged = .true.
1954  solution%iterationsNeeded = totaliter
1955  endif
1956  stagnorm = maxval(abs(phi_current - phi_staginc))
1957  solnnorm = maxval(abs(phi_current))
1958  call mpi_allreduce(mpi_in_place,stagnorm,1,mpi_double,mpi_max,petsc_comm_world,ierr)
1959  call mpi_allreduce(mpi_in_place,solnnorm,1,mpi_double,mpi_max,petsc_comm_world,ierr)
1961  solution%stagConverged = stagnorm < max(err_damage_tolabs, err_damage_tolrel*solnnorm)
1962 
1963 !--------------------------------------------------------------------------------------------------
1964 ! updating damage state
1965  cell = 0
1966  do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
1967  cell = cell + 1
1969  enddo; enddo; enddo
1970 
1971  call vecmin(solution_vec,devnull,phi_min,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1972  call vecmax(solution_vec,devnull,phi_max,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
1973  if (solution%converged) &
1974  write(6,'(/,a)') ' ... nonlocal damage converged .....................................'
1975  write(6,'(/,a,f8.6,2x,f8.6,2x,f8.6,/)',advance='no') ' Minimum|Maximum|Delta Damage = ',&
1976  phi_min, phi_max, stagnorm
1977  write(6,'(/,a)') ' ==========================================================================='
1978  flush(6)
1979 
1980 end function grid_damage_spectral_solution
1981 
1982 
1983 !--------------------------------------------------------------------------------------------------
1985 !--------------------------------------------------------------------------------------------------
1986 subroutine grid_damage_spectral_forward(cutBack)
1988  logical, intent(in) :: cutback
1989  integer :: i, j, k, cell
1990  type(tdm) :: dm_local
1991  real(kind=selected_real_kind(10)), dimension(:,:,:), pointer :: x_scal
1992  integer(kind=selected_int_kind(5)) :: ierr
1993 
1994  if (cutback) then
1997 !--------------------------------------------------------------------------------------------------
1998 ! reverting damage field state
1999  cell = 0
2000  call snesgetdm(damage_snes,dm_local,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
2001  call dmdavecgetarrayf90(dm_local,solution_vec,x_scal,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
2003  call dmdavecrestorearrayf90(dm_local,solution_vec,x_scal,ierr); if (ierr .ne. 0) then;call petscerrorf(ierr);return;endif
2004  do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
2005  cell = cell + 1
2007  enddo; enddo; enddo
2008  else
2010  call updatereference
2011  endif
2012 
2013 end subroutine grid_damage_spectral_forward
2014 
2015 
2016 !--------------------------------------------------------------------------------------------------
2018 !--------------------------------------------------------------------------------------------------
2019 subroutine formresidual(in,x_scal,f_scal,dummy,ierr)
2021  integer(kind=selected_int_kind(5)), dimension(25) :: &
2022  in
2023  real(kind=selected_real_kind(10)), dimension( & in(13)+1:in(13)+in(16),in(14)+1:in(14)+in(17),in(15)+1:in(15)+in(18)), intent(in) :: &
2024  x_scal
2025  real(kind=selected_real_kind(10)), dimension( & in(7)+1:in(7)+in(10),in(8)+1:in(8)+in(11),in(9)+1:in(9)+in(12)), intent(out) :: &
2026  f_scal
2027  integer(kind=selected_int_kind(10)) :: dummy
2028  integer(kind=selected_int_kind(5)) :: ierr
2029  integer :: i, j, k, cell
2030  real(preal) :: phidot, dphidot_dphi, mobility
2031 
2032  phi_current = x_scal
2033 !--------------------------------------------------------------------------------------------------
2034 ! evaluate polarization field
2035  scalarfield_real = 0.0_preal
2036  scalarfield_real(1:grid(1),1:grid(2),1:grid3) = phi_current
2040  cell = 0
2041  do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
2042  cell = cell + 1
2043  vectorfield_real(1:3,i,j,k) = matmul(damage_nonlocal_getdiffusion(1,cell) - k_ref, &
2044  vectorfield_real(1:3,i,j,k))
2045  enddo; enddo; enddo
2049  cell = 0
2050  do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
2051  cell = cell + 1
2052  call damage_nonlocal_getsourceanditstangent(phidot, dphidot_dphi, phi_current(i,j,k), 1, cell)
2053  mobility = damage_nonlocal_getmobility(1,cell)
2054  scalarfield_real(i,j,k) = params%timeinc*(scalarfield_real(i,j,k) + phidot) &
2055  + mobility*(phi_lastinc(i,j,k) - phi_current(i,j,k)) &
2056  + mu_ref*phi_current(i,j,k)
2057  enddo; enddo; enddo
2058 
2059 !--------------------------------------------------------------------------------------------------
2060 ! convolution of damage field with green operator
2064  where(scalarfield_real(1:grid(1),1:grid(2),1:grid3) > phi_lastinc) &
2065  scalarfield_real(1:grid(1),1:grid(2),1:grid3) = phi_lastinc
2066  where(scalarfield_real(1:grid(1),1:grid(2),1:grid3) < residualstiffness) &
2068 
2069 !--------------------------------------------------------------------------------------------------
2070 ! constructing residual
2071  f_scal = scalarfield_real(1:grid(1),1:grid(2),1:grid3) - phi_current
2072 
2073 end subroutine formresidual
2074 
2075 
2076 !--------------------------------------------------------------------------------------------------
2078 !--------------------------------------------------------------------------------------------------
2079 subroutine updatereference
2080 
2081  integer :: i,j,k,cell,ierr
2083  cell = 0
2084  k_ref = 0.0_preal
2085  mu_ref = 0.0_preal
2086  do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
2087  cell = cell + 1
2090  enddo; enddo; enddo
2091  k_ref = k_ref*wgt
2092  call mpi_allreduce(mpi_in_place,k_ref,9,mpi_double,mpi_sum,petsc_comm_world,ierr)
2093  mu_ref = mu_ref*wgt
2094  call mpi_allreduce(mpi_in_place,mu_ref,1,mpi_double,mpi_sum,petsc_comm_world,ierr)
2095 
2096 end subroutine updatereference
2097 
2098 
2099 end module grid_damage_spectral
2100 
grid_damage_spectral::zend
integer(kind=selected_int_kind(5)), private zend
Definition: grid_damage_spectral.f90:1823
spectral_utilities::utilities_fftscalarbackward
subroutine, public utilities_fftscalarbackward
backward FFT of data in scalarField_fourier to scalarField_real
Definition: spectral_utilities.f90:1918
grid_damage_spectral::formresidual
subroutine, private formresidual(in, x_scal, f_scal, dummy, ierr)
forms the spectral damage residual vector
Definition: grid_damage_spectral.f90:2020
damage_nonlocal
material subroutine for non-locally evolving damage field
Definition: damage_nonlocal.f90:9
spectral_utilities::scalarfield_real
real(c_double), dimension(:,:,:), pointer, public scalarfield_real
scalar field real representation for fftw
Definition: spectral_utilities.f90:1501
grid_damage_spectral::grid_damage_spectral_solution
type(tsolutionstate) function, public grid_damage_spectral_solution(timeinc, timeinc_old)
solution for the spectral damage scheme with internal iterations
Definition: grid_damage_spectral.f90:1927
grid_damage_spectral::xend
integer(kind=selected_int_kind(5)), private xend
Definition: grid_damage_spectral.f90:1823
grid_damage_spectral::yend
integer(kind=selected_int_kind(5)), private yend
Definition: grid_damage_spectral.f90:1823
grid_damage_spectral::k_ref
real(preal), dimension(3, 3), private k_ref
Definition: grid_damage_spectral.f90:1832
numerics::residualstiffness
real(preal), public, protected residualstiffness
non-zero residual damage
Definition: numerics.f90:1478
grid_damage_spectral::phi_current
real(preal), dimension(:,:,:), allocatable, private phi_current
field of current damage
Definition: grid_damage_spectral.f90:1824
spectral_utilities::tsolutionparams
Definition: spectral_utilities.f90:1557
grid_damage_spectral::zstart
integer(kind=selected_int_kind(5)), private zstart
Definition: grid_damage_spectral.f90:1823
spectral_utilities
Utilities used by the different spectral solver variants.
Definition: spectral_utilities.f90:10
numerics::worldsize
integer, public, protected worldsize
MPI worldsize (/=1 for MPI simulations only)
Definition: numerics.f90:1470
grid_damage_spectral::phi_lastinc
real(preal), dimension(:,:,:), allocatable, private phi_lastinc
field of previous damage
Definition: grid_damage_spectral.f90:1824
discretization_grid::grid3
integer, public, protected grid3
(local) grid in 3rd direction
Definition: discretization_grid.f90:1478
damage_nonlocal::damage_nonlocal_putnonlocaldamage
subroutine, public damage_nonlocal_putnonlocaldamage(phi, ip, el)
updated nonlocal damage field with solution from damage phase field PDE
Definition: damage_nonlocal.f90:186
discretization_grid
Parse geometry file to set up discretization and geometry for nonlocal model.
Definition: discretization_grid.f90:11
prec
setting precision for real and int type
Definition: prec.f90:13
spectral_utilities::utilities_fftvectorbackward
subroutine, public utilities_fftvectorbackward
backward FFT of data in field_fourier to field_real
Definition: spectral_utilities.f90:1943
spectral_utilities::vectorfield_real
real(c_double), dimension(:,:,:,:), pointer, public vectorfield_real
vector field real representation for fftw
Definition: spectral_utilities.f90:1499
damage_nonlocal::damage_nonlocal_getmobility
real(preal) function, public damage_nonlocal_getmobility(ip, el)
Returns homogenized nonlocal damage mobility.
Definition: damage_nonlocal.f90:163
grid_damage_spectral::updatereference
subroutine updatereference
update reference viscosity and conductivity
Definition: grid_damage_spectral.f90:2082
grid_damage_spectral::params
type(tsolutionparams), private params
Definition: grid_damage_spectral.f90:1817
spectral_utilities::utilities_fouriervectordivergence
subroutine, public utilities_fouriervectordivergence()
calculate vector divergence in fourier field
Definition: spectral_utilities.f90:2221
prec::preal
integer, parameter preal
number with 15 significant digits, up to 1e+-307 (typically 64 bit)
Definition: prec.f90:20
spectral_utilities::utilities_fftscalarforward
subroutine, public utilities_fftscalarforward
forward FFT of data in scalarField_real to scalarField_fourier
Definition: spectral_utilities.f90:1906
grid_damage_spectral::phi_staginc
real(preal), dimension(:,:,:), allocatable, private phi_staginc
field of staggered damage
Definition: grid_damage_spectral.f90:1824
spectral_utilities::utilities_fftvectorforward
subroutine, public utilities_fftvectorforward
forward FFT of data in field_real to field_fourier with highest freqs. removed
Definition: spectral_utilities.f90:1931
spectral_utilities::utilities_fourierscalargradient
subroutine, public utilities_fourierscalargradient()
calculate scalar gradient in fourier field
Definition: spectral_utilities.f90:2207
grid_damage_spectral::mu_ref
real(preal), private mu_ref
Definition: grid_damage_spectral.f90:1833
grid_damage_spectral::solution_vec
type(tvec), private solution_vec
Definition: grid_damage_spectral.f90:1822
numerics::itmax
integer, public, protected itmax
maximum number of iterations
Definition: numerics.f90:1495
grid_damage_spectral::grid_damage_spectral_init
subroutine, public grid_damage_spectral_init
allocates all neccessary fields and fills them with data
Definition: grid_damage_spectral.f90:1849
grid_damage_spectral::ystart
integer(kind=selected_int_kind(5)), private ystart
Definition: grid_damage_spectral.f90:1823
numerics::err_damage_tolabs
real(preal), public, protected err_damage_tolabs
absolute tolerance for damage evolution
Definition: numerics.f90:1488
grid_damage_spectral::damage_snes
type(tsnes), private damage_snes
Definition: grid_damage_spectral.f90:1821
numerics::worldrank
integer, public, protected worldrank
MPI worldrank (/=0 for MPI simulations only)
Definition: numerics.f90:1470
spectral_utilities::wgt
real(preal), public, protected wgt
weighting factor 1/Nelems
Definition: spectral_utilities.f90:1490
discretization_grid::grid
integer, dimension(3), public, protected grid
(global) grid
Definition: discretization_grid.f90:1476
grid_damage_spectral::xstart
integer(kind=selected_int_kind(5)), private xstart
Definition: grid_damage_spectral.f90:1823
grid_damage_spectral
1 solver for nonlocal damage
Definition: grid_damage_spectral.f90:11
grid_damage_spectral::grid_damage_spectral_forward
subroutine, public grid_damage_spectral_forward(cutBack)
spectral damage forwarding routine
Definition: grid_damage_spectral.f90:1987
spectral_utilities::utilities_fouriergreenconvolution
subroutine, public utilities_fouriergreenconvolution(D_ref, mobility_ref, deltaT)
doing convolution DamageGreenOp_hat * field_real
Definition: spectral_utilities.f90:2009
grid_damage_spectral::totaliter
integer, private totaliter
total iteration in current increment
Definition: grid_damage_spectral.f90:1831
numerics::err_damage_tolrel
real(preal), public, protected err_damage_tolrel
relative tolerance for damage evolution
Definition: numerics.f90:1488
numerics
Managing of parameters related to numerics.
Definition: numerics.f90:10
spectral_utilities::tsolutionstate
return type of solution from spectral solver variants
Definition: spectral_utilities.f90:1528
damage_nonlocal::damage_nonlocal_getdiffusion
real(preal) function, dimension(3, 3), public damage_nonlocal_getdiffusion(ip, el)
returns homogenized non local damage diffusion tensor in reference configuration
Definition: damage_nonlocal.f90:136
damage_nonlocal::damage_nonlocal_getsourceanditstangent
subroutine, public damage_nonlocal_getsourceanditstangent(phiDot, dPhiDot_dPhi, phi, ip, el)
calculates homogenized damage driving forces
Definition: damage_nonlocal.f90:83