-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMobility_Thickness_Skin_Rheology.f90
373 lines (333 loc) · 21.3 KB
/
Mobility_Thickness_Skin_Rheology.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
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
MODULE MOBILITY_THICKNESS_SKIN_RHEOLOGY
CONTAINS
SUBROUTINE fPhi_A(Ael,Agrav,h_a,delta_a,T_a,Ts_a,delta_a2,delta_a3,h_a2,h_a3,Delta_T_a,&
&phi_a,nu,Rheology,ERROR_CODE)
IMPLICIT NONE
INTEGER, INTENT(IN) :: Rheology
DOUBLE PRECISION , INTENT(IN) :: nu
DOUBLE PRECISION, INTENT(IN) :: Ael,Agrav,h_a,delta_a,T_a,Ts_a
DOUBLE PRECISION, INTENT(IN) :: delta_a2,delta_a3,h_a2,h_a3,Delta_T_a
DOUBLE PRECISION, INTENT(INOUT) :: phi_a
INTEGER, INTENT(INOUT) :: ERROR_CODE
DOUBLE PRECISION, PARAMETER :: pi = 3.14159265358979d0
IF (Rheology == 0) THEN
phi_a = (4.0d0/5.0d0)*T_a*delta_a**3*nu - 4.0d0/5.0d0*T_a*delta_a&
& **3 - 2*T_a*delta_a**2*h_a*nu + 2*T_a*delta_a**2*h_a + 2*T_a*&
& delta_a*h_a**2*nu - 2*T_a*delta_a*h_a**2 - T_a*h_a**3*nu + T_a*&
& h_a**3 - 4.0d0/5.0d0*Ts_a*delta_a**3*nu + (4.0d0/5.0d0)*Ts_a*&
& delta_a**3 + 2*Ts_a*delta_a**2*h_a*nu - 2*Ts_a*delta_a**2*h_a - 2&
& *Ts_a*delta_a*h_a**2*nu + 2*Ts_a*delta_a*h_a**2 + h_a**3*nu
! phi_a = (nu+(1.d0-nu)*T_a)*h_a3-(2.d0/5.d0)*(1.d0-nu)*&
! &Delta_T_a*(2.d0*delta_a3-5.d0*delta_a2*h_a+5.d0*delta_a*h_a2)
ELSEIF (Rheology == 1) THEN
ERROR_CODE = 1
ELSEIF (Rheology == 2) THEN
nutest:IF (nu /= 1.0) THEN
phi_a = -12.0d0*sqrt(pi)*T_a*delta_a**3*nu*nu**(-T_a)*(-log(nu))**&
& (-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(&
& T_a - Ts_a)) + 8.0d0*T_a*delta_a**3*nu*nu**(-T_a)*1.0/(-log(nu))*&
& 1.0/(T_a - Ts_a)*log(nu) + 12.0d0*sqrt(pi)*T_a*delta_a**2*h_a*nu*&
& nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*&
& erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) - 12.0d0*T_a*delta_a**2*h_a*&
& nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) - 3.0d0*&
& sqrt(pi)*T_a*delta_a*h_a**2*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(&
& T_a - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a&
& )) + 6.0d0*T_a*delta_a*h_a**2*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(&
& T_a - Ts_a)*log(nu) - 1.0d0*T_a*h_a**3*nu*nu**(-T_a)*1.0/(-log(nu&
& ))*1.0/(T_a - Ts_a)*log(nu) + 12.0d0*sqrt(pi)*Ts_a*delta_a**3*nu*&
& nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*&
& erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) - 8.0d0*Ts_a*delta_a**3*nu*&
& nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) - 12.0d0*sqrt(&
& pi)*Ts_a*delta_a**2*h_a*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a -&
& Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) +&
& 12.0d0*Ts_a*delta_a**2*h_a*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a&
& - Ts_a)*log(nu) + 3.0d0*sqrt(pi)*Ts_a*delta_a*h_a**2*nu*nu**(-T_a&
& )*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(&
& -log(nu))*sqrt(T_a - Ts_a)) - 6.0d0*Ts_a*delta_a*h_a**2*nu*nu**(&
& -T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 1.0d0*Ts_a*h_a**3&
& *nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 12.0d0*&
& delta_a**3*nu*nu**(-Ts_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a) + 6.0d0&
& *sqrt(pi)*delta_a**3*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a -&
& Ts_a)**(-1.5d0)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) - 24.0d0*&
& delta_a**3*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a) - 12.0d0&
& *delta_a**2*h_a*nu*nu**(-Ts_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a) +&
& 12.0d0*delta_a**2*h_a*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a -&
& Ts_a)
ELSEIF (nu==1.0) THEN
phi_a = 1.0d0*h_a**3
ELSE
ERROR_CODE = 1
ENDIF nutest
ELSE
ERROR_CODE = 1
ENDIF
END SUBROUTINE FPhi_A
SUBROUTINE fdPhi_A(Ael,Agrav,h_a,delta_a,T_a,Ts_a,hi,hia,Delta_T_a,delta_a2,&
&dphia_dhi1,dphia_dhi,nu,Rheology,ERROR_CODE)
IMPLICIT NONE
INTEGER, INTENT(IN) :: Rheology
DOUBLE PRECISION , INTENT(IN) :: nu
DOUBLE PRECISION, INTENT(IN) :: Ael,Agrav,h_a,T_a,delta_a,Ts_a,Delta_T_a
DOUBLE PRECISION, INTENT(IN) :: hi,hia,delta_a2
DOUBLE PRECISION, INTENT(INOUT) :: dphia_dhi,dphia_dhi1
INTEGER, INTENT(INOUT) :: ERROR_CODE
DOUBLE PRECISION, PARAMETER :: pi = 3.14159265358979d0
IF (Rheology == 0) THEN
dphia_dhi1 = -T_a*delta_a**2*nu + T_a*delta_a**2 + T_a*delta_a*hi*&
& nu - T_a*delta_a*hi + T_a*delta_a*hia*nu - T_a*delta_a*hia -&
& 3.0d0/8.0d0*T_a*hi**2*nu + (3.0d0/8.0d0)*T_a*hi**2 - 3.0d0/4.0d0*&
& T_a*hi*hia*nu + (3.0d0/4.0d0)*T_a*hi*hia - 3.0d0/8.0d0*T_a*hia**2&
& *nu + (3.0d0/8.0d0)*T_a*hia**2 + Ts_a*delta_a**2*nu - Ts_a*&
& delta_a**2 - Ts_a*delta_a*hi*nu + Ts_a*delta_a*hi - Ts_a*delta_a*&
& hia*nu + Ts_a*delta_a*hia + (3.0d0/8.0d0)*hi**2*nu + (3.0d0/4.0d0&
& )*hi*hia*nu + (3.0d0/8.0d0)*hia**2*nu
dphia_dhi = -T_a*delta_a**2*nu + T_a*delta_a**2 + T_a*delta_a*hi*&
& nu - T_a*delta_a*hi + T_a*delta_a*hia*nu - T_a*delta_a*hia -&
& 3.0d0/8.0d0*T_a*hi**2*nu + (3.0d0/8.0d0)*T_a*hi**2 - 3.0d0/4.0d0*&
& T_a*hi*hia*nu + (3.0d0/4.0d0)*T_a*hi*hia - 3.0d0/8.0d0*T_a*hia**2&
& *nu + (3.0d0/8.0d0)*T_a*hia**2 + Ts_a*delta_a**2*nu - Ts_a*&
& delta_a**2 - Ts_a*delta_a*hi*nu + Ts_a*delta_a*hi - Ts_a*delta_a*&
& hia*nu + Ts_a*delta_a*hia + (3.0d0/8.0d0)*hi**2*nu + (3.0d0/4.0d0&
& )*hi*hia*nu + (3.0d0/8.0d0)*hia**2*nu
! dphia_dhi1=(3.d0/2.d0)*(nu+(1-nu)*T_a)*hia**2-(1-nu)*Delta_T_a*(-delta_a2+delta_a*hia) ! d(phi_i+1/2)/d(h_i+1)
! dphia_dhi=(3.d0/2.d0)*(nu+(1-nu)*T_a)*hi**2-(1-nu)*Delta_T_a*(-delta_a2+delta_a*hi) ! d(phi_i+1/2)/d(h_i)
ELSEIF (Rheology == 1) THEN
ERROR_CODE = 1
ELSEIF (Rheology == 2) THEN
nutest:IF (nu /= 1.0) THEN
dphia_dhi = 6.0d0*sqrt(pi)*T_a*delta_a**2*nu*nu**(-T_a)*(-log(nu))&
& **(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt&
& (T_a - Ts_a)) - 6.0d0*T_a*delta_a**2*nu*nu**(-T_a)*1.0/(-log(nu))&
& *1.0/(T_a - Ts_a)*log(nu) - 1.5d0*sqrt(pi)*T_a*delta_a*hi*nu*nu**&
& (-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*erf(&
& sqrt(-log(nu))*sqrt(T_a - Ts_a)) + 3.0d0*T_a*delta_a*hi*nu*nu**(&
& -T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) - 1.5d0*sqrt(pi)*&
& T_a*delta_a*hia*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**&
& (-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) + 3.0d0*T_a&
& *delta_a*hia*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu&
& ) - 0.375d0*T_a*hi**2*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a -&
& Ts_a)*log(nu) - 0.75d0*T_a*hi*hia*nu*nu**(-T_a)*1.0/(-log(nu))*&
& 1.0/(T_a - Ts_a)*log(nu) - 0.375d0*T_a*hia**2*nu*nu**(-T_a)*1.0/(&
& -log(nu))*1.0/(T_a - Ts_a)*log(nu) - 6.0d0*sqrt(pi)*Ts_a*delta_a&
& **2*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log&
& (nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) + 6.0d0*Ts_a*delta_a**2&
& *nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 1.5d0*&
& sqrt(pi)*Ts_a*delta_a*hi*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a&
& - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) -&
& 3.0d0*Ts_a*delta_a*hi*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a -&
& Ts_a)*log(nu) + 1.5d0*sqrt(pi)*Ts_a*delta_a*hia*nu*nu**(-T_a)*(&
& -log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(&
& nu))*sqrt(T_a - Ts_a)) - 3.0d0*Ts_a*delta_a*hia*nu*nu**(-T_a)*1.0&
& /(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 0.375d0*Ts_a*hi**2*nu*nu**&
& (-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 0.75d0*Ts_a*hi*&
& hia*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) +&
& 0.375d0*Ts_a*hia**2*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)&
& *log(nu) - 6.0d0*delta_a**2*nu*nu**(-Ts_a)*1.0/(-log(nu))*1.0/(&
& T_a - Ts_a) + 6.0d0*delta_a**2*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(&
& T_a - Ts_a)
dphia_dhi1 = 6.0d0*sqrt(pi)*T_a*delta_a**2*nu*nu**(-T_a)*(-log(nu&
& ))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*&
& sqrt(T_a - Ts_a)) - 6.0d0*T_a*delta_a**2*nu*nu**(-T_a)*1.0/(-log(&
& nu))*1.0/(T_a - Ts_a)*log(nu) - 1.5d0*sqrt(pi)*T_a*delta_a*hi*nu*&
& nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*&
& erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) + 3.0d0*T_a*delta_a*hi*nu*nu&
& **(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) - 1.5d0*sqrt(pi)&
& *T_a*delta_a*hia*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)&
& **(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) + 3.0d0*&
& T_a*delta_a*hia*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log&
& (nu) - 0.375d0*T_a*hi**2*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a -&
& Ts_a)*log(nu) - 0.75d0*T_a*hi*hia*nu*nu**(-T_a)*1.0/(-log(nu))*&
& 1.0/(T_a - Ts_a)*log(nu) - 0.375d0*T_a*hia**2*nu*nu**(-T_a)*1.0/(&
& -log(nu))*1.0/(T_a - Ts_a)*log(nu) - 6.0d0*sqrt(pi)*Ts_a*delta_a&
& **2*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log&
& (nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) + 6.0d0*Ts_a*delta_a**2&
& *nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 1.5d0*&
& sqrt(pi)*Ts_a*delta_a*hi*nu*nu**(-T_a)*(-log(nu))**(-1.5d0)*(T_a&
& - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_a - Ts_a)) -&
& 3.0d0*Ts_a*delta_a*hi*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a -&
& Ts_a)*log(nu) + 1.5d0*sqrt(pi)*Ts_a*delta_a*hia*nu*nu**(-T_a)*(&
& -log(nu))**(-1.5d0)*(T_a - Ts_a)**(-1.5d0)*log(nu)*erf(sqrt(-log(&
& nu))*sqrt(T_a - Ts_a)) - 3.0d0*Ts_a*delta_a*hia*nu*nu**(-T_a)*1.0&
& /(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 0.375d0*Ts_a*hi**2*nu*nu**&
& (-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) + 0.75d0*Ts_a*hi*&
& hia*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)*log(nu) +&
& 0.375d0*Ts_a*hia**2*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(T_a - Ts_a)&
& *log(nu) - 6.0d0*delta_a**2*nu*nu**(-Ts_a)*1.0/(-log(nu))*1.0/(&
& T_a - Ts_a) + 6.0d0*delta_a**2*nu*nu**(-T_a)*1.0/(-log(nu))*1.0/(&
& T_a - Ts_a)
ELSEIF (nu==1.0) THEN
dphia_dhi1 = 0.375d0*hi**2 + 0.75d0*hi*hia + 0.375d0*hia**2
dphia_dhi = 0.375d0*hi**2 + 0.75d0*hi*hia + 0.375d0*hia**2
ELSE
ERROR_CODE = 1
ENDIF nutest
ELSE
ERROR_CODE = 1
ENDIF
END SUBROUTINE FdPhi_A
SUBROUTINE fPhi_B(Bel,Bgrav,h_b,delta_b,T_b,Ts_b,delta_b2,delta_b3,h_b2,h_b3,Delta_T_b,&
&phi_b,nu,Rheology,ERROR_CODE)
IMPLICIT NONE
INTEGER, INTENT(IN) :: Rheology
DOUBLE PRECISION , INTENT(IN) :: nu
DOUBLE PRECISION, INTENT(IN) :: Bel,Bgrav,h_b,delta_b,T_b,Ts_b
DOUBLE PRECISION, INTENT(IN) :: delta_b2,delta_b3,h_b2,h_b3,Delta_T_b
DOUBLE PRECISION, INTENT(INOUT) :: phi_b
INTEGER, INTENT(INOUT) :: ERROR_CODE
DOUBLE PRECISION, PARAMETER :: pi = 3.14159265358979d0
IF (Rheology == 0) THEN
phi_b = (4.0d0/5.0d0)*T_b*delta_b**3*nu - 4.0d0/5.0d0*T_b*delta_b&
& **3 - 2*T_b*delta_b**2*h_b*nu + 2*T_b*delta_b**2*h_b + 2*T_b*&
& delta_b*h_b**2*nu - 2*T_b*delta_b*h_b**2 - T_b*h_b**3*nu + T_b*&
& h_b**3 - 4.0d0/5.0d0*Ts_b*delta_b**3*nu + (4.0d0/5.0d0)*Ts_b*&
& delta_b**3 + 2*Ts_b*delta_b**2*h_b*nu - 2*Ts_b*delta_b**2*h_b - 2&
& *Ts_b*delta_b*h_b**2*nu + 2*Ts_b*delta_b*h_b**2 + h_b**3*nu
! phi_b=(nu+(1.d0-nu)*T_b)*h_b3-(2.d0/5.d0)*(1.d0-nu)*&
! &Delta_T_b*(2.d0*delta_b3-5.d0*delta_b2*h_b+5.d0*delta_b*h_b2)
ELSEIF (Rheology == 1) THEN
ERROR_CODE = 1
ELSEIF (Rheology == 2) THEN
nutest:IF (nu /= 1.0) THEN
phi_b = -12.0d0*sqrt(pi)*T_b*delta_b**3*nu*nu**(-T_b)*(-log(nu))**&
& (-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(&
& T_b - Ts_b)) + 8.0d0*T_b*delta_b**3*nu*nu**(-T_b)*1.0/(-log(nu))*&
& 1.0/(T_b - Ts_b)*log(nu) + 12.0d0*sqrt(pi)*T_b*delta_b**2*h_b*nu*&
& nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*&
& erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) - 12.0d0*T_b*delta_b**2*h_b*&
& nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) - 3.0d0*&
& sqrt(pi)*T_b*delta_b*h_b**2*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(&
& T_b - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b&
& )) + 6.0d0*T_b*delta_b*h_b**2*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(&
& T_b - Ts_b)*log(nu) - 1.0d0*T_b*h_b**3*nu*nu**(-T_b)*1.0/(-log(nu&
& ))*1.0/(T_b - Ts_b)*log(nu) + 12.0d0*sqrt(pi)*Ts_b*delta_b**3*nu*&
& nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*&
& erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) - 8.0d0*Ts_b*delta_b**3*nu*&
& nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) - 12.0d0*sqrt(&
& pi)*Ts_b*delta_b**2*h_b*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b -&
& Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) +&
& 12.0d0*Ts_b*delta_b**2*h_b*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b&
& - Ts_b)*log(nu) + 3.0d0*sqrt(pi)*Ts_b*delta_b*h_b**2*nu*nu**(-T_b&
& )*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(&
& -log(nu))*sqrt(T_b - Ts_b)) - 6.0d0*Ts_b*delta_b*h_b**2*nu*nu**(&
& -T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 1.0d0*Ts_b*h_b**3&
& *nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 12.0d0*&
& delta_b**3*nu*nu**(-Ts_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b) + 6.0d0&
& *sqrt(pi)*delta_b**3*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b -&
& Ts_b)**(-1.5d0)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) - 24.0d0*&
& delta_b**3*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b) - 12.0d0&
& *delta_b**2*h_b*nu*nu**(-Ts_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b) +&
& 12.0d0*delta_b**2*h_b*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b -&
& Ts_b)
ELSEIF (nu==1.0) THEN
phi_b = 1.0d0*h_b**3
ELSE
ERROR_CODE = 1
ENDIF nutest
ELSE
ERROR_CODE = 1
ENDIF
END SUBROUTINE FPhi_B
SUBROUTINE fDPhi_B(Bel,Bgrav,h_b,delta_b,T_b,Ts_b,hib,hi,Delta_T_b,delta_b2,&
&dphib_dhi,dphib_dhi1,nu,Rheology,ERROR_CODE)
IMPLICIT NONE
INTEGER, INTENT(IN) :: Rheology
DOUBLE PRECISION , INTENT(IN) :: nu
DOUBLE PRECISION, INTENT(IN) :: Bel,Bgrav,h_b,T_b,delta_b,Delta_T_b
DOUBLE PRECISION, INTENT(IN) :: Ts_b,hi,hib,delta_b2
DOUBLE PRECISION, INTENT(INOUT) :: dphib_dhi,dphib_dhi1
INTEGER, INTENT(INOUT) :: ERROR_CODE
DOUBLE PRECISION, PARAMETER :: pi = 3.14159265358979d0
IF (Rheology == 0) THEN
dphib_dhi = -T_b*delta_b**2*nu + T_b*delta_b**2 + T_b*delta_b*hi*&
& nu - T_b*delta_b*hi + T_b*delta_b*hib*nu - T_b*delta_b*hib -&
& 3.0d0/8.0d0*T_b*hi**2*nu + (3.0d0/8.0d0)*T_b*hi**2 - 3.0d0/4.0d0*&
& T_b*hi*hib*nu + (3.0d0/4.0d0)*T_b*hi*hib - 3.0d0/8.0d0*T_b*hib**2&
& *nu + (3.0d0/8.0d0)*T_b*hib**2 + Ts_b*delta_b**2*nu - Ts_b*&
& delta_b**2 - Ts_b*delta_b*hi*nu + Ts_b*delta_b*hi - Ts_b*delta_b*&
& hib*nu + Ts_b*delta_b*hib + (3.0d0/8.0d0)*hi**2*nu + (3.0d0/4.0d0&
& )*hi*hib*nu + (3.0d0/8.0d0)*hib**2*nu
dphib_dhi1 = -T_b*delta_b**2*nu + T_b*delta_b**2 + T_b*delta_b*hi*&
& nu - T_b*delta_b*hi + T_b*delta_b*hib*nu - T_b*delta_b*hib -&
& 3.0d0/8.0d0*T_b*hi**2*nu + (3.0d0/8.0d0)*T_b*hi**2 - 3.0d0/4.0d0*&
& T_b*hi*hib*nu + (3.0d0/4.0d0)*T_b*hi*hib - 3.0d0/8.0d0*T_b*hib**2&
& *nu + (3.0d0/8.0d0)*T_b*hib**2 + Ts_b*delta_b**2*nu - Ts_b*&
& delta_b**2 - Ts_b*delta_b*hi*nu + Ts_b*delta_b*hi - Ts_b*delta_b*&
& hib*nu + Ts_b*delta_b*hib + (3.0d0/8.0d0)*hi**2*nu + (3.0d0/4.0d0&
& )*hi*hib*nu + (3.0d0/8.0d0)*hib**2*nu
! dphib_dhi=(3.d0/2.d0)*(nu+(1-nu)*T_b)*hi**2-(1-nu)*Delta_T_b*(-delta_b2+delta_b*hi) ! d(phi_i-1/2)/d(h_i)
! dphib_dhi1=(3.d0/2.d0)*(nu+(1-nu)*T_b)*hib**2-(1-nu)*Delta_T_b*(-delta_b2+delta_b*hib) ! d(phi_i-1/2)/d(h_i-1)
ELSEIF (Rheology == 1) THEN
ERROR_CODE = 1
ELSEIF (Rheology == 2) THEN
nutest:IF (nu /= 1.0) THEN
dphib_dhi = 6.0d0*sqrt(pi)*T_b*delta_b**2*nu*nu**(-T_b)*(-log(nu))&
& **(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt&
& (T_b - Ts_b)) - 6.0d0*T_b*delta_b**2*nu*nu**(-T_b)*1.0/(-log(nu))&
& *1.0/(T_b - Ts_b)*log(nu) - 1.5d0*sqrt(pi)*T_b*delta_b*hi*nu*nu**&
& (-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*erf(&
& sqrt(-log(nu))*sqrt(T_b - Ts_b)) + 3.0d0*T_b*delta_b*hi*nu*nu**(&
& -T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) - 1.5d0*sqrt(pi)*&
& T_b*delta_b*hib*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**&
& (-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) + 3.0d0*T_b&
& *delta_b*hib*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu&
& ) - 0.375d0*T_b*hi**2*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b -&
& Ts_b)*log(nu) - 0.75d0*T_b*hi*hib*nu*nu**(-T_b)*1.0/(-log(nu))*&
& 1.0/(T_b - Ts_b)*log(nu) - 0.375d0*T_b*hib**2*nu*nu**(-T_b)*1.0/(&
& -log(nu))*1.0/(T_b - Ts_b)*log(nu) - 6.0d0*sqrt(pi)*Ts_b*delta_b&
& **2*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log&
& (nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) + 6.0d0*Ts_b*delta_b**2&
& *nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 1.5d0*&
& sqrt(pi)*Ts_b*delta_b*hi*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b&
& - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) -&
& 3.0d0*Ts_b*delta_b*hi*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b -&
& Ts_b)*log(nu) + 1.5d0*sqrt(pi)*Ts_b*delta_b*hib*nu*nu**(-T_b)*(&
& -log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(&
& nu))*sqrt(T_b - Ts_b)) - 3.0d0*Ts_b*delta_b*hib*nu*nu**(-T_b)*1.0&
& /(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 0.375d0*Ts_b*hi**2*nu*nu**&
& (-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 0.75d0*Ts_b*hi*&
& hib*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) +&
& 0.375d0*Ts_b*hib**2*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)&
& *log(nu) - 6.0d0*delta_b**2*nu*nu**(-Ts_b)*1.0/(-log(nu))*1.0/(&
& T_b - Ts_b) + 6.0d0*delta_b**2*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(&
& T_b - Ts_b)
dphib_dhi1 = 6.0d0*sqrt(pi)*T_b*delta_b**2*nu*nu**(-T_b)*(-log(nu&
& ))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*&
& sqrt(T_b - Ts_b)) - 6.0d0*T_b*delta_b**2*nu*nu**(-T_b)*1.0/(-log(&
& nu))*1.0/(T_b - Ts_b)*log(nu) - 1.5d0*sqrt(pi)*T_b*delta_b*hi*nu*&
& nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*&
& erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) + 3.0d0*T_b*delta_b*hi*nu*nu&
& **(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) - 1.5d0*sqrt(pi)&
& *T_b*delta_b*hib*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)&
& **(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) + 3.0d0*&
& T_b*delta_b*hib*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log&
& (nu) - 0.375d0*T_b*hi**2*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b -&
& Ts_b)*log(nu) - 0.75d0*T_b*hi*hib*nu*nu**(-T_b)*1.0/(-log(nu))*&
& 1.0/(T_b - Ts_b)*log(nu) - 0.375d0*T_b*hib**2*nu*nu**(-T_b)*1.0/(&
& -log(nu))*1.0/(T_b - Ts_b)*log(nu) - 6.0d0*sqrt(pi)*Ts_b*delta_b&
& **2*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log&
& (nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) + 6.0d0*Ts_b*delta_b**2&
& *nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 1.5d0*&
& sqrt(pi)*Ts_b*delta_b*hi*nu*nu**(-T_b)*(-log(nu))**(-1.5d0)*(T_b&
& - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(nu))*sqrt(T_b - Ts_b)) -&
& 3.0d0*Ts_b*delta_b*hi*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b -&
& Ts_b)*log(nu) + 1.5d0*sqrt(pi)*Ts_b*delta_b*hib*nu*nu**(-T_b)*(&
& -log(nu))**(-1.5d0)*(T_b - Ts_b)**(-1.5d0)*log(nu)*erf(sqrt(-log(&
& nu))*sqrt(T_b - Ts_b)) - 3.0d0*Ts_b*delta_b*hib*nu*nu**(-T_b)*1.0&
& /(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 0.375d0*Ts_b*hi**2*nu*nu**&
& (-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) + 0.75d0*Ts_b*hi*&
& hib*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)*log(nu) +&
& 0.375d0*Ts_b*hib**2*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(T_b - Ts_b)&
& *log(nu) - 6.0d0*delta_b**2*nu*nu**(-Ts_b)*1.0/(-log(nu))*1.0/(&
& T_b - Ts_b) + 6.0d0*delta_b**2*nu*nu**(-T_b)*1.0/(-log(nu))*1.0/(&
& T_b - Ts_b)
ELSEIF (nu == 1.0) THEN
dphib_dhi = 0.375d0*hi**2 + 0.75d0*hi*hib + 0.375d0*hib**2
dphib_dhi1 = 0.375d0*hi**2 + 0.75d0*hi*hib + 0.375d0*hib**2
ELSE
ERROR_CODE = 1
ENDIF nutest
ELSE
ERROR_CODE = 1
ENDIF
END SUBROUTINE FDPhi_B
END MODULE MOBILITY_THICKNESS_SKIN_RHEOLOGY