Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 0042 (Dockerfile and environments) #103

Closed
wants to merge 433 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
433 commits
Select commit Hold shift + click to select a range
18af08f
Merge branch 'main' into adding_PML
Olender Aug 15, 2023
33e8464
updating meshing functions
Olender Aug 15, 2023
8671ebe
Merge branch 'adding_PML' of github.com:Olender/spyro-1 into adding_PML
Olender Aug 15, 2023
af28be0
added for testing
Olender Aug 15, 2023
0205275
Merge branch 'adding_PML' of github.com:Olender/spyro-1 into adding_PML
Olender Aug 15, 2023
2c16df8
added debugging fucntions
Olender Aug 15, 2023
fc953f7
splitting old solver
Olender Aug 15, 2023
13ad0ed
reorganizing
Olender Aug 15, 2023
1e1a95e
seperating wave propagator for 2d
Olender Aug 15, 2023
c4a422d
making propagator independent of dimension
Olender Aug 15, 2023
0600eac
finished propagator
Olender Aug 15, 2023
139c1be
adding 3D
Olender Aug 15, 2023
d9ff590
removing unnecessary section
Olender Aug 16, 2023
62bd577
refactoring and renaming
Olender Aug 16, 2023
d7cf2c0
linting
Olender Aug 16, 2023
53a42cb
fixing tests
Olender Aug 16, 2023
19ad7fa
making pml test
Olender Aug 16, 2023
aede313
added pml test
Olender Aug 16, 2023
7387028
cleanup
Olender Aug 16, 2023
5362801
correct file location
Olender Aug 16, 2023
d89343f
fixing filename
Olender Aug 16, 2023
26e1c20
adding class selector and renaming
Olender Aug 17, 2023
b363856
adjusting imports
Olender Aug 17, 2023
bb8fbd2
linting
Olender Aug 17, 2023
50d3240
Merge pull request #18 from Olender/adding_PML
Olender Aug 17, 2023
24e9c4c
splitting firedrake mesh generation
Olender Aug 17, 2023
417f4b8
reducing complexity
Olender Aug 18, 2023
def5cfb
Merge pull request #19 from Olender/complexity_management
Olender Aug 18, 2023
208922c
Just adding documentation
Olender Aug 18, 2023
57e430f
Merge pull request #20 from Olender/complexity_management
Olender Aug 21, 2023
77058bf
reducing tests
Olender Aug 21, 2023
0e2258b
new codecov token for this fork
Olender Aug 21, 2023
7abee6d
switching to serial only
Olender Aug 21, 2023
ca25883
changing firedrake file
Olender Aug 21, 2023
7c4d78c
Merge pull request #22 from Olender/runner_debug
Olender Aug 21, 2023
41c773d
cleaning up and making sure it is abstract
Olender Aug 21, 2023
da1a89a
starting studying examples
Olender Aug 21, 2023
fe85d17
refactoring time integrator
Olender Aug 22, 2023
9e3e1ff
Started moving files
Olender Aug 23, 2023
b6513d5
Moving matrix builders
Olender Aug 25, 2023
1b6ec7f
fixing existing tests
Olender Aug 25, 2023
98a6592
joining classes
Olender Aug 25, 2023
12d3a4c
removing unused classes
Olender Aug 25, 2023
0616ea6
cleaning up imports
Olender Aug 25, 2023
4b8d0d4
finished parameters
Olender Aug 25, 2023
9d7e443
added camembert test
Olender Aug 29, 2023
f363d95
adding h parameter
Olender Aug 29, 2023
4c0da25
updating rectangle class
Olender Aug 29, 2023
bef28a3
making camembert inherit rectangle
Olender Aug 29, 2023
e7be4c7
fixed rectangle test
Olender Aug 29, 2023
0159af9
started testing plots
Olender Aug 29, 2023
8a857f5
finished plot test
Olender Aug 29, 2023
742111c
started debugging test
Olender Aug 29, 2023
6cb6433
Testing
Olender Aug 30, 2023
a13c45e
Merge branch 'adding_tests' of github.com:Olender/spyro-1 into adding…
Olender Aug 30, 2023
c8e0695
started adding utils test
Olender Aug 31, 2023
c91d1e0
added filter test
Olender Aug 31, 2023
efb88cb
added more utils test
Olender Aug 31, 2023
b4bf2f6
cleaning up
Olender Aug 31, 2023
29e8394
reducing complexity
Olender Aug 31, 2023
c362f70
Merge pull request #25 from Olender/adding_tests
Olender Aug 31, 2023
8140700
adding analytical functions
Olender Sep 4, 2023
1c80915
documentation
Olender Sep 4, 2023
04d2d9c
adding temp files for later cleanup
Olender Sep 4, 2023
a3c2995
finished changes required for analytical 2d solve and test
Olender Sep 4, 2023
9166740
just cleaning up
Olender Sep 5, 2023
e5f1b64
fixing 3d quad
Olender Sep 5, 2023
bd1f77b
adding temp 3d test
Olender Sep 5, 2023
f8d0db2
adding 3D hexa test
Olender Sep 5, 2023
e8904c2
updating core count
Olender Sep 5, 2023
12c85ff
adding coverage for 3d
Olender Sep 5, 2023
25801f0
testing 3d and then covering
Olender Sep 5, 2023
0f6aaf9
Merge pull request #26 from Olender/testing_3d
Olender Sep 5, 2023
da6973f
Update README.md
Olender Sep 6, 2023
8d084ba
removing temp file
Olender Sep 6, 2023
0062572
Merge pull request #27 from Olender/Olender-patch-1
Olender Sep 6, 2023
c228c9c
started making temp files
Olender Sep 6, 2023
2f7f5a2
started adding cpw calc
Olender Sep 7, 2023
952eeb1
starting first test
Olender Sep 7, 2023
a3584eb
added first test
Olender Sep 7, 2023
2fb3a2a
added reference solution
Olender Sep 7, 2023
a2ac3f6
added save and load option
Olender Sep 8, 2023
be7ca53
moslty linting
Olender Sep 10, 2023
8bb4c56
started adding seismicmesh
Olender Sep 10, 2023
b7ded07
linting tests
Olender Sep 10, 2023
377d5d5
added homogeneous seismicmesh calculation
Olender Sep 12, 2023
3611456
finished first test
Olender Sep 12, 2023
0fb8386
setting up radius calc
Olender Sep 12, 2023
c9c64c5
finished homogeneous test
Olender Sep 12, 2023
8ccb627
cleanup
Olender Sep 12, 2023
e703130
getting ready to save solution
Olender Sep 12, 2023
a0dd7ca
it started running
Olender Sep 17, 2023
7c4d8f1
trying first case
Olender Sep 17, 2023
6dfd26b
testing
Olender Sep 18, 2023
6d4c227
adding new error calc
Olender Sep 18, 2023
8ca5810
got it running
Olender Sep 18, 2023
8bf2fbb
updating results
Olender Sep 18, 2023
3cf60b4
added results and figure calculation
Olender Sep 18, 2023
2d03b04
linting
Olender Sep 18, 2023
836e552
debugged wavelet generation
Olender Sep 19, 2023
d868fa8
finishing simulation
Olender Sep 19, 2023
d0b0ee0
updating and cleaning up
Olender Sep 29, 2023
441594a
updating test
Olender Sep 29, 2023
aa53fe7
putting reference solution file in correctly
Olender Sep 29, 2023
6c87100
cleanup
Olender Sep 29, 2023
5461c47
Merge pull request #30 from Olender/cells_per_wavelength
Olender Sep 29, 2023
fb438d9
cleaning up repeated sections
Olender Oct 2, 2023
0e1ffa6
splitting methods
Olender Oct 2, 2023
f5169ba
expanding tests
Olender Oct 2, 2023
c5694ee
just linting
Olender Oct 2, 2023
aefce91
commenting out uused ensemble
Olender Oct 2, 2023
a1dbf9f
Merge pull request #31 from Olender/cleanup
Olender Oct 2, 2023
1f41b3e
DOcumentation
Olender Oct 2, 2023
63836cb
Merge pull request #32 from Olender/cleanup
Olender Oct 3, 2023
db1999b
refined accuracy tests
Olender Oct 3, 2023
2d3a498
Getting results for chapter
Olender Oct 4, 2023
9a7b6a6
saving results
Olender Oct 4, 2023
ef68c2a
updating plot
Olender Oct 4, 2023
73325a3
updating plot
Olender Oct 4, 2023
3a08d63
adding g calcs
Olender Oct 5, 2023
8ed9dc2
added first image data
Olender Oct 5, 2023
d9065d5
starting heterogeneous implementation
Olender Oct 6, 2023
600d3a3
commit to test in demeter
Olender Oct 6, 2023
e56ed47
testing forward and mesh generation
Olender Oct 6, 2023
13d6cc5
fixing forward problem with velocity model
Olender Oct 11, 2023
e1a13c5
changing to dictionary mesh parameters
Olender Oct 13, 2023
2fc7a4e
fixing tests
Olender Oct 17, 2023
be63a35
got het cpw working
Olender Oct 18, 2023
5743a22
adding het results
Olender Oct 19, 2023
c9aeb3c
fixing tests
Olender Oct 19, 2023
d6d9d67
fixing 3d test
Olender Oct 19, 2023
9f25be7
cleaning up
Olender Oct 20, 2023
57f482c
Merge pull request #33 from Olender/cell_per_wavelength_mlt_chapter_n…
Olender Oct 23, 2023
6e89ad4
adding 3d run
Olender Oct 23, 2023
d719cc7
fixing meshing
Olender Oct 23, 2023
9c79f2f
first comparisons
Olender Oct 25, 2023
d5a7fd6
initial results from mintrop
Olender Oct 26, 2023
2ca4623
Merge branch 'cpw_mls_results' of github.com:Olender/spyro-1 into cpw…
Olender Oct 26, 2023
c078551
Merge branch 'cpw_mls_results' of github.com:Olender/spyro-1 into cpw…
Olender Oct 26, 2023
04b0de5
Adding demeter changes
Olender Oct 30, 2023
918bb66
continuiung comparison
Olender Oct 30, 2023
77515d7
first new tests before going home
Olender Oct 30, 2023
6953aba
testing
Olender Nov 1, 2023
14f6520
working with parallelism
Olender Nov 7, 2023
018251f
adding temp files
Olender Nov 7, 2023
d7d854a
Merge branch 'cpw_mls_results' of github.com:Olender/spyro-1 into cpw…
Olender Nov 7, 2023
3c4973c
updating for tests
Olender Nov 7, 2023
85a479b
cleanup
Olender Nov 8, 2023
582cbe2
added verification for heterogeneous 2d velocity
Olender Nov 16, 2023
016f638
sending data to demeter
Olender Nov 16, 2023
878b7c6
sending data
Olender Nov 16, 2023
02e18ca
Adding next ricker propagation 2d figures
Olender Nov 16, 2023
c29ef08
Moving files
Olender Nov 16, 2023
20ec0c9
sending to mintrop
Olender Nov 16, 2023
7da4572
updating with 3d results
Olender Nov 20, 2023
60cd4ce
finishing up more figures
Olender Nov 20, 2023
4d0eac5
added 2d homogeneous results
Olender Nov 20, 2023
9281bdd
updating with mintrop results
Olender Nov 21, 2023
b186c8e
sending to mintrop
Olender Nov 21, 2023
89663f8
Merge branch 'chapter_mls_all_images' of github.com:Olender/spyro-1 i…
Olender Nov 21, 2023
711e3db
updating results
Olender Nov 22, 2023
dd2146d
data organizers
Olender Nov 22, 2023
06d42bc
finished basic plot
Olender Nov 22, 2023
d210af6
moving and cleaning up
Olender Nov 22, 2023
3eaf76a
finishing figure
Olender Nov 22, 2023
eeaf972
finished 3d verification image
Olender Nov 23, 2023
6b899ad
moving to folder
Olender Nov 23, 2023
b65d618
cell figure generator
Olender Nov 23, 2023
7809f91
cleanup
Olender Nov 23, 2023
ddc23f2
started adding 3g figures
Olender Nov 23, 2023
3d7374e
added 3d elements
Olender Nov 23, 2023
7f7525b
moving files
Olender Nov 23, 2023
0b1b27a
heterogeneous data
Olender Nov 27, 2023
59300a0
cleaning_up_results
Olender Nov 27, 2023
b3b5948
moving files to folder
Olender Nov 27, 2023
e87ee98
updating images
Olender Nov 28, 2023
2f9b795
creating gen velocity figure
Olender Nov 28, 2023
2d3e395
sending to demeter
Olender Nov 28, 2023
cfae26e
cpw6_just results
Olender Nov 30, 2023
4dd107f
updating with correct image
Olender Nov 30, 2023
24d83e8
Merge branch 'chapter_mls_all_images' of github.com:Olender/spyro-1 i…
Olender Nov 30, 2023
b4078d7
using runtime results from same computer
Olender Nov 30, 2023
8138576
cleaning_up
Olender Nov 30, 2023
c2e9768
updating for new figures
Olender Nov 30, 2023
709783d
updating figure
Olender Nov 30, 2023
a55b1ec
trying to fix tests
Olender Dec 7, 2023
9eb476b
deleting chapter folders
Olender Dec 8, 2023
e0f991a
Adding documentation
Olender Dec 8, 2023
8ef2775
Improving complexity
Olender Dec 11, 2023
e68e67e
Merge pull request #36 from Olender/chapter_MLS_cleanup
Olender Dec 11, 2023
5b19e8e
started test
Olender Dec 11, 2023
0fc1580
adding more velocity interpolator operators
Olender Dec 12, 2023
f135bdc
gettin ready to add gradient calculation
Olender Dec 13, 2023
3ae9504
starting gradient calculation
Olender Dec 14, 2023
6827c55
finished first fwi object test of misfit calculation
Olender Dec 18, 2023
24dfb41
fixing gradient calc
Olender Dec 27, 2023
077c7e1
reinitializing variables
Olender Dec 27, 2023
23bb49b
resetting Pressure
Olender Dec 28, 2023
12c9bd4
Finding adjoint error
Olender Jan 8, 2024
0f286ea
comparing forward problem with devito
Olender Jan 15, 2024
185fe42
started tests with camembert model
Olender Jan 17, 2024
232a1c3
debugging and moving testing files
Olender Jan 18, 2024
69ff6b2
added testing data
Olender Jan 18, 2024
cc23f85
trying out camembert
Olender Jan 20, 2024
db019f1
comparing with devito
Olender Jan 23, 2024
fbd2c3e
still debugging
Olender Jan 23, 2024
2f517ce
seems fixed
Olender Feb 2, 2024
6f46616
getting everything ready before cleaning up
Olender Feb 2, 2024
1720c96
cleaning up
Olender Feb 2, 2024
19e5705
Removing testing files
Olender Feb 2, 2024
3b32e8e
started adding fwi
Olender Feb 2, 2024
7aa2ead
Merge pull request #37 from Olender/adding_gradient
Olender Feb 2, 2024
3231d3a
started testing gradient in fwi obj
Olender Feb 2, 2024
ee612f5
added fwi parameters correctly
Olender Feb 2, 2024
bd0f839
Documentation and parallelism
Olender Feb 5, 2024
71970fc
fixing gradient communicator
Olender Feb 5, 2024
44a08e8
starting mpi debug
Olender Feb 15, 2024
0088450
debugging comm
Olender Feb 15, 2024
dc54372
fixing meshing comm
Olender Feb 15, 2024
6601dc3
sending to demeter
Olender Feb 15, 2024
e5e1457
mpidebugging files
Olender Feb 16, 2024
a6f5b4c
minor update
Olender Feb 20, 2024
deee541
testing files
Olender Mar 8, 2024
73424a4
local_changes
Olender Mar 10, 2024
6ad7e49
Merge branch 'adding_fwi' of github.com:Olender/spyro-1 into adding_fwi
Olender Mar 10, 2024
58f8ee9
scipy fwi
Olender Mar 10, 2024
dae3566
adding rol options
Olender Mar 26, 2024
cab5e60
Merge branch 'adding_fwi' of github.com:Olender/spyro-1 into adding_fwi
Olender Mar 26, 2024
0bc067b
fixing tests
Olender Mar 26, 2024
6c52274
Merge branch 'adding_fwi' of github.com:Olender/spyro-1 into adding_fwi
Olender Mar 26, 2024
53eb96a
added ROL as optional
Olender Mar 26, 2024
2ba5855
fixed tests
Olender Mar 26, 2024
0b7f8c9
saving test before rewriting as test
Olender Mar 26, 2024
1dccfc9
Added forward parallel test
Olender Mar 27, 2024
d11b6ea
added first user friendly tutorials
Olender Apr 11, 2024
60591b3
added exercises
Olender Apr 15, 2024
5a42709
added meshing tutorial
Olender Apr 18, 2024
2d5a0d2
added premade useful examples tutorial
Olender Apr 22, 2024
f0f3597
temp file for backup
Olender Apr 24, 2024
8d8271d
removing outdated demos
Olender Apr 25, 2024
51ced01
moving tutorials
Olender Apr 25, 2024
639230d
minor update
Olender Apr 26, 2024
a1846f9
removed unfinished tutorial
Olender Apr 26, 2024
194e42f
Merge branch 'main' into adding_tutorials
Olender Apr 26, 2024
3984f1a
removing codescene
Olender May 2, 2024
a1b1fc7
Merge pull request #40 from Olender/adding_tutorials
Olender May 2, 2024
ae9b3d7
Add first version of Dockerfile with release image
SouzaEM May 7, 2024
5dadc19
Add testing environment to Docker images
SouzaEM May 7, 2024
4707465
Add development environment to Docker images
SouzaEM May 7, 2024
f97931b
Add python3-tk to enable visualization with the container and fix ins…
SouzaEM Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .coverage
Binary file not shown.
63 changes: 34 additions & 29 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,45 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Running serial tests in parallel (only one test per core)
- name: Running serial tests
run: |
source /home/olender/Firedrakes/main/firedrake/bin/activate
pytest -n 10 --cov-report=xml --cov=spyro test/
- name: Running serial tests for adjoint
run: |
source /home/olender/Firedrakes/main/firedrake/bin/activate
pytest -n 10 --cov-report=xml --cov-append --cov=spyro test_ad/
- name: Running parallel tests
run: |
source /home/olender/Firedrakes/main/firedrake/bin/activate
cp /home/olender/Testing_files/velocity_models/* velocity_models/
cp /home/olender/Testing_files/meshes/* meshes/
mpiexec -n 10 pytest test_parallel/test_forward.py
- name: Covering parallel tests
continue-on-error: true
run: |
source /home/olender/Firedrakes/main/firedrake/bin/activate
cp /home/olender/Testing_files/velocity_models/* velocity_models/
cp /home/olender/Testing_files/meshes/* meshes/
mpiexec -n 10 pytest --cov-report=xml --cov-append --cov=spyro test_parallel/test_forward.py
source /home/olender/Firedrakes/newest3/firedrake/bin/activate
pytest --cov-report=xml --cov=spyro test/
- name: Running parallel 3D forward test
run: |
source /home/olender/Firedrakes/main/firedrake/bin/activate
cp /home/olender/Testing_files/velocity_models/* velocity_models/
cp /home/olender/Testing_files/meshes/* meshes/
mpiexec -n 10 pytest test_3d/test_forward_3d.py
source /home/olender/Firedrakes/newest3/firedrake/bin/activate
mpiexec -n 6 pytest test_3d/test_hexahedral_convergence.py
mpiexec -n 6 pytest test_parallel/test_forward.py
- name: Covering parallel 3D forward test
continue-on-error: true
run: |
source /home/olender/Firedrakes/main/firedrake/bin/activate
cp /home/olender/Testing_files/velocity_models/* velocity_models/
cp /home/olender/Testing_files/meshes/* meshes/
mpiexec -n 10 pytest --cov-report=xml --cov-append --cov=spyro test_3d/test_forward_3d.py
source /home/olender/Firedrakes/newest3/firedrake/bin/activate
mpiexec -n 6 pytest --cov-report=xml --cov-append --cov=spyro test_3d/test_hexahedral_convergence.py
mpiexec -n 6 pytest --cov-report=xml --cov-append --cov=spyro test_parallel/test_forward.py
# - name: Running serial tests for adjoint
# run: |
# source /home/olender/Firedrakes/main/firedrake/bin/activate
# pytest -n 10 --cov-report=xml --cov-append --cov=spyro test_ad/
# - name: Running parallel tests
# run: |
# source /home/olender/Firedrakes/main/firedrake/bin/activate
# cp /home/olender/Testing_files/velocity_models/* velocity_models/
# cp /home/olender/Testing_files/meshes/* meshes/
# mpiexec -n 10 pytest test_parallel/test_forward.py
# - name: Covering parallel tests
# continue-on-error: true
# run: |
# source /home/olender/Firedrakes/main/firedrake/bin/activate
# cp /home/olender/Testing_files/velocity_models/* velocity_models/
# cp /home/olender/Testing_files/meshes/* meshes/
# mpiexec -n 10 pytest --cov-report=xml --cov-append --cov=spyro test_parallel/test_forward.py
# - name: Covering parallel 3D forward test
# continue-on-error: true
# run: |
# source /home/olender/Firedrakes/main/firedrake/bin/activate
# cp /home/olender/Testing_files/velocity_models/* velocity_models/
# cp /home/olender/Testing_files/meshes/* meshes/
# mpiexec -n 10 pytest --cov-report=xml --cov-append --cov=spyro test_3d/test_forward_3d.py
- name: Uploading coverage to Codecov
run: export CODECOV_TOKEN="6cd21147-54f7-4b77-94ad-4b138053401d" && bash <(curl -s https://codecov.io/bash)
run: export CODECOV_TOKEN="057ec853-d7ea-4277-819b-0c5ea2f9ff57" && bash <(curl -s https://codecov.io/bash)

29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// {
// "name": "Python Attach 0",
// "type": "python",
// "request": "attach",
// "port": 3000,
// "host": "localhost",
// },
// {
// "name": "Python Attach 1",
// "type": "python",
// "request": "attach",
// "port": 3001,
// "host": "localhost"
// },
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
182 changes: 83 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
[![DOI](https://zenodo.org/badge/318542339.svg)](https://zenodo.org/badge/latestdoi/318542339)
[![Python tests](https://github.com/NDF-Poli-USP/spyro/actions/workflows/python-tests.yml/badge.svg)](https://github.com/NDF-Poli-USP/spyro/actions/workflows/python-tests.yml)
[![codecov](https://codecov.io/gh/NDF-Poli-USP/spyro/branch/main/graph/badge.svg?token=8NM4N4N7YW)](https://codecov.io/gh/NDF-Poli-USP/spyro)
[![codecov](https://codecov.io/gh/Olender/spyro-1/graph/badge.svg?token=69M30UMRFD)](https://codecov.io/gh/Olender/spyro-1)

spyro: Acoustic wave modeling in Firedrake
SPIRO: Seismic Parallel Inversion and Reconstruction Optimization framework
============================================

spyro is a Python library for modeling acoustic waves. The main
Acoustic wave modeling in Firedrake

SPIRO is a Python library for modeling acoustic waves. The main
functionality is a set of forward and adjoint wave propagators for solving the acoustic wave equation in the time domain.
These wave propagators can be used to form complete full waveform inversion (FWI) applications. See the [demos](https://github.com/krober10nd/spyro/tree/main/demos).
To implement these solvers, spyro uses the finite element package [Firedrake](https://www.firedrakeproject.org/index.html).
To implement these solvers, SPIRO uses the finite element package [Firedrake](https://www.firedrakeproject.org/index.html).

To use Spyro, you'll need to have some knowledge of Python and some basic concepts in inverse modeling relevant to active-sourcce seismology.
To use SPIRO, you'll need to have some knowledge of Python and some basic concepts in inverse modeling relevant to active-sourcce seismology.

Discussions about development take place on our Slack channel. Everyone is invited to join using the link: https://join.slack.com/t/spyroworkspace/shared_invite/zt-u87ih28m-2h9JobfkdArs4ku3a1wLLQ

Expand Down Expand Up @@ -51,137 +53,119 @@ See the demos folder for an FWI example (this requires some other dependencies p
![Above shows the simulation at two timesteps in ParaView that results from running the code below](https://user-images.githubusercontent.com/18619644/94087976-7e81df00-fde5-11ea-96c0-474348286091.png)

```python
from firedrake import (
RectangleMesh,
FunctionSpace,
Function,
SpatialCoordinate,
conditional,
File,
)

import spyro

model = {}

# Choose method and parameters
model["opts"] = {
"method": "KMV", # either CG or KMV
"quadratrue": "KMV", # Equi or KMV
"degree": 1, # p order
"dimension": 2, # dimension
dictionary = {}

# Choose spatial discretization method and parameters
dictionary["options"] = {
# simplexes such as triangles or tetrahedra (T) or quadrilaterals (Q)
"cell_type": "T",
# lumped, equispaced or DG, default is lumped "method":"MLT",
# (MLT/spectral_quadrilateral/DG_triangle/DG_quadrilateral)
# You can either specify a cell_type+variant or a method.
"variant": 'lumped',
# Polynomial order of the spatial discretion's basis functions.
# For MLT we recomend 4th order in 2D, 3rd order in 3D, for SEM 4th or 8th.
"degree": 4,
# Dimension (2 or 3)
"dimension": 2,
}

# Number of cores for the shot. For simplicity, we keep things serial.
# spyro however supports both spatial parallelism and "shot" parallelism.
model["parallelism"] = {
"type": "spatial", # options: automatic (same number of cores for evey processor) or spatial
# Number of cores for the shot. For simplicity, we keep things automatic.
# SPIRO supports both spatial parallelism and "shot" parallelism.
dictionary["parallelism"] = {
# options: automatic (same number of cores for every shot) or spatial
"type": "automatic",
}

# Define the domain size without the PML. Here we'll assume a 0.75 x 1.50 km
# domain and reserve the remaining 250 m for the Perfectly Matched Layer (PML) to absorb
# outgoing waves on three sides (eg., -z, +-x sides) of the domain.
model["mesh"] = {
"Lz": 0.75, # depth in km - always positive
"Lx": 1.5, # width in km - always positive
"Ly": 0.0, # thickness in km - always positive
"meshfile": "not_used.msh",
"initmodel": "not_used.hdf5",
"truemodel": "not_used.hdf5",
}

# Specify a 250-m PML on the three sides of the domain to damp outgoing waves.
model["BCs"] = {
"status": True, # True or false
"outer_bc": "non-reflective", # None or non-reflective (outer boundary condition)
"damping_type": "polynomial", # polynomial, hyperbolic, shifted_hyperbolic
"exponent": 2, # damping layer has a exponent variation
"cmax": 4.7, # maximum acoustic wave velocity in PML - km/s
"R": 1e-6, # theoretical reflection coefficient
"lz": 0.25, # thickness of the PML in the z-direction (km) - always positive
"lx": 0.25, # thickness of the PML in the x-direction (km) - always positive
"ly": 0.0, # thickness of the PML in the y-direction (km) - always positive
dictionary["mesh"] = {
# depth in km - always positive
"Lz": 0.75,
# width in km - always positive
"Lx": 1.50,
# thickness in km - always positive
"Ly": 0.0,
# If we are loading and external .msh mesh file
"mesh_file": None,
# options: None (default), firedrake_mesh, user_mesh, or SeismicMesh
# use this opion if your are not loading an external file
# 'firedrake_mesh' will create an automatic mesh using firedrake's built-in meshing tools
# 'user_mesh' gives the option to load other user generated meshes from unsuported formats
# 'SeismicMesh' automatically creates a waveform adapted unstructured mesh to reduce total
# DoFs using the SeismicMesh tool.
"mesh_type": "firedrake_mesh",
}

# Create a source injection operator. Here we use a single source with a
# Ricker wavelet that has a peak frequency of 8 Hz injected at the center of the mesh.
# We also specify to record the solution at 101 microphones near the top of the domain.
# This transect of receivers is created with the helper function `create_transect`.
model["acquisition"] = {
"source_type": "Ricker",
"source_pos": [(-0.1, 0.75)],
dictionary["acquisition"] = {
"source_type": "ricker",
"source_locations": [(-0.3, 0.75)],
"frequency": 8.0,
"delay": 1.0,
"receiver_locations": spyro.create_transect(
(-0.10, 0.1), (-0.10, 1.4), 100
(-0.5, 0.1), (-0.5, 1.4), 100
),
}

# Simulate for 2.0 seconds.
model["timeaxis"] = {
"t0": 0.0, # Initial time for event
"tf": 2.00, # Final time for event
"dt": 0.0005, # timestep size
"amplitude": 1, # the Ricker has an amplitude of 1.
"nspool": 100, # how frequently to output solution to pvds
"fspool": 100, # how frequently to save solution to RAM
dictionary["time_axis"] = {
# Initial time for event
"initial_time": 0.0,
# Final time for event
"final_time": 0.50,
# timestep size
"dt": 0.0001,
# the Ricker has an amplitude of 1.
"amplitude": 1,
# how frequently to output solution to pvds
"output_frequency": 100,
# how frequently to save solution to RAM
"gradient_sampling_frequency": 100,
}

dictionary["visualization"] = {
"forward_output" : True,
"output_filename": "results/forward_output.pvd",
"fwi_velocity_model_output": False,
"velocity_model_filename": None,
"gradient_output": False,
"gradient_filename": None,
}

# Create a simple mesh of a rectangle ∈ [1 x 2] km with ~100 m sized elements
# and then create a function space for P=1 Continuous Galerkin FEM
mesh = RectangleMesh(100, 200, 1.0, 2.0)

# We edit the coordinates of the mesh so that it's in the (z, x) plane
# and has a domain padding of 250 m on three sides, which will be used later to show
# the Perfectly Matched Layer (PML). More complex 2D/3D meshes can be automatically generated with
# SeismicMesh https://github.com/krober10nd/SeismicMesh
mesh.coordinates.dat.data[:, 0] -= 1.0
mesh.coordinates.dat.data[:, 1] -= 0.25

# Create an AcousticWave object with the above dictionary.
Wave_obj = spyro.AcousticWave(dictionary=dictionary)

# Create the computational environment
comm = spyro.utils.mpi_init(model)
# Defines the element size in the automatically generated firedrake mesh.
Wave_obj.set_mesh(dx=0.01)

element = spyro.domains.space.FE_method(
mesh, model["opts"]["method"], model["opts"]["degree"]
)
V = FunctionSpace(mesh, element)

# Manually create a simple two layer seismic velocity model `vp`.
# Note: the user can specify their own velocity model in a HDF5 file format
# in the above two lines using SeismicMesh.
# If so, the HDF5 file has to contain an array with
# Manually create a simple two layer seismic velocity model.
# Note: the user can specify their own velocity model in a HDF5 or SEG-Y file format.
# The HDF5 file has to contain an array with
# the velocity data and it is linearly interpolated onto the mesh nodes at run-time.
x, y = SpatialCoordinate(mesh)
velocity = conditional(x > -0.35, 1.5, 3.0)
vp = Function(V, name="velocity").interpolate(velocity)
# These pvd files can be easily visualized in ParaView!
File("simple_velocity_model.pvd").write(vp)


# Now we instantiate both the receivers and source objects.
sources = spyro.Sources(model, mesh, V, comm)

receivers = spyro.Receivers(model, mesh, V, comm)

# Create a wavelet to force the simulation
wavelet = spyro.full_ricker_wavelet(dt=0.0005, tf=2.0, freq=8.0)
z = Wave_obj.mesh_z
import firedrake as fire
velocity_conditional = fire.conditional(z > -0.35, 1.5, 3.0)
Wave_obj.set_initial_velocity_model(conditional=velocity_conditional, output=True)

# And now we simulate the shot using a 2nd order central time-stepping scheme
# Note: simulation results are stored in the folder `~/results/` by default
p_field, p_at_recv = spyro.solvers.forward(
model, mesh, comm, vp, sources, wavelet, receivers
)
Wave_obj.forward_solve()

# Visualize the shot record
spyro.plots.plot_shots(model, comm, p_at_recv)
spyro.plots.plot_shots(Wave_obj, show=True)

# Save the shot (a Numpy array) as a pickle for other use.
spyro.io.save_shots(model, comm, p_at_recv)
spyro.io.save_shots(Wave_obj)

# can be loaded back via
my_shot = spyro.io.load_shots(model, comm)
my_shot = spyro.io.load_shots(Wave_obj)
```

### Testing
Expand Down
Loading
Loading