-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplastic_phenopowerlaw.f90
More file actions
1288 lines (1161 loc) · 76.1 KB
/
plastic_phenopowerlaw.f90
File metadata and controls
1288 lines (1161 loc) · 76.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
! Copyright 2011-16 Max-Planck-Institut für Eisenforschung GmbH
!
! This program is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!--------------------------------------------------------------------------------------------------
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
!> @brief material subroutine for phenomenological crystal plasticity formulation using a powerlaw
!! fitting
!--------------------------------------------------------------------------------------------------
module plastic_phenopowerlaw
use prec, only: &
pReal,&
pInt
implicit none
private
integer(pInt), dimension(:), allocatable, public, protected :: &
plastic_phenopowerlaw_sizePostResults !< cumulative size of post results
integer(pInt), dimension(:,:), allocatable, target, public :: &
plastic_phenopowerlaw_sizePostResult !< size of each post result output
character(len=64), dimension(:,:), allocatable, target, public :: &
plastic_phenopowerlaw_output !< name of each post result output
integer(pInt), dimension(:), allocatable, target, public :: &
plastic_phenopowerlaw_Noutput !< number of outputs per instance of this constitution
integer(pInt), dimension(:), allocatable, public, protected :: &
plastic_phenopowerlaw_totalNslip, & !< no. of slip system used in simulation
plastic_phenopowerlaw_totalNtwin, & !< no. of twin system used in simulation
plastic_phenopowerlaw_totalNtrans !< no. of trans system used in simulation
integer(pInt), dimension(:,:), allocatable, private :: &
plastic_phenopowerlaw_Nslip, & !< active number of slip systems per family (input parameter, per family)
plastic_phenopowerlaw_Ntwin, & !< active number of twin systems per family (input parameter, per family)
plastic_phenopowerlaw_Ntrans !< active number of trans systems per family (input parameter, per family)
real(pReal), dimension(:), allocatable, private :: &
plastic_phenopowerlaw_gdot0_slip, & !< reference shear strain rate for slip (input parameter)
plastic_phenopowerlaw_gdot0_twin, & !< reference shear strain rate for twin (input parameter)
plastic_phenopowerlaw_n_slip, & !< stress exponent for slip (input parameter)
plastic_phenopowerlaw_n_twin, & !< stress exponent for twin (input parameter)
plastic_phenopowerlaw_spr, & !< push-up factor for slip saturation due to twinning
plastic_phenopowerlaw_twinB, &
plastic_phenopowerlaw_twinC, &
plastic_phenopowerlaw_twinD, &
plastic_phenopowerlaw_twinE, &
plastic_phenopowerlaw_h0_SlipSlip, & !< reference hardening slip - slip (input parameter)
plastic_phenopowerlaw_h0_TwinSlip, & !< reference hardening twin - slip (input parameter)
plastic_phenopowerlaw_h0_TwinTwin, & !< reference hardening twin - twin (input parameter)
plastic_phenopowerlaw_a_slip, &
plastic_phenopowerlaw_aTolResistance, &
plastic_phenopowerlaw_aTolShear, &
plastic_phenopowerlaw_aTolTwinfrac, &
plastic_phenopowerlaw_aTolTransfrac, &
plastic_phenopowerlaw_Cnuc, & !< coefficient for strain-induced martensite nucleation
plastic_phenopowerlaw_Cdwp, & !< coefficient for double well potential
plastic_phenopowerlaw_Cgro, & !< coefficient for stress-assisted martensite growth
plastic_phenopowerlaw_deltaG, & !< free energy difference between austensite and martensite [MPa]
plastic_phenopowerlaw_taub_c, & !< material parameter for back stress (Armstrong-Frederick rule)
plastic_phenopowerlaw_taub_d, & !< material parameter for back stress (Armstrong-Frederick rule)
plastic_phenopowerlaw_aTolTaub !< tolerance for back stress evolution
real(pReal), dimension(:,:), allocatable, private :: &
plastic_phenopowerlaw_tau0_slip, & !< initial critical shear stress for slip (input parameter, per family)
plastic_phenopowerlaw_tau0_twin, & !< initial critical shear stress for twin (input parameter, per family)
plastic_phenopowerlaw_tausat_slip, & !< maximum critical shear stress for slip (input parameter, per family)
plastic_phenopowerlaw_nonSchmidCoeff, &
plastic_phenopowerlaw_interaction_SlipSlip, & !< interaction factors slip - slip (input parameter)
plastic_phenopowerlaw_interaction_SlipTwin, & !< interaction factors slip - twin (input parameter)
plastic_phenopowerlaw_interaction_TwinSlip, & !< interaction factors twin - slip (input parameter)
plastic_phenopowerlaw_interaction_TwinTwin !< interaction factors twin - twin (input parameter)
real(pReal), dimension(:,:,:), allocatable, private :: &
plastic_phenopowerlaw_hardeningMatrix_SlipSlip, &
plastic_phenopowerlaw_hardeningMatrix_SlipTwin, &
plastic_phenopowerlaw_hardeningMatrix_TwinSlip, &
plastic_phenopowerlaw_hardeningMatrix_TwinTwin
enum, bind(c)
enumerator :: undefined_ID, &
resistance_slip_ID, &
accumulatedshear_slip_ID, &
shearrate_slip_ID, &
resolvedstress_slip_ID, &
totalshear_ID, &
resistance_twin_ID, &
accumulatedshear_twin_ID, &
shearrate_twin_ID, &
resolvedstress_twin_ID, &
totalvolfrac_twin_ID
end enum
integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: &
plastic_phenopowerlaw_outputID !< ID of each post result output
type, private :: tPhenopowerlawState
real(pReal), pointer, dimension(:,:) :: &
s_slip, &
s_twin, &
accshear_slip, &
accshear_twin, &
tau_b
real(pReal), pointer, dimension(:) :: &
sumGamma, &
sumF
end type
type(tPhenopowerlawState), allocatable, dimension(:), private :: &
dotState, &
state, &
state0
public :: &
plastic_phenopowerlaw_init, &
plastic_phenopowerlaw_LpAndItsTangent, &
plastic_phenopowerlaw_dotState, &
plastic_phenopowerlaw_postResults
private :: &
plastic_phenopowerlaw_aTolState, &
plastic_phenopowerlaw_stateInit
contains
!--------------------------------------------------------------------------------------------------
!> @brief module initialization
!> @details reads in material parameters, allocates arrays, and does sanity checks
!--------------------------------------------------------------------------------------------------
subroutine plastic_phenopowerlaw_init(fileUnit)
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
use debug, only: &
debug_level, &
debug_constitutive,&
debug_levelBasic
use math, only: &
math_Mandel3333to66, &
math_Voigt66to3333
use IO, only: &
IO_read, &
IO_lc, &
IO_getTag, &
IO_isBlank, &
IO_stringPos, &
IO_stringValue, &
IO_floatValue, &
IO_intValue, &
IO_warning, &
IO_error, &
IO_timeStamp, &
IO_EOF
use material, only: &
phase_plasticity, &
phase_plasticityInstance, &
phase_Noutput, &
PLASTICITY_PHENOPOWERLAW_label, &
PLASTICITY_PHENOPOWERLAW_ID, &
material_phase, &
plasticState, &
MATERIAL_partPhase
use lattice
use numerics,only: &
analyticJaco, &
worldrank, &
numerics_integrator
implicit none
integer(pInt), intent(in) :: fileUnit
integer(pInt), allocatable, dimension(:) :: chunkPos
integer(pInt) :: &
maxNinstance, &
instance,phase,j,k, f,o, &
Nchunks_SlipSlip = 0_pInt, Nchunks_SlipTwin = 0_pInt, &
Nchunks_TwinSlip = 0_pInt, Nchunks_TwinTwin = 0_pInt, &
Nchunks_SlipFamilies = 0_pInt, Nchunks_TwinFamilies = 0_pInt, &
Nchunks_TransFamilies = 0_pInt, Nchunks_nonSchmid = 0_pInt, &
NipcMyPhase, &
offset_slip, index_myFamily, index_otherFamily, &
mySize=0_pInt,sizeState,sizeDotState, sizeDeltaState, &
startIndex, endIndex
character(len=65536) :: &
tag = '', &
line = ''
real(pReal), dimension(:), allocatable :: tempPerSlip
mainProcess: if (worldrank == 0) then
write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>'
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
#include "compilation_info.f90"
endif mainProcess
maxNinstance = int(count(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID),pInt)
if (maxNinstance == 0_pInt) return
if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt) &
write(6,'(a16,1x,i5,/)') '# instances:',maxNinstance
allocate(plastic_phenopowerlaw_sizePostResults(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_sizePostResult(maxval(phase_Noutput),maxNinstance), &
source=0_pInt)
allocate(plastic_phenopowerlaw_output(maxval(phase_Noutput),maxNinstance))
plastic_phenopowerlaw_output = ''
allocate(plastic_phenopowerlaw_outputID(maxval(phase_Noutput),maxNinstance), source=undefined_ID)
allocate(plastic_phenopowerlaw_Noutput(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_Nslip(lattice_maxNslipFamily,maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_Ntwin(lattice_maxNtwinFamily,maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_Ntrans(lattice_maxNtransFamily,maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_totalNslip(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_totalNtwin(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_totalNtrans(maxNinstance), source=0_pInt)
allocate(plastic_phenopowerlaw_gdot0_slip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_n_slip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_tau0_slip(lattice_maxNslipFamily,maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_tausat_slip(lattice_maxNslipFamily,maxNinstance),source=0.0_pReal)
allocate(plastic_phenopowerlaw_gdot0_twin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_n_twin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_tau0_twin(lattice_maxNtwinFamily,maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_spr(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinB(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinC(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinD(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_twinE(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_h0_SlipSlip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_h0_TwinSlip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_h0_TwinTwin(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_interaction_SlipSlip(lattice_maxNinteraction,maxNinstance), &
source=0.0_pReal)
allocate(plastic_phenopowerlaw_interaction_SlipTwin(lattice_maxNinteraction,maxNinstance), &
source=0.0_pReal)
allocate(plastic_phenopowerlaw_interaction_TwinSlip(lattice_maxNinteraction,maxNinstance), &
source=0.0_pReal)
allocate(plastic_phenopowerlaw_interaction_TwinTwin(lattice_maxNinteraction,maxNinstance), &
source=0.0_pReal)
allocate(plastic_phenopowerlaw_a_slip(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_aTolResistance(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_aTolShear(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_aTolTwinfrac(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_aTolTransfrac(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_nonSchmidCoeff(lattice_maxNnonSchmid,maxNinstance), &
source=0.0_pReal)
allocate(plastic_phenopowerlaw_Cnuc(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_Cdwp(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_Cgro(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_deltaG(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_taub_c(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_taub_d(maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_aTolTaub(maxNinstance),source=0.0_pReal)
rewind(fileUnit)
phase = 0_pInt
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partPhase) ! wind forward to <phase>
line = IO_read(fileUnit)
enddo
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of phase part
line = IO_read(fileUnit)
if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
line = IO_read(fileUnit, .true.) ! reset IO_read
exit
endif
if (IO_getTag(line,'[',']') /= '') then ! next phase
phase = phase + 1_pInt ! advance phase section counter
if (phase_plasticity(phase) == PLASTICITY_PHENOPOWERLAW_ID) then
Nchunks_SlipFamilies = count(lattice_NslipSystem(:,phase) > 0_pInt) ! maximum number of slip families according to lattice type of current phase
Nchunks_TwinFamilies = count(lattice_NtwinSystem(:,phase) > 0_pInt) ! maximum number of twin families according to lattice type of current phase
Nchunks_TransFamilies = count(lattice_NtransSystem(:,phase) > 0_pInt) ! maximum number of trans families according to lattice type of current phase
Nchunks_SlipSlip = maxval(lattice_interactionSlipSlip(:,:,phase))
Nchunks_SlipTwin = maxval(lattice_interactionSlipTwin(:,:,phase))
Nchunks_TwinSlip = maxval(lattice_interactionTwinSlip(:,:,phase))
Nchunks_TwinTwin = maxval(lattice_interactionTwinTwin(:,:,phase))
Nchunks_nonSchmid = lattice_NnonSchmid(phase)
if(allocated(tempPerSlip)) deallocate(tempPerSlip)
allocate(tempPerSlip(Nchunks_SlipFamilies))
endif
cycle ! skip to next line
endif
if (phase > 0_pInt ) then; if (phase_plasticity(phase) == PLASTICITY_PHENOPOWERLAW_ID) then ! one of my phases. Do not short-circuit here (.and. between if-statements), it's not safe in Fortran
instance = phase_plasticityInstance(phase) ! which instance of my plasticity is present phase
chunkPos = IO_stringPos(line)
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
select case(tag)
case ('(output)')
select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt)))
case ('resistance_slip')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = resistance_slip_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('accumulatedshear_slip','accumulated_shear_slip')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = accumulatedshear_slip_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('shearrate_slip')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = shearrate_slip_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('resolvedstress_slip')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = resolvedstress_slip_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('totalshear')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = totalshear_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('resistance_twin')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = resistance_twin_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('accumulatedshear_twin','accumulated_shear_twin')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = accumulatedshear_twin_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('shearrate_twin')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = shearrate_twin_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('resolvedstress_twin')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = resolvedstress_twin_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('totalvolfrac_twin')
plastic_phenopowerlaw_Noutput(instance) = plastic_phenopowerlaw_Noutput(instance) + 1_pInt
plastic_phenopowerlaw_outputID(plastic_phenopowerlaw_Noutput(instance),instance) = totalvolfrac_twin_ID
plastic_phenopowerlaw_output(plastic_phenopowerlaw_Noutput(instance),instance) = &
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case default
end select
!--------------------------------------------------------------------------------------------------
! parameters depending on number of slip families
case ('nslip')
if (chunkPos(1) < Nchunks_SlipFamilies + 1_pInt) &
call IO_warning(50_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (chunkPos(1) > Nchunks_SlipFamilies + 1_pInt) &
call IO_error(150_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
Nchunks_SlipFamilies = chunkPos(1) - 1_pInt ! user specified number of (possibly) active slip families (e.g. 6 0 6 --> 3)
do j = 1_pInt, Nchunks_SlipFamilies
plastic_phenopowerlaw_Nslip(j,instance) = IO_intValue(line,chunkPos,1_pInt+j)
enddo
case ('tausat_slip','tau0_slip')
tempPerSlip = 0.0_pReal
do j = 1_pInt, Nchunks_SlipFamilies
if (plastic_phenopowerlaw_Nslip(j,instance) > 0_pInt) &
tempPerSlip(j) = IO_floatValue(line,chunkPos,1_pInt+j)
enddo
select case(tag)
case ('tausat_slip')
plastic_phenopowerlaw_tausat_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
case ('tau0_slip')
plastic_phenopowerlaw_tau0_slip(1:Nchunks_SlipFamilies,instance) = tempPerSlip(1:Nchunks_SlipFamilies)
end select
!--------------------------------------------------------------------------------------------------
! parameters depending on number of twin families
case ('ntwin')
if (chunkPos(1) < Nchunks_TwinFamilies + 1_pInt) &
call IO_warning(51_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (chunkPos(1) > Nchunks_TwinFamilies + 1_pInt) &
call IO_error(150_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
Nchunks_TwinFamilies = chunkPos(1) - 1_pInt
do j = 1_pInt, Nchunks_TwinFamilies
plastic_phenopowerlaw_Ntwin(j,instance) = IO_intValue(line,chunkPos,1_pInt+j)
enddo
case ('tau0_twin')
do j = 1_pInt, Nchunks_TwinFamilies
if (plastic_phenopowerlaw_Ntwin(j,instance) > 0_pInt) &
plastic_phenopowerlaw_tau0_twin(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j)
enddo
!--------------------------------------------------------------------------------------------------
! parameters depending on number of transformation families
case ('ntrans')
if (chunkPos(1) < Nchunks_TransFamilies + 1_pInt) &
call IO_warning(53_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (chunkPos(1) > Nchunks_TransFamilies + 1_pInt) &
call IO_error(150_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
Nchunks_TransFamilies = chunkPos(1) - 1_pInt
do j = 1_pInt, Nchunks_TransFamilies
plastic_phenopowerlaw_Ntrans(j,instance) = IO_intValue(line,chunkPos,1_pInt+j)
enddo
!--------------------------------------------------------------------------------------------------
! parameters depending on number of interactions
case ('interaction_slipslip')
if (chunkPos(1) < 1_pInt + Nchunks_SlipSlip) &
call IO_warning(52_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
do j = 1_pInt, Nchunks_SlipSlip
plastic_phenopowerlaw_interaction_SlipSlip(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j)
enddo
case ('interaction_sliptwin')
if (chunkPos(1) < 1_pInt + Nchunks_SlipTwin) &
call IO_warning(52_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
do j = 1_pInt, Nchunks_SlipTwin
plastic_phenopowerlaw_interaction_SlipTwin(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j)
enddo
case ('interaction_twinslip')
if (chunkPos(1) < 1_pInt + Nchunks_TwinSlip) &
call IO_warning(52_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
do j = 1_pInt, Nchunks_TwinSlip
plastic_phenopowerlaw_interaction_TwinSlip(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j)
enddo
case ('interaction_twintwin')
if (chunkPos(1) < 1_pInt + Nchunks_TwinTwin) &
call IO_warning(52_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
do j = 1_pInt, Nchunks_TwinTwin
plastic_phenopowerlaw_interaction_TwinTwin(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j)
enddo
case ('nonschmid_coefficients')
if (chunkPos(1) < 1_pInt + Nchunks_nonSchmid) &
call IO_warning(52_pInt,ext_msg=trim(tag)//' ('//PLASTICITY_PHENOPOWERLAW_label//')')
do j = 1_pInt,Nchunks_nonSchmid
plastic_phenopowerlaw_nonSchmidCoeff(j,instance) = IO_floatValue(line,chunkPos,1_pInt+j)
enddo
!--------------------------------------------------------------------------------------------------
! parameters independent of number of slip/twin systems
case ('gdot0_slip')
plastic_phenopowerlaw_gdot0_slip(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('n_slip')
plastic_phenopowerlaw_n_slip(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('a_slip', 'w0_slip')
plastic_phenopowerlaw_a_slip(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('gdot0_twin')
plastic_phenopowerlaw_gdot0_twin(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('n_twin')
plastic_phenopowerlaw_n_twin(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('s_pr')
plastic_phenopowerlaw_spr(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('twin_b')
plastic_phenopowerlaw_twinB(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('twin_c')
plastic_phenopowerlaw_twinC(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('twin_d')
plastic_phenopowerlaw_twinD(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('twin_e')
plastic_phenopowerlaw_twinE(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('h0_slipslip')
plastic_phenopowerlaw_h0_SlipSlip(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('h0_twinslip')
plastic_phenopowerlaw_h0_TwinSlip(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('h0_twintwin')
plastic_phenopowerlaw_h0_TwinTwin(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('atol_resistance')
plastic_phenopowerlaw_aTolResistance(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('atol_shear')
plastic_phenopowerlaw_aTolShear(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('atol_twinfrac')
plastic_phenopowerlaw_aTolTwinfrac(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('atol_transfrac')
plastic_phenopowerlaw_aTolTransfrac(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('cnuc')
plastic_phenopowerlaw_Cnuc(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('cdwp')
plastic_phenopowerlaw_Cdwp(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('cgro')
plastic_phenopowerlaw_Cgro(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('deltag')
plastic_phenopowerlaw_deltaG(instance) = IO_floatValue(line,chunkPos,2_pInt)
!-------------------------------------------------------------------------------------------------
! parameters for back stress (Armstrong-Frederick rule)
case ('taub_c')
plastic_phenopowerlaw_taub_c(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('taub_d')
plastic_phenopowerlaw_taub_d(instance) = IO_floatValue(line,chunkPos,2_pInt)
case ('atol_taub')
plastic_phenopowerlaw_aTolTaub(instance) = IO_floatValue(line,chunkPos,2_pInt)
case default
end select
endif; endif
enddo parsingFile
sanityChecks: do phase = 1_pInt, size(phase_plasticity)
myPhase: if (phase_plasticity(phase) == PLASTICITY_phenopowerlaw_ID) then
instance = phase_plasticityInstance(phase)
plastic_phenopowerlaw_Nslip(1:lattice_maxNslipFamily,instance) = &
min(lattice_NslipSystem(1:lattice_maxNslipFamily,phase),& ! limit active slip systems per family to min of available and requested
plastic_phenopowerlaw_Nslip(1:lattice_maxNslipFamily,instance))
plastic_phenopowerlaw_Ntwin(1:lattice_maxNtwinFamily,instance) = &
min(lattice_NtwinSystem(1:lattice_maxNtwinFamily,phase),& ! limit active twin systems per family to min of available and requested
plastic_phenopowerlaw_Ntwin(:,instance))
plastic_phenopowerlaw_totalNslip(instance) = sum(plastic_phenopowerlaw_Nslip(:,instance)) ! how many slip systems altogether
plastic_phenopowerlaw_totalNtwin(instance) = sum(plastic_phenopowerlaw_Ntwin(:,instance)) ! how many twin systems altogether
plastic_phenopowerlaw_totalNtrans(instance) = sum(plastic_phenopowerlaw_Ntrans(:,instance)) ! how many trans systems altogether
if (any(plastic_phenopowerlaw_tau0_slip(:,instance) < 0.0_pReal .and. &
plastic_phenopowerlaw_Nslip(:,instance) > 0)) &
call IO_error(211_pInt,el=instance,ext_msg='tau0_slip ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (plastic_phenopowerlaw_gdot0_slip(instance) <= 0.0_pReal) &
call IO_error(211_pInt,el=instance,ext_msg='gdot0_slip ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (plastic_phenopowerlaw_n_slip(instance) <= 0.0_pReal) &
call IO_error(211_pInt,el=instance,ext_msg='n_slip ('//PLASTICITY_PHENOPOWERLAW_label//')')
if ( any(plastic_phenopowerlaw_tausat_slip(:,instance) <= 0.0_pReal .and. &
plastic_phenopowerlaw_Nslip(:,instance) > 0)) &
call IO_error(211_pInt,el=instance,ext_msg='tausat_slip ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (abs(plastic_phenopowerlaw_a_slip(instance)) <= tiny(0.0_pReal)) &
call IO_error(211_pInt,el=instance,ext_msg='a_slip ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (any(plastic_phenopowerlaw_tau0_twin(:,instance) < 0.0_pReal .and. &
plastic_phenopowerlaw_Ntwin(:,instance) > 0)) &
call IO_error(211_pInt,el=instance,ext_msg='tau0_twin ('//PLASTICITY_PHENOPOWERLAW_label//')')
if ( plastic_phenopowerlaw_gdot0_twin(instance) <= 0.0_pReal) &
call IO_error(211_pInt,el=instance,ext_msg='gdot0_twin ('//PLASTICITY_PHENOPOWERLAW_label//')')
if ( plastic_phenopowerlaw_n_twin(instance) <= 0.0_pReal) &
call IO_error(211_pInt,el=instance,ext_msg='n_twin ('//PLASTICITY_PHENOPOWERLAW_label//')')
if ( plastic_phenopowerlaw_taub_c(instance) < 0.0_pReal) &
call IO_error(211_pInt,el=instance,ext_msg='taub_c ('//PLASTICITY_PHENOPOWERLAW_label//')')
if ( plastic_phenopowerlaw_taub_d(instance) < 0.0_pReal) &
call IO_error(211_pInt,el=instance,ext_msg='taub_d ('//PLASTICITY_PHENOPOWERLAW_label//')')
if (plastic_phenopowerlaw_aTolResistance(instance) <= 0.0_pReal) &
plastic_phenopowerlaw_aTolResistance(instance) = 1.0_pReal ! default absolute tolerance 1 Pa
if (plastic_phenopowerlaw_aTolShear(instance) <= 0.0_pReal) &
plastic_phenopowerlaw_aTolShear(instance) = 1.0e-6_pReal ! default absolute tolerance 1e-6
if (plastic_phenopowerlaw_aTolTwinfrac(instance) <= 0.0_pReal) &
plastic_phenopowerlaw_aTolTwinfrac(instance) = 1.0e-6_pReal ! default absolute tolerance 1e-6
if (plastic_phenopowerlaw_aTolTransfrac(instance) <= 0.0_pReal) &
plastic_phenopowerlaw_aTolTransfrac(instance) = 1.0e-6_pReal ! default absolute tolerance 1e-6
if (plastic_phenopowerlaw_aTolTaub(instance) <= 0.0_pReal) & ! default absolute tolerance 1e-6
plastic_phenopowerlaw_aTolTaub(instance) = 1.0e-6_pReal
endif myPhase
enddo sanityChecks
!--------------------------------------------------------------------------------------------------
! allocation of variables whose size depends on the total number of active slip systems
allocate(plastic_phenopowerlaw_hardeningMatrix_SlipSlip(maxval(plastic_phenopowerlaw_totalNslip),& ! slip resistance from slip activity
maxval(plastic_phenopowerlaw_totalNslip),&
maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_hardeningMatrix_SlipTwin(maxval(plastic_phenopowerlaw_totalNslip),& ! slip resistance from twin activity
maxval(plastic_phenopowerlaw_totalNtwin),&
maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_hardeningMatrix_TwinSlip(maxval(plastic_phenopowerlaw_totalNtwin),& ! twin resistance from slip activity
maxval(plastic_phenopowerlaw_totalNslip),&
maxNinstance), source=0.0_pReal)
allocate(plastic_phenopowerlaw_hardeningMatrix_TwinTwin(maxval(plastic_phenopowerlaw_totalNtwin),& ! twin resistance from twin activity
maxval(plastic_phenopowerlaw_totalNtwin),&
maxNinstance), source=0.0_pReal)
allocate(state(maxNinstance))
allocate(state0(maxNinstance))
allocate(dotState(maxNinstance))
initializeInstances: do phase = 1_pInt, size(phase_plasticity) ! loop through all phases in material.config
myPhase2: if (phase_plasticity(phase) == PLASTICITY_phenopowerlaw_ID) then ! only consider my phase
NipcMyPhase = count(material_phase == phase) ! number of IPCs containing my phase
instance = phase_plasticityInstance(phase) ! which instance of my phase
!--------------------------------------------------------------------------------------------------
! Determine size of postResults array
outputsLoop: do o = 1_pInt,plastic_phenopowerlaw_Noutput(instance)
select case(plastic_phenopowerlaw_outputID(o,instance))
case(resistance_slip_ID, &
shearrate_slip_ID, &
accumulatedshear_slip_ID, &
resolvedstress_slip_ID &
)
mySize = plastic_phenopowerlaw_totalNslip(instance)
case(resistance_twin_ID, &
shearrate_twin_ID, &
accumulatedshear_twin_ID, &
resolvedstress_twin_ID &
)
mySize = plastic_phenopowerlaw_totalNtwin(instance)
case(totalshear_ID, &
totalvolfrac_twin_ID &
)
mySize = 1_pInt
case default
end select
outputFound: if (mySize > 0_pInt) then
plastic_phenopowerlaw_sizePostResult(o,instance) = mySize
plastic_phenopowerlaw_sizePostResults(instance) = plastic_phenopowerlaw_sizePostResults(instance) + mySize
endif outputFound
enddo outputsLoop
!--------------------------------------------------------------------------------------------------
! allocate state arrays
sizeState = plastic_phenopowerlaw_totalNslip(instance) & ! s_slip
+ plastic_phenopowerlaw_totalNtwin(instance) & ! s_twin
+ 2_pInt & ! sum(gamma) + sum(f)
+ plastic_phenopowerlaw_totalNslip(instance) & ! accshear_slip
+ plastic_phenopowerlaw_totalNtwin(instance) & ! accshear_twin
+ plastic_phenopowerlaw_totalNslip(instance) ! taub
sizeDotState = sizeState
sizeDeltaState = 0_pInt
plasticState(phase)%sizeState = sizeState
plasticState(phase)%sizeDotState = sizeDotState
plasticState(phase)%sizeDeltaState = sizeDeltaState
plasticState(phase)%sizePostResults = plastic_phenopowerlaw_sizePostResults(instance)
plasticState(phase)%nSlip =plastic_phenopowerlaw_totalNslip(instance)
plasticState(phase)%nTwin =plastic_phenopowerlaw_totalNtwin(instance)
plasticState(phase)%nTrans=plastic_phenopowerlaw_totalNtrans(instance)
allocate(plasticState(phase)%aTolState ( sizeState), source=0.0_pReal)
allocate(plasticState(phase)%state0 ( sizeState,NipcMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%partionedState0 ( sizeState,NipcMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%subState0 ( sizeState,NipcMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%state ( sizeState,NipcMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase), source=0.0_pReal)
if (.not. analyticJaco) then
allocate(plasticState(phase)%state_backup ( sizeState,NipcMyPhase),source=0.0_pReal)
allocate(plasticState(phase)%dotState_backup (sizeDotState,NipcMyPhase),source=0.0_pReal)
endif
if (any(numerics_integrator == 1_pInt)) then
allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal)
allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal)
endif
if (any(numerics_integrator == 4_pInt)) &
allocate(plasticState(phase)%RK4dotState (sizeDotState,NipcMyPhase), source=0.0_pReal)
if (any(numerics_integrator == 5_pInt)) &
allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NipcMyPhase), source=0.0_pReal)
offset_slip = plasticState(phase)%nSlip+plasticState(phase)%nTwin+2_pInt
plasticState(phase)%slipRate => &
plasticState(phase)%dotState(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NipcMyPhase)
plasticState(phase)%accumulatedSlip => &
plasticState(phase)%state(offset_slip+1:offset_slip+plasticState(phase)%nSlip,1:NipcMyPhase)
do f = 1_pInt,lattice_maxNslipFamily ! >>> interaction slip -- X
index_myFamily = sum(plastic_phenopowerlaw_Nslip(1:f-1_pInt,instance))
do j = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance) ! loop over (active) systems in my family (slip)
do o = 1_pInt,lattice_maxNslipFamily
index_otherFamily = sum(plastic_phenopowerlaw_Nslip(1:o-1_pInt,instance))
do k = 1_pInt,plastic_phenopowerlaw_Nslip(o,instance) ! loop over (active) systems in other family (slip)
plastic_phenopowerlaw_hardeningMatrix_SlipSlip(index_myFamily+j,index_otherFamily+k,instance) = &
plastic_phenopowerlaw_interaction_SlipSlip(lattice_interactionSlipSlip( &
sum(lattice_NslipSystem(1:f-1,phase))+j, &
sum(lattice_NslipSystem(1:o-1,phase))+k, &
phase), instance )
enddo; enddo
do o = 1_pInt,lattice_maxNtwinFamily
index_otherFamily = sum(plastic_phenopowerlaw_Ntwin(1:o-1_pInt,instance))
do k = 1_pInt,plastic_phenopowerlaw_Ntwin(o,instance) ! loop over (active) systems in other family (twin)
plastic_phenopowerlaw_hardeningMatrix_SlipTwin(index_myFamily+j,index_otherFamily+k,instance) = &
plastic_phenopowerlaw_interaction_SlipTwin(lattice_interactionSlipTwin( &
sum(lattice_NslipSystem(1:f-1_pInt,phase))+j, &
sum(lattice_NtwinSystem(1:o-1_pInt,phase))+k, &
phase), instance )
enddo; enddo
enddo; enddo
do f = 1_pInt,lattice_maxNtwinFamily ! >>> interaction twin -- X
index_myFamily = sum(plastic_phenopowerlaw_Ntwin(1:f-1_pInt,instance))
do j = 1_pInt,plastic_phenopowerlaw_Ntwin(f,instance) ! loop over (active) systems in my family (twin)
do o = 1_pInt,lattice_maxNslipFamily
index_otherFamily = sum(plastic_phenopowerlaw_Nslip(1:o-1_pInt,instance))
do k = 1_pInt,plastic_phenopowerlaw_Nslip(o,instance) ! loop over (active) systems in other family (slip)
plastic_phenopowerlaw_hardeningMatrix_TwinSlip(index_myFamily+j,index_otherFamily+k,instance) = &
plastic_phenopowerlaw_interaction_TwinSlip(lattice_interactionTwinSlip( &
sum(lattice_NtwinSystem(1:f-1_pInt,phase))+j, &
sum(lattice_NslipSystem(1:o-1_pInt,phase))+k, &
phase), instance )
enddo; enddo
do o = 1_pInt,lattice_maxNtwinFamily
index_otherFamily = sum(plastic_phenopowerlaw_Ntwin(1:o-1_pInt,instance))
do k = 1_pInt,plastic_phenopowerlaw_Ntwin(o,instance) ! loop over (active) systems in other family (twin)
plastic_phenopowerlaw_hardeningMatrix_TwinTwin(index_myFamily+j,index_otherFamily+k,instance) = &
plastic_phenopowerlaw_interaction_TwinTwin(lattice_interactionTwinTwin( &
sum(lattice_NtwinSystem(1:f-1_pInt,phase))+j, &
sum(lattice_NtwinSystem(1:o-1_pInt,phase))+k, &
phase), instance )
enddo; enddo
enddo; enddo
startIndex = 1_pInt
endIndex = plastic_phenopowerlaw_totalNslip(instance)
state (instance)%s_slip=>plasticState(phase)%state (startIndex:endIndex,:)
state0 (instance)%s_slip=>plasticState(phase)%state0 (startIndex:endIndex,:)
dotState(instance)%s_slip=>plasticState(phase)%dotState(startIndex:endIndex,:)
startIndex = endIndex + 1_pInt
endIndex = endIndex + plastic_phenopowerlaw_totalNtwin(instance)
state (instance)%s_twin=>plasticState(phase)%state (startIndex:endIndex,:)
state0 (instance)%s_twin=>plasticState(phase)%state0 (startIndex:endIndex,:)
dotState(instance)%s_twin=>plasticState(phase)%dotState(startIndex:endIndex,:)
startIndex = endIndex + 1_pInt
endIndex = endIndex + 1_pInt
state (instance)%sumGamma=>plasticState(phase)%state (startIndex,:)
state0 (instance)%sumGamma=>plasticState(phase)%state0 (startIndex,:)
dotState(instance)%sumGamma=>plasticState(phase)%dotState(startIndex,:)
startIndex = endIndex + 1_pInt
endIndex = endIndex + 1_pInt
state (instance)%sumF=>plasticState(phase)%state (startIndex,:)
state0 (instance)%sumF=>plasticState(phase)%state0 (startIndex,:)
dotState(instance)%sumF=>plasticState(phase)%dotState(startIndex,:)
startIndex = endIndex + 1_pInt
endIndex = endIndex +plastic_phenopowerlaw_totalNslip(instance)
state (instance)%accshear_slip=>plasticState(phase)%state (startIndex:endIndex,:)
state0 (instance)%accshear_slip=>plasticState(phase)%state0 (startIndex:endIndex,:)
dotState(instance)%accshear_slip=>plasticState(phase)%dotState(startIndex:endIndex,:)
startIndex = endIndex + 1_pInt
endIndex = endIndex +plastic_phenopowerlaw_totalNtwin(instance)
state (instance)%accshear_twin=>plasticState(phase)%state (startIndex:endIndex,:)
state0 (instance)%accshear_twin=>plasticState(phase)%state0 (startIndex:endIndex,:)
dotState(instance)%accshear_twin=>plasticState(phase)%dotState(startIndex:endIndex,:)
startIndex = endIndex + 1_pInt
endIndex = endIndex + plastic_phenopowerlaw_totalNslip(instance)
state (instance)%tau_b=>plasticState(phase)%state (startIndex:endIndex,:)
state0 (instance)%tau_b=>plasticState(phase)%state0 (startIndex:endIndex,:)
dotState(instance)%tau_b=>plasticState(phase)%dotState(startIndex:endIndex,:)
call plastic_phenopowerlaw_stateInit(phase,instance)
call plastic_phenopowerlaw_aTolState(phase,instance)
endif myPhase2
enddo initializeInstances
end subroutine plastic_phenopowerlaw_init
!--------------------------------------------------------------------------------------------------
!> @brief sets the initial microstructural state for a given instance of this plasticity
!--------------------------------------------------------------------------------------------------
subroutine plastic_phenopowerlaw_stateInit(ph,instance)
use lattice, only: &
lattice_maxNslipFamily, &
lattice_maxNtwinFamily
use material, only: &
plasticState
implicit none
integer(pInt), intent(in) :: &
instance, & !< number specifying the instance of the plasticity
ph
integer(pInt) :: &
i
real(pReal), dimension(plasticState(ph)%sizeState) :: &
tempState
tempState = 0.0_pReal ! initialize 0
do i = 1_pInt,lattice_maxNslipFamily
tempState(1+sum(plastic_phenopowerlaw_Nslip(1:i-1,instance)) : &
sum(plastic_phenopowerlaw_Nslip(1:i ,instance))) = &
plastic_phenopowerlaw_tau0_slip(i,instance)
enddo
do i = 1_pInt,lattice_maxNtwinFamily
tempState(1+sum(plastic_phenopowerlaw_Nslip(:,instance))+&
sum(plastic_phenopowerlaw_Ntwin(1:i-1,instance)) : &
sum(plastic_phenopowerlaw_Nslip(:,instance))+&
sum(plastic_phenopowerlaw_Ntwin(1:i ,instance))) = &
plastic_phenopowerlaw_tau0_twin(i,instance)
enddo
plasticState(ph)%state0(:,:) = spread(tempState, & ! spread single tempstate array
2, & ! along dimension 2
size(plasticState(ph)%state0(1,:))) ! number of copies (number of IPCs)
end subroutine plastic_phenopowerlaw_stateInit
!--------------------------------------------------------------------------------------------------
!> @brief sets the relevant state values for a given instance of this plasticity
!--------------------------------------------------------------------------------------------------
subroutine plastic_phenopowerlaw_aTolState(ph,instance)
use material, only: &
plasticState
implicit none
integer(pInt), intent(in) :: &
instance, & !< number specifying the instance of the plasticity
ph
plasticState(ph)%aTolState(1:plastic_phenopowerlaw_totalNslip(instance)+ &
plastic_phenopowerlaw_totalNtwin(instance)) = &
plastic_phenopowerlaw_aTolResistance(instance)
plasticState(ph)%aTolState(1+plastic_phenopowerlaw_totalNslip(instance)+ &
plastic_phenopowerlaw_totalNtwin(instance)) = &
plastic_phenopowerlaw_aTolShear(instance)
plasticState(ph)%aTolState(2+plastic_phenopowerlaw_totalNslip(instance)+ &
plastic_phenopowerlaw_totalNtwin(instance)) = &
plastic_phenopowerlaw_aTolTwinFrac(instance)
plasticState(ph)%aTolState(3+plastic_phenopowerlaw_totalNslip(instance)+ &
plastic_phenopowerlaw_totalNtwin(instance): &
2+2*(plastic_phenopowerlaw_totalNslip(instance)+ &
plastic_phenopowerlaw_totalNtwin(instance))) = &
plastic_phenopowerlaw_aTolShear(instance)
plasticState(ph)%aTolState(3+2*(plastic_phenopowerlaw_totalNslip(instance)+ &
plastic_phenopowerlaw_totalNtwin(instance)): &
2+3*plastic_phenopowerlaw_totalNslip(instance)+ &
2*plastic_phenopowerlaw_totalNtwin(instance)) = &
plastic_phenopowerlaw_aTolTaub(instance)
end subroutine plastic_phenopowerlaw_aTolState
!--------------------------------------------------------------------------------------------------
!> @brief calculates plastic velocity gradient and its tangent
!--------------------------------------------------------------------------------------------------
subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el)
use math, only: &
math_Plain3333to99, &
math_Mandel6to33
use lattice, only: &
lattice_Sslip, &
lattice_Sslip_v, &
lattice_Stwin, &
lattice_Stwin_v, &
lattice_maxNslipFamily, &
lattice_maxNtwinFamily, &
lattice_NslipSystem, &
lattice_NtwinSystem, &
lattice_NnonSchmid
use material, only: &
phaseAt, phasememberAt, &
phase_plasticityInstance
implicit none
real(pReal), dimension(3,3), intent(out) :: &
Lp !< plastic velocity gradient
real(pReal), dimension(9,9), intent(out) :: &
dLp_dTstar99 !< derivative of Lp with respect to 2nd Piola Kirchhoff stress
integer(pInt), intent(in) :: &
ipc, & !< component-ID of integration point
ip, & !< integration point
el !< element
real(pReal), dimension(6), intent(in) :: &
Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation
integer(pInt) :: &
instance, &
index_myFamily, &
f,i,j,k,l,m,n, &
of, &
ph
real(pReal) :: &
tau_slip_pos,tau_slip_neg, &
gdot_slip_pos,gdot_slip_neg, &
dgdot_dtauslip_pos,dgdot_dtauslip_neg, &
gdot_twin,dgdot_dtautwin,tau_twin, &
tau_b
real(pReal), dimension(3,3,3,3) :: &
dLp_dTstar3333 !< derivative of Lp with respect to Tstar as 4th order tensor
real(pReal), dimension(3,3,2) :: &
nonSchmid_tensor
of = phasememberAt(ipc,ip,el)
ph = phaseAt(ipc,ip,el)
instance = phase_plasticityInstance(ph)
Lp = 0.0_pReal
dLp_dTstar3333 = 0.0_pReal
dLp_dTstar99 = 0.0_pReal
!--------------------------------------------------------------------------------------------------
! Slip part
j = 0_pInt
slipFamilies: do f = 1_pInt,lattice_maxNslipFamily
index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) ! at which index starts my family
slipSystems: do i = 1_pInt,plastic_phenopowerlaw_Nslip(f,instance)
j = j+1_pInt
! Calculation of Lp
tau_slip_pos = dot_product(Tstar_v,lattice_Sslip_v(1:6,1,index_myFamily+i,ph))
tau_slip_neg = tau_slip_pos
nonSchmid_tensor(1:3,1:3,1) = lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph)
nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,1)
do k = 1,lattice_NnonSchmid(ph)
tau_slip_pos = tau_slip_pos + plastic_phenopowerlaw_nonSchmidCoeff(k,instance)* &
dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k,index_myFamily+i,ph))
tau_slip_neg = tau_slip_neg + plastic_phenopowerlaw_nonSchmidCoeff(k,instance)* &
dot_product(Tstar_v,lattice_Sslip_v(1:6,2*k+1,index_myFamily+i,ph))
nonSchmid_tensor(1:3,1:3,1) = nonSchmid_tensor(1:3,1:3,1) + plastic_phenopowerlaw_nonSchmidCoeff(k,instance)*&
lattice_Sslip(1:3,1:3,2*k,index_myFamily+i,ph)
nonSchmid_tensor(1:3,1:3,2) = nonSchmid_tensor(1:3,1:3,2) + plastic_phenopowerlaw_nonSchmidCoeff(k,instance)*&
lattice_Sslip(1:3,1:3,2*k+1,index_myFamily+i,ph)
enddo
! back stress
tau_b = state(instance)%tau_b(j,of)
gdot_slip_pos = 0.5_pReal*plastic_phenopowerlaw_gdot0_slip(instance)* &
((abs(tau_slip_pos-tau_b)/(state(instance)%s_slip(j,of))) &
**plastic_phenopowerlaw_n_slip(instance))*sign(1.0_pReal,tau_slip_pos-tau_b)
gdot_slip_neg = 0.5_pReal*plastic_phenopowerlaw_gdot0_slip(instance)* &
((abs(tau_slip_neg-tau_b)/(state(instance)%s_slip(j,of))) &
**plastic_phenopowerlaw_n_slip(instance))*sign(1.0_pReal,tau_slip_neg-tau_b)
Lp = Lp + (1.0_pReal-state(instance)%sumF(of))*& ! 1-F
(gdot_slip_pos+gdot_slip_neg)*lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph)
! Calculation of the tangent of Lp
if (abs(gdot_slip_pos) > tiny(0.0_pReal)) then
dgdot_dtauslip_pos = gdot_slip_pos*plastic_phenopowerlaw_n_slip(instance)/(tau_slip_pos-tau_b)
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + &
(1.0_pReal-state(instance)%sumF(of))* &
dgdot_dtauslip_pos*lattice_Sslip(k,l,1,index_myFamily+i,ph)* &
nonSchmid_tensor(m,n,1)
endif
if (abs(gdot_slip_neg) > tiny(0.0_pReal)) then
dgdot_dtauslip_neg = gdot_slip_neg*plastic_phenopowerlaw_n_slip(instance)/(tau_slip_neg-tau_b)
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + &
(1.0_pReal-state(instance)%sumF(of))* &
dgdot_dtauslip_neg*lattice_Sslip(k,l,1,index_myFamily+i,ph)* &
nonSchmid_tensor(m,n,2)
endif
enddo slipSystems
enddo slipFamilies
!--------------------------------------------------------------------------------------------------
! Twinning part
j = 0_pInt
twinFamilies: do f = 1_pInt,lattice_maxNtwinFamily
index_myFamily = sum(lattice_NtwinSystem(1:f-1_pInt,ph)) ! at which index starts my family
twinSystems: do i = 1_pInt,plastic_phenopowerlaw_Ntwin(f,instance)
j = j+1_pInt
! Calculation of Lp
tau_twin = dot_product(Tstar_v,lattice_Stwin_v(1:6,index_myFamily+i,ph))
gdot_twin = (1.0_pReal-state(instance)%sumF(of))*& ! 1-F
plastic_phenopowerlaw_gdot0_twin(instance)*&
(abs(tau_twin)/state(instance)%s_twin(j,of))**&
plastic_phenopowerlaw_n_twin(instance)*max(0.0_pReal,sign(1.0_pReal,tau_twin))
Lp = Lp + gdot_twin*lattice_Stwin(1:3,1:3,index_myFamily+i,ph)
! Calculation of the tangent of Lp
if (abs(gdot_twin) > tiny(0.0_pReal)) then
dgdot_dtautwin = gdot_twin*plastic_phenopowerlaw_n_twin(instance)/tau_twin
forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) &
dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + &
dgdot_dtautwin*lattice_Stwin(k,l,index_myFamily+i,ph)* &
lattice_Stwin(m,n,index_myFamily+i,ph)
endif
enddo twinSystems
enddo twinFamilies
dLp_dTstar99 = math_Plain3333to99(dLp_dTstar3333)
end subroutine plastic_phenopowerlaw_LpAndItsTangent
!--------------------------------------------------------------------------------------------------
!> @brief calculates the rate of change of microstructure
!--------------------------------------------------------------------------------------------------
subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el)
use lattice, only: &
lattice_Sslip_v, &
lattice_Stwin_v, &
lattice_maxNslipFamily, &
lattice_maxNtwinFamily, &
lattice_NslipSystem, &
lattice_NtwinSystem, &
lattice_shearTwin, &
lattice_NnonSchmid
use material, only: &
material_phase, &
phaseAt, phasememberAt, &
plasticState, &
phase_plasticityInstance
implicit none
real(pReal), dimension(6), intent(in) :: &
Tstar_v !< 2nd Piola Kirchhoff stress tensor in Mandel notation
integer(pInt), intent(in) :: &
ipc, & !< component-ID of integration point
ip, & !< integration point
el !< element !< microstructure state
integer(pInt) :: &
instance,ph, &
nSlip,nTwin, &
f,i,j,k, &
index_Gamma,index_F,index_myFamily, &
offset_accshear_slip,offset_accshear_twin, offset_taub, &
of
real(pReal) :: &
c_SlipSlip,c_TwinSlip,c_TwinTwin, &