-
Notifications
You must be signed in to change notification settings - Fork 49
/
seismic_ADEPML_2D_viscoelastic_RK4_eighth_order.f90
1774 lines (1450 loc) · 65.2 KB
/
seismic_ADEPML_2D_viscoelastic_RK4_eighth_order.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
!
! Copyright Universite de Pau et des Pays de l'Adour, CNRS and INRIA, France.
! Contributors: Roland Martin, roland DOT martin aT get DOT obs-mip DOT fr
! and Ruiqi Shi and Youshan Liu, China.
!
! RK4 bug detected by Youshan Liu, China fixed by Quentin Brissaud, France and also Caltech (USA) in this version in March 2018.
!
! Ruiqi Shi, Department of Exploration Geophysics, China University of Petroleum, Beijing, China.
! Email: shiruiqi123 AT gmail DOT com
!
! This software is a computer program whose purpose is to solve
! the two-dimensional viscoelastic wave equation
! using a finite-difference method with Auxiliary Differential
! Equation Perfectly Matched Layer (ADE-PML) conditions.
!
! 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, write to the Free Software Foundation, Inc.,
! 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
!
! The full text of the license is available in file "LICENSE".
program seismic_ADEPML_2D_viscoelastic_RK4_eighth_order
! High order 2D explicit-semi implicit-implicit viscoelastic finite-difference code
! in velocity and stress formulation with Auxiliary Differential
! Equation Perfectly Matched Layer (ADE-PML) absorbing conditions for
! an SLS viscoelastic medium. It is fourth order Runge-Kutta (RK4) in time
! and 8th order in space using Holberg spatial discretization.
! Version 1.1.3
! by Roland Martin, University of Pau, France, Jan 2010
! with improvements by Ruiqi Shi and
! with a major bug fix in the Runge-Kutta implementation
! and also significant memory usage optimization by Youshan Liu, China, August 2015.
! based on seismic_CPML_2D_isotropic_second_order.f90
! by Dimitri Komatitsch and Roland Martin, University of Pau, France, 2007.
! *BEWARE* that the attenuation model implemented below is that of J. M. Carcione,
! Seismic modeling in viscoelastic media, Geophysics, vol. 58(1), p. 110-120 (1993), which is NON causal,
! i.e., waves speed up instead of slowing down when turning attenuation on.
! This comes from the fact that in that model the relaxed state at zero frequency is used as a reference instead of
! the unrelaxed state at infinite frequency. These days a causal model should be used instead,
! i.e. one using the unrelaxed state at infinite frequency as a reference.
! The 8th-order staggered-grid formulation of Holberg is used:
!
! ^ y
! |
! |
!
! +-------------------+
! | |
! | |
! | |
! | |
! | v_y |
! sigma_xy +---------+ |
! | | |
! | | |
! | | |
! | | |
! | | |
! +---------+---------+ ---> x
! v_x sigma_xx
! sigma_yy
!
! The ADE-PML implementation is based in part on formulas given in Roden and Gedney (2010)
!
! If you use this code for your own research, please cite some (or all) of these articles:
!
! @Article{BlKoChLoXi15,
! Title = {Positivity-preserving highly-accurate optimization of the {Z}ener viscoelastic model, with application
! to wave propagation in the presence of strong attenuation},
! Author = {\'Emilie Blanc and Dimitri Komatitsch and Emmanuel Chaljub and Bruno Lombard and Zhinan Xie},
! Journal = {Geophysical Journal International},
! Year = {2015},
! Note = {in press.}}
!
! @ARTICLE{MaKoGeBr10,
! author = {Roland Martin and Dimitri Komatitsch and Stephen D. Gedney and Emilien Bruthiaux},
! title = {A high-order time and space formulation of the unsplit perfectly matched layer
! for the seismic wave equation using {Auxiliary Differential Equations (ADE-PML)}},
! journal = {Comput. Model. Eng. Sci.},
! year = {2010},
! volume = {56},
! pages = {17-42},
! number = {1}}
!
! @ARTICLE{MaCo10,
! author = {Roland Martin and Carlos Couder-Casta{\~n}eda},
! title = {An improved unsplit and convolutional Perfectly Matched Layer
! absorbing technique for the Navier-Stokes equations using cut-off frequency shift},
! journal = {Comput. Model. Eng. Sci.},
! pages ={47-77}
! year = {2010},
! volume = {63},
! number = {1}}
!
! @ARTICLE{KoMa07,
! author = {Dimitri Komatitsch and Roland Martin},
! title = {An unsplit convolutional {P}erfectly {M}atched {L}ayer improved
! at grazing incidence for the seismic wave equation},
! journal = {Geophysics},
! year = {2007},
! volume = {72},
! number = {5},
! pages = {SM155-SM167},
! doi = {10.1190/1.2757586}}
!
! @ARTICLE{MaKoEz08,
! author = {Roland Martin and Dimitri Komatitsch and Abdelaaziz Ezziani},
! title = {An unsplit convolutional perfectly matched layer improved at grazing
! incidence for seismic wave equation in poroelastic media},
! journal = {Geophysics},
! year = {2008},
! volume = {73},
! pages = {T51-T61},
! number = {4},
! doi = {10.1190/1.2939484}}
!
! @ARTICLE{MaKoGe08,
! author = {Roland Martin and Dimitri Komatitsch and Stephen D. Gedney},
! title = {A variational formulation of a stabilized unsplit convolutional perfectly
! matched layer for the isotropic or anisotropic seismic wave equation},
! journal = {Computer Modeling in Engineering and Sciences},
! year = {2008},
! volume = {37},
! pages = {274-304},
! number = {3}}
!
! @ARTICLE{MaKo09,
! author = {Roland Martin and Dimitri Komatitsch},
! title = {An unsplit convolutional perfectly matched layer technique improved
! at grazing incidence for the viscoelastic wave equation},
! journal = {Geophysical Journal International},
! year = {2009},
! volume = {179},
! pages = {333-344},
! number = {1},
! doi = {10.1111/j.1365-246X.2009.04278.x}}
!
! @ARTICLE{RoGe00,
! author = {J. A. Roden and S. D. Gedney},
! title = {Convolution {PML} ({CPML}): {A}n Efficient {FDTD} Implementation
! of the {CFS}-{PML} for Arbitrary Media},
! journal = {Microwave and Optical Technology Letters},
! year = {2000},
! volume = {27},
! number = {5},
! pages = {334-339},
! doi = {10.1002/1098-2760(20001205)27:5 < 334::AID-MOP14>3.0.CO;2-A}}
!
! To display the 2D results as color images, use:
!
! " display image*.gif " or " gimp image*.gif "
!
! or
!
! " montage -geometry +0+3 -rotate 90 -tile 1x21 image*Vx*.gif allfiles_Vx.gif "
! " montage -geometry +0+3 -rotate 90 -tile 1x21 image*Vy*.gif allfiles_Vy.gif "
! then " display allfiles_Vx.gif " or " gimp allfiles_Vx.gif "
! then " display allfiles_Vy.gif " or " gimp allfiles_Vy.gif "
!
! IMPORTANT : all our CPML codes work fine in single precision as well (which is significantly faster).
! If you want you can thus force automatic conversion to single precision at compile time
! or change all the declarations and constants in the code from double precision to single.
implicit none
! total number of grid points in each direction of the grid
integer, parameter :: NX = 141
integer, parameter :: NY = 621 ! NY = 800
! Explicit (epsn=1,epsn=0), implicit (epsn=0,epsn1=1), semi-implicit (epsn=0.5,epsn1=0.5)
integer, parameter :: iexpl=0
integer, parameter :: iimpl=0
integer, parameter :: isemiimpl=1
! size of a grid cell
double precision, parameter :: DELTAX = 5.d0, ONE_OVER_DELTAX = 1.d0 / DELTAX
double precision, parameter :: DELTAY = DELTAX
double precision, parameter :: ONE_OVER_DELTAY = ONE_OVER_DELTAX
double precision, parameter :: ONE=1.d0,TWO=2.d0, DIM=2.d0
! P-velocity, S-velocity and density
double precision, parameter :: cp_top = 3050.d0
double precision, parameter :: cs_top = 1950.d0
double precision, parameter :: rho_top = 2000.d0
double precision, parameter :: mu_top = rho_top*cs_top*cs_top
double precision, parameter :: lambda_top = rho_top*(cp_top*cp_top - 2.d0*cs_top*cs_top)
double precision, parameter :: lambdaplustwomu_top = rho_top*cp_top*cp_top
double precision, parameter :: cp_bottom = 2600.d0
double precision, parameter :: cs_bottom = 1500.d0
double precision, parameter :: rho_bottom = 1500.d0
double precision, parameter :: mu_bottom = rho_bottom*cs_bottom*cs_bottom
double precision, parameter :: lambda_bottom = rho_bottom*(cp_bottom*cp_bottom - 2.d0*cs_bottom*cs_bottom)
double precision, parameter :: lambdaplustwomu_bottom = rho_bottom*cp_bottom*cp_bottom
! total number of time steps
integer, parameter :: NSTEP = 5000
! time step in seconds
double precision, parameter :: DELTAT = 5.d-4
! parameters for the source
double precision, parameter :: f0 = 15.d0
double precision, parameter :: t0 = 1.20d0 / f0
double precision, parameter :: factor = 1.d5
! parameters for attenuation
! number of standard linear solids
integer, parameter :: N_SLS = 2
! Qp approximately equal to 13, Qkappa approximately to 20 and Qmu / Qs approximately to 10
double precision, parameter :: QKappa_att = 20.d0, QMu_att = 10.d0
double precision, parameter :: f0_attenuation = 16 ! in Hz
! flags to add PML layers to the edges of the grid
logical, parameter :: USE_PML_XMIN = .true.
logical, parameter :: USE_PML_XMAX = .true.
logical, parameter :: USE_PML_YMIN = .true.
logical, parameter :: USE_PML_YMAX = .true.
! thickness of the PML layer in grid points
integer, parameter :: NPOINTS_PML = 10
! heterogeneous model and height of the interface
logical, parameter :: HETEROGENEOUS_MODEL = .true.
! source
! integer, parameter :: ISOURCE = NX - 2*NPOINTS_PML - 1
integer, parameter :: ISOURCE = NPOINTS_PML+11
integer, parameter :: JSOURCE = 2*NY / 3
double precision, parameter :: xsource = (ISOURCE) * DELTAX
double precision, parameter :: ysource = (JSOURCE) * DELTAY
double precision, parameter :: INTERFACE_HEIGHT = ysource - 125*DELTAY
integer, parameter:: JINTERFACE=INT(INTERFACE_HEIGHT/DELTAY)+1
! angle of source force clockwise with respect to vertical (Y) axis
double precision, parameter :: ANGLE_FORCE = 45.d0
! receivers
integer, parameter :: NREC = 3
double precision, parameter :: xdeb = xsource - 100.d0 ! first receiver x in meters
double precision, parameter :: ydeb = 2300.d0 ! first receiver y in meters
double precision, parameter :: xfin = xsource ! last receiver x in meters
double precision, parameter :: yfin = 300.d0 ! last receiver y in meters
! display information on the screen from time to time
integer, parameter :: IT_DISPLAY = 500
! value of PI
double precision, parameter :: PI = 3.141592653589793238462643d0
! conversion from degrees to radians
double precision, parameter :: DEGREES_TO_RADIANS = PI / 180.d0
! zero
double precision, parameter :: ZERO = 0.d0
! large value for maximum
double precision, parameter :: HUGEVAL = 1.d+30
! velocity threshold above which we consider that the code became unstable
double precision, parameter :: STABILITY_THRESHOLD = 1.d+25
! Holberg (1987) coefficients, taken from
! @ARTICLE{Hol87,
! author = {O. Holberg},
! title = {Computational aspects of the choice of operator and sampling interval
! for numerical differentiation in large-scale simulation of wave phenomena},
! journal = {Geophysical Prospecting},
! year = {1987},
! volume = {35},
! pages = {629-655}}
double precision, parameter :: c1 = 1.231666d0
double precision, parameter :: c2 = -1.041182d-1
double precision, parameter :: c3 = 2.063707d-2
double precision, parameter :: c4 = -3.570998d-3
double precision, parameter :: coefficient_sum = abs(c1)+abs(c2)+abs(c3)+abs(c4)
! RK4 scheme coefficients, 2 per subloop, 8 in total
double precision, dimension(4) :: rk41, rk42
! power to compute d0 profile
double precision, parameter :: NPOWER = 2.d0
double precision, parameter :: NPOWER2 = 2.d0
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-11
!double precision, parameter :: K_MAX_PML = 7.d0
! double precision, parameter :: ALPHA_MAX_PML = 0.d0 ! from Festa and Vilotte
double precision, parameter :: ALPHA_MAX_PML_1 = 2.d0*PI*(f0/2.d0) ! from Festa and Vilotte
double precision K_MAX_PML_1
! double precision, parameter :: K_MAX_PML_2 = K_MAX_PML_1 / 15.d0
! double precision, parameter :: K_MAX_PML_2 = K_MAX_PML_1
! double precision, parameter :: ALPHA_MAX_PML_2 = ALPHA_MAX_PML_1 / 5.d0
! arrays for the memory variables
! could declare these arrays in PML only to save a lot of memory, but proof of concept only here
! We have as many memory variables as the number of frequency shift poles in the CPML
! Indices are 1 and 2 for the 2 frequency shift poles
double precision, dimension(4,-4:NX+4,-4:NY+4) :: &
memory_dvx_dx_1, &
memory_dvx_dy_1, &
memory_dvy_dx_1, &
memory_dvy_dy_1, &
memory_dsigmaxx_dx_1, &
memory_dsigmayy_dy_1, &
memory_dsigmaxy_dx_1, &
memory_dsigmaxy_dy_1
double precision, dimension(-4:NX+4,-4:NY+4) :: &
memory_vx_dx_1, &
memory_vx_dy_1, &
memory_vy_dx_1, &
memory_vy_dy_1, &
memory_sigmaxx_dx_1, &
memory_sigmayy_dy_1, &
memory_sigmaxy_dx_1, &
memory_sigmaxy_dy_1
double precision :: &
value_dvx_dx, &
value_dvx_dy, &
value_dvy_dx, &
value_dvy_dy, &
value_dsigmaxx_dx, &
value_dsigmayy_dy, &
value_dsigmaxy_dx, &
value_dsigmaxy_dy
double precision :: duxdx,duxdy,duydx,duydy,div
double precision :: epsn,epsn1,Sn
! 1D arrays for the damping profiles
double precision, dimension(-4:NX+4) :: d_x_1,K_x_1,alpha_prime_x_1,g_x_1,ksi_x
double precision, dimension(-4:NX+4) :: d_x_half_1,K_x_half_1,alpha_prime_x_half_1,g_x_half_1,ksi_x_half
double precision, dimension(-4:NY+4) :: d_y_1,K_y_1,alpha_prime_y_1,g_y_1,ksi_y
double precision, dimension(-4:NY+4) :: d_y_half_1,K_y_half_1,alpha_prime_y_half_1,g_y_half_1,ksi_y_half
! 1D arrays for the damping profiles
double precision, dimension(-4:NX+4) :: d_x_2,K_x_2,alpha_prime_x_2,g_x_2
double precision, dimension(-4:NX+4) :: d_x_half_2,K_x_half_2,alpha_prime_x_half_2,g_x_half_2
double precision, dimension(-4:NY+4) :: d_y_2,K_y_2,alpha_prime_y_2,g_y_2
double precision, dimension(-4:NY+4) :: d_y_half_2,K_y_half_2,alpha_prime_y_half_2,g_y_half_2
! coefficients that allow to reset the memory variables at each RK4 substep depend on the substepping and are then of dimension 4,
! 1D arrays for the damping profiles
double precision, dimension(4,-4:NX+4) :: a_x_1,b_x_1
double precision, dimension(4,-4:NX+4) :: a_x_half_1,b_x_half_1
double precision, dimension(4,-4:NY+4) :: a_y_1,b_y_1
double precision, dimension(4,-4:NY+4) :: a_y_half_1,b_y_half_1
double precision, dimension(-4:NX+4) :: r_x_1,s_x_1
double precision, dimension(-4:NX+4) :: r_x_half_1,s_x_half_1
double precision, dimension(-4:NY+4) :: r_y_1,s_y_1
double precision, dimension(-4:NY+4) :: r_y_half_1,s_y_half_1
! 1D arrays for the damping profiles
double precision, dimension(4,-4:NX+4) :: a_x_2
double precision, dimension(4,-4:NX+4) :: a_x_half_2
double precision, dimension(4,-4:NY+4) :: a_y_2
double precision, dimension(4,-4:NY+4) :: a_y_half_2
! PML
double precision :: thickness_PML_x,thickness_PML_y,xoriginleft,xoriginright,yoriginbottom,yorigintop
double precision :: Rcoef,d0_x,d0_y,xval,yval,abscissa_in_PML,abscissa_normalized
double precision, dimension(-4:NX+4,-4:NY+4) :: vx,vy,sigmaxx,sigmayy,sigmaxy
double precision, dimension(-4:NX+4,-4:NY+4) :: sigmaxx_R,sigmayy_R,sigmaxy_R
double precision, dimension(N_SLS,-4:NX+4,-4:NY+4) :: e1,e11,e22,e12
double precision, dimension(-4:NX+4,-4:NY+4) :: rho, mu,lambda,lambdaplustwomu
double precision rho_half_x_half_y
! variables are stored in four indices in the first dimension to implement RK4
! dv does not always indicate a derivative
double precision, dimension(4,-4:NX+4,-4:NY+4) :: dvx,dvy,dsigmaxx,dsigmayy,dsigmaxy
double precision, dimension(4,-4:NX+4,-4:NY+4) :: dsigmaxx_R,dsigmayy_R,dsigmaxy_R
double precision, dimension(N_SLS,4,-4:NX+4,-4:NY+4) :: de1,de11,de12
integer, parameter :: number_of_2Darrays = 2*8
integer, parameter :: number_of_3Darrays = 32
! for the source
double precision a,t,force_x,force_y,source_term
! for attenuation
double precision :: f_min_attenuation, f_max_attenuation
double precision, dimension(N_SLS) :: tau_epsilon_nu1,tau_sigma_nu1,tau_epsilon_nu2,tau_sigma_nu2
! for stability estimate
double precision :: c_max,c_min
! for receivers
double precision distval,dist
integer, dimension(NREC) :: ix_rec,iy_rec
double precision, dimension(NREC) :: xrec,yrec
! for seismograms
double precision, dimension(NSTEP,NREC) :: sisvx,sisvy
! max amplitude for color snapshots
double precision max_amplitudeVx
double precision max_amplitudeVy
! for evolution of total energy in the medium
double precision :: epsilon_xx,epsilon_yy,epsilon_xy
double precision, dimension(NSTEP) :: total_energy,total_energy_kinetic,total_energy_potential
double precision :: local_energy_kinetic,local_energy_potential
integer :: irec,inc
double precision :: mul_relaxed,lambdal_relaxed,lambdalplus2mul_relaxed
double precision :: mul_unrelaxed,lambdal_unrelaxed,lambdalplus2mul_unrelaxed
double precision :: Mu_nu1,Mu_nu2
double precision :: phi_nu1(N_SLS)
double precision :: phi_nu2(N_SLS)
double precision :: tauinv,inv_tau_sigma_nu1(N_SLS)
double precision :: taumin,taumax, tau1, tau2, tau3, tau4
double precision :: inv_tau_sigma_nu2(N_SLS)
integer :: i,j,it,it2
double precision :: Vsolidnorm
double precision Courant_number_bottom,Courant_number_top
double precision Dispersion_number_bottom,Dispersion_number_top
! timer to count elapsed time
character(len=8) datein
character(len=10) timein
character(len=5) :: zone
integer, dimension(8) :: time_values
integer ihours,iminutes,iseconds,int_tCPU
double precision :: time_start,time_end,tCPU
! names of the time stamp files
character(len=150) outputname
! main I/O file
integer, parameter :: IOUT = 41
!---
!--- the program starts here
!---
if (iexpl == 1) then
epsn = 1.d0
epsn1 = 0.d0
endif
if (iimpl == 1) then
epsn = 0.d0
epsn1 = 1.d0
endif
if (isemiimpl == 1) then
epsn = 0.5d0
epsn1 = 0.5d0
endif
! attenuation constants for standard linear solids
! nu1 is the dilatation/incompressibility mode (QKappa)
! nu2 is the shear mode (Qmu)
! array index (1) is the first standard linear solid, (2) is the second etc.
! from J. M. Carcione, Seismic modeling in viscoelastic media, Geophysics,
! vol. 58(1), p. 110-120 (1993) for two memory-variable mechanisms (page 112).
! Beware: these values implement specific values of the quality factors:
! Qp approximately equal to 13, Qkappa approximately to 20 and Qmu / Qs approximately to 10,
! which means very high attenuation, see that paper for details.
! tau_epsilon_nu1(1) = 0.0334d0
! tau_sigma_nu1(1) = 0.0303d0
! tau_epsilon_nu2(1) = 0.0352d0
! tau_sigma_nu2(1) = 0.0287d0
! tau_epsilon_nu1(2) = 0.0028d0
! tau_sigma_nu1(2) = 0.0025d0
! tau_epsilon_nu2(2) = 0.0029d0
! tau_sigma_nu2(2) = 0.0024d0
! from J. M. Carcione, D. Kosloff and R. Kosloff, Wave propagation simulation
! in a linear viscoelastic medium, Geophysical Journal International,
! vol. 95, p. 597-611 (1988) for two memory-variable mechanisms (page 604).
! Beware: these values implement specific values of the quality factors:
! Qkappa approximately to 27 and Qmu / Qs approximately to 20,
! which means very high attenuation, see that paper for details.
! tau_epsilon_nu1(1) = 0.0325305d0
! tau_sigma_nu1(1) = 0.0311465d0
! tau_epsilon_nu2(1) = 0.0332577d0
! tau_sigma_nu2(1) = 0.0304655d0
! tau_epsilon_nu1(2) = 0.0032530d0
! tau_sigma_nu1(2) = 0.0031146d0
! tau_epsilon_nu2(2) = 0.0033257d0
! tau_sigma_nu2(2) = 0.0030465d0
! f_min and f_max are computed as : f_max/f_min=12 and (log(f_min)+log(f_max))/2 = log(f0)
f_min_attenuation = exp(log(f0_attenuation)-log(12.d0)/2.d0)
f_max_attenuation = 12.d0 * f_min_attenuation
! use new SolvOpt nonlinear optimization with constraints from Emilie Blanc, Bruno Lombard and Dimitri Komatitsch
! to compute attenuation mechanisms
call compute_attenuation_coeffs(N_SLS,QKappa_att,f0_attenuation,f_min_attenuation,f_max_attenuation, &
tau_epsilon_nu1,tau_sigma_nu1)
call compute_attenuation_coeffs(N_SLS,QMu_att,f0_attenuation,f_min_attenuation,f_max_attenuation, &
tau_epsilon_nu2,tau_sigma_nu2)
print *
print *,'with new SolvOpt routine for attenuation:'
print *
print *,'N_SLS, QKappa_att, QMu_att = ',N_SLS, QKappa_att, QMu_att
print *,'f0_attenuation,f_min_attenuation,f_max_attenuation = ',f0_attenuation,f_min_attenuation,f_max_attenuation
print *,'tau_epsilon_nu1 = ',tau_epsilon_nu1
print *,'tau_sigma_nu1 = ',tau_sigma_nu1
print *,'tau_epsilon_nu2 = ',tau_epsilon_nu2
print *,'tau_sigma_nu2 = ',tau_sigma_nu2
print *
tau1 = tau_sigma_nu1(1)/tau_epsilon_nu1(1)
tau2 = tau_sigma_nu2(1)/tau_epsilon_nu2(1)
tau3 = tau_sigma_nu1(2)/tau_epsilon_nu1(2)
tau4 = tau_sigma_nu2(2)/tau_epsilon_nu2(2)
taumax = max(1.d0/tau1,1.d0/tau2,1.d0/tau3,1.d0/tau4)
taumin = min(1.d0/tau1,1.d0/tau2,1.d0/tau3,1.d0/tau4)
inv_tau_sigma_nu1(1) = ONE / tau_sigma_nu1(1)
inv_tau_sigma_nu2(1) = ONE / tau_sigma_nu2(1)
inv_tau_sigma_nu1(2) = ONE / tau_sigma_nu1(2)
inv_tau_sigma_nu2(2) = ONE / tau_sigma_nu2(2)
phi_nu1(1) = (ONE - tau_epsilon_nu1(1)/tau_sigma_nu1(1)) / tau_sigma_nu1(1)
phi_nu2(1) = (ONE - tau_epsilon_nu2(1)/tau_sigma_nu2(1)) / tau_sigma_nu2(1)
phi_nu1(2) = (ONE - tau_epsilon_nu1(2)/tau_sigma_nu1(2)) / tau_sigma_nu1(2)
phi_nu2(2) = (ONE - tau_epsilon_nu2(2)/tau_sigma_nu2(2)) / tau_sigma_nu2(2)
Mu_nu1 = ONE - (ONE - tau_epsilon_nu1(1)/tau_sigma_nu1(1)) - (ONE - tau_epsilon_nu1(2)/tau_sigma_nu1(2))
Mu_nu2 = ONE - (ONE - tau_epsilon_nu2(1)/tau_sigma_nu2(1)) - (ONE - tau_epsilon_nu2(2)/tau_sigma_nu2(2))
print *
print *,'2D visco-elastic FD code in velocity and stress formulation with ADE in 8th an RK4'
print *
! display size of the model
print *
print *,'NX = ',NX
print *,'NY = ',NY
print *
print *
print *,'size of the model along X = ',(NX+1) * DELTAX
print *,'size of the model along Y = ',(NY+1) * DELTAY
print *
print *,'Total number of grid points = ',NX * NY
print *,'Number of points of all the arrays = ',dble(NX+4*2+1)*dble(NY+4*2+1)*number_of_2Darrays + &
4*dble(NX+4*2+1)*dble(NY+4*2+1)*number_of_3Darrays
print *,'Size in GB of all the arrays = ',dble(NX+4*2+1)*dble(NY+4*2+1)*number_of_2Darrays*8.d0/(1024.d0*1024.d0*1024.d0) + &
4*dble(NX+4*2+1)*dble(NY+4*2+1)*number_of_3Darrays*8.d0/(1024.d0*1024.d0*1024.d0)
!--- define profile of absorption in PML region
! thickness of the PML layer in meters
thickness_PML_x = NPOINTS_PML * DELTAX
thickness_PML_y = NPOINTS_PML * DELTAY
! reflection coefficient (INRIA report section 6.1) http://hal.inria.fr/docs/00/07/32/19/PDF/RR-3471.pdf
Rcoef = 1.d-5
c_max = max(cp_bottom,cp_top)
c_min = min(cs_bottom,cs_top)
K_MAX_PML_1 = 1.d0
print *,'K_MAX_PML = ',K_MAX_PML_1
! check that NPOWER is okay
if (NPOWER < 1) stop 'NPOWER must be greater than 1'
! compute d0 from INRIA report section 6.1 http://hal.inria.fr/docs/00/07/32/19/PDF/RR-3471.pdf
if (HETEROGENEOUS_MODEL) then
d0_x = - (NPOWER + 1) * c_max *dsqrt(taumax)* log(Rcoef) / (2.d0 * thickness_PML_x)
d0_y = - (NPOWER + 1) * c_max *dsqrt(taumax)* log(Rcoef) / (2.d0 * thickness_PML_y)
else
d0_x = - (NPOWER + 1) * cp_bottom *dsqrt(taumax)* log(Rcoef) / (2.d0 * thickness_PML_x)
d0_y = - (NPOWER + 1) * cp_bottom *dsqrt(taumax)* log(Rcoef) / (2.d0 * thickness_PML_y)
endif
print *
print *,'d0_x = ',d0_x
print *,'d0_y = ',d0_y
! parameters involved in RK4 time expansion
rk41(1) = ZERO
rk41(2) = 0.5d0
rk41(3) = 0.5d0
rk41(4) = 1.d0
rk42(1) = 1.d0 / 6.d0
rk42(2) = 2.d0 / 6.d0
rk42(3) = 2.d0 / 6.d0
rk42(4) = 1.d0 / 6.d0
ksi_x(:) = ZERO
ksi_x_half(:) = ZERO
d_x_1(:) = ZERO
d_x_half_1(:) = ZERO
K_x_1(:) = 1.d0
K_x_half_1(:) = 1.d0
alpha_prime_x_1(:) = ZERO
alpha_prime_x_half_1(:) = ZERO
a_x_1(:,:) = ZERO
a_x_half_1(:,:) = ZERO
g_x_1(:) = 5.d-1
g_x_half_1(:) = 5.d-1
ksi_y(:) = ZERO
ksi_y_half(:) = ZERO
d_y_1(:) = ZERO
d_y_half_1(:) = ZERO
K_y_1(:) = 1.d0
K_y_half_1(:) = 1.d0
alpha_prime_y_1(:) = ZERO
alpha_prime_y_half_1(:) = ZERO
a_y_1(:,:) = ZERO
a_y_half_1(:,:) = ZERO
g_y_1(:) = 1.d0
g_y_half_1(:) = 1.d0
d_x_2(:) = ZERO
d_x_half_2(:) = ZERO
K_x_2(:) = 1.d0
K_x_half_2(:) = 1.d0
alpha_prime_x_2(:) = ZERO
alpha_prime_x_half_2(:) = ZERO
a_x_2(:,:) = ZERO
a_x_half_2(:,:) = ZERO
g_x_2(:) = 1.d0
g_x_half_2(:) = 1.d0
d_y_2(:) = ZERO
d_y_half_2(:) = ZERO
K_y_2(:) = 1.d0
K_y_half_2(:) = 1.d0
alpha_prime_y_2(:) = ZERO
alpha_prime_y_half_2(:) = ZERO
a_y_2(:,:) = ZERO
a_y_half_2(:,:) = ZERO
g_y_2(:) = 1.d0
g_y_half_2(:) =1.d0
r_x_1(:) = ZERO
s_x_1(:) = ZERO
r_x_half_1(:) = ZERO
s_x_half_1(:) = ZERO
r_y_1(:) = ZERO
s_y_1(:) = ZERO
r_y_half_1(:) = ZERO
s_y_half_1(:) = ZERO
! damping in the X direction
! origin of the PML layer (position of right edge minus thickness, in meters)
xoriginleft = thickness_PML_x
xoriginright = (NX-1)*DELTAX - thickness_PML_x
do i = -4,NX+4
! abscissa of current grid point along the damping profile
xval = DELTAX * dble(i-1)
!---------- left edge
if (USE_PML_XMIN) then
! define damping profile at the grid points
abscissa_in_PML = xoriginleft - xval
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_x
d_x_1(i) = d0_x * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_x_1(i) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_x_1(i) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
! define damping profile at half the grid points
abscissa_in_PML = xoriginleft - (xval + DELTAX/2.d0)
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_x
d_x_half_1(i) = d0_x * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_x_half_1(i) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_x_half_1(i) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
endif
!---------- right edge
if (USE_PML_XMAX) then
! define damping profile at the grid points
abscissa_in_PML = xval - xoriginright
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_x
d_x_1(i) = d0_x * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_x_1(i) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_x_1(i) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
! define damping profile at half the grid points
abscissa_in_PML = xval + DELTAX/2.d0 - xoriginright
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_x
d_x_half_1(i) = d0_x * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_x_half_1(i) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_x_half_1(i) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
endif
! 1 pole
d_x_2(i) = 0.d0
d_x_half_2(i) = 0.d0
! just in case, for -5 at the end
if (alpha_prime_x_1(i) < ZERO) alpha_prime_x_1(i) = ZERO
if (alpha_prime_x_half_1(i) < ZERO) alpha_prime_x_half_1(i) = ZERO
! just in case, for -5 at the end
if (alpha_prime_x_2(i) < ZERO) alpha_prime_x_2(i) = ZERO
if (alpha_prime_x_half_2(i) < ZERO) alpha_prime_x_half_2(i) = ZERO
! CPML damping parameters for the 4 sub time steps of RK4 algorithm
do inc=1,4
b_x_1(inc,i) = (1.-epsn*DELTAT*rk41(inc)*(d_x_1(i)/K_x_1(i) + alpha_prime_x_1(i)))/&
(1.+epsn1*DELTAT*rk41(inc)*(d_x_1(i)/K_x_1(i) + alpha_prime_x_1(i)))
b_x_half_1(inc,i) = (1.-epsn*DELTAT*rk41(inc)*(d_x_half_1(i)/K_x_half_1(i) &
+ alpha_prime_x_half_1(i)))/(1. +epsn1*DELTAT*rk41(inc)*(d_x_half_1(i)/K_x_half_1(i) &
+ alpha_prime_x_half_1(i)))
! this to avoid division by zero outside the PML
if (abs(d_x_1(i)) > 1.d-6) a_x_1(inc,i) = - DELTAT*rk41(inc)*d_x_1(i) / (K_x_1(i)* K_x_1(i))/&
(1. +epsn1*DELTAT*rk41(inc)*(d_x_1(i)/K_x_1(i) + alpha_prime_x_1(i)))
if (abs(d_x_half_1(i)) > 1.d-6) a_x_half_1(inc,i) =-DELTAT*rk41(inc)*d_x_half_1(i)/&
(K_x_half_1(i)*K_x_half_1(i) )/&
(1. +epsn1*DELTAT*rk41(inc)*(d_x_half_1(i)/K_x_half_1(i)&
+ alpha_prime_x_half_1(i)))
r_x_1(i) = -(d_x_1(i)/K_x_1(i) + alpha_prime_x_1(i))
s_x_1(i) = - d_x_1(i)/K_x_1(i)/K_x_1(i)
r_x_half_1(i) = -(d_x_half_1(i)/K_x_half_1(i) + alpha_prime_x_half_1(i))
s_x_half_1(i) = - d_x_half_1(i)/K_x_half_1(i)/K_x_half_1(i)
enddo
enddo
! damping in the Y direction
! origin of the PML layer (position of right edge minus thickness, in meters)
yoriginbottom = thickness_PML_y
yorigintop = (NY-1)*DELTAY - thickness_PML_y
do j = -4,NY+4
! abscissa of current grid point along the damping profile
yval = DELTAY * dble(j-1)
!---------- bottom edge
if (USE_PML_YMIN) then
! define damping profile at the grid points
abscissa_in_PML = yoriginbottom - yval
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_y
d_y_1(j) = d0_y * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_y_1(j) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_y_1(j) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
! define damping profile at half the grid points
abscissa_in_PML = yoriginbottom - (yval + DELTAY/2.d0)
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_y
d_y_half_1(j) = d0_y * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_y_half_1(j) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_y_half_1(j) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
endif
!---------- top edge
if (USE_PML_YMAX) then
! define damping profile at the grid points
abscissa_in_PML = yval - yorigintop
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_y
d_y_1(j) = d0_y * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_y_1(j) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_y_1(j) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
! define damping profile at half the grid points
abscissa_in_PML = yval + DELTAY/2.d0 - yorigintop
if (abscissa_in_PML >= ZERO) then
abscissa_normalized = abscissa_in_PML / thickness_PML_y
d_y_half_1(j) = d0_y * abscissa_normalized**NPOWER
! from Stephen Gedney's unpublished class notes for class EE699, lecture 8, slide 8-2
K_y_half_1(j) = 1.d0 + (K_MAX_PML_1 - 1.d0) * abscissa_normalized**NPOWER2
alpha_prime_y_half_1(j) = ALPHA_MAX_PML_1 * (1.d0 - abscissa_normalized)
endif
endif
! just in case, for -5 at the end
if (alpha_prime_y_1(j) < ZERO) alpha_prime_y_1(j) = ZERO
if (alpha_prime_y_half_1(j) < ZERO) alpha_prime_y_half_1(j) = ZERO
! CPML damping parameters for the 4 sub time steps of RK4 algorithm
do inc=1,4
b_y_1(inc,j) = (1.-epsn*DELTAT*rk41(inc)*(d_y_1(j)/K_y_1(j) + alpha_prime_y_1(j)))/&
(1.+epsn1*DELTAT*rk41(inc)*(d_y_1(j)/K_y_1(j) + alpha_prime_y_1(j)))
b_y_half_1(inc,j) = (1.-epsn*DELTAT*rk41(inc)*(d_y_half_1(j)/K_y_half_1(j) + &
alpha_prime_y_half_1(j)))/(1.+epsn1*DELTAT*rk41(inc)*(d_y_half_1(j)/K_y_half_1(j)&
+ alpha_prime_y_half_1(j)))
! this to avoid division by zero outside the PML
if (abs(d_y_1(j)) > 1.d-6) a_y_1(inc,j) = - DELTAT*rk41(inc)*d_y_1(j)&
/ (K_y_1(j)* K_y_1(j))/&
(1.+epsn1*DELTAT*rk41(inc)*(d_y_1(j)/K_y_1(j) + alpha_prime_y_1(j)))
if (abs(d_y_half_1(j)) > 1.d-6) a_y_half_1(inc,j) = -DELTAT*rk41(inc)*d_y_half_1(j) /&
(K_y_half_1(j) * K_y_half_1(j) )/&
(1.+epsn1*DELTAT*rk41(inc)*(d_y_half_1(j)/K_y_half_1(j) + alpha_prime_y_half_1(j)))
enddo
r_y_1(j) = -(d_y_1(j)/K_y_1(j) + alpha_prime_y_1(j))
s_y_1(j) = - d_y_1(j)/K_y_1(j)/K_y_1(j)
r_y_half_1(j) = -(d_y_half_1(j)/K_y_half_1(j) + alpha_prime_y_half_1(j))
s_y_half_1(j) = - d_y_half_1(j)/K_y_half_1(j)/K_y_half_1(j)
enddo
! compute the Lame parameters and density
do j = -4,NY+4
do i = -4,NX+4
if (HETEROGENEOUS_MODEL .and. DELTAY*dble(j-1) > INTERFACE_HEIGHT) then
rho(i,j)= rho_top
mu(i,j)= mu_top
lambda(i,j) = lambda_top
lambdaplustwomu(i,j) = lambdaplustwomu_top
else
rho(i,j)= rho_bottom
mu(i,j)= mu_bottom
lambda(i,j) = lambda_bottom
lambdaplustwomu(i,j) = lambdaplustwomu_bottom
endif
enddo
enddo
! print position of the source
print *
print *,'Position of the source:'
print *
print *,'x = ',xsource
print *,'y = ',ysource
print *
! define location of receivers
print *
print *,'There are ',nrec,' receivers'
print *
! xspacerec = (xfin-xdeb) / dble(NREC-1)
! yspacerec = (yfin-ydeb) / dble(NREC-1)
! do irec=1,nrec
! xrec(irec) = xdeb + dble(irec-1)*xspacerec
! yrec(irec) = ydeb + dble(irec-1)*yspacerec
! enddo
xrec(1) = xsource
yrec(1) = ysource - 393*DELTAY
xrec(2) = xsource
yrec(2) = ysource + 191*DELTAY
xrec(3) = xsource + 101*DELTAX
yrec(3) = ysource
! find closest grid point for each receiver
do irec=1,nrec
dist = HUGEVAL
do j = 1,NY
do i = 1,NX
distval = sqrt((DELTAX*dble(i) - xrec(irec))**2 + (DELTAY*dble(j) - yrec(irec))**2)
if (distval < dist) then
dist = distval
ix_rec(irec) = i
iy_rec(irec) = j
endif
enddo
enddo
print *,'receiver ',irec,' x_target,y_target = ',xrec(irec),yrec(irec)
print *,'closest grid point found at distance ',dist,' in i,j = ',ix_rec(irec),iy_rec(irec)
print *
enddo
! check the Courant stability condition for the explicit time scheme
! R. Courant et K. O. Friedrichs et H. Lewy (1928)
Courant_number_bottom = cp_bottom *dsqrt(taumax)* DELTAT*sqrt(1.d0/DELTAX**2 + 1.d0/DELTAY**2)
Dispersion_number_bottom=cs_bottom*dsqrt(taumin)/(2.5d0*f0*max(DELTAX,DELTAY))
print *,'Courant number at the bottom is ',Courant_number_bottom
print *,'Dispersion number at the bottom is ',Dispersion_number_bottom
print *
!if (Courant_number_bottom > 1.d0/coefficient_sum) stop 'time step is too large, simulation will be unstable'
if (HETEROGENEOUS_MODEL) then
Courant_number_top = cp_top *dsqrt(taumax) * DELTAT* sqrt(1.d0/DELTAX**2 + 1.d0/DELTAY**2 )
Dispersion_number_top= cs_top*dsqrt(taumin) /(2.5d0*f0*max(DELTAX,DELTAY))
print *,'Courant number at the top is ',Courant_number_top
print *
print *,'Dispersion number at the top is ',Dispersion_number_top
!if (Courant_number_top > 1.d0/coefficient_sum) stop 'time step is too large, simulation will be unstable'
endif
! erase main arrays
vx(:,:) = ZERO
vy(:,:) = ZERO
sigmaxy(:,:) = ZERO
sigmayy(:,:) = ZERO
sigmaxx(:,:) = ZERO
sigmaxy_R(:,:) = ZERO
sigmayy_R(:,:) = ZERO
sigmaxx_R(:,:) = ZERO
dvx(:,:,:) = ZERO
dvy(:,:,:) = ZERO
dsigmaxy(:,:,:) = ZERO
dsigmayy(:,:,:) = ZERO
dsigmaxx(:,:,:) = ZERO
dsigmaxy_R(:,:,:) = ZERO
dsigmayy_R(:,:,:) = ZERO
dsigmaxx_R(:,:,:) = ZERO
e1(1,:,:)=ZERO
e1(2,:,:)=ZERO
e11(1,:,:)=ZERO
e11(2,:,:)=ZERO
e12(1,:,:)=ZERO
e12(2,:,:)=ZERO
e22(1,:,:)=ZERO
e22(2,:,:)=ZERO
de1(1,:,:,:)=ZERO
de1(2,:,:,:)=ZERO
de11(1,:,:,:)=ZERO
de11(2,:,:,:)=ZERO
de12(1,:,:,:)=ZERO
de12(2,:,:,:)=ZERO
! PML
memory_vx_dx_1(:,:) = ZERO
memory_vx_dy_1(:,:) = ZERO
memory_vy_dx_1(:,:) = ZERO
memory_vy_dy_1(:,:) = ZERO
memory_sigmaxx_dx_1(:,:) = ZERO
memory_sigmayy_dy_1(:,:) = ZERO
memory_sigmaxy_dx_1(:,:) = ZERO
memory_sigmaxy_dy_1(:,:) = ZERO
memory_dvx_dx_1(:,:,:) = ZERO
memory_dvx_dy_1(:,:,:) = ZERO
memory_dvy_dx_1(:,:,:) = ZERO
memory_dvy_dy_1(:,:,:) = ZERO
memory_dsigmaxx_dx_1(:,:,:) = ZERO
memory_dsigmayy_dy_1(:,:,:) = ZERO
memory_dsigmaxy_dx_1(:,:,:) = ZERO
memory_dsigmaxy_dy_1(:,:,:) = ZERO