-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
261 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 33 additions & 21 deletions
54
.../Tromp_2005/templates/specfem_config.yaml → ...mp_2005/CMakeFiles/adjoint_config.yaml.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
parameters: | ||
|
||
databases: | ||
mesh-database: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/database.bin" | ||
source-file: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/adjoint_source.yaml" | ||
header: | ||
title: "Tromp-Tape-Liu (GJI 2005)" | ||
description: | | ||
Material systems : Elastic domain (1) | ||
description: 'Material systems : Elastic domain (1) | ||
|
||
Interfaces : None | ||
|
||
Sources : Force source (1) | ||
|
||
Boundary conditions : Free surface (1) | ||
|
||
Mesh : 2D Cartesian grid (1) | ||
|
||
Receiver : Displacement seismogram (1) | ||
|
||
Output : Wavefield at the last time step (1) | ||
|
||
Output : Seismograms in ASCII format (1) | ||
|
||
' | ||
title: Tromp-Tape-Liu (GJI 2005) | ||
receivers: | ||
angle: 0.0 | ||
nstep_between_samples: 1 | ||
seismogram-type: | ||
- displacement | ||
stations-file: placeholder/for/path/to/STATIONS | ||
run-setup: | ||
number-of-processors: 1 | ||
number-of-runs: 1 | ||
simulation-setup: | ||
quadrature: | ||
quadrature-type: GLL4 | ||
|
||
simulation-mode: | ||
combined: | ||
reader: | ||
wavefield: | ||
directory: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES" | ||
format: HDF5 | ||
writer: | ||
kernels: | ||
directory: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES" | ||
format: ASCII | ||
solver: | ||
time-marching: | ||
time-scheme: | ||
type: Newmark | ||
dt: 0.02 | ||
nstep: 2004 | ||
t0: 8.0 | ||
|
||
receivers: | ||
stations-file: placeholder/for/path/to/STATIONS | ||
angle: 0.0 | ||
seismogram-type: | ||
- displacement | ||
nstep_between_samples: 1 | ||
|
||
run-setup: | ||
number-of-processors: 1 | ||
number-of-runs: 1 | ||
|
||
databases: | ||
mesh-database: placeholder/for/path/to/database.bin | ||
source-file: placeholder/for/path/to/source.yaml | ||
type: Newmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
parameters: | ||
databases: | ||
mesh-database: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/database.bin" | ||
source-file: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/forward_source.yaml" | ||
header: | ||
description: 'Material systems : Elastic domain (1) | ||
|
||
Interfaces : None | ||
|
||
Sources : Force source (1) | ||
|
||
Boundary conditions : Free surface (1) | ||
|
||
Mesh : 2D Cartesian grid (1) | ||
|
||
Receiver : Displacement seismogram (1) | ||
|
||
Output : Wavefield at the last time step (1) | ||
|
||
Output : Seismograms in ASCII format (1) | ||
|
||
' | ||
title: Tromp-Tape-Liu (GJI 2005) | ||
receivers: | ||
angle: 0.0 | ||
nstep_between_samples: 1 | ||
seismogram-type: | ||
- displacement | ||
stations-file: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/STATIONS" | ||
run-setup: | ||
number-of-processors: 1 | ||
number-of-runs: 1 | ||
simulation-setup: | ||
quadrature: | ||
quadrature-type: GLL4 | ||
simulation-mode: | ||
forward: | ||
writer: | ||
seismogram: | ||
directory: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/results" | ||
format: ASCII | ||
wavefield: | ||
directory: "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES" | ||
format: HDF5 | ||
solver: | ||
time-marching: | ||
time-scheme: | ||
dt: 0.02 | ||
nstep: 2004 | ||
t0: 8.0 | ||
type: Newmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
SPECFEM_BIN = "specfem2d" | ||
MESHFEM_BIN = "xmeshfem2D" | ||
ADJ_SEISMOGRAM_BIN = "xadj_seismogram" | ||
|
||
|
||
rule all: | ||
input: | ||
kernels="OUTPUT_FILES/Kernels.png", | ||
|
||
|
||
rule generate_mesh: | ||
input: | ||
"Par_File", | ||
output: | ||
database="OUTPUT_FILES/database.bin", | ||
stations="OUTPUT_FILES/STATIONS", | ||
localrule: True | ||
shell: | ||
""" | ||
mkdir -p OUTPUT_FILES | ||
{MESHFEM_BIN} -p {input} | ||
""" | ||
|
||
|
||
rule forward_simulation: | ||
input: | ||
database="OUTPUT_FILES/database.bin", | ||
stations="OUTPUT_FILES/STATIONS", | ||
source="forward_source.yaml", | ||
config="forward_config.yaml", | ||
output: | ||
siesmograms=expand( | ||
"OUTPUT_FILES/results/{station_name}{network_name}{component}.semd", | ||
station_name=["S0001"], | ||
network_name=["AA"], | ||
component=["BXX", "BXZ"], | ||
), | ||
forward_wavefield="OUTPUT_FILES/ForwardWavefield.h5", | ||
resources: | ||
nodes=1, | ||
tasks=1, | ||
cpus_per_task=1, | ||
runtime=10, | ||
shell: | ||
""" | ||
# module purge | ||
# module load boost/1.73.0 | ||
mkdir -p OUTPUT_FILES/results | ||
echo "Hostname: $(hostname)" > output.log | ||
{SPECFEM_BIN} -p {input.config} >> output.log | ||
""" | ||
|
||
|
||
rule compute_adjoint_sources: | ||
input: | ||
seismograms=expand( | ||
"OUTPUT_FILES/results/{station_name}{network_name}{component}.semd", | ||
station_name=["S0001"], | ||
network_name=["AA"], | ||
component=["BXX", "BXZ"], | ||
), | ||
output: | ||
adjoint_sources=expand( | ||
"adjoint_sources/{station_name}{network_name}.{component}.adj", | ||
station_name=["S0001"], | ||
network_name=["AA"], | ||
component=["BXX", "BXZ"], | ||
), | ||
shell: | ||
""" | ||
mkdir -p adjoint_sources | ||
echo "Hostname: $(hostname)" > output.log | ||
{ADJ_SEISMOGRAM_BIN} 27.0 32.0 S0001AA OUTPUT_FILES/results/ adjoint_sources/ 1 | ||
""" | ||
|
||
|
||
rule adjoint_simulation: | ||
input: | ||
database="OUTPUT_FILES/database.bin", | ||
stations="OUTPUT_FILES/STATIONS", | ||
source="adjoint_source.yaml", | ||
config="adjoint_config.yaml", | ||
adjoint_sources=expand( | ||
"adjoint_sources/{station_name}{network_name}.{component}.adj", | ||
station_name=["S0001"], | ||
network_name=["AA"], | ||
component=["BXX", "BXZ"], | ||
), | ||
output: | ||
kernels=directory("OUTPUT_FILES/Kernels"), | ||
resources: | ||
nodes=1, | ||
tasks=1, | ||
cpus_per_task=1, | ||
runtime=10, | ||
shell: | ||
""" | ||
# module purge | ||
# module load boost/1.73.0 | ||
mkdir -p OUTPUT_FILES/results | ||
echo "Hostname: $(hostname)" > output.log | ||
{SPECFEM_BIN} -p {input.config} >> output.log | ||
""" | ||
|
||
|
||
rule plot_kernels: | ||
input: | ||
kernels="OUTPUT_FILES/Kernels", | ||
plot_script="plot.py", | ||
output: | ||
plot="OUTPUT_FILES/Kernels.png", | ||
run: | ||
from plot import plot_kernels | ||
|
||
# Set matplotlib gui off | ||
import matplotlib | ||
matplotlib.use("Agg") | ||
|
||
plot_kernels(input.kernels, output.plot) | ||
|
||
|
||
rule clean: | ||
shell: | ||
""" | ||
rm -rf OUTPUT_FILES adjoint_sources | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
number-of-sources: 2 | ||
sources: | ||
- force: | ||
Ricker: | ||
f0: 0.42 | ||
factor: 7500000000.0 | ||
tshift: 0.0 | ||
angle: 270.0 | ||
source_surf: false | ||
vx: 0.0 | ||
vz: 0.0 | ||
x: 50000 | ||
z: 40000 | ||
- adjoint-source: | ||
External: | ||
format: ASCII | ||
stf: | ||
X-component: adjoint_sources/S0001AA.BXX.adj | ||
Z-component: adjoint_sources/S0001AA.BXZ.adj | ||
angle: 0.0 | ||
network_name: S0001 | ||
source-surf: false | ||
station_name: AA | ||
vx: 0.0 | ||
vz: 0.0 | ||
x: 150000.0 | ||
z: 40000.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
number-of-sources: 1 | ||
sources: | ||
- force: | ||
Ricker: | ||
f0: 0.42 | ||
factor: 7500000000.0 | ||
tshift: 0.0 | ||
angle: 270.0 | ||
source_surf: false | ||
vx: 0.0 | ||
vz: 0.0 | ||
x: 50000 | ||
z: 40000 |
This file was deleted.
Oops, something went wrong.