-
Notifications
You must be signed in to change notification settings - Fork 2
/
ROMUtility.f90
executable file
·148 lines (100 loc) · 4.11 KB
/
ROMUtility.f90
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
!=====================================================================72
!
real*8 FUNCTION SSKineticEqn(rss1, crss1, kflag, argmin, argmax, &
is, ip)
use NumType
use PlaPar
use FILEIO
implicit none
integer kflag, is, ip
real*8 crss1, rss1, pow,arg, argmin, argmax
real*8 CheckArgPowLaw, SignOf, Power,tem
tem=295.0d0
!------- check argument of power law
arg = rss1/crss1
if (dabs(arg) .ne. 0) arg = CheckArgPowLaw(arg, SignOf(arg), argmin, argmax)
pow = Power(dabs(arg), 1./PlaP%xm-1.)
if (kflag .eq. kGAMDOT) then
SSKineticEqn = PlaP%gam0 * arg * pow
else if (kflag .eq. kdGAMdTAU) then
SSKineticEqn = PlaP%gam0 / (PlaP%xm*crss1) * pow
else if (kflag .eq. kdGAMdKAPP) then
SSKineticEqn = -PlaP%gam0 / (PlaP%xm*crss1) * arg * pow
!---- This is used to caculate the dGamDOTdTau for caculating Jacobian when sloving the first set of equations
else if (kflag .eq. kDDGAM) then
if (Plap%crystalID(ip) .eq. kHCP) then
if (is.le.3) then
SSKineticEqn =0.5*Plap%ddavg(1,1)*Plap%vid(1,1)*Plap%burgers(1,1)**2.*exp(((dabs(rss1)-crss1)-Plap%detF(1,1)/Plap%detV(1,1))*Plap%detV(1,1)/Plap%kbolt/tem)*SignOf(rss1)
else if (is.le.6) then
SSKineticEqn =0.5*Plap%ddavg(1,2)*Plap%vid(1,2)*Plap%burgers(1,2)**2.*exp(((dabs(rss1)-crss1)-Plap%detF(1,2)/Plap%detV(1,2))*Plap%detV(1,2)/Plap%kbolt/tem)*SignOf(rss1)
else if (is.le.12) then
SSKineticEqn =0.5*Plap%ddavg(1,3)*Plap%vid(1,3)*Plap%burgers(1,3)**2.*exp(((dabs(rss1)-crss1)-Plap%detF(1,3)/Plap%detV(1,3))*Plap%detV(1,3)/Plap%kbolt/tem)*SignOf(rss1)
else if (is.le.30) then
SSKineticEqn =0.5*Plap%ddavg(1,4)*Plap%vid(1,4)*Plap%burgers(1,4)**2.*exp(((dabs(rss1)-crss1)-Plap%detF(1,4)/Plap%detV(1,4))*Plap%detV(1,4)/Plap%kbolt/tem)*SignOf(rss1)
else
call RunTimeError(File_o, 'SSKineticEqn: is exceed maxinum number')
endif
else if (Plap%crystalID(ip) .eq. kBCC) then
SSKineticEqn =0.5*Plap%ddavg(2,1)*Plap%vid(2,1)*Plap%burgers(2,1)**2.*exp(((dabs(rss1)-crss1)-Plap%detF(2,1)/Plap%detV(2,1))*Plap%detV(2,1)/Plap%kbolt/tem)*SignOf(rss1)
else
call RunTimeError( FILE_O,'Error: crystalID exceed the existing lattice!')
end if
else
call RunTimeError(File_o, 'SSKineticEqn: unknown kflag!')
endif
return
END
!
!=====================================================================72
!=====================================================================72
!
logical FUNCTION NConverged(res, toler, n)
use NumType
implicit none
real*8 toler
real*8 res(NVEC)
integer i,n
!------- check convergence on residual
NConverged = .true.
do i = 1, n
NConverged = ( (dabs(res(i)) .lt. toler) .and. NConverged)
enddo
return
END
!
!=====================================================================72
!=====================================================================72
!
SUBROUTINE BoundForArgPowLaw(xm, argmin, argmax)
use NumType
implicit none
real*8 xm, xmm, argmin, argmax
real*8 EXPON
data EXPON /280.d0/
!---- limits (bounds) on the value of the argument for power law
!---- note: In general: xm <= 1.0 (1/xm >= 1.0)
xmm = pone/xm - pone
if (dabs(xm-pone) .lt. TINY(1.d0)) xmm = pone
argMin = dexp(-EXPON/(xmm)*dlog(10.d0))
argMax = dexp( EXPON/(xmm)*dlog(10.d0))
return
END
!
!=====================================================================72
!=====================================================================72
!
real*8 FUNCTION CheckArgPowLaw(arg, sgn, argmin, argmax)
use NumType
implicit none
real*8 arg, sgn, argmin, argmax
!---- check range of argument for power law
if (dabs(arg) .lt. argMin) then
CheckArgPowLaw = argMin * sgn
else if (dabs(arg) .ge. argMax) then
CheckArgPowLaw = argMax * sgn
else
CheckArgPowLaw = arg
endif
return
END
!=====================================================================72