Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/Solvers/GolfLaw.F90
3204 views
1
!/*****************************************************************************/
2
! *
3
! * Elmer/Ice, a glaciological add-on to Elmer
4
! * http://elmerice.elmerfem.org
5
! *
6
! *
7
! * This program is free software; you can redistribute it and/or
8
! * modify it under the terms of the GNU General Public License
9
! * as published by the Free Software Foundation; either version 2
10
! * of the License, or (at your option) any later version.
11
! *
12
! * This program is distributed in the hope that it will be useful,
13
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
! * GNU General Public License for more details.
16
! *
17
! * You should have received a copy of the GNU General Public License
18
! * along with this program (in file fem/GPL-2); if not, write to the
19
! * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
! * Boston, MA 02110-1301, USA.
21
! *
22
! *****************************************************************************/
23
! ******************************************************************************
24
! *
25
! * Authors: Olivier Gagliardini, Ga¨el Durand
26
! * Email:
27
! * Web: http://elmerice.elmerfem.org
28
! *
29
! * Original Date:
30
! *
31
! *****************************************************************************
32
!> tools for utilizing the GOLF anisotropic law
33
!
34
! Definition of the interpolation grid
35
!
36
37
Module DefGrid
38
39
! INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(12) ! If not using
40
! with Elmer
41
USE Types ! If using with Elmer
42
43
Real, Parameter :: kmin=0.002_dp ! valeur de ki mimum
44
Integer, Parameter :: Ndiv=30 ! Ndiv+2 Number of points along ik1
45
Integer, Parameter :: Ntot=813 ! Total number of points
46
Integer, Parameter :: NetaI=4878 ! 6*4884 length of EtaI
47
Integer, Parameter, Dimension(32) :: Nk2 = &
48
(/ -1, 46, 93, 139, 183, 226, 267, 307, 345, 382,&
49
417, 451, 483, 514, 543, 571, 597, 622, 645, 667,&
50
687, 706, 723, 739, 753, 766, 777, 787, 795, 802,&
51
807, 811/)
52
53
End Module DefGrid
54
55
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56
57
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
58
!!!!!! !!!!!!
59
!!!!!! Non-relative viscosities and Temperature dependency !!!!!!
60
!!!!!! !!!!!!
61
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
62
63
Function BGlenT(Tc,W)
64
65
USE defGrid
66
67
Implicit None
68
Real(kind=dp) :: BGlenT
69
Real(kind=dp), Intent(in) :: Tc ! Temperature en d Celsius
70
Real(kind=dp), Intent(in), Dimension(7) :: W ! Glen law parameters
71
! W(1)=B0 Glen's fluidity parameter
72
! W(2)=n Glen's law exponent
73
! W(3)=Q1 Energy activation for Tc<Tl
74
! W(4)=Q2 Energy activation for Tc>Tl
75
! W(5)=T0 temperature reference for B0
76
! W(6)=Tl temperature for Q1->Q2
77
Real(kind=dp), parameter :: Tzero=273.15
78
Real(kind=dp) :: Q, DT
79
80
81
Q= W(3)
82
If (Tc.GT.W(6)) Q=W(4)
83
Q=Q/W(7)
84
DT=-1./(Tc+Tzero)+1./(W(5)+Tzero)
85
86
BGlenT=W(1)*Exp(Q*DT)
87
88
End
89
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
91
!!!!!! !!!!!!
92
!!!!!! Expression of the viscosity matrix in the reference frame !!!!!!
93
!!!!!! !!!!!!
94
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
95
96
! from the 6 eta6 viscoisties of the matrice law
97
!
98
! S = eta6(k) tr(M_kd)M_k^D + eta6(k+3)(M_k d + d M_k)^D
99
!
100
! get the Voigt eta36 expressed in the general reference frame
101
!
102
! Si = Aij dj
103
! Aij = eta(i,j) i=1,6; j=1,6 non-symetric matrix
104
! where S=(S11,S22,S33,S12,S23,S31)
105
! and d=(d11,d22,d33,2 d12,2 d23,2 d31)
106
! Voigt notation as in ELMER
107
!
108
109
Subroutine ViscGene(eta6,Angle,eta36)
110
111
use defgrid
112
113
Implicit None
114
Real(kind=dp), Intent(in), Dimension(3) :: Angle ! Euler Angles
115
Real(kind=dp), Intent(in), Dimension(6) :: Eta6 ! 6 Viscosities of the
116
! matrice law
117
118
Real(kind=dp), Intent(out), Dimension(6,6) :: eta36 ! Viscosity matrix in
119
! the reference frame
120
121
Real(kind=dp) :: p,t,o,st,ct
122
Real(kind=dp), Dimension(3,3) :: Q
123
Real(kind=dp) :: dQk
124
Real(kind=dp), Dimension(6), Parameter :: coef=(/1.,1.,1.,.0,.0,.0/)
125
Integer, Dimension(6), Parameter :: ik=(/1,2,3,1,2,3/)
126
Integer, Dimension(6), Parameter :: jk=(/1,2,3,2,3,1/)
127
Integer :: k,m,n
128
Integer :: i,j
129
130
131
! Angle = Phi, Theta, Omega
132
133
p=Angle(1)
134
t=Angle(2)
135
o=Angle(3)
136
137
! terms of the rotation matrix from RG to RO
138
139
ct = cos(t)
140
Q(3,3) = ct
141
Q(1,3) = sin(o)
142
Q(2,3) = cos(o)
143
Q(3,1) = sin(p)
144
Q(3,2) = cos(p)
145
146
Q(1,1) = Q(3,2)*Q(2,3) - Q(3,1)*Q(1,3)*ct
147
Q(1,2) = Q(3,1)*Q(2,3) + Q(3,2)*Q(1,3)*ct
148
Q(2,1) = - Q(3,2)*Q(1,3) - Q(3,1)*Q(2,3)*ct
149
Q(2,2) = - Q(3,1)*Q(1,3) + Q(3,2)*Q(2,3)*ct
150
151
st = sin(t)
152
Q(1,3) = Q(1,3)*st
153
Q(2,3) = Q(2,3)*st
154
Q(3,1) = Q(3,1)*st
155
Q(3,2) = -Q(3,2)*st
156
157
! 36 terms of the Voigt matrix in the reference frame
158
Do m=1,6
159
Do n=1,6
160
eta36(m,n) = 0.
161
End Do
162
End Do
163
Do k=1,3
164
dQk=Q(k,1)*Q(k,1)+Q(k,2)*Q(k,2)+Q(k,3)*Q(k,3)
165
Do m=1,6
166
Do n=1,6
167
eta36(m,n)=eta36(m,n)+eta6(k)*Q(k,ik(n))*Q(k,jk(n))*&
168
(Q(k,ik(m))*Q(k,jk(m))-1./3.*coef(m)*dQk)
169
eta36(m,n) = eta36(m,n) - 2./3.*eta6(k+3)*coef(m)* &
170
Q(k,ik(n))*Q(k,jk(n))
171
End Do
172
End Do
173
174
eta36(1,1)=eta36(1,1)+eta6(k+3)*Q(k,1)*Q(k,1)*2.
175
eta36(1,4)=eta36(1,4)+eta6(k+3)*Q(k,1)*Q(k,2)
176
eta36(1,6)=eta36(1,6)+eta6(k+3)*Q(k,1)*Q(k,3)
177
178
eta36(2,2)=eta36(2,2)+eta6(k+3)*Q(k,2)*Q(k,2)*2.
179
eta36(2,4)=eta36(2,4)+eta6(k+3)*Q(k,2)*Q(k,1)
180
eta36(2,5)=eta36(2,5)+eta6(k+3)*Q(k,2)*Q(k,3)
181
182
eta36(3,3)=eta36(3,3)+eta6(k+3)*Q(k,3)*Q(k,3)*2.
183
eta36(3,5)=eta36(3,5)+eta6(k+3)*Q(k,3)*Q(k,2)
184
eta36(3,6)=eta36(3,6)+eta6(k+3)*Q(k,3)*Q(k,1)
185
186
eta36(4,1)=eta36(4,1)+eta6(k+3)*Q(k,1)*Q(k,2)
187
eta36(4,2)=eta36(4,2)+eta6(k+3)*Q(k,1)*Q(k,2)
188
eta36(4,4)=eta36(4,4)+eta6(k+3)*(dQk-Q(k,3)*Q(k,3))*0.5
189
eta36(4,5)=eta36(4,5)+eta6(k+3)*Q(k,1)*Q(k,3)*0.5
190
eta36(4,6)=eta36(4,6)+eta6(k+3)*Q(k,2)*Q(k,3)*0.5
191
192
eta36(5,2)=eta36(5,2)+eta6(k+3)*Q(k,2)*Q(k,3)
193
eta36(5,3)=eta36(5,3)+eta6(k+3)*Q(k,2)*Q(k,3)
194
eta36(5,4)=eta36(5,4)+eta6(k+3)*Q(k,1)*Q(k,3)*0.5
195
eta36(5,5)=eta36(5,5)+eta6(k+3)*(dQk-Q(k,1)*Q(k,1))*0.5
196
eta36(5,6)=eta36(5,6)+eta6(k+3)*Q(k,1)*Q(k,2)*0.5
197
198
eta36(6,1)=eta36(6,1)+eta6(k+3)*Q(k,1)*Q(k,3)
199
eta36(6,3)=eta36(6,3)+eta6(k+3)*Q(k,1)*Q(k,3)
200
eta36(6,4)=eta36(6,4)+eta6(k+3)*Q(k,2)*Q(k,3)*0.5
201
eta36(6,5)=eta36(6,5)+eta6(k+3)*Q(k,1)*Q(k,2)*0.5
202
eta36(6,6)=eta36(6,6)+eta6(k+3)*(dQk-Q(k,2)*Q(k,2))*0.5
203
End Do
204
205
End
206
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207
!
208
! sens = 1 : tri des ki pour avoir k1 < k2 < k3
209
! sens =-1 : tri des visc apres calcul avec k1 < k2 < k3
210
!
211
!
212
Subroutine triki(ki0,ki,visc,ordre,sens)
213
214
use defgrid
215
216
implicit none
217
218
Real(kind=dp), Dimension(3) :: ki0,ki
219
real(kind=dp), Dimension(6) :: visc,b
220
real(kind=dp) :: a
221
Integer :: sens,i,j
222
Integer, Dimension(3) :: ordre
223
224
225
226
!
227
! Passage pour trier les ki
228
!
229
If (sens.EQ.1) Then
230
Do i=1,3
231
ki(i)=ki0(i)
232
ordre(i)=i
233
End Do
234
Do j=2,3
235
a=ki(j)
236
Do i=j-1,1,-1
237
If (ki(i).LE.a) Goto 20
238
ki(i+1)=ki(i)
239
ordre(i+1)=ordre(i)
240
End Do
241
20 Continue
242
ki(i+1)=a
243
ordre(i+1)=j
244
End Do
245
!
246
! Passage pour remettre les viscosite dans le bon ordre
247
!
248
ElseIf (sens.EQ.-1) Then
249
250
Do i=1,6
251
b(i)=visc(i)
252
End Do
253
Do i=1,3
254
visc(ordre(i))=b(i)
255
visc(ordre(i)+3)=b(i+3)
256
End Do
257
258
Else
259
Write(*,*)'triki.f : sens <> 1 ou -1'
260
Stop
261
End If
262
End
263
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
265
!
266
! Interpolation quadratique d'une quantite Q definie en x1,x2,x3
267
!
268
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
269
!
270
Function InterP(t,x,Q)
271
272
use defgrid
273
!
274
Implicit None
275
Real(kind=dp), Dimension(3) :: x,Q
276
Real(kind=dp) :: t,InterP,d12,d23
277
Real(kind=dp) :: Ip
278
279
!
280
d12=x(2)-x(1)
281
d23=x(3)-x(2)
282
Ip=Q(1)*(x(2)-t)*(x(3)-t)/((d12+d23)*d12)
283
Ip=Ip+Q(2)*(t-x(1))*(x(3)-t)/(d12*d23)
284
Ip=Ip+Q(3)*(t-x(1))*(t-x(2))/((d12+d23)*d23)
285
286
InterP = Ip
287
Return
288
End
289
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
290
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
291
!
292
! Interpolation quadratique d'une quantite Q definie en 9 points
293
!
294
! y3 --- Q7 ---- Q8 ------ Q9
295
! | | |
296
! | | |
297
! y2 --- Q4 ----- Q5 ----- Q6
298
! | | |
299
! | | |
300
! y1 --- Q1 ----- Q2 ----- Q3
301
!
302
! | | |
303
! x1 x2 x3
304
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
305
!
306
Function InterQ9(x,y,xi,yi,Q)
307
308
use defgrid
309
!
310
Implicit None
311
Real(KIND=dp), Dimension(3) :: xi,yi,a
312
Real(kind=dp), Dimension(9) :: Q
313
Real(kind=dp) :: InterQ9,InterP
314
Real(kind=dp) :: Ip,x,y
315
Integer i
316
317
!
318
a(1)=InterP(x,xi,Q(1))
319
a(2)=InterP(x,xi,Q(4))
320
a(3)=InterP(x,xi,Q(7))
321
Ip=InterP(y,yi,a)
322
323
InterQ9 = Ip
324
325
Return
326
End
327
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
328
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
329
!!!!!! !!!!!!
330
!!!!!! Orthotropic Polycrystalline Ice Law from LGGE !!!!!!
331
!!!!!! !!!!!!
332
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
333
! give the Voigt viscosity matrix eta36 expressed
334
! in the general reference frame
335
! Si = Aij dj
336
! Aij = eta36(i,j) i=1,6; j=1,6 non-symetric matrix
337
! where S=(S11,S22,S33,S12,S23,S31)
338
! and d=(d11,d22,d33,2d12,2d23,2d31)
339
! as in Elmer
340
!
341
342
Subroutine OPILGGE_ai_nl(ai,Angle,etaI,eta36)
343
344
USE DEFGRID
345
346
Implicit None
347
Real(kind=dp), Intent(in), Dimension(3) :: ai ! Texture parameters
348
Real(kind=dp), Dimension(3) :: ki ! Texture parameters
349
Real(kind=dp), Intent(in), Dimension(3) :: Angle ! Euler Angles
350
Real(kind=dp), Intent(in), Dimension(:) :: etaI ! Grid Viscosities
351
Real(kind=dp), Intent(out), Dimension(6,6) :: eta36
352
Real(kind=dp), Dimension(6) :: eta6
353
Real(kind=dp) :: aplusa
354
Integer :: i
355
356
Do i=1,3
357
ki(i)=ai(i)
358
End do
359
360
Do i=1,3
361
ki(i)=min(Max(ki(i),0._dp),1._dp)
362
End do
363
aplusa=ki(1)+ki(2)+ki(3)
364
If (aplusa.GT.1._dp) then
365
do i=1,3
366
ki(i)=ki(i)/aplusa
367
end do
368
endif
369
370
! Value of the 6 relative viscosities in the orthotropic frame
371
372
Call ViscMat_ai(ki,eta6,etaI)
373
374
! Viscosities in the reference frame
375
376
Call ViscGene(eta6,Angle,eta36)
377
378
End
379
380
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
381
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
382
!ccccc cccc
383
!ccccc subroutine de calcul des viscosites Analytiques cccc
384
!ccccc Les viscosites ont ete calculees sur une grille cccc
385
!ccccc avec le sous-prog makeEtaI.f cccc
386
!ccccc Elles passent dans etaI(6*814)=EtaI(4884) cccc
387
!ccccc cccc
388
!ccccc !!! En entree a1,a2,a3 les valeurs propres du tenseur cccc
389
!ccccc d'orientation cccc
390
!ccccc cccc
391
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
392
393
Subroutine ViscMat_ai(ai0,eta6,etaI)
394
395
USE defGrid
396
397
Implicit None
398
Real(kind=dp), Intent(in), Dimension(3) :: ai0
399
Real(kind=dp), Intent(out), Dimension(6) :: eta6
400
Real(kind=dp), Intent(in), Dimension(NetaI) :: etaI
401
Real(kind=dp), Dimension(3) :: a1i,a2i
402
Real(kind=dp) :: InterQ9
403
Real(kind=dp), Dimension(3) :: ai
404
Real(kind=dp), Dimension(9) :: etaN
405
Real(kind=dp) :: Delta
406
Real(kind=dp) :: a1,a2
407
Real(kind=dp), parameter :: UnTier = 0.3333333333333333333333333333333333333333_dp
408
Integer, Dimension(3) :: ordre
409
Integer :: i,j,n
410
Integer :: ik1,ik2
411
Integer :: N4,N5,N6
412
413
414
Delta = UnTier / Ndiv
415
!
416
! tri des ki
417
! pour avoir k1 < k2 < k3
418
!
419
!
420
Call triki(ai0,ai,eta6,ordre,1)
421
!
422
a1 = ai(1)
423
a2 = ai(2)
424
!
425
! Position de a1,a2 dans EtaI
426
! calcul des indices ik1,ik2
427
! ik1,ik2 indice du noeud en haut a droite du pt (a1,a2)
428
!
429
ik1 = Int((a1 + Delta)/Delta) + 1
430
ik2 = Int((a2 + Delta)/Delta) + 1
431
432
! Si ik1 + 2ik2 -3(Ndiv+1) >0 => on est sur la frontiere a2=a3
433
! ( a1+2a2=1)
434
! => ik1=ik1-1 sauf si ik1=2 , ik2=ik2-1
435
!
436
If ((ik1+2*ik2-3*(Ndiv+1)).GE.0) Then
437
If ((ik1.NE.2).And.((ik1+2*ik2-3*(Ndiv+1)).NE.0).And. &
438
(abs((a1-Delta*(ik1-1))/a1).GT.1.0E-5)) ik1=ik1-1
439
ik2=ik2-1
440
End If
441
If (ik1.EQ.1) ik1=2
442
!
443
! Indice N4,N5 et N6 des points 4,5 et 6 dans EtaI
444
!
445
446
N4 = Nk2(ik1-1) + ik2 - ik1 + 3
447
N5 = Nk2(ik1) + ik2 - ik1 + 2
448
N6 = Nk2(ik1+1) + ik2 - ik1 + 1
449
450
!
451
! Remplissage etaN(1 a 9)
452
! 7 - 8 - 9
453
! 4 - 5 - 6
454
! 1 - 2 - 3
455
!
456
Do i=1,3
457
a1i(i)=Delta*(ik1-3+i)
458
a2i(i)=Delta*(ik2-3+i)
459
End Do
460
!
461
Do n=1,6
462
Do i=1,3
463
etaN(1+(i-1)*3) = etaI(6*(N4-3+i)+n)
464
etaN(2+(i-1)*3) = etaI(6*(N5-3+i)+n)
465
etaN(3+(i-1)*3) = etaI(6*(N6-3+i)+n)
466
End Do
467
!
468
! interpolation sur le Q9
469
!
470
! If ( (a1 < a1i(1)) .OR. &
471
! (a1 > a1i(3)) .OR. &
472
! (a2 < a2i(1)) .OR. &
473
! (a2 > a2i(3)) ) Then
474
! write(*,*)a1,a1i
475
! write(*,*)a2,a2i
476
! Stop
477
! End If
478
479
eta6(n)=InterQ9(a1,a2,a1i,a2i,etaN)
480
481
End Do
482
!
483
! tri des eta
484
!
485
Call triki(ai0,ai,eta6,ordre,-1)
486
487
Return
488
End
489
490
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
491
!!! calcul de a4 a partir de a2 par fermeture IBOF (Chung 2002)
492
!! a2 rentre dans l'ordre : 11, 22, 33, 12, 23 ,13
493
!!!a4 sort dans l'ordre : 1111, 2222, 1122, 1123, 2231, 1131, 1112, 2223, 2212
494
!
495
!------------------------------------------------------------------------------
496
subroutine IBOF(a2,a4)
497
498
USE Types
499
500
implicit none
501
Real(dp),dimension(6),intent(in):: a2
502
Real(dp),dimension(9),intent(out):: a4
503
Real(dp):: a_11,a_22,a_33,a_12,a_13,a_23
504
Real(dp):: b_11,b_22,b_12,b_13,b_23
505
Real(dp):: aPlusa
506
507
Real(dp),dimension(21) :: vec
508
Real(dp),dimension(3,21) :: Mat
509
Real(dp),dimension(6) :: beta
510
Real(dp) :: Inv2,Inv3
511
integer :: i,j
512
513
514
a_11=a2(1)
515
a_22=a2(2)
516
a_33=a2(3)
517
a_12=a2(4)
518
a_23=a2(5)
519
a_13=a2(6)
520
521
522
! write(*,*) 'a2'
523
! write(*,*) a2
524
525
!Coefficients
526
527
Mat(1,1)=0.217774509809788e+02_dp
528
Mat(1,2)=-.297570854171128e+03_dp
529
Mat(1,3)=0.188686077307885e+04_dp
530
Mat(1,4)=-.272941724578513e+03_dp
531
Mat(1,5)=0.417148493642195e+03_dp
532
Mat(1,6)=0.152038182241196e+04_dp
533
Mat(1,7)=-.137643852992708e+04_dp
534
Mat(1,8)=-.628895857556395e+03_dp
535
Mat(1,9)=-.526081007711996e+04_dp
536
Mat(1,10)=-.266096234984017e+03_dp
537
Mat(1,11)=-.196278098216953e+04_dp
538
Mat(1,12)=-.505266963449819e+03_dp
539
Mat(1,13)=-.110483041928547e+03_dp
540
Mat(1,14)=0.430488193758786e+04_dp
541
Mat(1,15)=-.139197970442470e+02_dp
542
Mat(1,16)=-.144351781922013e+04_dp
543
Mat(1,17)=-.265701301773249e+03_dp
544
Mat(1,18)=-.428821699139210e+02_dp
545
Mat(1,19)=-.443236656693991e+01_dp
546
Mat(1,20)=0.309742340203200e+04_dp
547
Mat(1,21)=0.386473912295113e+00_dp
548
Mat(2,1)=-.514850598717222e+00_dp
549
Mat(2,2)=0.213316362570669e+02_dp
550
Mat(2,3)=-.302865564916568e+03_dp
551
Mat(2,4)=-.198569416607029e+02_dp
552
Mat(2,5)=-.460306750911640e+02_dp
553
Mat(2,6)=0.270825710321281e+01_dp
554
Mat(2,7)=0.184510695601404e+03_dp
555
Mat(2,8)=0.156537424620061e+03_dp
556
Mat(2,9)=0.190613131168980e+04_dp
557
Mat(2,10)=0.277006550460850e+03_dp
558
Mat(2,11)=-.568117055198608e+02_dp
559
Mat(2,12)=0.428921546783467e+03_dp
560
Mat(2,13)=0.142494945404341e+03_dp
561
Mat(2,14)=-.541945228489881e+04_dp
562
Mat(2,15)=0.233351898912768e+02_dp
563
Mat(2,16)=0.104183218654671e+04_dp
564
Mat(2,17)=0.331489412844667e+03_dp
565
Mat(2,18)=0.660002154209991e+02_dp
566
Mat(2,19)=0.997500770521877e+01_dp
567
Mat(2,20)=0.560508628472486e+04_dp
568
Mat(2,21)=0.209909225990756e+01_dp
569
Mat(3,1)=0.203814051719994e+02_dp
570
Mat(3,2)=-.283958093739548e+03_dp
571
Mat(3,3)=0.173908241235198e+04_dp
572
Mat(3,4)=-.195566197110461e+03_dp
573
Mat(3,5)=-.138012943339611e+03_dp
574
Mat(3,6)=0.523629892715050e+03_dp
575
Mat(3,7)=0.859266451736379e+03_dp
576
Mat(3,8)=-.805606471979730e+02_dp
577
Mat(3,9)=-.468711180560599e+04_dp
578
Mat(3,10)=0.889580760829066e+01_dp
579
Mat(3,11)=-.782994158054881e+02_dp
580
Mat(3,12)=-.437214580089117e+02_dp
581
Mat(3,13)=0.112996386047623e+01_dp
582
Mat(3,14)=0.401746416262936e+04_dp
583
Mat(3,15)=0.104927789918320e+01_dp
584
Mat(3,16)=-.139340154288711e+03_dp
585
Mat(3,17)=-.170995948015951e+02_dp
586
Mat(3,18)=0.545784716783902e+00_dp
587
Mat(3,19)=0.971126767581517e+00_dp
588
Mat(3,20)=0.141909512967882e+04_dp
589
Mat(3,21)=0.994142892628410e+00_dp
590
591
592
! calcul des invariants
593
Inv2=0.5_dp*(1._dp-(a_11*a_11+a_22*a_22+a_33*a_33+ &
594
2._dp*(a_12*a_12+a_13*a_13+a_23*a_23)))
595
596
Inv3=a_11*(a_22*a_33-a_23*a_23)+a_12*(a_23*a_13-a_12*a_33)+ &
597
a_13*(a_12*a_23-a_22*a_13)
598
599
! polynome complet de degre 5 des 2 invariants.
600
vec(1)=1._dp
601
vec(2)=Inv2
602
vec(3)=vec(2)*vec(2)
603
vec(4)=Inv3
604
vec(5)=vec(4)*vec(4)
605
vec(6)=vec(2)*vec(4)
606
vec(7)=vec(3)*vec(4)
607
vec(8)=vec(2)*vec(5)
608
vec(9)=vec(2)*vec(3)
609
vec(10)=vec(5)*vec(4)
610
vec(11)=vec(9)*vec(4)
611
vec(12)=vec(3)*vec(5)
612
vec(13)=vec(2)*vec(10)
613
vec(14)=vec(3)*vec(3)
614
vec(15)=vec(5)*vec(5)
615
vec(16)=vec(14)*vec(4)
616
vec(17)=vec(12)*vec(2)
617
vec(18)=vec(12)*vec(4)
618
vec(19)=vec(2)*vec(15)
619
vec(20)=vec(14)*vec(2)
620
vec(21)=vec(15)*vec(4)
621
622
! calcul des beta_bar (cf annexe C Chung)
623
! attention beta(1)=beta_bar_3 (Chung); beta(2)=beta_bar_4; beta(3)=beta_bar_6
624
! beta(4)=beta_bar_1 ; beta(5)=beta_bar_2; beta(6)=beta_bar_5
625
626
! calcul des trois beta en fonction du polynome
627
beta(:)=0._dp
628
Do i=1,3
629
Do j=1,21
630
beta(i)=beta(i)+Mat(i,j)*vec(j)
631
End do
632
End do
633
634
! calcul des 3 autres pour avoir la normalisation
635
beta(4)=3._dp*(-1._dp/7._dp+beta(1)*(1._dp/7._dp+4._dp*Inv2/7._dp+8._dp*Inv3/3._dp)/5._dp- &
636
beta(2)*(0.2_dp-8._dp*Inv2/15._dp-14._dp*Inv3/15._dp)- &
637
beta(3)*(1._dp/35._dp-24._dp*Inv3/105._dp-4._dp*Inv2/35._dp+ &
638
16._dp*Inv2*Inv3/15._dp+8._dp*Inv2*Inv2/35._dp))/5._dp
639
640
beta(5)=6._dp*(1._dp-0.2_dp*beta(1)*(1._dp+4._dp*Inv2)+ &
641
7._dp*beta(2)*(1._dp/6._dp-Inv2)/5._dp- &
642
beta(3)*(-0.2_dp+2._dp*Inv3/3._dp+4._dp*Inv2/5._dp- &
643
8._dp*Inv2*Inv2/5._dp))/7._dp
644
645
beta(6)=-4._dp*beta(1)/5._dp-7._dp*beta(2)/5._dp- &
646
6._dp*beta(3)*(1._dp-4._dp*Inv2/3._dp)/5._dp
647
648
! pour avoir les beta_bar
649
Do i=1,6
650
beta(i)=beta(i)/3._dp
651
End do
652
beta(2)=beta(2)/2._dp
653
beta(5)=beta(5)/2._dp
654
beta(6)=beta(6)/2._dp
655
656
!! calcul des 5 b=a.a
657
b_11=a_11*a_11+a_12*a_12+a_13*a_13
658
b_22=a_22*a_22+a_12*a_12+a_23*a_23
659
b_12=a_11*a_12+a_12*a_22+a_13*a_23
660
b_13=a_11*a_13+a_12*a_23+a_13*a_33
661
b_23=a_12*a_13+a_22*a_23+a_23*a_33
662
663
!Calcul des 9 termes de a4
664
665
a4(1)=3._dp*beta(4)+6._dp*beta(5)*a_11+3._dp*beta(1)*a_11*a_11+&
666
6._dp*beta(2)*b_11+6._dp*beta(6)*a_11*b_11+3._dp*beta(3)*b_11*b_11
667
a4(2)=3._dp*beta(4)+6._dp*beta(5)*a_22+3._dp*beta(1)*a_22*a_22+&
668
6._dp*beta(2)*b_22+6._dp*beta(6)*a_22*b_22+3._dp*beta(3)*b_22*b_22
669
670
a4(3)=beta(4)+beta(5)*(a_22+a_11)+beta(1)*(a_11*a_22+2._dp*a_12*a_12)+&
671
beta(2)*(b_22+b_11)+beta(6)*(a_11*b_22+a_22*b_11+4._dp*a_12*b_12)+&
672
beta(3)*(b_11*b_22+2._dp*b_12*b_12)
673
674
675
a4(4)=beta(5)*a_23+beta(1)*(a_11*a_23+2._dp*a_12*a_13)+beta(2)*b_23+&
676
beta(6)*(a_11*b_23+a_23*b_11+2._dp*(a_12*b_13+a_13*b_12))+beta(3)*&
677
(b_11*b_23+2._dp*b_12*b_13)
678
a4(5)=beta(5)*a_13+beta(1)*(a_22*a_13+2._dp*a_12*a_23)+beta(2)*b_13+&
679
beta(6)*(a_22*b_13+a_13*b_22+2._dp*(a_12*b_23+a_23*b_12))+beta(3)*&
680
(b_22*b_13+2._dp*b_12*b_23)
681
682
683
a4(6)=3._dp*beta(5)*a_13+3._dp*beta(1)*a_11*a_13+3._dp*beta(2)*b_13+&
684
3._dp*beta(6)*(a_11*b_13+a_13*b_11)+3._dp*beta(3)*b_11*b_13
685
a4(7)=3._dp*beta(5)*a_12+3._dp*beta(1)*a_11*a_12+3._dp*beta(2)*b_12+&
686
3._dp*beta(6)*(a_11*b_12+a_12*b_11)+3._dp*beta(3)*b_11*b_12
687
a4(8)=3._dp*beta(5)*a_23+3._dp*beta(1)*a_22*a_23+3._dp*beta(2)*b_23+&
688
3._dp*beta(6)*(a_22*b_23+a_23*b_22)+3._dp*beta(3)*b_22*b_23
689
a4(9)=3._dp*beta(5)*a_12+3._dp*beta(1)*a_22*a_12+3._dp*beta(2)*b_12+&
690
3._dp*beta(6)*(a_22*b_12+a_12*b_22)+3._dp*beta(3)*b_22*b_12
691
692
693
End
694
!**************************************************************************************
695
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
696
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
697
!
698
! Compute Eigenvalues (ai) and euler angles (Euler)
699
! of the second order orientation tensor (a2)
700
! using lapack DGEEV lapack routine
701
!--------------------------------------------------------
702
subroutine R2Ro(a2,dim,ai,Euler)
703
704
use Types ! types d'Elmer
705
706
implicit none
707
708
Real(dp),dimension(6),intent(in) :: a2
709
Real(dp),dimension(3),intent(out) :: ai,Euler
710
Real(dp),dimension(3,3) :: A,EigenVec
711
Real(dp) :: Dumy(1,3),EI(3),Work(24)
712
Real(dp) :: norm
713
integer :: dim ! dimension (2D-3D)
714
integer :: i,infor
715
716
Do i=1,3
717
A(i,i)=a2(i)
718
End do
719
A(1,2)=a2(4)
720
A(2,1)=A(1,2)
721
A(2,3)=a2(5)
722
A(3,2)=A(2,3)
723
A(1,3)=a2(6)
724
A(3,1)=A(1,3)
725
726
727
CALL DGEEV('N','V',3,A,3,ai,EI,Dumy,1,EigenVec,3,Work,24,infor)
728
729
if (infor.ne.0) &
730
CALL FATAL('GolfLaw,R2R0', 'failed to compute fabric eignevalues')
731
732
! need a right handed orthonormal basis to compute euler angles;
733
! not guarantee by DGEEV.
734
EigenVec(1,3)=EigenVec(2,1)*EigenVec(3,2)-EigenVec(3,1)*EigenVec(2,2)
735
EigenVec(2,3)=EigenVec(3,1)*EigenVec(1,2)-EigenVec(1,1)*EigenVec(3,2)
736
EigenVec(3,3)=EigenVec(1,1)*EigenVec(2,2)-EigenVec(2,1)*EigenVec(1,2)
737
738
! normalize
739
norm=sqrt(EigenVec(1,3)**2+EigenVec(2,3)**2+EigenVec(3,3)**2)
740
EigenVec(:,3)=EigenVec(:,3)/norm
741
742
Euler(2)=Acos(EigenVec(3,3))
743
if (abs(Euler(2)).gt.tiny(Euler(2))) then !3D euler angles
744
Euler(1)=ATAN2(EigenVec(1,3),-EigenVec(2,3))
745
Euler(3)=ATAN2(EigenVec(3,1),EigenVec(3,2))
746
else ! only one rotation of angle phi
747
Euler(3)=0.0
748
Euler(1)=ATAN2(EigenVec(2,1),EigenVec(1,1))
749
end if
750
751
RETURN
752
END
753
754
755
756