-
Notifications
You must be signed in to change notification settings - Fork 0
/
hydroforces.f90
3490 lines (3008 loc) · 133 KB
/
hydroforces.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
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
! Subroutines for computing hydrodynamic interaction between two spheres
! Developed by Ahmad Ababaei ([email protected]) under PhD supervision
! of Professor Bogdan Rosa ([email protected])
! Institute of Meteorology and Water Management — National Research Institute
! Podleśna 61, 01-673 Warsaw, Poland
! Compile using:
! -mcmodel=medium -w
! For OpenMP:
! -fopenmp export OMP_NUM_THREADS=<n>
PROGRAM HYDROFORCES
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
PARAMETER ( acu = 1d-9 )
DIMENSION fg(4,4)
LOGICAL opp, ncl
INTEGER sample
CALL CPU_TIME(t0)
OPEN (1, file='output.dat')
! ============ I N P U T S ==============
alam = 2.50d-0 ! Radius ratio
a1 = 1d+0 ! Larger drop radius [μm]
mur = 1d+2 ! Viscosity ratio
ncl = .TRUE. ! Non-continuum lubrication ON
! ncl = .FALSE. ! Non-continuum lubrication OFF
opp = .TRUE. ! Orientation: opposing
! opp = .FALSE. ! Orientation: same
! ========= L O G D I S T R. ==========
! Logarithmic distribution of normalized
! gap size ξ = s — 2 in JO84 notation:
xi_min = 1d-6
xi_max = 1d+2
sample = 10
dlt_xi = DLOG ( xi_max / xi_min ) / DBLE(sample-1)
! dlt_la = ( 1d0 - 5d-2 ) / sample
s = 2d0 + xi_min + 3d-16
! =======================================
DO i = 1, sample
CALL MAP(s,alam,al,be) ! (s,λ) —> (α,β)
! ============ M E T H O D ==============
! CALL J1915(opp,al,be,T1,T2,acu)
! CALL SJ26M61EXP(opp,al,be,F1,F2,acu)
! CALL SJ1926IMP(opp,al,be,F1,F2,acu)
! CALL H37(s,alam,1d1,5d-13,F1,F2) ! vdW forces
! CALL GCB66T(al,F1,T1,acu)
! CALL GCB66R(al,F1,T1,acu)
! CALL ON69T(al,F1,T1,acu)
! CALL ON69R(al,F1,T1,acu)
! CALL FREEROTEQUAL(opp,al,F1,acu)
! CALL ONM70R(opp,al,be,fg,F1,F2,T1,T2,acu)
! CALL ONM70T(opp,al,be,fg,F1,F2,T1,T2,acu)
! CALL FREEROTATION(opp,al,be,F1,F2,acu)
! CALL WW72(mur,al,F1,acu)
! CALL HHS73EXP(opp,mur,mur,al,be,F1,F2,acu)
! CALL HHS73IMP(opp,mur,mur,al,be,F1,F2,acu)
! CALL RM74(opp,al,be,a1,F1,F2,acu)
CALL RSD22(opp,mur,mur,al,be,a1,F1,F2,acu)
! CALL BRI78(mur,al,F1,acu)
! CALL JO84XA(opp,s,alam,ncl,a1,F1,F2,acu)
! CALL JO84YA(opp,s,alam,ncl,a1,F1,F2,acu)
! CALL JO84YB(opp,s,alam,ncl,a1,F1,F2,T1,T2,acu)
! CALL JO84YC(opp,s,alam,ncl,a1,T1,T2,acu)
! CALL JO84XC(opp,s,alam,T1,T2,acu)
! CALL WAG05ISMX(opp,mur,s,alam,F1,F2)
! CALL WAG05ISMY(opp,mur,s,alam,F1,F2)
! CALL ROT(opp,s,alam,F1,F2) ! not done
! CALL GMS20a(al,be,F1,F2)
! CALL GMS20b(al,F1) ! wrong ?
! ============ O U T P U T ==============
WRITE(*,*) s-2d0, F1, F2, T1, T2
! WRITE(*,*) alam, F1, F2, T1, T2
WRITE(1,*) s-2d0, F1, F2, T1, T2
! =======================================
! STOP
! ========= L O G D I S T R. ==========
s = DLOG ( s - 2d0 ) + dlt_xi
s = DEXP ( s ) + 2d0
! alam = alam + dlt_la
ENDDO
! =======================================
CALL CPU_TIME(t1)
WRITE(*,*) 'Elapsed time:', t1-t0 ,'s'
CLOSE ( 1 )
END PROGRAM HYDROFORCES
! ======================= S U B R O U T I N E S ========================
! ============ M A P P I N G ============
SUBROUTINE MAP(s,alam,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
! Zinchenko explicit transform
! Here we map the regular JO84 (s,λ)
! geometrical setting in two sets of
! spherical polar coordinates (JO84 Sec. 2)
! system to spherical bipolar, known as
! bispherical, coordinates (ε,k),
! to obtain two spheres interfaces, e.g.
! (α,β) in Stimson & Jeffery (1926)
! notation or (ξ₁, ξ₂) in Jeffery (1915)
! notation, using formulae given by Zinchenko
! for example in Eq. (2.2) of his paper:
! doi.org/10.1016/0021-8928(78)90051-5.
! The methodology to derive these, however,
! is not straightforward, and he kindly
! sent it to us in a personal communication.
! Radii ratio:
! "k" in Zinchenko (1977) notation
! "λ = 1/k" in JO84 notation
! Mapping formulae:
! (s,λ) —> (ε,k) —> (α,β)
! They are modified according to our problem setting.
k = 1d0 / alam ! size ratio
eps = ( s - 2d0 ) * ( alam + 1d0 ) / 2d0 ! normalized clearance: ε.a₁ = gap
coshal = 1d0 + eps * ( alam + eps / 2d0 ) / ( 1d0 + alam + eps )
coshbe = 1d0 + eps/alam*( 1d0 + eps / 2d0 ) / ( 1d0 + alam + eps )
! coshal = 1d0 + eps * ( 1d0 + k * eps / 2d0 ) / ( 1d0 + k * ( 1d0 + eps ) )
! coshbe = 1d0 + eps * k**2 * ( 1d0 + eps / 2d0 ) / ( 1d0 + k * ( 1d0 + eps ) )
al = DACOSH(coshal)
be =-DACOSH(coshbe)
! be = asinh(-k*DSINH(al))
! WRITE(*,*) "ε, k, α, β =",eps,k,al,be
END SUBROUTINE
! === Jeffery (1915) ===================================================
! Jeffery, G. B. (1915). On the steady rotation of a solid of revolution in a viscous fluid. Proceedings of the London Mathematical Society, 2(1), 327-338.
SUBROUTINE J1915(opp,xi1,xi2,G1,G2,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
LOGICAL opp
sum1o = 0d0
sum2o = 0d0
rel = 1d3
i = 0
DO WHILE ( rel .GT. acu )
m = DBLE(i)
IF (opp) THEN
sum1 = sum1o + DSINH((m+1d0)*xi1-m*xi2)**(-3) + DSINH((m+1d0)*(xi1-xi2))**(-3)
sum2 = sum2o + DSINH((m+1d0)*xi2-m*xi1)**(-3) + DSINH((m+1d0)*(xi2-xi1))**(-3)
ELSE
sum1 = sum1o + DSINH((m+1d0)*xi1-m*xi2)**(-3) - DSINH((m+1d0)*(xi1-xi2))**(-3)
sum2 = sum2o + DSINH((m+1d0)*xi2-m*xi1)**(-3) - DSINH((m+1d0)*(xi2-xi1))**(-3)
ENDIF
rel = MAX(DABS(sum1-sum1o)/DABS(sum1),DABS(sum2-sum2o)/DABS(sum2))
sum1o = sum1
sum2o = sum2
i = i + 1
ENDDO
! Equation (12):
G1 = DSINH(xi1)**3 * sum1 ! normalized by —8πμa₁³Ω₁
G2 = DSINH(xi2)**3 * sum2 ! normalized by —8πμa₂³Ω₂
END SUBROUTINE
! ======================================================================
! === Stimson & Jeffery (1926) - Explicit Method =======================
! Stimson, M., & Jeffery, G. B. (1926). The motion of two spheres in a viscous fluid. Proceedings of the Royal Society of London. Series A, Containing Papers of a Mathematical and Physical Character, 111(757), 110-116.
! Maude, A. D. (1961). End effects in a falling-sphere viscometer. British Journal of Applied Physics, 12(6), 293.
SUBROUTINE SJ26M61EXP(opp,al,be,F1,F2,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
LOGICAL opp
sum1o = 0d0
sum2o = 0d0
sum3o = 0d0
! sum4o = 0d0
! sum5o = 0d0
! sum6o = 0d0
! sum7o = 0d0
rel = 1d3
i = 1
DO WHILE ( rel .GT. acu )
n = DBLE(i)
k = n*(n+1d0)/(2d0*n-1d0)/(2d0*n+3d0)
IF (opp) THEN ! Maude (1961)
sum1 = sum1o + ( A2(n,k,al,be) + B2(n,k,al,be) &
+ C2(n,k,al,be) + D2(n,k,al,be) &
) / Delta(n,al,be)
sum2 = sum2o + ( A2(n,k,al,be) - B2(n,k,al,be) &
+ C2(n,k,al,be) - D2(n,k,al,be) &
) / Delta(n,al,be)
sum3 = sum3o + lambda2(n,al) ! (2)
ELSE ! Stimson & Jeffery (1926)
sum1 = sum1o + ( A1(n,k,al,be) + B1(n,k,al,be) &
+ C1(n,k,al,be) + D1(n,k,al,be) &
) / Delta(n,al,be)
sum2 = sum2o + ( A1(n,k,al,be) - B1(n,k,al,be) &
+ C1(n,k,al,be) - D1(n,k,al,be) &
) / Delta(n,al,be)
! last page for equal-sized spheres:
sum3 = sum3o + lambda1(n,al) ! (37)
! sum4 = sum4o + C_equal(n,k,al)
! sum5 = sum5o + C(n,k,al,be)/Delta(n,al,be)
! sum6 = sum6o + C_equal(n,k,al)
! sum7 = sum7o + C(n,k,al,be)/Delta(n,al,be)
ENDIF
rel = MAX(DABS(sum1-sum1o)/DABS(sum1),DABS(sum2-sum2o)/DABS(sum2),DABS(sum3-sum3o)/DABS(sum3))
sum1o = sum1
sum2o = sum2
sum3o = sum3
! sum4o = sum4
! sum5o = sum5
! sum6o = sum6
! sum7o = sum7
i = i + 1
ENDDO
F1 = 1d0/3d0 * DSINH(al) * DABS(sum1) ! (34) normalized by —6πκa₁V₁
F2 =-1d0/3d0 * DSINH(be) * DABS(sum2) ! (35) normalized by —6πκa₂V₂
Fe = 4d0/3d0 * DSINH(al) * DABS(sum3) ! (37) normalized by —6πκaV
END SUBROUTINE
! ==== F U N C T I O N S : S & J (1926) ===============================
FUNCTION A1(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
A1 = 4d0*DEXP(-(n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al-be))
A1 = A1 + (2d0*n+1d0)**2*DEXP(al-be)*DSINH(al-be)
A1 = A1 + 2d0*(2d0*n-1d0)*DSINH((n+1d0/2d0)*(al-be))*DCOSH((n+1d0/2d0)*(al+be))
A1 = A1 - 2d0*(2d0*n+1d0)*DSINH((n+3d0/2d0)*(al-be))*DCOSH((n-1d0/2d0)*(al+be))
A1 = A1 - (2d0*n+1d0)*(2d0*n-1d0)*DSINH(al-be)*DCOSH(al+be)
A1 = A1 * (2d0*n+3d0) * k
END
FUNCTION B1(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
B1 = 2d0*(2d0*n-1d0)*DSINH((n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al+be))
B1 = B1 - 2d0*(2d0*n+1d0)*DSINH((n+3d0/2d0)*(al-be))*DSINH((n-1d0/2d0)*(al+be))
B1 = B1 + (2d0*n+1d0)*(2d0*n-1d0)*DSINH(al-be)*DSINH(al+be)
B1 = B1 *-(2d0*n+3d0) * k
END
FUNCTION C1(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
C1 = 4d0*DEXP(-(n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al-be))
C1 = C1 - (2d0*n+1d0)**2*DEXP(be-al)*DSINH(al-be)
C1 = C1 + 2d0*(2d0*n+1d0)*DSINH((n-1d0/2d0)*(al-be))*DCOSH((n+3d0/2d0)*(al+be))
C1 = C1 - 2d0*(2d0*n+3d0)*DSINH((n+1d0/2d0)*(al-be))*DCOSH((n+1d0/2d0)*(al+be))
C1 = C1 + (2d0*n+1d0)*(2d0*n+3d0)*DSINH(al-be)*DCOSH(al+be)
C1 = C1 *-(2d0*n-1d0) * k
END
FUNCTION D1(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
D1 = 2d0*(2d0*n+1d0)*DSINH((n-1d0/2d0)*(al-be))*DSINH((n+3d0/2d0)*(al+be))
D1 = D1 - 2d0*(2d0*n+3d0)*DSINH((n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al+be))
D1 = D1 + (2d0*n+1d0)*(2d0*n+3d0)*DSINH(al-be)*DSINH(al+be)
D1 = D1 * (2d0*n-1d0) * k
END
FUNCTION Delta(n,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
Delta = 4d0*DSINH((n+1d0/2d0)*(al-be))**2-((2d0*n+1d0)*DSINH(al-be))**2
END
! ==== F U N C T I O N S : M (1961) ===================================
FUNCTION A2(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
A2 = 2d0*(2d0*n-1d0)*DSINH((n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al+be))
A2 = A2 - 2d0*(2d0*n+1d0)*DSINH((n+3d0/2d0)*(al-be))*DSINH((n-1d0/2d0)*(al+be))
A2 = A2 - (2d0*n+1d0)*(2d0*n-1d0)*DSINH(al-be)*DSINH(al+be)
A2 = A2 * (2d0*n+3d0) * k
END
FUNCTION B2(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
! B2 =-4d0*DEXP((n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al-be)) ! typo?!
B2 =-4d0*DEXP(-(n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al-be))
B2 = B2 - (2d0*n+1d0)**2*DEXP(al-be)*DSINH(al-be)
B2 = B2 + 2d0*(2d0*n-1d0)*DSINH((n+1d0/2d0)*(al-be))*DCOSH((n+1d0/2d0)*(al+be))
B2 = B2 - 2d0*(2d0*n+1d0)*DSINH((n+3d0/2d0)*(al-be))*DCOSH((n-1d0/2d0)*(al+be))
! B2 = B2 + (2d0*n+1d0)*(2d0*n-1d0)*DSINH(al-be)*DCOSH(al-be) ! typo?!
B2 = B2 + (2d0*n+1d0)*(2d0*n-1d0)*DSINH(al-be)*DCOSH(al+be)
B2 = B2 *-(2d0*n+3d0) * k
END
FUNCTION C2(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
! C2 = 2d0*(2d0*n+1d0)*DSINH((n-1d0/2d0)*(al-be))*DSINH((n+3d0/2d0)*(al-be)) ! typo?!
C2 = 2d0*(2d0*n+1d0)*DSINH((n-1d0/2d0)*(al-be))*DSINH((n+3d0/2d0)*(al+be))
! C2 = C2 - 2d0*(2d0*n+3d0)*DSINH((n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al-be)) ! typo?!
C2 = C2 - 2d0*(2d0*n+3d0)*DSINH((n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al+be))
C2 = C2 - (2d0*n+1d0)*(2d0*n+3d0)*DSINH(al-be)*DSINH(al+be)
C2 = C2 *-(2d0*n-1d0) * k
END
FUNCTION D2(n,k,al,be)
IMPLICIT DOUBLE PRECISION (A-Z)
! D2 =-4d0*DEXP(-(n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al+be)) ! typo?!
D2 =-4d0*DEXP(-(n+1d0/2d0)*(al-be))*DSINH((n+1d0/2d0)*(al-be))
D2 = D2 + (2d0*n+1d0)**2*DEXP(be-al)*DSINH(al-be)
D2 = D2 + 2d0*(2d0*n+1d0)*DSINH((n-1d0/2d0)*(al-be))*DCOSH((n+3d0/2d0)*(al+be))
D2 = D2 - 2d0*(2d0*n+3d0)*DSINH((n+1d0/2d0)*(al-be))*DCOSH((n+1d0/2d0)*(al+be))
D2 = D2 - (2d0*n+1d0)*(2d0*n+3d0)*DSINH(al-be)*DCOSH(al+be)
D2 = D2 * (2d0*n-1d0) * k
END
! ==== E Q U A L - S I Z E S P H E R E S : S & J (1926) =============
FUNCTION A_equal(n,k,al)
IMPLICIT DOUBLE PRECISION (A-Z)
A_equal = 2d0*(1d0-DEXP(-(2d0*n+1d0)*al))+(2d0*n+1d0)*(DEXP(2d0*al)-1d0)
A_equal = A_equal / ( 2d0*DSINH((2d0*n+1d0)*al)+(2d0*n+1d0)*DSINH(2d0*al) )
A_equal = A_equal *-(2d0*n+3d0) * k
END
FUNCTION C_equal(n,k,al)
IMPLICIT DOUBLE PRECISION (A-Z)
C_equal = 2d0*(1d0-DEXP(-(2d0*n+1d0)*al))+(2d0*n+1d0)*(1d0-DEXP(-2d0*al))
C_equal = C_equal / ( 2d0*DSINH((2d0*n+1d0)*al)+(2d0*n+1d0)*DSINH(2d0*al) )
C_equal = C_equal * (2d0*n-1d0) * k
END
FUNCTION lambda1(n,al)
IMPLICIT DOUBLE PRECISION (A-Z)
lambda1 = 4d0*DSINH(al*(n+1d0/2d0))**2-((2d0*n+1d0)*DSINH(al))**2
lambda1 = lambda1 / ( 2d0*DSINH(al*(2d0*n+1d0))+(2d0*n+1d0)*DSINH(al*2d0) )
lambda1 = 1d0 - lambda1
lambda1 = lambda1 * n*(n+1d0)/(2d0*n-1d0)/(2d0*n+3d0)
END
FUNCTION lambda2(n,al)
IMPLICIT DOUBLE PRECISION (A-Z)
lambda2 = 4d0*DCOSH(al*(n+1d0/2d0))**2+((2d0*n+1d0)*DSINH(al))**2
lambda2 = lambda2 / ( 2d0*DSINH(al*(2d0*n+1d0))-(2d0*n+1d0)*DSINH(al*2d0) )
lambda2 = 1d0 - lambda2
lambda2 = lambda2 * n*(n+1d0)/(2d0*n-1d0)/(2d0*n+3d0)
END
! === Stimson & Jeffery (1926) - Implicit Method =======================
! Stimson, M., & Jeffery, G. B. (1926). The motion of two spheres in a viscous fluid. Proceedings of the Royal Society of London. Series A, Containing Papers of a Mathematical and Physical Character, 111(757), 110-116.
! Zinchenko's suggestion:
! Instead of using explicit Eqs. (27)—(31) for (34) & (35), we
! numerically solve the set (26). This gives us the advantage of
! "choosing" the velocity boundary condition such that we can have
! the forces when the spheres are moving not only in the same direction
! but also an "opposing" direction, that is, Maude's solution.
SUBROUTINE SJ1926IMP(opp,al,be,F1,F2,acu)
USE OMP_LIB
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
DOUBLE PRECISION, DIMENSION(4,5) :: T
INTEGER nd
LOGICAL opp
!!$OMP PARALLEL PRIVATE(id)
! nd = OMP_GET_NUM_THREADS()
! id = OMP_GET_THREAD_NUM()
! IF ( id .eq. 0 ) WRITE(*,*) "Open-MP version with threads = ", nd
!!$OMP END PARALLEL
sum1o= 0d0
sum2o= 0d0
rel = 1d3
i = 1
DO WHILE ( rel .GT. acu )
!!$OMP PARALLEL DEFAULT(PRIVATE) FIRSTPRIVATE(i) SHARED(al,be,opp,acu) REDUCTION(+:sum1,sum2)
! nd = OMP_GET_NUM_THREADS()
! id = OMP_GET_THREAD_NUM()
! n = DBLE((i-1)*nd+id+1)
n = DBLE(i)
! PRINT*,"i,n,id+1",i,n,id+1
k = n*(n+1d0)/(2d0*n-1d0)/(2d0*n+3d0)
T(1,1) = DCOSH((n-1d0/2d0)*al)
T(1,2) = DSINH((n-1d0/2d0)*al)
T(1,3) = DCOSH((n+3d0/2d0)*al)
T(1,4) = DSINH((n+3d0/2d0)*al)
T(1,5) =-k*( (2d0*n+3d0)*DEXP(-(n-1d0/2d0)*al) - (2d0*n-1d0)*DEXP(-(n+3d0/2d0)*al) )
T(2,1) = DCOSH((n-1d0/2d0)*be)
T(2,2) = DSINH((n-1d0/2d0)*be)
T(2,3) = DCOSH((n+3d0/2d0)*be)
T(2,4) = DSINH((n+3d0/2d0)*be)
IF (opp) THEN
T(2,5) =+k*( (2d0*n+3d0)*DEXP((n-1d0/2d0)*be) - (2d0*n-1d0)*DEXP((n+3d0/2d0)*be) ) ! opposing direction
ELSE
T(2,5) =-k*( (2d0*n+3d0)*DEXP((n-1d0/2d0)*be) - (2d0*n-1d0)*DEXP((n+3d0/2d0)*be) ) ! same direction
ENDIF
T(3,1) = (2d0*n-1d0)*DSINH((n-1d0/2d0)*al)
T(3,2) = (2d0*n-1d0)*DCOSH((n-1d0/2d0)*al)
T(3,3) = (2d0*n+3d0)*DSINH((n+3d0/2d0)*al)
T(3,4) = (2d0*n+3d0)*DCOSH((n+3d0/2d0)*al)
T(3,5) = (2d0*n-1d0)*(2d0*n+3d0)*k*( DEXP(-(n-1d0/2d0)*al) - DEXP(-(n+3d0/2d0)*al) )
T(4,1) = (2d0*n-1d0)*DSINH((n-1d0/2d0)*be)
T(4,2) = (2d0*n-1d0)*DCOSH((n-1d0/2d0)*be)
T(4,3) = (2d0*n+3d0)*DSINH((n+3d0/2d0)*be)
T(4,4) = (2d0*n+3d0)*DCOSH((n+3d0/2d0)*be)
IF (opp) THEN
T(4,5) =+(2d0*n-1d0)*(2d0*n+3d0)*k*( DEXP((n-1d0/2d0)*be) - DEXP((n+3d0/2d0)*be) ) ! opposing direction
ELSE
T(4,5) =-(2d0*n-1d0)*(2d0*n+3d0)*k*( DEXP((n-1d0/2d0)*be) - DEXP((n+3d0/2d0)*be) ) ! same direction
ENDIF
CALL GAUSS(4,5,T)
sum1 = sum1o + SUM(T(1:4,5))
sum2 = sum2o + T(1,5) - T(2,5) + T(3,5) - T(4,5)
!!$OMP END PARALLEL
rel = MAX(DABS((sum1-sum1o)/DABS(sum1)),DABS((sum2-sum2o)/DABS(sum2)))
sum1o = sum1
sum2o = sum2
! WRITE(*,*)"n_max,sum1,sum2,sum1o,sum2o,rel",i,sum1,sum2,sum1o,sum2o,rel
! pause
i = i + 1
ENDDO
F1 =-DSINH(al)/3d0 * sum1 ! (34) normalized by —6πκa₁V₁
F2 =-DSINH(be)/3d0 * DABS(sum2) ! (35) normalized by —6πκa₂V₂
END SUBROUTINE
! ======================================================================
! === Hamaker (1937) - van der Waals ===================================
! Hamaker, H. C. (1937). The London—van der Waals attraction between spherical particles. physica, 4(10), 1058-1072.
SUBROUTINE H37(s,alam,aa,A,F1,F2)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
! Important: output is force not resistance (force/velocity) unlike other subroutines
! A = 5d-13 ! Hamaker constant g.cm2/s2
a1 = aa / 1d4 ! radius in cm
a2 = alam * a1
mu = 1.7d-4 ! dyn visc of air
pi = 4d0*DATAN(1d0)
! Dimensional formulation: doi.org/10.1016/S0031-8914(37)80203-7
! r = (a1+a2)/2d0*s
! D1 = r**2-(a1+a2)**2
! D2 = r**2-(a1-a2)**2
! F = A/6d0*(4d0*a1*a2)**3*r/D1**2/D2**2 ! d(8) / dC
! F1 = F/(6d0*pi*mu*a1)
! F2 = F/(6d0*pi*mu*a2)
! Dimensionless formulation: doi.org/10.1017/S002211208400286X
D1 = (s**2-4d0)*(1d0+alam)**2
D2 = s**2*(1d0+alam)**2-4d0*(1d0-alam)**2
F = A/6d0*(16d0*alam)**3*s*(1d0+alam)**2/D1**2/D2**2 ! d(2.2a) / dr
F1 = F/(6d0*pi*mu*a1)*2d0/(a1+a2) ! Note1: dPhi / dr = dPhi / ds * ds / dr
F2 = F/(6d0*pi*mu*a2)*2d0/(a1+a2) ! Note2: ds / dr = 2 / ( a1 + a2 )
END SUBROUTINE
! ======================================================================
! === Goldman, Cox, Brenner (1966) - Translation =======================
! Goldman, A. J., Cox, R. G., & Brenner, H. (1966). The slow motion of two identical arbitrarily oriented spheres through a viscous fluid. Chemical Engineering Science, 21(12), 1151-1170.
! "Cross effects" due to translation-rotation
! coupling: for any alpha the ratio of F1 from
! rotating spheres subroutine to T1 of this
! (translating spheres) subroutine is 4/3, given
! in (4.40) in the paper
SUBROUTINE GCB66T(al,F1,T1,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:) :: At
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:,:) :: T
F1o= 0d0
T1o= 0d0
iN = 50
1 ALLOCATE ( T(iN,4), At(-1:iN+1) )
At = 0d0
DO i = 1, iN
n = DBLE(i)
T(i,1) = (n-1d0)*(gam(n-1d0,al)-1d0)-(n-1d0)*(2d0*n-3d0)/(2d0*n-1d0)*(gam(n,al)-1d0)
T(i,2) = (2d0*n+1d0)-5d0*gam(n,al)-n*(2d0*n-1d0)/(2d0*n+1d0)*(gam(n-1d0,al)+1d0) &
+ (n+1d0)*(2d0*n+3d0)/(2d0*n+1d0)*(gam(n+1d0,al)-1d0)
T(i,3) = (n+2d0)*(2d0*n+5d0)/(2d0*n+3d0)*(gam(n,al)+1d0)-(n+2d0)*(gam(n+1d0,al)+1d0)
T(i,4) = DSQRT(2d0)*DEXP(-(n+5d-1)*al)*( DEXP(al)/DCOSH((n-5d-1)*al) &
- 2d0/DCOSH((n+5d-1)*al)+DEXP(-al)/DCOSH((n+15d-1)*al) )
ENDDO
CALL TDMA(iN,T)
At(1:iN) = T(1:iN,4)
sumF = 0d0
sumT = 0d0
DO i = 0, iN
n = DBLE(i)
Bt_n = 2d0*(n-1d0)/(2d0*n-1d0)*(gam(n,al)-1d0)*At(i-1) &
- 2d0*gam(n,al)*At(i) + 2d0*(n+2d0)/(2d0*n+3d0) &
* (gam(n,al)+1d0)*At(i+1)
Dt_n = DSQRT(8d0)*DEXP(-(n+5d-1)*al)/DCOSH((n+5d-1)*al) &
- n*(n-1d0)/(2d0*n-1d0)*(gam(n,al)-1d0) *At(i-1) &
+ (n+1d0)*(n+2d0)/(2d0*n+3d0)*(gam(n,al)+1d0)*At(i+1)
sumF = sumF + Dt_n + n*(n+1d0) * Bt_n
sumT = sumT + 2d0*n* (n+1d0)*(2d0+DEXP(-(2d0*n+1d0)*al)) &
* At(i) + (2d0-DEXP(-(2d0*n+1d0)*al)) &
* ( n*(n+1d0) * Bt_n / DTANH(al) -(2d0*n+1d0-1d0 &
/ DTANH(al)) * Dt_n )
ENDDO
DEALLOCATE ( T, At )
F1 = DSQRT(2d0)/6d0 * DSINH(al) * sumF ! (3.57) normalized by —6πμaU
T1 =-DSINH(al)**2/DSQRT(288d0) * sumT ! (3.58) normalized by —8πμa²U
rel = MAX(DABS(F1-F1o)/DABS(F1),DABS(T1-T1o)/DABS(T1))
IF ( rel .GT. acu ) THEN
iN = INT(2.0 * FLOAT(iN)) ! 100% increase
F1o= F1
T1o= T1
! WRITE(*,*) "n_max, F1, T1 = ", iN,F1,T1
GOTO 1
ENDIF
END SUBROUTINE
! ======================================================================
! === Goldman, Cox, Brenner (1966) - Rotation ==========================
! Goldman, A. J., Cox, R. G., & Brenner, H. (1966). The slow motion of two identical arbitrarily oriented spheres through a viscous fluid. Chemical Engineering Science, 21(12), 1151-1170.
! "Cross effects" due to translation-rotation
! coupling: for any alpha the ratio of F1 from this
! (rotating spheres) subroutine to T1 of the
! translating spheres subroutine is 4/3, given
! in (4.40) in the paper
SUBROUTINE GCB66R(al,F1,T1,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:) :: Ar
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:,:) :: T
F1o= 0d0
T1o= 0d0
iN = 50
1 ALLOCATE ( T(iN,4), Ar(-1:iN+1) )
Ar = 0d0
DO i = 1, iN
n = DBLE(i)
T(i,1) = (n-1d0)*(gam(n-1d0,al)-1d0)-(n-1d0)*(2d0*n-3d0)/(2d0*n-1d0)*(gam(n,al)-1d0)
T(i,2) = (2d0*n+1d0)-5d0*gam(n,al)-n*(2d0*n-1d0)/(2d0*n+1d0)*(gam(n-1d0,al)+1d0) &
+ (n+1d0)*(2d0*n+3d0)/(2d0*n+1d0)*(gam(n+1d0,al)-1d0)
T(i,3) = (n+2d0)*(2d0*n+5d0)/(2d0*n+3d0)*(gam(n,al)+1d0)-(n+2d0)*(gam(n+1d0,al)+1d0)
T(i,4) = DSQRT(2d0) * DEXP(-(n+5d-1)*al) / DSINH(al) * &
( (2d0*n+1d0)/ DCOSH((n+5d-1)*al) * &
( DEXP(al)/(2d0*n-1d0) + DEXP(-al)/(2d0*n+3d0) ) &
- (2d0*n-1d0)/(2d0*n+1d0) / DCOSH((n- 5d-1)*al) &
- (2d0*n+3d0)/(2d0*n+1d0) / DCOSH((n+15d-1)*al) )
ENDDO
CALL TDMA(iN,T)
Ar(1:iN) = T(1:iN,4)
sumF = 0d0
sumT = 0d0
DO i = 0, iN
n = DBLE(i)
Br_n = 4d0*tau(n,al)/DSINH(al)/DCOSH((n+5d-1)*al) &
+ 2d0*(n-1d0)/(2d0*n-1d0)*(gam(n,al)-1d0)*Ar(i-1) &
- 2d0*gam(n,al)*Ar(i) + 2d0*(n+2d0)/(2d0*n+3d0) &
* (gam(n,al)+1d0)*Ar(i+1)
Dr_n = DSQRT(8d0)/DSINH(al) / DCOSH((n+05d-1)*al) &
* ( n**2 /(2d0*n-1d0)*DEXP(-(n-05d-1)*al) &
- (n+1d0)**2/(2d0*n+3d0)*DEXP(-(n+15d-1)*al) ) &
- n*(n-1d0)/(2d0*n-1d0)*(gam(n,al)-1d0) *Ar(i-1) &
+ (n+1d0)*(n+2d0)/(2d0*n+3d0)*(gam(n,al)+1d0)*Ar(i+1)
sumF = sumF + Dr_n + n*(n+1d0) * Br_n
sumT = sumT + 2d0*n*(n+1d0)*(2d0+DEXP(-(2d0*n+1d0)*al)) &
* Ar(i) +(2d0-DEXP(-(2d0*n+1d0)*al)) &
* ( n*(n+1d0) * Br_n / DTANH(al)-(2d0*n+1d0-1d0 &
/ DTANH(al)) * Dr_n )
ENDDO
DEALLOCATE ( T, Ar )
F1 = DSQRT(2d0)/6d0*DSINH(al)**2 * sumF ! (4.24) normalized by —6πμa²Ω
T1 = 1d0/3d0-DSINH(al)**3/DSQRT(288d0) * sumT ! (4.25) normalized by —8πμa³Ω
rel = MAX(DABS(F1-F1o)/DABS(F1),DABS(T1-T1o)/DABS(T1))
IF ( rel .GT. acu ) THEN
iN = INT(2.0 * FLOAT(iN)) ! 100% increase
F1o= F1
T1o= T1
! WRITE(*,*) "n_max, F1, T1 = ", iN,F1,T1
GOTO 1
ENDIF
END SUBROUTINE
! === F U N C T I O N S : G C B (1966) ================================
FUNCTION gam(n,al)
IMPLICIT DOUBLE PRECISION (A-Z)
gam = DTANH((n+5d-1)*al)/DTANH(al)
END
FUNCTION tau(n,al)
IMPLICIT DOUBLE PRECISION (A-Z)
DOUBLE PRECISION :: n,al
tau = (DEXP(-(n+15d-1)*al)/(2d0*n+3d0)-DEXP(-(n-5d-1)*al)/(2d0*n-1d0))/DSQRT(2d0)
END
! ======================================================================
! === O'Neill (1969) - Rotation ========================================
! O'Neill, M. E. (1969). Exact solutions of the equations of slow viscous flow generated by the asymmetrical motion of two equal spheres. Applied Scientific Research, 21(1), 452-466.
SUBROUTINE ON69R(al,f1,g1,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:) :: An
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:,:) :: T
f1o= 0d0
g1o= 0d0
iN = 50
1 ALLOCATE ( T(iN,4), An(-1:iN+1) )
An = 0d0
DO i = 1, iN
n = DBLE(i)
fctr1 = (2d0*n-3d0)*gma(n,al)-(2d0*n-1d0)*gma(n-1d0,al)+2d0
fctr2 = (2d0*n+3d0)*gma(n+1d0,al)-(2d0*n+5d0)*gma(n,al)-2d0
T(i,1) = fctr1 * (n-1d0)/(2d0*n-1d0)
T(i,2) = fctr1 * -n/(2d0*n+1d0) + fctr2 * -(n+1d0)/(2d0*n+1d0)
T(i,3) = fctr2 * (n+2d0)/(2d0*n+3d0)
T(i,4) = DSQRT(2d0)/DCOSH(al) * &
( (gma(n-1d0,al)-1d0/DTANH(al))*(2d0*n-1d0)/(2d0*n+1d0)*DEXP(-al) &
- (gma(n,al)-1d0/DTANH(al))*((2d0*n+1d0)/(2d0*n-1d0)*DEXP(al)+(2d0*n+1d0)/(2d0*n+3d0)*DEXP(-al)) &
+ (gma(n+1d0,al)-1d0/DTANH(al))*(2d0*n+3d0)/(2d0*n+1d0)*DEXP(al) )
ENDDO
CALL TDMA(iN,T)
An(1:iN) = T(1:iN,4)
sumf = 0d0
sumg = 0d0
DO i = 0, iN
n = DBLE(i)
D_n = (n+1d0)*(n+2d0)/(2d0*n+3d0)*An(i+1)*(gma(n,al)+1d0) &
- n *(n-1d0)/(2d0*n-1d0)*An(i-1)*(gma(n,al)-1d0) &
+ DSQRT(8d0) / DCOSH(al) * (gma(n,al)-1d0/DTANH(al)) &
* ( n**2*DEXP(al)/(2d0*n-1d0)-(n+1d0)**2*DEXP(-al)/(2d0*n+3d0) )
sumf = sumf + D_n
sumg = sumg + D_n * (2d0*n+1d0-1d0/DTANH(al))
ENDDO
DEALLOCATE ( T, An )
f1 =-DSQRT(2d0)/3d0 * DSINH(al)**2 * sumf ! (5.1) normalized by —6πμa²Ω
g1 = DSQRT(2d0)/4d0 * DSINH(al)**3 * sumg ! (5.2) normalized by —8πμa³Ω
rel = MAX(DABS(f1-f1o)/DABS(f1),DABS(g1-g1o)/DABS(g1))
IF ( rel .GT. acu ) THEN
iN = INT(2.0 * FLOAT(iN)) ! 100% increase
f1o = f1
g1o = g1
! WRITE(*,*) "n_max, f1, g1 = ", iN,f1,g1
GOTO 1
ENDIF
END SUBROUTINE
! ======================================================================
! === O'Neill (1969) - Translation =====================================
! O'Neill, M. E. (1969). Exact solutions of the equations of slow viscous flow generated by the asymmetrical motion of two equal spheres. Applied Scientific Research, 21(1), 452-466.
SUBROUTINE ON69T(al,f2,g2,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:) :: An
DOUBLE PRECISION, ALLOCATABLE, DIMENSION (:,:) :: T
f2o= 0d0
g2o= 0d0
iN = 50
1 ALLOCATE ( T(iN,4), An(-1:iN+1) )
An = 0d0
DO i = 1, iN
n = DBLE(i)
fctr1 = (2d0*n-3d0)*gma(n,al)-(2d0*n-1d0)*gma(n-1d0,al)+2d0
fctr2 = (2d0*n+3d0)*gma(n+1d0,al)-(2d0*n+5d0)*gma(n,al)-2d0
T(i,1) = fctr1 * (n-1d0)/(2d0*n-1d0)
T(i,2) = fctr1 * -n/(2d0*n+1d0) + fctr2 * -(n+1d0)/(2d0*n+1d0)
T(i,3) = fctr2 * (n+2d0)/(2d0*n+3d0)
T(i,4) = DSQRT(2d0)*DTANH(al)*(2d0*gma(n,al)-gma(n-1d0,al)-gma(n+1d0,al))
ENDDO
CALL TDMA(iN,T)
An(1:iN) = T(1:iN,4)
sumf = 0d0
sumg = 0d0
DO i = 0, iN
n = DBLE(i)
D_n = (n+1d0)*(n+2d0)/(2d0*n+3d0)*An(i+1)*(gma(n,al)+1d0) &
- n *(n-1d0)/(2d0*n-1d0)*An(i-1)*(gma(n,al)-1d0) &
+ DSQRT(8d0)*(DTANH((n+5d-1)*al)**(-1)-1d0)
sumf = sumf + D_n
sumg = sumg + D_n * (2d0*n+1d0-1d0/DTANH(al))
ENDDO
DEALLOCATE ( T, An )
f2 = DSQRT(2d0)/3d0 * DSINH(al) * sumf ! (5.3) normalized by —6πμaU
g2 =-DSQRT(2d0)/4d0 * DSINH(al)**2 * sumg ! (5.4) normalized by —8πμa²U
rel = MAX(DABS(f2-f2o)/DABS(f2),DABS(g2-g2o)/DABS(g2))
IF ( rel .GT. acu ) THEN
iN = INT(2.0 * FLOAT(iN)) ! 100% increase
f2o = f2
g2o = g2
! WRITE(*,*) "n_max, f2, g2 = ", iN,f2,g2,rel
GOTO 1
ENDIF
END SUBROUTINE
! ======================================================================
! === Forces acting on a pair of freely rotating equal-sized spheres ===
SUBROUTINE FREEROTEQUAL(opp,al,F,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
LOGICAL opp
IF (opp) THEN
CALL ON69T(al,F1,T1,acu)
F_tra = F1
T_tra = T1
CALL ON69R(al,F1,T1,acu)
F_rot = F1
T_rot = T1
ELSE
CALL GCB66T(al,F1,T1,acu)
F_tra = F1
T_tra = T1
CALL GCB66R(al,F1,T1,acu)
F_rot = F1
T_rot = T1
ENDIF
F = F_tra - F_rot * T_tra / T_rot
END SUBROUTINE
! ======================================================================
! === O'Neill & Majumdar (1970) - Rotation =============================
! O'Neill, M. E., & Majumdar, R. (1970). Asymmetrical slow viscous fluid motions caused by the translation or rotation of two spheres. Part I: The determination of exact solutions for any values of the ratio of radii and separation parameters. Zeitschrift für angewandte Mathematik und Physik ZAMP, 21(2), 164-179.
SUBROUTINE ONM70R(opp,al,be,fg,F1,F2,T1,T2,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:) :: An, Bn
DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:) :: T
DOUBLE PRECISION :: fg(4,4)
LOGICAL opp
alam =-DSINH(al)/DSINH(be)
rlam = 1d0/alam
F1o= 0d0
F2o= 0d0
T1o= 0d0
T2o= 0d0
iN = 25
1 ALLOCATE ( T(2*iN,8), An(-1:iN+1), Bn(-1:iN+1) )
j = 1 ! first droplet
2 T = 0d0
DO i = 1, iN
n = DBLE(i)
fctr1 = (2d0*n-1d0)*alpha(n-1d0,al,be)-(2d0*n-3d0)*alpha(n,al,be)+2d0*kappa(al,be)
fctr2 = (2d0*n+5d0)*alpha(n,al,be)-(2d0*n+3d0)*alpha(n+1d0,al,be)+2d0*kappa(al,be)
fctr3 = (2d0*n-1d0)*(gamm(n-1d0,al,be)-dlta(n-1d0,al,be))-(2d0*n-3d0)*(gamm(n,al,be)-dlta(n,al,be))-4d0
fctr4 = (2d0*n+5d0)*(gamm(n,al,be)-dlta(n,al,be))-(2d0*n+3d0)*(gamm(n+1d0,al,be)-dlta(n+1d0,al,be))+4d0
IF (i.GT.1) THEN
T(2*i-1,2) = fctr3 * (n-1d0)/(2d0*n-1d0) ! B_n-1 (39)
T(2*i-1,3) = fctr1 * (n-1d0)/(2d0*n-1d0) ! A_n-1 (39)
ENDIF
T(2*i-1,4) = fctr3 * -n/(2d0*n+1d0) - fctr4 * (n+1d0)/(2d0*n+1d0) ! B_n (39)
T(2*i-1,5) = fctr1 * -n/(2d0*n+1d0) - fctr2 * (n+1d0)/(2d0*n+1d0) ! A_n (39)
IF (i.LT.iN) THEN
T(2*i-1,6) = fctr4 * (n+2d0)/(2d0*n+3d0) ! B_n+1 (39)
T(2*i-1,7) = fctr2 * (n+2d0)/(2d0*n+3d0) ! A_n+1 (39)
ENDIF
T(2*i-1,8) = D_1R(n,al,be)
fctr1 = (2d0*n-1d0)*(gamm(n-1d0,al,be)+dlta(n-1d0,al,be))-(2d0*n-3d0)*(gamm(n,al,be)+dlta(n,al,be))+4d0
fctr2 = (2d0*n+5d0)*(gamm(n,al,be)+dlta(n,al,be))-(2d0*n+3d0)*(gamm(n+1d0,al,be)+dlta(n+1d0,al,be))-4d0
fctr3 = (2d0*n-1d0)*alpha(n-1d0,al,be)-(2d0*n-3d0)*alpha(n,al,be)-2d0*kappa(al,be)
fctr4 = (2d0*n+5d0)*alpha(n,al,be)-(2d0*n+3d0)*alpha(n+1d0,al,be)-2d0*kappa(al,be)
IF (i.GT.1) THEN
T(2*i,1) = fctr3 * (n-1d0)/(2d0*n-1d0) ! B_n-1 (40)
T(2*i,2) = fctr1 * (n-1d0)/(2d0*n-1d0) ! A_n-1 (40)
ENDIF
T(2*i,3) = fctr3 * -n/(2d0*n+1d0) - fctr4 * (n+1d0)/(2d0*n+1d0) ! B_n (40)
T(2*i,4) = fctr1 * -n/(2d0*n+1d0) - fctr2 * (n+1d0)/(2d0*n+1d0) ! A_n (40)
IF (i.LT.iN) THEN
T(2*i,5) = fctr4 * (n+2d0)/(2d0*n+3d0) ! B_n+1 (40)
T(2*i,6) = fctr2 * (n+2d0)/(2d0*n+3d0) ! A_n+1 (40)
ENDIF
T(2*i,8) = D_2R(n,al,be)
ENDDO
CALL THOMAS(2*iN,3,3,T)
An = 0d0
Bn = 0d0
DO i = 1, iN
An(i) = T(2*i ,8)
Bn(i) = T(2*i-1,8)
ENDDO
f11 = 0d0
g11 = 0d0
f12 = 0d0
g12 = 0d0
DO i = 0, iN
n = DBLE(i)
En =-(kappa(al,be)+alpha(n,al,be))/2d0*(n*(n-1d0)/(2d0*n-1d0)*An(i-1)-(n+1d0)*(n+2d0)/(2d0*n+3d0)*An(i+1))-(gamm(n,al,be) &
- dlta(n,al,be))/2d0*(n*(n-1d0)/(2d0*n-1d0)*Bn(i-1)-(n+1d0)*(n+2d0)/(2d0*n+3d0)*Bn(i+1))+n*(n-1d0)/(2d0*n-1d0)*Bn(i-1) &
+ (n+1d0)*(n+2d0)/(2d0*n+3d0)*Bn(i+1)+(lambda(n,al)/DSINH(al) &
- DSQRT(2d0)*(2d0*n+1d0)*DEXP(-(n+5d-1)*al))*DSINH((n+5d-1)*be)/DSINH((n+5d-1)*(al-be))
Fn = (gamm(n,al,be)+dlta(n,al,be))/2d0*(n*(n-1d0)/(2d0*n-1d0)*An(i-1)-(n+1d0)*(n+2d0)/(2d0*n+3d0)*An(i+1))-(kappa(al,be) &
- alpha(n,al,be))/2d0*(n*(n-1d0)/(2d0*n-1d0)*Bn(i-1)-(n+1d0)*(n+2d0)/(2d0*n+3d0)*Bn(i+1))+n*(n-1d0)/(2d0*n-1d0)*An(i-1) &
+ (n+1d0)*(n+2d0)/(2d0*n+3d0)*An(i+1)-(lambda(n,al)/DSINH(al) &
- DSQRT(2d0)*(2d0*n+1d0)*DEXP(-(n+5d-1)*al))*DCOSH((n+5d-1)*be)/DSINH((n+5d-1)*(al-be))
f11 = f11 + ( En + Fn )
f12 = f12 + ( En - Fn )
g11 = g11 + ( En + Fn ) * ( 2d0*n + 1d0 - 1d0 / DTANH( al) )
g12 = g12 + ( En - Fn ) * ( 2d0*n + 1d0 - 1d0 / DTANH(-be) )
ENDDO
f11 = DSQRT(2d0)/3d0*DSINH( al)**2*f11 ! (5.7)
f12 = DSQRT(2d0)/3d0*DSINH(-be)**2*f12 ! (5.9)
g11 = DSQRT(2d0)/4d0*DSINH( al)**3*g11 ! (5.8)
g12 = DSQRT(2d0)/4d0*DSINH(-be)**3*g12 ! (5.10) typo !
! IF ( j .EQ. 1 ) WRITE(*,*)"f11,f12,g11,g12=",f11,f12,g11,g12
! IF ( j .EQ. 2 ) WRITE(*,*)"f12,f11,g12,g11=",f12,f11,g12,g11
IF ( j .EQ. 1 ) THEN
YB11 = f11*3d0/2d0
YB12 = f12*6d0/(1d0+rlam)**2
YC11 = g11
YC21 =-g12*8d0/(1d0+rlam)**3
fg(1,1) = f11
fg(1,2) = f12
fg(1,3) = g11
fg(1,4) = g12
tmp =-al
al =-be
be = tmp
j = 2 ! second droplet
GOTO 2
ENDIF
DEALLOCATE ( T, An, Bn )
fg(2,1) = f12
fg(2,2) = f11
fg(2,3) = g12
fg(2,4) = g11
tmp=-al
al =-be
be = tmp
YB22 =-f11*3d0/2d0
YB21 =-f12*6d0/(1d0+alam)**2
YC22 = g11
YC12 =-g12*8d0/(1d0+alam)**3
! Normalization: —6πμa²Ω & —8πμa³Ω
IF (opp) THEN
F1 =-fg(1,1) - fg(2,1)
F2 = fg(1,2) + fg(2,2)
T1 = fg(1,3) + fg(2,3)
T2 = fg(1,4) + fg(2,4)
ELSE
F1 =-fg(1,1) + fg(2,1)
F2 =-fg(1,2) + fg(2,2)
T1 = fg(1,3) - fg(2,3)
T2 =-fg(1,4) + fg(2,4)
ENDIF
rel = MAX(DABS(F1-F1o)/DABS(F1),DABS(F2-F2o)/DABS(F2),DABS(T1-T1o)/DABS(T1),DABS(T2-T2o)/DABS(T2))
IF ( rel .GT. acu ) THEN
iN = INT(1.5 * FLOAT(iN)) ! 50% increase
F1o = F1
F2o = F2
T1o = T1
T2o = T2
! WRITE(*,*) "n_max, F1, F2, T1, T2 = ", iN,F1,F2,T1,T2,rel
GOTO 1
ENDIF
! WRITE(1,*) YB11, YB12, YB21, YB22
! WRITE(1,*) YC11, YC12, YC21, YC22
END SUBROUTINE
! ======================================================================
! === O'Neill & Majumdar (1970) - Translation ==========================
! O'Neill, M. E., & Majumdar, R. (1970). Asymmetrical slow viscous fluid motions caused by the translation or rotation of two spheres. Part I: The determination of exact solutions for any values of the ratio of radii and separation parameters. Zeitschrift für angewandte Mathematik und Physik ZAMP, 21(2), 164-179.
SUBROUTINE ONM70T(opp,al,be,fg,F1,F2,T1,T2,acu)
IMPLICIT DOUBLE PRECISION (A-H,K-Z)
DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:) :: An, Bn
DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:,:) :: T
DOUBLE PRECISION :: fg(4,4)
LOGICAL opp
F1o= 0d0
F2o= 0d0
T1o= 0d0
T2o= 0d0
iN = 25
1 ALLOCATE ( T(2*iN,8), An(-1:iN+1), Bn(-1:iN+1) )
j = 1 ! first droplet
2 T = 0d0
DO i = 1, iN
n = DBLE(i)
fctr1 = (2d0*n-1d0)*alpha(n-1d0,al,be)-(2d0*n-3d0)*alpha(n,al,be)+2d0*kappa(al,be)
fctr2 = (2d0*n+5d0)*alpha(n,al,be)-(2d0*n+3d0)*alpha(n+1d0,al,be)+2d0*kappa(al,be)
fctr3 = (2d0*n-1d0)*(gamm(n-1d0,al,be)-dlta(n-1d0,al,be))-(2d0*n-3d0)*(gamm(n,al,be)-dlta(n,al,be))-4d0
fctr4 = (2d0*n+5d0)*(gamm(n,al,be)-dlta(n,al,be))-(2d0*n+3d0)*(gamm(n+1d0,al,be)-dlta(n+1d0,al,be))+4d0
IF (i.GT.1) THEN
T(2*i-1,2) = fctr3 * (n-1d0)/(2d0*n-1d0) ! B_n-1 (39)
T(2*i-1,3) = fctr1 * (n-1d0)/(2d0*n-1d0) ! A_n-1 (39)
ENDIF
T(2*i-1,4) = fctr3 * -n/(2d0*n+1d0) - fctr4 * (n+1d0)/(2d0*n+1d0) ! B_n (39)
T(2*i-1,5) = fctr1 * -n/(2d0*n+1d0) - fctr2 * (n+1d0)/(2d0*n+1d0) ! A_n (39)
IF (i.LT.iN) THEN
T(2*i-1,6) = fctr4 * (n+2d0)/(2d0*n+3d0) ! B_n+1 (39)
T(2*i-1,7) = fctr2 * (n+2d0)/(2d0*n+3d0) ! A_n+1 (39)
ENDIF
T(2*i-1,8) = D_1T(n,al,be)
fctr1 = (2d0*n-1d0)*(gamm(n-1d0,al,be)+dlta(n-1d0,al,be))-(2d0*n-3d0)*(gamm(n,al,be)+dlta(n,al,be))+4d0
fctr2 = (2d0*n+5d0)*(gamm(n,al,be)+dlta(n,al,be))-(2d0*n+3d0)*(gamm(n+1d0,al,be)+dlta(n+1d0,al,be))-4d0
fctr3 = (2d0*n-1d0)*alpha(n-1d0,al,be)-(2d0*n-3d0)*alpha(n,al,be)-2d0*kappa(al,be)
fctr4 = (2d0*n+5d0)*alpha(n,al,be)-(2d0*n+3d0)*alpha(n+1d0,al,be)-2d0*kappa(al,be)
IF (i.GT.1) THEN
T(2*i,1) = fctr3 * (n-1d0)/(2d0*n-1d0) ! B_n-1 (40)
T(2*i,2) = fctr1 * (n-1d0)/(2d0*n-1d0) ! A_n-1 (40)
ENDIF
T(2*i,3) = fctr3 * -n/(2d0*n+1d0) - fctr4 * (n+1d0)/(2d0*n+1d0) ! B_n (40)
T(2*i,4) = fctr1 * -n/(2d0*n+1d0) - fctr2 * (n+1d0)/(2d0*n+1d0) ! A_n (40)
IF (i.LT.iN) THEN
T(2*i,5) = fctr4 * (n+2d0)/(2d0*n+3d0) ! B_n+1 (40)
T(2*i,6) = fctr2 * (n+2d0)/(2d0*n+3d0) ! A_n+1 (40)
ENDIF
T(2*i,8) = D_2T(n,al,be)
ENDDO
CALL THOMAS(2*iN,3,3,T)
An = 0d0
Bn = 0d0
DO i = 1, iN
An(i) = T(2*i ,8)
Bn(i) = T(2*i-1,8)
ENDDO
f21 = 0d0
g21 = 0d0
f22 = 0d0
g22 = 0d0
DO i = 0, iN
n = DBLE(i)