Skip to content

Commit 04fd688

Browse files
authored
Merge pull request #1848 from danielpeter/devel
adds scattering perturbations feature, lunar projections (LTM/LPS) & Moon example
2 parents 8bd3f5a + 332ce8b commit 04fd688

File tree

94 files changed

+151628
-719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+151628
-719
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# Contributing to SPECFEM3D
1+
# Contributing to SPECFEM3D Cartesian
22

3-
You want to contribute to the SPECFEM code? Great, let's check out this set of simple guidelines to follow for contributions.
3+
You want to contribute to the SPECFEM3D Cartesian code? Great, let's check out this set of simple guidelines to follow for contributions.
44

55
## Contributing as a user
66

77
Software needs constant maintaining and updating to keep up with newest hardware and compilers.
8-
You found an issue when running the code? Please consider creating a "*New issue*" on the [SPECFEM3D Issues github page](https://github.com/SPECFEM/specfem3d/issues).
8+
You found an issue when running the code? Please consider creating a "*New issue*" on the [SPECFEM3D Cartesian Issues github page](https://github.com/SPECFEM/specfem3d/issues).
99

1010
Describe the problem as detailed as possible to help us reproduce the error. You can also attach console outputs from the executables to make it easier for debugging. Feel free to add an appropriate label to highlight the issue by checking out "*Labels*" on the right side of the page. Once done, click the button "*Submit new issue*". Catching bugs is always welcome, many thanks to you for improving the code!
1111

1212
## Contributing as a developer
1313

1414
You have a new feature, bug fix, or other modification you want to contribute to the code? In this case, consider submitting a "*Pull request*" to the **devel branch** of our github code repository.
1515

16-
This will require a few steps to setup your own github fork and be able to create a PR to the official devel version of the SPECFEM code (**note that only Pull requests towards devel are accepted**). The most basic setup looks the following:
16+
This will require a few steps to setup your own github fork and be able to create a PR to the official devel version of the SPECFEM3D Cartesian code (**note that only Pull requests towards devel are accepted**). The most basic setup looks the following:
1717

1818
#### 1. Create your fork of the repository:
19-
Go to the main [SPECFEM3D github repository](https://github.com/SPECFEM/specfem3d) and click the "*Fork*" button at the top of the page. This will create a copy of the SPECFEM3D repository in your personal GitHub account.
19+
Go to the main [SPECFEM3D Cartesian github repository](https://github.com/SPECFEM/specfem3d) and click the "*Fork*" button at the top of the page. This will create a copy of the SPECFEM3D repository in your personal GitHub account.
2020

2121
#### 2. Clone your fork to your local workstation/laptop:
2222
```
2323
git clone --recursive --branch devel https://github.com/<your-github-account-name>/specfem3d.git
2424
```
2525
Once you change into your local folder `cd specfem3d/`, all git commands will be recognized.
26-
Now, add the remote address of the SPECFEM3D repository:
26+
Now, add the remote address of the SPECFEM3D Cartesian repository:
2727
```
2828
git remote add upstream https://github.com/SPECFEM/specfem3d.git
2929
```
@@ -77,7 +77,7 @@ In the "*Open a pull request*" page, double-check that the base repository is: *
7777
#### 6. Final merge:
7878
We'll do the rest by reviewing your code changes, checking if the Github Actions, Travis and Azure checks all look okay. We might follow up with you by commenting on the PR, as you can still fix smaller issues in the PR by committing them to your github fork version.<br>
7979

80-
Finally, if the are no merge conflicts, the new version still compiles and tests pass, we'll merge your PR into the SPECFEM devel version - **with big thanks to you from the maintainers and the whole community!**
80+
Finally, if the are no merge conflicts, the new version still compiles and tests pass, we'll merge your PR into the SPECFEM3D Cartesian devel version - **with big thanks to you from the maintainers and the whole community!**
8181

8282

8383
## Further informations

EXAMPLES/applications/cmt_force_hybrid/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
This example provides a simple guide for the simultaneous use of point-force and moment-tensor sources in SEM simulations.
44

55

6-
1. **Enable Hybrid `FORCESOLUTION` and `CMTSOLUTION`**
7-
In `DATA/Par_file`, set:
6+
1. **Enable Hybrid `FORCESOLUTION` and `CMTSOLUTION`**
7+
In `DATA/Par_file`, set:
88
```fortran
99
USE_CMT_AND_FORCE_SOURCE = .true.`
1010
The program will then read both `FORCESOLUTION` and `CMTSOLUTION` from the `DATA` directory and run a simulation using both point force and CMT sources.
1111
12-
2. **Use Binary Source Files**
12+
2. **Use Binary Source Files**
1313
when
1414
```fortran
1515
USE_BINARY_SOURCE_FILE = .true.
@@ -18,7 +18,7 @@ is set in `DATA/Par_file`, all source attributes and source time functions must
1818
```fortran
1919
access='stream'
2020
```
21-
in the `write` statement.
21+
in the `write` statement.
2222
- When both options are enabled, the program ignores `FORCESOLUTION` and `CMTSOLUTION` and instead reads from SOLUTION.bin.
2323
- The format of SOLUTION.bin is illustrated in the Fortran snippet below:
2424
```fortran
@@ -49,7 +49,7 @@ enddo
4949
```
5050
you can also refer to `write_binary_source.f90` for a small example.
5151

52-
3. **Use an External Source Time Function**
52+
3. **Use an External Source Time Function**
5353
In `DATA/Par_file`, enable:
5454
```fortran
5555
USE_EXTERNAL_SOURCE_FILE = .true.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22
gfortran write_binary_source.f90 -o write_source
33

4-
./write_source
4+
./write_source
55
\rm write_source

EXAMPLES/applications/cmt_force_hybrid/step3_run_simulations.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
# function to change Par_file
88
change_parfile() {
99
local param=$1
10-
local value=$2
10+
local value=$2
1111
local file="DATA/Par_file"
1212

1313
local oldstr=`grep "^$param " $file`
1414
local newstr="$param = $value"
1515

1616
sed "s?$oldstr?$newstr?g" $file > tmp
17-
mv tmp $file
17+
mv tmp $file
1818
}
1919

20-
set -e
20+
set -e
2121

2222
# USER DEFINED VARIABLES
2323
GPU_MODE=.TRUE.
@@ -30,28 +30,28 @@ change_parfile USE_FORCE_POINT_SOURCE .true.
3030
change_parfile USE_CMT_AND_FORCE_SOURCE .true.
3131
change_parfile USE_BINARY_SOURCE_FILE .false.
3232
change_parfile USE_EXTERNAL_SOURCE_FILE .true.
33-
bash run.sh
33+
bash run.sh
3434
mv OUTPUT_FILES OUTPUT_FILES.txt
3535

3636
#run binary source
3737
change_parfile USE_FORCE_POINT_SOURCE .true.
3838
change_parfile USE_CMT_AND_FORCE_SOURCE .true.
3939
change_parfile USE_BINARY_SOURCE_FILE .true.
4040
change_parfile USE_EXTERNAL_SOURCE_FILE .true.
41-
bash run.sh
41+
bash run.sh
4242
mv OUTPUT_FILES OUTPUT_FILES.bin
4343

4444
#seperate run
4545
change_parfile USE_FORCE_POINT_SOURCE .true.
4646
change_parfile USE_CMT_AND_FORCE_SOURCE .false.
4747
change_parfile USE_BINARY_SOURCE_FILE .false.
4848
change_parfile USE_EXTERNAL_SOURCE_FILE .true.
49-
bash run.sh
49+
bash run.sh
5050
mv OUTPUT_FILES OUTPUT_FILES.force
5151

5252
change_parfile USE_FORCE_POINT_SOURCE .false.
5353
change_parfile USE_CMT_AND_FORCE_SOURCE .false.
5454
change_parfile USE_BINARY_SOURCE_FILE .false.
5555
change_parfile USE_EXTERNAL_SOURCE_FILE .true.
56-
bash run.sh
56+
bash run.sh
5757
mv OUTPUT_FILES OUTPUT_FILES.moment

EXAMPLES/applications/cmt_force_hybrid/write_binary_source.f90

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
subroutine linspace(n,xmin,xmax,arr)
22
implicit none
3-
integer,intent(in) :: n
4-
real,intent(in) :: xmin,xmax
3+
integer,intent(in) :: n
4+
real,intent(in) :: xmin,xmax
55
double precision,intent(inout) :: arr(n)
66

7-
!local
7+
!local
88
integer :: i
99

10-
if(n == 1) then
10+
if (n == 1) then
1111
arr(1) = xmin
12-
else
13-
do i = 0,n-1
12+
else
13+
do i = 0,n-1
1414
arr(i + 1) = xmin + (xmax - xmin) / (n-1) * i
1515
enddo
1616
endif
@@ -32,21 +32,21 @@ program main
3232
integer,parameter :: IO = 123, IO_TXT = 12114 ! FILE number
3333
integer,parameter :: NSTEP= 3000
3434
integer :: isource,it,i
35-
logical :: USE_EXTERNAL_SOURCE = .TRUE.
35+
logical :: USE_EXTERNAL_SOURCE = .true.
3636

3737
! allocate space for force
3838
integer,dimension(NS_FORCE) :: force_stf ! source time function flag
39-
double precision,dimension(NS_FORCE) :: lat_f,lon_f,depth_f,hdur_f,shift_f,&
40-
factor_f,fe,fn,fzup
39+
double precision,dimension(NS_FORCE) :: lat_f,lon_f,depth_f,hdur_f,shift_f, &
40+
factor_f,fe,fn,fzup
4141
real :: external_stf_force(NSTEP,NS_FORCE)
42-
42+
4343
! allocate space for cmt
4444
double precision,dimension(NS_CMT) :: lat_c,lon_c,depth_c,hdur_c,shift_c
4545
double precision, dimension(6,NS_CMT) :: mt ! Mrr Mtt Mpp Mrt Mrp Mtp
4646
real :: external_stf_cmt(NSTEP,NS_CMT)
4747

48-
!filename
49-
character(len=128) :: filename
48+
!filename
49+
character(len=128) :: filename
5050

5151
! set value for FORCE, same as FORCESOLUTION
5252
force_stf = 0
@@ -59,9 +59,9 @@ program main
5959
do isource = 1,NS_FORCE
6060
write(filename,'(a,i0,a)') './DATA/stf.force.',isource-1,'.txt'
6161
open(IO_TXT,file=trim(filename))
62-
do it=1,NSTEP
62+
do it = 1,NSTEP
6363
read(IO_TXT,*) external_stf_force(it,isource)
64-
enddo;
64+
enddo;
6565
close(IO_TXT)
6666
enddo
6767

@@ -74,14 +74,14 @@ program main
7474

7575
do i = 1,NS_CMT
7676
lat_c(i) = -523.131 + 1000. / (NS_CMT - 1) * (i-1)
77-
enddo
77+
enddo
7878

7979
do isource = 1,NS_CMT
8080
write(filename,'(a,i0,a)') './DATA/stf.cmt.',isource-1,'.txt'
8181
open(IO_TXT,file=trim(filename))
82-
do it=1,NSTEP
82+
do it = 1,NSTEP
8383
read(IO_TXT,*) external_stf_cmt(it,isource)
84-
enddo;
84+
enddo;
8585
close(IO_TXT)
8686
enddo
8787

@@ -94,23 +94,23 @@ program main
9494
do isource = 1,NS_CMT
9595
write(IO) shift_c(isource),hdur_c(isource),lat_c(isource),lon_c(isource),depth_c(isource)
9696
write(IO) mt(:,isource) ! Mrr Mtt Mpp Mrt Mrp Mtp
97-
if(USE_EXTERNAL_SOURCE) write(IO) external_stf_cmt(:,isource)
97+
if (USE_EXTERNAL_SOURCE) write(IO) external_stf_cmt(:,isource)
9898

9999

100-
! txt file
100+
! txt file
101101
write(IO_TXT,*)'PDE 1999 01 01 00 00 00.00 67000 67000 -25000 4.2 4.2 hom_explosion'
102102
write(IO_TXT,*) 'event name: hom_explosion'
103103
write(IO_TXT,*) 'time shift:', shift_c(isource)
104104
write(IO_TXT,*) 'half duration:', hdur_c(isource)
105105
write(IO_TXT,*) 'latorUTM:', lat_c(isource)
106106
write(IO_TXT,*) 'longorUTM:', lon_c(isource)
107107
write(IO_TXT,*) 'depth:', depth_c(isource)
108-
write(IO_TXT,*) 'Mrr:', mt(1,isource)
109-
write(IO_TXT,*) 'Mtt:', mt(2,isource)
110-
write(IO_TXT,*) 'Mpp:', mt(3,isource)
111-
write(IO_TXT,*) 'Mrt:', mt(4,isource)
112-
write(IO_TXT,*) 'Mrp:', mt(5,isource)
113-
write(IO_TXT,*) 'Mtp:', mt(6,isource)
108+
write(IO_TXT,*) 'Mrr:', mt(1,isource)
109+
write(IO_TXT,*) 'Mtt:', mt(2,isource)
110+
write(IO_TXT,*) 'Mpp:', mt(3,isource)
111+
write(IO_TXT,*) 'Mrt:', mt(4,isource)
112+
write(IO_TXT,*) 'Mrp:', mt(5,isource)
113+
write(IO_TXT,*) 'Mtp:', mt(6,isource)
114114
write(filename,'(a,i0,a)') './DATA/stf.cmt.',isource-1,'.txt'
115115
write(IO_TXT,*) trim(filename)
116116
enddo
@@ -122,7 +122,7 @@ program main
122122
write(IO) shift_f(isource),hdur_f(isource),lat_f(isource),lon_f(isource),depth_f(isource)
123123
write(IO) force_stf(isource)
124124
write(IO) factor_f(isource),fe(isource),fn(isource),fzup(isource)
125-
if(USE_EXTERNAL_SOURCE) write(IO) external_stf_force(:,isource)
125+
if (USE_EXTERNAL_SOURCE) write(IO) external_stf_force(:,isource)
126126

127127
!txt file
128128
write(IO_TXT,*) 'FORCE 001'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1+
! note: format of nummaterial_velocity_file must be
2+
!
3+
! #(1)material_domain_id #(2)material_id #(3)rho #(4)vp #(5)vs #(6)Q_kappa #(7)Q_mu #(8)anisotropy_flag
4+
!
5+
! where
6+
! material_domain_id : 1=acoustic / 2=elastic
7+
! material_id : POSITIVE integer identifier corresponding to the identifier of material block
8+
! rho : density
9+
! vp : P-velocity
10+
! vs : S-velocity
11+
! Q_kappa : 9999 = no Q_kappa attenuation
12+
! Q_mu : 9999 = no Q_mu attenuation
13+
! anisotropy_flag : 0=no anisotropy/ 1,2,.. check with implementation in aniso_model.f90
14+
!
15+
!example:
16+
!2 1 2300 2800 1500 9999.0 9999.0 0
17+
!
18+
!or
19+
!
20+
! #(1)material_domain_id #(2)material_id tomography elastic #(3)tomography_filename #(4)positive_unique_number
21+
!
22+
! where
23+
! material_domain_id : 1=acoustic / 2=elastic
24+
! material_id : NEGATIVE integer identifier corresponding to the identifier of material block
25+
! tomography_filename: filename of the tomography file
26+
! positive_unique_number: a positive unique identifier
27+
!
28+
!example:
29+
!2 -1 tomography elastic tomo.xyz 1
30+
131
1 1 2300.000000 2800.000000 0.000000 9999.00000 9999.00000 0

EXAMPLES/applications/homogeneous_acoustic/REF_KERNEL/output.log

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ decomposing mesh...
1515
using NGNOD = 8
1616
linear elements
1717

18-
total number of nodes:
18+
total number of nodes:
1919
nnodes = 23273
2020
total number of spectral elements:
2121
nspec = 20736
@@ -83,7 +83,7 @@ decomposing mesh...
8383
load per partition: imbalance = 1.53374231 %
8484
(0% being totally balanced, 100% being unbalanced)
8585

86-
partitions:
86+
partitions:
8787
num = 4
8888
ninterfaces = 6
8989

@@ -105,7 +105,7 @@ forward simulation
105105
#########################################################
106106
(running forward simulation with saving forward wavefield)
107107

108-
Changed simulation_type to 1 and save_forward = .true. in Par_file
108+
Changed simulation_type to 1 and save_forward = .true. in Par_file
109109

110110
running solver on 4 processors...
111111

@@ -128,23 +128,23 @@ gfortran -o xcreate_adjsrc_traveltime create_adjsrc_traveltime.o rw_ascfile_c.o
128128
running adjoint source creation
129129

130130
xcreate_adjsrc_traveltime:
131-
measurement window start/end = 9.0000000000000000 / 26.000000000000000
131+
measurement window start/end = 9.0000000000000000 / 26.000000000000000
132132
component ifile = 1 lrot = F
133-
133+
134134
reading asc file DB.X20.MXX.semp ...
135135
reading asc file DB.X20.MXY.semp ...
136136
reading asc file DB.X20.MXZ.semp ...
137-
138-
start time: -6.0000000000000000
139-
time step: 0.11359978000000037
137+
138+
start time: -6.0000000000000000
139+
time step: 0.11359978000000037
140140
number of steps: 300
141-
142-
i = 1 norm = 51519175283406.109
143-
i = 2 norm = 51519175283406.109
141+
142+
i = 1 norm = 51519175283406.109
143+
i = 2 norm = 51519175283406.109
144144
component set to zero
145-
i = 3 norm = 51519175283406.109
145+
i = 3 norm = 51519175283406.109
146146
component set to zero
147-
147+
148148
write to asc file DB.X20.MXX.adj
149149
write to asc file DB.X20.MXY.adj
150150
write to asc file DB.X20.MXZ.adj
@@ -157,7 +157,7 @@ kernel simulation
157157
#########################################################
158158
(running kernel simulation: SIMULATION_TYPE == 3)
159159

160-
Changed simulation_type to 3 in Par_file
160+
Changed simulation_type to 3 in Par_file
161161

162162
running solver (kernel run) on 4 processors...
163163

0 commit comments

Comments
 (0)