From d0ca8aa65e9ee2c5ef9a6e99cbc512567b0ecb75 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 4 Nov 2024 12:33:56 -0500 Subject: [PATCH 1/6] Fixed example directory structure | Added documentation links on examples --- docs/cookbooks/example_02.rst | 3 +++ docs/getting_started/index.rst | 6 +++--- examples/Tromp_2005/{ => CMakeFiles}/Par_File.in | 0 examples/Tromp_2005/{ => CMakeFiles}/Snakefile.in | 0 examples/Tromp_2005/CMakeLists.txt | 3 ++- examples/Tromp_2005/README.md | 2 +- examples/fluid-solid-interface/{ => CMakeFiles}/Par_File.in | 0 .../{ => CMakeFiles}/specfem_config.yaml.in | 0 examples/fluid-solid-interface/CMakeLists.txt | 4 ++-- examples/fluid-solid-interface/README.md | 2 +- .../{ => CMakeFiles}/Par_File.in | 0 .../{ => CMakeFiles}/specfem_config.yaml.in | 0 examples/homogeneous-medium-flat-topography/CMakeLists.txt | 4 ++-- examples/homogeneous-medium-flat-topography/README.md | 2 +- 14 files changed, 15 insertions(+), 11 deletions(-) rename examples/Tromp_2005/{ => CMakeFiles}/Par_File.in (100%) rename examples/Tromp_2005/{ => CMakeFiles}/Snakefile.in (100%) rename examples/fluid-solid-interface/{ => CMakeFiles}/Par_File.in (100%) rename examples/fluid-solid-interface/{ => CMakeFiles}/specfem_config.yaml.in (100%) rename examples/homogeneous-medium-flat-topography/{ => CMakeFiles}/Par_File.in (100%) rename examples/homogeneous-medium-flat-topography/{ => CMakeFiles}/specfem_config.yaml.in (100%) diff --git a/docs/cookbooks/example_02.rst b/docs/cookbooks/example_02.rst index d94b1f78..3bae8efe 100644 --- a/docs/cookbooks/example_02.rst +++ b/docs/cookbooks/example_02.rst @@ -51,6 +51,7 @@ Parameter file ~~~~~~~~~~~~~ .. code-block:: bash + :caption: Par_File #----------------------------------------------------------- # @@ -199,6 +200,7 @@ Defining the topography of the domain We define the topography of the domain using the following topography file .. code-block:: bash + :caption: topography_file.dat # # number of interfaces @@ -260,6 +262,7 @@ Defining the source We define the source location and the source time function in the source file. .. code-block:: yaml + :caption: single_source.yaml :linenos: number-of-sources: 1 diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst index 834fd8ba..cbc99e31 100644 --- a/docs/getting_started/index.rst +++ b/docs/getting_started/index.rst @@ -127,11 +127,11 @@ SPECFEM++ inherits several architecure specific cmake configuration keywords fro Adding SPECFEM to PATH ---------------------- -Finally, once compiled you could run SPECFEM++ from inside the build directory, by running the executible ``./specfem``. However, we recommend you add SPECFEM++ build directory to your ``PATH`` using +Finally, once compiled you could run SPECFEM++ from inside the build directory, by running the executible ``./specfem2d``. However, we recommend you add SPECFEM++ build directory to your ``PATH`` using .. code-block:: bash - export $PATH=$(pwd)/build:$PATH + export PATH=$(pwd)/build:$PATH Running the solver ------------------ @@ -145,7 +145,7 @@ Lets run a simple example to test the installation. We will use the ``example\ho .. code-block:: bash cd examples/homogeneous-medium-flat-topography - xmeshfem2D -p Par_file + xmeshfem2D -p Par_File This will generate the mesh files. Next, we will run the solver using diff --git a/examples/Tromp_2005/Par_File.in b/examples/Tromp_2005/CMakeFiles/Par_File.in similarity index 100% rename from examples/Tromp_2005/Par_File.in rename to examples/Tromp_2005/CMakeFiles/Par_File.in diff --git a/examples/Tromp_2005/Snakefile.in b/examples/Tromp_2005/CMakeFiles/Snakefile.in similarity index 100% rename from examples/Tromp_2005/Snakefile.in rename to examples/Tromp_2005/CMakeFiles/Snakefile.in diff --git a/examples/Tromp_2005/CMakeLists.txt b/examples/Tromp_2005/CMakeLists.txt index d50f5ecd..b511f69e 100644 --- a/examples/Tromp_2005/CMakeLists.txt +++ b/examples/Tromp_2005/CMakeLists.txt @@ -1,4 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.17.5) -configure_file(Snakefile.in ${CMAKE_SOURCE_DIR}/examples/Tromp_2005/Snakefile) +configure_file(CMakeFiles/Par_File.in ${CMAKE_SOURCE_DIR}/examples/Tromp_2005/Par_File) +configure_file(CMakeFiles/Snakefile.in ${CMAKE_SOURCE_DIR}/examples/Tromp_2005/Snakefile) diff --git a/examples/Tromp_2005/README.md b/examples/Tromp_2005/README.md index 6bc1139f..298b1514 100644 --- a/examples/Tromp_2005/README.md +++ b/examples/Tromp_2005/README.md @@ -1,6 +1,6 @@ # Wave propagation through homogeneous medium with no interfaces -This example reproduces the results from Fig 9 of [Tromp et al. 2005](https://doi.org/10.1111/j.1365-246X.2004.02453.x). +This example reproduces the results from Fig 9 of [Tromp et al. 2005](https://doi.org/10.1111/j.1365-246X.2004.02453.x). For a step-by-step guide on this example, please refer to the [documentation](https://specfem2d-kokkos.readthedocs.io/en/latest/cookbooks/example_03.html). ## Running the examples diff --git a/examples/fluid-solid-interface/Par_File.in b/examples/fluid-solid-interface/CMakeFiles/Par_File.in similarity index 100% rename from examples/fluid-solid-interface/Par_File.in rename to examples/fluid-solid-interface/CMakeFiles/Par_File.in diff --git a/examples/fluid-solid-interface/specfem_config.yaml.in b/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in similarity index 100% rename from examples/fluid-solid-interface/specfem_config.yaml.in rename to examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in diff --git a/examples/fluid-solid-interface/CMakeLists.txt b/examples/fluid-solid-interface/CMakeLists.txt index 5235ddfa..da471514 100644 --- a/examples/fluid-solid-interface/CMakeLists.txt +++ b/examples/fluid-solid-interface/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.17.5) -configure_file(specfem_config.yaml.in ${CMAKE_SOURCE_DIR}/examples/fluid-solid-interface/specfem_config.yaml) -configure_file(Par_File.in ${CMAKE_SOURCE_DIR}/examples/fluid-solid-interface/Par_File) +configure_file(CMakeFiles/specfem_config.yaml.in ${CMAKE_SOURCE_DIR}/examples/fluid-solid-interface/specfem_config.yaml) +configure_file(CMakeFiles/Par_File.in ${CMAKE_SOURCE_DIR}/examples/fluid-solid-interface/Par_File) diff --git a/examples/fluid-solid-interface/README.md b/examples/fluid-solid-interface/README.md index 5ad63fde..932c2cfa 100644 --- a/examples/fluid-solid-interface/README.md +++ b/examples/fluid-solid-interface/README.md @@ -1,6 +1,6 @@ # Wave propagration through fluid-solid interface -This example creates the fluid-solid example with flat ocean bottom from [Komatitsch et. al.](https://doi.org/10.1190/1.1444758). +This example creates the fluid-solid example with flat ocean bottom from [Komatitsch et. al.](https://doi.org/10.1190/1.1444758). For a step-by-step guide on this example, please refer to the [documentation](https://specfem2d-kokkos.readthedocs.io/en/latest/cookbooks/example_02.html). ## Running the examples diff --git a/examples/homogeneous-medium-flat-topography/Par_File.in b/examples/homogeneous-medium-flat-topography/CMakeFiles/Par_File.in similarity index 100% rename from examples/homogeneous-medium-flat-topography/Par_File.in rename to examples/homogeneous-medium-flat-topography/CMakeFiles/Par_File.in diff --git a/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in b/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in similarity index 100% rename from examples/homogeneous-medium-flat-topography/specfem_config.yaml.in rename to examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in diff --git a/examples/homogeneous-medium-flat-topography/CMakeLists.txt b/examples/homogeneous-medium-flat-topography/CMakeLists.txt index 98b29e65..4b2d8ad5 100644 --- a/examples/homogeneous-medium-flat-topography/CMakeLists.txt +++ b/examples/homogeneous-medium-flat-topography/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.17.5) -configure_file(Par_File.in ${CMAKE_SOURCE_DIR}/examples/homogeneous-medium-flat-topography/Par_File) -configure_file(specfem_config.yaml.in ${CMAKE_SOURCE_DIR}/examples/homogeneous-medium-flat-topography/specfem_config.yaml) +configure_file(CMakeFiles/Par_File.in ${CMAKE_SOURCE_DIR}/examples/homogeneous-medium-flat-topography/Par_File) +configure_file(CMakeFiles/specfem_config.yaml.in ${CMAKE_SOURCE_DIR}/examples/homogeneous-medium-flat-topography/specfem_config.yaml) diff --git a/examples/homogeneous-medium-flat-topography/README.md b/examples/homogeneous-medium-flat-topography/README.md index 7f985773..483aad9e 100644 --- a/examples/homogeneous-medium-flat-topography/README.md +++ b/examples/homogeneous-medium-flat-topography/README.md @@ -1,6 +1,6 @@ # Wave propagation through homogeneous medium with no interfaces -In this example we simulate wave propagation through a 2-dimensional homogeneous medium. +In this example we simulate wave propagation through a 2-dimensional homogeneous medium. For a step-by-step guide on this example, please refer to the [documentation](https://specfem2d-kokkos.readthedocs.io/en/latest/cookbooks/example_01.html). ## Running the examples From f8dd3b4ecf7a7b254166119b3bf08a58c8b69163 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 4 Nov 2024 12:38:42 -0500 Subject: [PATCH 2/6] Removed docs workflow for github pages --- .github/workflows/docs.yml | 34 ---------------------------------- docs/cookbooks/example_02.rst | 2 -- 2 files changed, 36 deletions(-) delete mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 8711e88b..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Docs - -on: - #push: - # branches-ignore: - # - '**' - push: - branches: [ main ] - -jobs: - build: - - runs-on: macos-latest - - steps: - - name: Requirements - run: brew install doxygen - && brew install sphinx-doc - && pip3 install sphinx-rtd-theme - && pip3 install breathe - && pip3 install sphinx-sitemap - - name: Checkout repo - uses: actions/checkout@1.0.0 - - name: Build docs - run: cd docs - && make html - && cd _build/html - && touch .nojekyll - - name: Deploy - uses: JamesIves/github-pages-deploy-action@releases/v3 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages # The branch the action should deploy to. - FOLDER: docs/_build/html # The folder the action should deploy. diff --git a/docs/cookbooks/example_02.rst b/docs/cookbooks/example_02.rst index 3bae8efe..00e12fd5 100644 --- a/docs/cookbooks/example_02.rst +++ b/docs/cookbooks/example_02.rst @@ -263,7 +263,6 @@ We define the source location and the source time function in the source file. .. code-block:: yaml :caption: single_source.yaml - :linenos: number-of-sources: 1 sources: @@ -285,7 +284,6 @@ Running the simulation To run the solver, we first need to define a configuration file ``specfem_config.yaml``. .. code-block:: yaml - :linenos: :caption: specfem_config.yaml parameters: From 19eb500042ddd084084790582df48fdbb1bf6a2b Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 4 Nov 2024 13:48:45 -0500 Subject: [PATCH 3/6] Fixed plot.py link --- docs/cookbooks/example_03.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cookbooks/example_03.rst b/docs/cookbooks/example_03.rst index 2e4b9a9d..a84f66b2 100644 --- a/docs/cookbooks/example_03.rst +++ b/docs/cookbooks/example_03.rst @@ -483,7 +483,7 @@ Lastly if the kernels are stored in ASCII format, we can use numpy to read the k .. note:: - An python code for reading ASCII kernels and plotting them is provided `here `_. + An python code for reading ASCII kernels and plotting them is provided `here `_. .. figure:: ../../examples/Tromp_2005/Reference_Kernels/Kernels.png :alt: Kernels From 84302840c85f5ab2f88da335e961ce3bc9af77a9 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 4 Nov 2024 15:27:02 -0500 Subject: [PATCH 4/6] Fixed xadj_seismograms | Fixed example03 --- docs/cookbooks/example_03.rst | 4 ++-- docs/index.rst | 6 +++--- meshfem2d/adj_seismogram.f90 | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/cookbooks/example_03.rst b/docs/cookbooks/example_03.rst index a84f66b2..a994d76a 100644 --- a/docs/cookbooks/example_03.rst +++ b/docs/cookbooks/example_03.rst @@ -216,7 +216,7 @@ With the above input files, we can run the mesher to generate the mesh database. .. code:: bash - xmeshfem2D -p Par_file + xmeshfem2D -p Par_File Running the forward simulation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -321,7 +321,7 @@ With the above input files, we can run the forward simulation. Generating adjoint sources -------------------------- -The next step is to generate the adjoint sources. We can generate the adjoint sources using ``./xadj_seismogram`` utility which models Eq. 45 of `Tromp et al. 2005 `_. The utility requires synthetic seismograms and does not depend on the observed data. +The next step is to generate the adjoint sources. In this example, we are computing sensitivity kernels for travel-time measurements. The adjoint source required for this kernel is defined by Eq. 45 of `Tromp et al. 2005 `_, and relies only the synthetic velocity seismogram. Here we use the utility ``xadj_seismogram``, which computes this adjoint source from the displacement synthetics computed during forward run i.e. by numerically differentiating the displacements. .. code:: bash diff --git a/docs/index.rst b/docs/index.rst index cd26ddc0..6c55f7a4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -140,19 +140,19 @@ Table below shows various features available and tested in this package on vario - - - * - displacement + * - Displacement - ✔ - ✔ - ✔ - - * - velocity + * - Velocity - ✔ - ✔ - ✔ - - * - acceleration + * - Acceleration - ✔ - ✔ - ✔ diff --git a/meshfem2d/adj_seismogram.f90 b/meshfem2d/adj_seismogram.f90 index 2d217289..d1db32ff 100644 --- a/meshfem2d/adj_seismogram.f90 +++ b/meshfem2d/adj_seismogram.f90 @@ -460,7 +460,8 @@ program adj_seismogram ! user output print *,'*************************' - print *,'The input files (AA.S****.BXX/BXY/BXZ.adj) needed to run the adjoint simulation are in folder SEM/' + print *, 'The input files (AA.S****.BXX/BXY/BXZ.adj) needed to run the adjoint simulation are in folder ',& + trim(adjoint_sources_folder) print *,'*************************' end program adj_seismogram From b92c382ff65834b1b8759e1f9cdb97bc302dc8bc Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Mon, 4 Nov 2024 15:54:05 -0500 Subject: [PATCH 5/6] Added directories to getting started --- docs/getting_started/index.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst index cbc99e31..dafdb789 100644 --- a/docs/getting_started/index.rst +++ b/docs/getting_started/index.rst @@ -145,12 +145,14 @@ Lets run a simple example to test the installation. We will use the ``example\ho .. code-block:: bash cd examples/homogeneous-medium-flat-topography + mkdir -p OUTPUT_FILES xmeshfem2D -p Par_File This will generate the mesh files. Next, we will run the solver using .. code-block:: bash + mkdir -p OUTPUT_FILES/results specfem2d -p specfem_config.yaml This will run the solver and generate synthetic seismograms at the receiver locations specified in ``STATIONS`` file. From b7082e0e3c08730d013d6270c5eb28108945c9a9 Mon Sep 17 00:00:00 2001 From: Rohit Kakodkar Date: Tue, 5 Nov 2024 08:49:41 -0500 Subject: [PATCH 6/6] Removed build examples from recipes --- docs/getting_started/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst index dafdb789..522facdb 100644 --- a/docs/getting_started/index.rst +++ b/docs/getting_started/index.rst @@ -117,7 +117,7 @@ SPECFEM++ inherits several architecure specific cmake configuration keywords fro .. code-block:: bash # cd into SPECFEM root directory - cmake3 -S . -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON -D Kokkos_ENABLE_CUDA=ON -D Kokkos_ARCH_=ON -D BUILD_EXAMPLES=ON + cmake3 -S . -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON -D Kokkos_ENABLE_CUDA=ON -D Kokkos_ARCH_=ON cmake --build build .. note::