From 5b14db7edfe35ce5de5b7e44142094b5200ad450 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 14 Jan 2025 13:59:44 -0500 Subject: [PATCH 01/20] Added overload to read_sources() --- CMakeLists.txt | 4 +++- include/IO/interface.hpp | 17 +++++++++++++++++ src/IO/sources.cpp | 9 ++++++++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 757f2327a..54c483aa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,6 +216,7 @@ if (NOT HDF5_CXX_BUILD) mesh source_class receiver_class + yaml-cpp ${BOOST_LIBS} Kokkos::kokkos) else() @@ -224,8 +225,9 @@ else() mesh source_class receiver_class - Kokkos::kokkos + yaml-cpp + ${BOOST_LIBS} ${HDF5_LIBRARIES} ) endif() diff --git a/include/IO/interface.hpp b/include/IO/interface.hpp index 783198304..e38ecff8e 100644 --- a/include/IO/interface.hpp +++ b/include/IO/interface.hpp @@ -7,6 +7,7 @@ #include "source/interface.hpp" #include "specfem_mpi/interface.hpp" #include "specfem_setup.hpp" +#include namespace specfem { @@ -53,5 +54,21 @@ read_sources(const std::string sources_file, const int nsteps, const type_real user_t0, const type_real dt, const specfem::simulation::type simulation_type); +/** + * @brief Read sources file written in .yml format + * + * Parse source specification file written in yaml format and create a vector of + * specfem::source::source * object + * + * @param yaml YAML node containing source information + * @param mpi Pointer to specfem MPI object + * @return std::vector vector of instantiated source + * objects + */ +std::tuple >, type_real> +read_sources(const YAML::Node yaml, const int nsteps, const type_real user_t0, + const type_real dt, + const specfem::simulation::type simulation_type); + } // namespace IO } // namespace specfem diff --git a/src/IO/sources.cpp b/src/IO/sources.cpp index 3478830ee..69c39ad84 100644 --- a/src/IO/sources.cpp +++ b/src/IO/sources.cpp @@ -16,6 +16,14 @@ std::tuple >, type_real> specfem::IO::read_sources(const std::string sources_file, const int nsteps, const type_real user_t0, const type_real dt, const specfem::simulation::type simulation_type) { + return read_sources(YAML::LoadFile(sources_file), nsteps, user_t0, dt, + simulation_type); +} + +std::tuple >, type_real> +specfem::IO::read_sources(const YAML::Node yaml, const int nsteps, + const type_real user_t0, const type_real dt, + const specfem::simulation::type simulation_type) { const bool user_defined_start_time = (std::abs(user_t0) > std::numeric_limits::epsilon()); @@ -34,7 +42,6 @@ specfem::IO::read_sources(const std::string sources_file, const int nsteps, // read sources file std::vector > sources; - YAML::Node yaml = YAML::LoadFile(sources_file); int nsources = yaml["number-of-sources"].as(); YAML::Node Node = yaml["sources"]; assert(Node.IsSequence()); From 485666ccea5727def35c5935197effac684c3c6a Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 14 Jan 2025 17:11:32 -0500 Subject: [PATCH 02/20] Added test to read moment tensor source. --- include/source/moment_tensor_source.hpp | 20 ++++++++ src/IO/sources.cpp | 6 +-- tests/unit-tests/CMakeLists.txt | 14 ++++++ .../IO/sources/data/single_moment_tensor.yml | 13 +++++ .../IO/sources/test_read_sources.cpp | 49 +++++++++++++++++++ 5 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 tests/unit-tests/IO/sources/data/single_moment_tensor.yml create mode 100644 tests/unit-tests/IO/sources/test_read_sources.cpp diff --git a/include/source/moment_tensor_source.hpp b/include/source/moment_tensor_source.hpp index 194695fd7..e0945e6af 100644 --- a/include/source/moment_tensor_source.hpp +++ b/include/source/moment_tensor_source.hpp @@ -30,6 +30,26 @@ class moment_tensor : public source { * */ moment_tensor(){}; + + /** + * @brief Get the Mxx component of the moment tensor + * + * @return type_real x-coordinate + */ + type_real get_Mxx() const { return Mxx; } + /** + * @brief Get the Mxz component of the moment tensor + * + * @return type_real z-coordinate + */ + type_real get_Mxz() const { return Mxz; } + /** + * @brief Get the Mzz component of the moment tensor + * + * @return type_real z-coordinate + */ + type_real get_Mzz() const { return Mzz; } + /** * @brief Construct a new moment tensor force object * diff --git a/src/IO/sources.cpp b/src/IO/sources.cpp index 69c39ad84..17849d356 100644 --- a/src/IO/sources.cpp +++ b/src/IO/sources.cpp @@ -16,6 +16,7 @@ std::tuple >, type_real> specfem::IO::read_sources(const std::string sources_file, const int nsteps, const type_real user_t0, const type_real dt, const specfem::simulation::type simulation_type) { + return read_sources(YAML::LoadFile(sources_file), nsteps, user_t0, dt, simulation_type); } @@ -96,9 +97,8 @@ specfem::IO::read_sources(const YAML::Node yaml, const int nsteps, if (sources.size() != nsources) { std::ostringstream message; message << "Found only " << sources.size() - << " number of sources. Total number of sources in " << sources_file - << " are" << nsources - << " Please check if there is a error in sources file."; + << " number of sources. Found total number of sources in are " + << nsources << " Please check if there is a error in sources file."; throw std::runtime_error(message.str()); } diff --git a/tests/unit-tests/CMakeLists.txt b/tests/unit-tests/CMakeLists.txt index e5e96a538..abad41f23 100644 --- a/tests/unit-tests/CMakeLists.txt +++ b/tests/unit-tests/CMakeLists.txt @@ -203,6 +203,7 @@ add_executable( assembly/sources/sources.cpp ) + target_link_libraries( assembly_tests reader @@ -218,6 +219,19 @@ target_link_libraries( -lpthread -lm ) +add_executable( + IO_tests + IO/sources/test_read_sources.cpp +) + +target_link_libraries( + IO_tests + IO + gtest_main + kokkos_environment + yaml-cpp + Boost::filesystem +) add_executable( locate_point diff --git a/tests/unit-tests/IO/sources/data/single_moment_tensor.yml b/tests/unit-tests/IO/sources/data/single_moment_tensor.yml new file mode 100644 index 000000000..549939921 --- /dev/null +++ b/tests/unit-tests/IO/sources/data/single_moment_tensor.yml @@ -0,0 +1,13 @@ +number-of-sources: 1 +sources: + - moment-tensor: + x: 2000.0 + z: 3000.0 + Mxx: 1.0 + Mzz: 1.0 + Mxz: 0.0 + angle: 0.0 + Ricker: + factor: 1.0e10 + tshift: 30.0 + f0: 1.0 diff --git a/tests/unit-tests/IO/sources/test_read_sources.cpp b/tests/unit-tests/IO/sources/test_read_sources.cpp new file mode 100644 index 000000000..2f408a415 --- /dev/null +++ b/tests/unit-tests/IO/sources/test_read_sources.cpp @@ -0,0 +1,49 @@ +#include "../../Kokkos_Environment.hpp" +#include "IO/interface.hpp" +#include "enumerations/specfem_enums.hpp" +#include "enumerations/wavefield.hpp" +#include "source/interface.hpp" +#include +#include +#include + +TEST(read_sources, READ_SOURCES) { + /** + * This test checks whether a moment tensor source is read correctly + */ + + std::string sources_file = + "../../../tests/unit-tests/IO/sources/data/single_moment_tensor.yml"; + + int nsteps = 100; + type_real t0 = 0.0; + type_real dt = 0.01; + type_real f0 = 1.0; + type_real tshift = 30.0; + type_real factor = 1.0e10; + // This is from the definition of the STF such that it is zero at t=0 + type_real hdur = 1.0 / f0; + type_real t0_final = -1.2 * hdur + tshift; + + auto [sources, user_t0] = specfem::IO::read_sources( + sources_file, nsteps, t0, dt, specfem::simulation::type::forward); + + ASSERT_EQ(sources.size(), 1); + auto source = sources[0]; + auto mt = std::dynamic_pointer_cast(source); + ASSERT_EQ(mt->get_wavefield_type(), + specfem::wavefield::simulation_field::forward); + ASSERT_EQ(mt->get_Mxx(), 1.0); + ASSERT_EQ(mt->get_Mxz(), 0.0); + ASSERT_EQ(mt->get_Mzz(), 1.0); + EXPECT_NEAR(mt->get_x(), 2000.0, 1e-10); + EXPECT_NEAR(mt->get_z(), 3000.0, 1e-10); + ASSERT_EQ(source->get_t0(), t0_final); + ASSERT_EQ(source->get_tshift(), 0.0); // tshift is adjusted to be 0.0 +} + +int main(int argc, char *argv[]) { + ::testing::InitGoogleTest(&argc, argv); + ::testing::AddGlobalTestEnvironment(new KokkosEnvironment); + return RUN_ALL_TESTS(); +} From a58f60d6f53d681efcba8d746002fd3a89935a65 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 15 Jan 2025 10:37:13 -0500 Subject: [PATCH 03/20] Forgot to add the test to the google_test_discover part --- tests/unit-tests/CMakeLists.txt | 1 + tests/unit-tests/IO/sources/test_read_sources.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/unit-tests/CMakeLists.txt b/tests/unit-tests/CMakeLists.txt index abad41f23..8c8e6876f 100644 --- a/tests/unit-tests/CMakeLists.txt +++ b/tests/unit-tests/CMakeLists.txt @@ -427,6 +427,7 @@ if (NOT MPI_PARALLEL) gtest_discover_tests(gll_tests) gtest_discover_tests(lagrange_tests) gtest_discover_tests(fortranio_test) + gtest_discover_tests(IO_tests) gtest_discover_tests(mesh_tests) gtest_discover_tests(compute_partial_derivatives_tests) gtest_discover_tests(compute_elastic_tests) diff --git a/tests/unit-tests/IO/sources/test_read_sources.cpp b/tests/unit-tests/IO/sources/test_read_sources.cpp index 2f408a415..6bf19ef85 100644 --- a/tests/unit-tests/IO/sources/test_read_sources.cpp +++ b/tests/unit-tests/IO/sources/test_read_sources.cpp @@ -7,7 +7,7 @@ #include #include -TEST(read_sources, READ_SOURCES) { +TEST(IO_TESTS, read_sources) { /** * This test checks whether a moment tensor source is read correctly */ @@ -42,8 +42,8 @@ TEST(read_sources, READ_SOURCES) { ASSERT_EQ(source->get_tshift(), 0.0); // tshift is adjusted to be 0.0 } -int main(int argc, char *argv[]) { - ::testing::InitGoogleTest(&argc, argv); - ::testing::AddGlobalTestEnvironment(new KokkosEnvironment); - return RUN_ALL_TESTS(); -} +// int main(int argc, char *argv[]) { +// ::testing::InitGoogleTest(&argc, argv); +// ::testing::AddGlobalTestEnvironment(new KokkosEnvironment); +// return RUN_ALL_TESTS(); +// } From 5039c1397ca87d1832c7ea2443edb7e4524c3686 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 15 Jan 2025 11:28:51 -0500 Subject: [PATCH 04/20] Fixed installables for the python installation --- CMakeLists.txt | 5 +- fortran/meshfem2d/CMakeLists.txt | 4 +- .../generate_databases/CMakeLists.txt | 1 - poetry.lock | 130 ++++++++++++++---- 4 files changed, 113 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54c483aa7..e6c53ccac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -674,7 +674,10 @@ endif (DOXYGEN_FOUND) if (SPECFEMPP_USE_SKBUILD AND EXISTS ${SKBUILD_SCRIPTS_DIR}) install(TARGETS specfem2d DESTINATION ${SKBUILD_SCRIPTS_DIR}) - install(FILES ${CMAKE_BINARY_DIR}/xmeshfem2D DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + install(FILES ${CMAKE_BINARY_DIR}/bin/xmeshfem2D DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + install(FILES ${CMAKE_BINARY_DIR}/bin/xmeshfem3D DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + install(FILES ${CMAKE_BINARY_DIR}/bin/xgenerate_databases DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + install(FILES ${CMAKE_BINARY_DIR}/bin/xadj_seismogram DESTINATION ${SKBUILD_SCRIPTS_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) endif () if (SPECFEMPP_BINDING_PYTHON) diff --git a/fortran/meshfem2d/CMakeLists.txt b/fortran/meshfem2d/CMakeLists.txt index f942658d4..0ae663fe3 100644 --- a/fortran/meshfem2d/CMakeLists.txt +++ b/fortran/meshfem2d/CMakeLists.txt @@ -207,12 +207,12 @@ add_custom_target(meshfem_mesh ALL ) set( meshfem2D_PREPROCESSOR_OBJECTS - decompose_mesh.mesh.o + decompose_mesh.mesh.o metis_partitioning.mesh.o part_unstruct.mesh.o read_external_mesh_files.mesh.o read_mesh_files.mesh.o - scotch_partitioning.mesh.o + scotch_partitioning.mesh.o meshfem2D.mesh.o ) diff --git a/fortran/meshfem3d/generate_databases/CMakeLists.txt b/fortran/meshfem3d/generate_databases/CMakeLists.txt index df7ed2073..217e9b100 100644 --- a/fortran/meshfem3d/generate_databases/CMakeLists.txt +++ b/fortran/meshfem3d/generate_databases/CMakeLists.txt @@ -17,7 +17,6 @@ set(MESHFEM3D_GENERATE_DATABASES_MODULE create_regions_mesh.f90 fault_generate_databases.f90 finalize_databases.f90 - generate_databases_par.F90 generate_databases.f90 get_absorbing_boundary.F90 get_coupling_surfaces.f90 diff --git a/poetry.lock b/poetry.lock index ed20bba14..aa52d2f4b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.0.0 and should not be changed by hand. [[package]] name = "alabaster" @@ -6,6 +6,7 @@ version = "0.7.16" description = "A light, configurable Sphinx theme" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "alabaster-0.7.16-py3-none-any.whl", hash = "sha256:b46733c07dce03ae4e150330b975c75737fa60f0a7c591b6c8bf4928a28e2c92"}, {file = "alabaster-0.7.16.tar.gz", hash = "sha256:75a8b99c28a5dad50dd7f8ccdd447a121ddb3892da9e53d1ca5cca3106d58d65"}, @@ -17,6 +18,7 @@ version = "0.7.0" description = "Reusable constraint types to use with typing.Annotated" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, @@ -28,6 +30,7 @@ version = "2.16.0" description = "Internationalization utilities" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "babel-2.16.0-py3-none-any.whl", hash = "sha256:368b5b98b37c06b7daf6696391c3240c938b37767d4584413e8438c5c435fa8b"}, {file = "babel-2.16.0.tar.gz", hash = "sha256:d1f3554ca26605fe173f3de0c65f750f5a42f924499bf134de6423582298e316"}, @@ -42,6 +45,7 @@ version = "4.12.3" description = "Screen-scraping library" optional = false python-versions = ">=3.6.0" +groups = ["main"] files = [ {file = "beautifulsoup4-4.12.3-py3-none-any.whl", hash = "sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed"}, {file = "beautifulsoup4-4.12.3.tar.gz", hash = "sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051"}, @@ -63,6 +67,7 @@ version = "4.35.0" description = "Sphinx Doxygen renderer" optional = false python-versions = "*" +groups = ["main"] files = [ {file = "breathe-4.35.0-py3-none-any.whl", hash = "sha256:52c581f42ca4310737f9e435e3851c3d1f15446205a85fbc272f1f97ed74f5be"}, {file = "breathe-4.35.0.tar.gz", hash = "sha256:5165541c3c67b6c7adde8b3ecfe895c6f7844783c4076b6d8d287e4f33d62386"}, @@ -78,6 +83,7 @@ version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "certifi-2024.8.30-py3-none-any.whl", hash = "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8"}, {file = "certifi-2024.8.30.tar.gz", hash = "sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9"}, @@ -89,6 +95,7 @@ version = "3.4.0" description = "Validate configuration and produce human readable error messages." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9"}, {file = "cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560"}, @@ -100,6 +107,7 @@ version = "3.4.0" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." optional = false python-versions = ">=3.7.0" +groups = ["main"] files = [ {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6"}, {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b"}, @@ -210,20 +218,20 @@ files = [ [[package]] name = "clang-format" -version = "14.0.6" +version = "15.0.7" description = "Clang-Format is an LLVM-based code formatting tool" optional = false python-versions = "*" +groups = ["main"] files = [ - {file = "clang-format-14.0.6.tar.gz", hash = "sha256:d5c96b500d7f8b5d2db5b75ac035be387512850ad589cdc3019666b861382136"}, - {file = "clang_format-14.0.6-py2.py3-none-macosx_10_9_universal2.whl", hash = "sha256:bd400c47665dd19afc03f98e747f78ed828abab99c6a1b07e137b35c1cd3cc26"}, - {file = "clang_format-14.0.6-py2.py3-none-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:13f2d6d4a2af004a783c65f0921afa8f0384bffcdaf500b6c2cb542edeb0b4a5"}, - {file = "clang_format-14.0.6-py2.py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d7c1c5e404c58e55f0170f01b3c5611dce6c119e62b5d1020347e0ad97d5a047"}, - {file = "clang_format-14.0.6-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dbfd60528eb3bb7d7cfe8576faa70845fbf93601f815ef75163d36606e87f388"}, - {file = "clang_format-14.0.6-py2.py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c93580945f75de7e01996f1fb3cf67e4dc424f1c864e237c85614fb99a48c7a4"}, - {file = "clang_format-14.0.6-py2.py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aaf4edecc46a24f0b572b82cf5827e292ad1c137903427627c4d5f671668cc2b"}, - {file = "clang_format-14.0.6-py2.py3-none-win32.whl", hash = "sha256:810c649ab97d208cd418c897d50ab6e958eb8d96854527edd80d0dd21a75e914"}, - {file = "clang_format-14.0.6-py2.py3-none-win_amd64.whl", hash = "sha256:d780c04334bca80f2b60d25bf53c37bd0618520ee295a7888a11f25bde114ac4"}, + {file = "clang-format-15.0.7.tar.gz", hash = "sha256:60954c571394354200912e72ce10454b96016af879771df39d09d605ceaec035"}, + {file = "clang_format-15.0.7-py2.py3-none-macosx_10_9_universal2.whl", hash = "sha256:0983aa108920a84a84358a1a045537311ad77c3fcb60fdec2af0aad71d53bd1d"}, + {file = "clang_format-15.0.7-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6bb879288a08cf646e2930f1f69b197bae90003a6c6abacd7beabed340a9752f"}, + {file = "clang_format-15.0.7-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5a7815754c48cd9ffb14b2f306690f08b8ad8050cc7735c05c6caba046faee3"}, + {file = "clang_format-15.0.7-py2.py3-none-musllinux_1_1_i686.whl", hash = "sha256:a81115f042e59a042e6600d034d15a75dbd2830fae98eb806830380054f49fe7"}, + {file = "clang_format-15.0.7-py2.py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:0343cd5f0cf33c3d552ebacbd2604e1a1342163ed7e5cb750c0a1495aae96340"}, + {file = "clang_format-15.0.7-py2.py3-none-win32.whl", hash = "sha256:c5fa1420c08f6293c6dfa90ca137e6e7ac5ee8838e151522816da43f375bc93f"}, + {file = "clang_format-15.0.7-py2.py3-none-win_amd64.whl", hash = "sha256:3a2712fc3a252aec5196958a97642f2cf637fee34058352e6acfe0d2d3be1965"}, ] [[package]] @@ -232,6 +240,7 @@ version = "8.1.7" description = "Composable command line interface toolkit" optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, @@ -246,6 +255,8 @@ version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["main"] +markers = "sys_platform == \"win32\" or platform_system == \"Windows\"" files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, @@ -257,6 +268,7 @@ version = "0.3.9" description = "Distribution utilities" optional = false python-versions = "*" +groups = ["main"] files = [ {file = "distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87"}, {file = "distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403"}, @@ -268,6 +280,7 @@ version = "0.11.2" description = "Style checker for Sphinx (or other) RST documentation" optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "doc8-0.11.2-py3-none-any.whl", hash = "sha256:9187da8c9f115254bbe34f74e2bbbdd3eaa1b9e92efd19ccac7461e347b5055c"}, {file = "doc8-0.11.2.tar.gz", hash = "sha256:c35a231f88f15c204659154ed3d499fa4d402d7e63d41cba7b54cf5e646123ab"}, @@ -285,6 +298,7 @@ version = "0.18.1" description = "Docutils -- Python Documentation Utilities" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +groups = ["main"] files = [ {file = "docutils-0.18.1-py2.py3-none-any.whl", hash = "sha256:23010f129180089fbcd3bc08cfefccb3b890b0050e1ca00c867036e9d161b98c"}, {file = "docutils-0.18.1.tar.gz", hash = "sha256:679987caf361a7539d76e584cbeddc311e3aee937877c87346f31debc63e9d06"}, @@ -296,6 +310,7 @@ version = "3.16.1" description = "A platform independent file lock." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0"}, {file = "filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435"}, @@ -312,6 +327,7 @@ version = "2024.8.6" description = "A clean customisable Sphinx documentation theme." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "furo-2024.8.6-py3-none-any.whl", hash = "sha256:6cd97c58b47813d3619e63e9081169880fbe331f0ca883c871ff1f3f11814f5c"}, {file = "furo-2024.8.6.tar.gz", hash = "sha256:b63e4cee8abfc3136d3bc03a3d45a76a850bada4d6374d24c1716b0e01394a01"}, @@ -329,6 +345,7 @@ version = "2.6.3" description = "File identification library for Python" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "identify-2.6.3-py2.py3-none-any.whl", hash = "sha256:9edba65473324c2ea9684b1f944fe3191db3345e50b6d04571d10ed164f8d7bd"}, {file = "identify-2.6.3.tar.gz", hash = "sha256:62f5dae9b5fef52c84cc188514e9ea4f3f636b1d8799ab5ebc475471f9e47a02"}, @@ -343,6 +360,7 @@ version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, @@ -357,6 +375,7 @@ version = "1.4.1" description = "Getting image size from png/jpeg/jpeg2000/gif file" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +groups = ["main"] files = [ {file = "imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b"}, {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"}, @@ -368,6 +387,7 @@ version = "3.1.4" description = "A very fast and expressive template engine." optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "jinja2-3.1.4-py3-none-any.whl", hash = "sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d"}, {file = "jinja2-3.1.4.tar.gz", hash = "sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369"}, @@ -385,6 +405,7 @@ version = "3.0.0" description = "Python port of markdown-it. Markdown parsing, done right!" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, @@ -409,6 +430,7 @@ version = "3.0.2" description = "Safely add untrusted strings to HTML/XML markup." optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"}, {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"}, @@ -479,6 +501,7 @@ version = "0.1.2" description = "Markdown URL utilities" optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, @@ -490,6 +513,7 @@ version = "1.9.1" description = "Node.js virtual environment builder" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["main"] files = [ {file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"}, {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, @@ -501,6 +525,7 @@ version = "24.2" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"}, {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, @@ -512,6 +537,7 @@ version = "6.1.0" description = "Python Build Reasonableness" optional = false python-versions = ">=2.6" +groups = ["main"] files = [ {file = "pbr-6.1.0-py2.py3-none-any.whl", hash = "sha256:a776ae228892d8013649c0aeccbb3d5f99ee15e005a4cbb7e61d55a067b28a2a"}, {file = "pbr-6.1.0.tar.gz", hash = "sha256:788183e382e3d1d7707db08978239965e8b9e4e5ed42669bf4758186734d5f24"}, @@ -523,6 +549,7 @@ version = "4.3.6" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"}, {file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"}, @@ -535,13 +562,14 @@ type = ["mypy (>=1.11.2)"] [[package]] name = "pre-commit" -version = "2.21.0" +version = "2.19.0" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false python-versions = ">=3.7" +groups = ["main"] files = [ - {file = "pre_commit-2.21.0-py2.py3-none-any.whl", hash = "sha256:e2f91727039fc39a92f58a588a25b87f936de6567eed4f0e673e0507edc75bad"}, - {file = "pre_commit-2.21.0.tar.gz", hash = "sha256:31ef31af7e474a8d8995027fefdfcf509b5c913ff31f2015b4ec4beb26a6f658"}, + {file = "pre_commit-2.19.0-py2.py3-none-any.whl", hash = "sha256:10c62741aa5704faea2ad69cb550ca78082efe5697d6f04e5710c3c229afdd10"}, + {file = "pre_commit-2.19.0.tar.gz", hash = "sha256:4233a1e38621c87d9dda9808c6606d7e7ba0e087cd56d3fe03202a01d2919615"}, ] [package.dependencies] @@ -549,7 +577,8 @@ cfgv = ">=2.0.0" identify = ">=1.0.0" nodeenv = ">=0.11.1" pyyaml = ">=5.1" -virtualenv = ">=20.10.0" +toml = "*" +virtualenv = ">=20.0.8" [[package]] name = "pydantic" @@ -557,6 +586,7 @@ version = "2.10.3" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "pydantic-2.10.3-py3-none-any.whl", hash = "sha256:be04d85bbc7b65651c5f8e6b9976ed9c6f41782a55524cef079a34a0bb82144d"}, {file = "pydantic-2.10.3.tar.gz", hash = "sha256:cb5ac360ce894ceacd69c403187900a02c4b20b693a9dd1d643e1effab9eadf9"}, @@ -577,6 +607,7 @@ version = "2.27.1" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "pydantic_core-2.27.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:71a5e35c75c021aaf400ac048dacc855f000bdfed91614b4a726f7432f1f3d6a"}, {file = "pydantic_core-2.27.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f82d068a2d6ecfc6e054726080af69a6764a10015467d7d7b9f66d6ed5afa23b"}, @@ -689,6 +720,7 @@ version = "2.18.0" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "pygments-2.18.0-py3-none-any.whl", hash = "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a"}, {file = "pygments-2.18.0.tar.gz", hash = "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199"}, @@ -703,6 +735,7 @@ version = "6.0.2" description = "YAML parser and emitter for Python" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"}, {file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"}, @@ -765,6 +798,7 @@ version = "2.32.3" description = "Python HTTP for Humans." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"}, {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"}, @@ -786,6 +820,7 @@ version = "1.4.0" description = "reStructuredText linter" optional = false python-versions = "*" +groups = ["main"] files = [ {file = "restructuredtext_lint-1.4.0.tar.gz", hash = "sha256:1b235c0c922341ab6c530390892eb9e92f90b9b75046063e047cacfb0f050c45"}, ] @@ -799,6 +834,7 @@ version = "13.9.4" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" optional = false python-versions = ">=3.8.0" +groups = ["main"] files = [ {file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"}, {file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"}, @@ -817,6 +853,7 @@ version = "6.2.4" description = "Checks syntax of reStructuredText and code blocks nested within it" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "rstcheck-6.2.4-py3-none-any.whl", hash = "sha256:23de2575ba0af1adcddea87a20d69187f0fb9dd8270f59eb98d63461c95375a7"}, {file = "rstcheck-6.2.4.tar.gz", hash = "sha256:384942563dfbfcc85903a587ecf050447217c46b51e266ed3fe51371bc599015"}, @@ -840,6 +877,7 @@ version = "1.2.1" description = "Checks syntax of reStructuredText and code blocks nested within it" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "rstcheck-core-1.2.1.tar.gz", hash = "sha256:9b330020d912e2864f23f332c1a0569463ca3b06b8fee7b7bdd201b055f7f831"}, {file = "rstcheck_core-1.2.1-py3-none-any.whl", hash = "sha256:1c100de418b6c9e14d9cf6558644d0ab103fdc447f891313882d02df3a3c52ba"}, @@ -864,6 +902,7 @@ version = "0.8.2" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "ruff-0.8.2-py3-none-linux_armv6l.whl", hash = "sha256:c49ab4da37e7c457105aadfd2725e24305ff9bc908487a9bf8d548c6dad8bb3d"}, {file = "ruff-0.8.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ec016beb69ac16be416c435828be702ee694c0d722505f9c1f35e1b9c0cc1bf5"}, @@ -891,17 +930,31 @@ version = "1.5.4" description = "Tool to Detect Surrounding Shell" optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"}, {file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"}, ] +[[package]] +name = "six" +version = "1.17.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +groups = ["main"] +files = [ + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, +] + [[package]] name = "snowballstemmer" version = "2.2.0" description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." optional = false python-versions = "*" +groups = ["main"] files = [ {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, @@ -913,6 +966,7 @@ version = "2.6" description = "A modern CSS selector implementation for Beautiful Soup." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "soupsieve-2.6-py3-none-any.whl", hash = "sha256:e72c4ff06e4fb6e4b5a9f0f55fe6e81514581fca1515028625d0f299c602ccc9"}, {file = "soupsieve-2.6.tar.gz", hash = "sha256:e2e68417777af359ec65daac1057404a3c8a5455bb8abc36f1a9866ab1a51abb"}, @@ -924,6 +978,7 @@ version = "7.3.7" description = "Python documentation generator" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "sphinx-7.3.7-py3-none-any.whl", hash = "sha256:413f75440be4cacf328f580b4274ada4565fb2187d696a84970c23f77b64d8c3"}, {file = "sphinx-7.3.7.tar.gz", hash = "sha256:a4a7db75ed37531c05002d56ed6948d4c42f473a36f46e1382b0bd76ca9627bc"}, @@ -958,6 +1013,7 @@ version = "1.0.0b2" description = "A modern skeleton for Sphinx themes." optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "sphinx_basic_ng-1.0.0b2-py3-none-any.whl", hash = "sha256:eb09aedbabfb650607e9b4b68c9d240b90b1e1be221d6ad71d61c52e29f7932b"}, {file = "sphinx_basic_ng-1.0.0b2.tar.gz", hash = "sha256:9ec55a47c90c8c002b5960c57492ec3021f5193cb26cebc2dc4ea226848651c9"}, @@ -975,6 +1031,7 @@ version = "0.4.0" description = "Add a copy button to each of your code cells." optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "sphinx-copybutton-0.4.0.tar.gz", hash = "sha256:8daed13a87afd5013c3a9af3575cc4d5bec052075ccd3db243f895c07a689386"}, {file = "sphinx_copybutton-0.4.0-py3-none-any.whl", hash = "sha256:4340d33c169dac6dd82dce2c83333412aa786a42dd01a81a8decac3b130dc8b0"}, @@ -993,6 +1050,7 @@ version = "1.3.0" description = "Read the Docs theme for Sphinx" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" +groups = ["main"] files = [ {file = "sphinx_rtd_theme-1.3.0-py2.py3-none-any.whl", hash = "sha256:46ddef89cc2416a81ecfbeaceab1881948c014b1b6e4450b815311a89fb977b0"}, {file = "sphinx_rtd_theme-1.3.0.tar.gz", hash = "sha256:590b030c7abb9cf038ec053b95e5380b5c70d61591eb0b552063fbe7c41f0931"}, @@ -1008,27 +1066,26 @@ dev = ["bump2version", "sphinxcontrib-httpdomain", "transifex-client", "wheel"] [[package]] name = "sphinx-sitemap" -version = "2.6.0" +version = "2.2.1" description = "Sitemap generator for Sphinx" optional = false python-versions = "*" +groups = ["main"] files = [ - {file = "sphinx_sitemap-2.6.0-py3-none-any.whl", hash = "sha256:7478e417d141f99c9af27ccd635f44c03a471a08b20e778a0f9daef7ace1d30b"}, - {file = "sphinx_sitemap-2.6.0.tar.gz", hash = "sha256:5e0c66b9f2e371ede80c659866a9eaad337d46ab02802f9c7e5f7bc5893c28d2"}, + {file = "sphinx-sitemap-2.2.1.tar.gz", hash = "sha256:f1f2149c8013b6d68cc48e6b5bd90f088658cd4584c0220224e72ca85d07b92b"}, ] [package.dependencies] +six = "*" sphinx = ">=1.2" -[package.extras] -dev = ["build", "flake8", "pre-commit", "pytest", "sphinx", "tox"] - [[package]] name = "sphinxcontrib-applehelp" version = "2.0.0" description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "sphinxcontrib_applehelp-2.0.0-py3-none-any.whl", hash = "sha256:4cd3f0ec4ac5dd9c17ec65e9ab272c9b867ea77425228e68ecf08d6b28ddbdb5"}, {file = "sphinxcontrib_applehelp-2.0.0.tar.gz", hash = "sha256:2f29ef331735ce958efa4734873f084941970894c6090408b079c61b2e1c06d1"}, @@ -1045,6 +1102,7 @@ version = "2.0.0" description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "sphinxcontrib_devhelp-2.0.0-py3-none-any.whl", hash = "sha256:aefb8b83854e4b0998877524d1029fd3e6879210422ee3780459e28a1f03a8a2"}, {file = "sphinxcontrib_devhelp-2.0.0.tar.gz", hash = "sha256:411f5d96d445d1d73bb5d52133377b4248ec79db5c793ce7dbe59e074b4dd1ad"}, @@ -1061,6 +1119,7 @@ version = "2.1.0" description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "sphinxcontrib_htmlhelp-2.1.0-py3-none-any.whl", hash = "sha256:166759820b47002d22914d64a075ce08f4c46818e17cfc9470a9786b759b19f8"}, {file = "sphinxcontrib_htmlhelp-2.1.0.tar.gz", hash = "sha256:c9e2916ace8aad64cc13a0d233ee22317f2b9025b9cf3295249fa985cc7082e9"}, @@ -1077,6 +1136,7 @@ version = "4.1" description = "Extension to include jQuery on newer Sphinx releases" optional = false python-versions = ">=2.7" +groups = ["main"] files = [ {file = "sphinxcontrib-jquery-4.1.tar.gz", hash = "sha256:1620739f04e36a2c779f1a131a2dfd49b2fd07351bf1968ced074365933abc7a"}, {file = "sphinxcontrib_jquery-4.1-py2.py3-none-any.whl", hash = "sha256:f936030d7d0147dd026a4f2b5a57343d233f1fc7b363f68b3d4f1cb0993878ae"}, @@ -1091,6 +1151,7 @@ version = "1.0.1" description = "A sphinx extension which renders display math in HTML via JavaScript" optional = false python-versions = ">=3.5" +groups = ["main"] files = [ {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"}, {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"}, @@ -1105,6 +1166,7 @@ version = "2.0.0" description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "sphinxcontrib_qthelp-2.0.0-py3-none-any.whl", hash = "sha256:b18a828cdba941ccd6ee8445dbe72ffa3ef8cbe7505d8cd1fa0d42d3f2d5f3eb"}, {file = "sphinxcontrib_qthelp-2.0.0.tar.gz", hash = "sha256:4fe7d0ac8fc171045be623aba3e2a8f613f8682731f9153bb2e40ece16b9bbab"}, @@ -1121,6 +1183,7 @@ version = "2.0.0" description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "sphinxcontrib_serializinghtml-2.0.0-py3-none-any.whl", hash = "sha256:6e2cb0eef194e10c27ec0023bfeb25badbbb5868244cf5bc5bdc04e4464bf331"}, {file = "sphinxcontrib_serializinghtml-2.0.0.tar.gz", hash = "sha256:e9d912827f872c029017a53f0ef2180b327c3f7fd23c87229f7a8e8b70031d4d"}, @@ -1137,6 +1200,7 @@ version = "5.4.0" description = "Manage dynamic plugins for Python applications" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "stevedore-5.4.0-py3-none-any.whl", hash = "sha256:b0be3c4748b3ea7b854b265dcb4caa891015e442416422be16f8b31756107857"}, {file = "stevedore-5.4.0.tar.gz", hash = "sha256:79e92235ecb828fe952b6b8b0c6c87863248631922c8e8e0fa5b17b232c4514d"}, @@ -1145,12 +1209,25 @@ files = [ [package.dependencies] pbr = ">=2.0.0" +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +groups = ["main"] +files = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] + [[package]] name = "typer" version = "0.15.1" description = "Typer, build great CLIs. Easy to code. Based on Python type hints." optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "typer-0.15.1-py3-none-any.whl", hash = "sha256:7994fb7b8155b64d3402518560648446072864beefd44aa2dc36972a5972e847"}, {file = "typer-0.15.1.tar.gz", hash = "sha256:a0588c0a7fa68a1978a069818657778f86abe6ff5ea6abf472f940a08bfe4f0a"}, @@ -1168,6 +1245,7 @@ version = "4.12.2" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, @@ -1179,6 +1257,7 @@ version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, @@ -1196,6 +1275,7 @@ version = "20.28.0" description = "Virtual Python Environment builder" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "virtualenv-20.28.0-py3-none-any.whl", hash = "sha256:23eae1b4516ecd610481eda647f3a7c09aea295055337331bb4e6892ecce47b0"}, {file = "virtualenv-20.28.0.tar.gz", hash = "sha256:2c9c3262bb8e7b87ea801d715fae4495e6032450c71d2309be9550e7364049aa"}, @@ -1210,7 +1290,11 @@ platformdirs = ">=3.9.1,<5" docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] +[extras] +dev = ["clang-format", "pre-commit", "ruff"] +docs = ["breathe", "doc8", "furo", "restructuredtext-lint", "rstcheck", "sphinx-copybutton", "sphinx-rtd-theme", "sphinx-sitemap"] + [metadata] -lock-version = "2.0" +lock-version = "2.1" python-versions = ">=3.12,<4.0" -content-hash = "710e6ce7851c9b3c21c7ad0002ec55e56e4ee5b3124f92ca36b28493907b9394" +content-hash = "eab453f18f64e89468baec39c83607c1004b9ab2efe3babbe74842442ad65909" From 9e22d7536c2dd61f4caedd22c2f53c979f943f98 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Wed, 15 Jan 2025 15:48:36 -0500 Subject: [PATCH 05/20] this adds capability to add a source into the yaml tree --- .../database_configuration.hpp | 8 +++++ include/parameter_parser/setup.hpp | 24 ++++++++++---- include/parameter_parser/sources.hpp | 32 +++++++++++++++++++ pyproject.toml | 2 +- .../database_configuration.cpp | 16 ++++++++-- src/parameter_parser/setup.cpp | 12 +++++++ src/specfem2d.cpp | 5 +-- .../Newmark/acoustic/newmark_tests.cpp | 3 +- .../Newmark/elastic/newmark_tests.cpp | 3 +- .../Newmark/newmark_tests.cpp | 5 +-- .../domain/acoustic/rmass_inverse_tests.cpp | 3 +- .../domain/elastic/rmass_inverse_tests.cpp | 3 +- 12 files changed, 97 insertions(+), 19 deletions(-) create mode 100644 include/parameter_parser/sources.hpp diff --git a/include/parameter_parser/database_configuration.hpp b/include/parameter_parser/database_configuration.hpp index f581034d1..3b9fb3720 100644 --- a/include/parameter_parser/database_configuration.hpp +++ b/include/parameter_parser/database_configuration.hpp @@ -24,6 +24,14 @@ class database_configuration { database_configuration(std::string fortran_database, std::string source_database) : fortran_database(fortran_database), source_database(source_database){}; + /** + * @brief Construct a new database configuration object + * + * @param fortran_database location of fortran database + * @param source_node location of source file + */ + database_configuration(std::string fortran_database, YAML::Node source_node) + : fortran_database(fortran_database), source_database(""){}; /** * @brief Construct a new run setup object * diff --git a/include/parameter_parser/setup.hpp b/include/parameter_parser/setup.hpp index 243a253bf..febc31750 100644 --- a/include/parameter_parser/setup.hpp +++ b/include/parameter_parser/setup.hpp @@ -1,13 +1,14 @@ #ifndef _PARAMETER_SETUP_HPP #define _PARAMETER_SETUP_HPP +#include "IO/reader.hpp" #include "database_configuration.hpp" #include "header.hpp" #include "parameter_parser/solver/interface.hpp" #include "quadrature.hpp" -#include "IO/reader.hpp" #include "receivers.hpp" #include "run_setup.hpp" +#include "sources.hpp" #include "specfem_setup.hpp" #include "time_scheme/interface.hpp" #include "writer/kernel.hpp" @@ -105,6 +106,13 @@ class setup { return databases->get_databases(); } + /** + * @brief Get the sources YAML object + * + * @return YAML::Node YAML node describing the sources + */ + YAML::Node get_sources() const { return this->sources->get_sources(); } + /** * @brief Get the path to stations file * @@ -140,8 +148,7 @@ class setup { * @return specfem::IO::writer* Pointer to an instantiated writer object */ - std::shared_ptr - instantiate_seismogram_writer() const { + std::shared_ptr instantiate_seismogram_writer() const { if (this->seismogram) { return this->seismogram->instantiate_seismogram_writer( this->time_scheme->get_dt(), this->time_scheme->get_t0(), @@ -151,8 +158,7 @@ class setup { } } - std::shared_ptr - instantiate_wavefield_writer() const { + std::shared_ptr instantiate_wavefield_writer() const { if (this->wavefield) { return this->wavefield->instantiate_wavefield_writer(); } else { @@ -160,8 +166,7 @@ class setup { } } - std::shared_ptr - instantiate_wavefield_reader() const { + std::shared_ptr instantiate_wavefield_reader() const { if (this->wavefield) { return this->wavefield->instantiate_wavefield_reader(); } else { @@ -234,6 +239,11 @@ class setup { ///< quadrature object std::unique_ptr receivers; ///< Pointer to receivers object + std::unique_ptr + sources; ///< Pointer + ///< to + ///< receivers + ///< object std::unique_ptr seismogram; ///< Pointer to ///< seismogram object diff --git a/include/parameter_parser/sources.hpp b/include/parameter_parser/sources.hpp new file mode 100644 index 000000000..b1c2697a0 --- /dev/null +++ b/include/parameter_parser/sources.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include "enumerations/specfem_enums.hpp" +#include "yaml-cpp/yaml.h" +#include + +namespace specfem { +namespace runtime_configuration { +/** + * @brief class to read source information + * + */ +class sources { +public: + sources(const std::string sources_file) { + source_node = YAML::LoadFile(sources_file); + }; + + sources(const YAML::Node &Node) { source_node = Node; }; + + /** + * @brief Get the sources + * + * @return YAML::Node describing the sources + */ + YAML::Node get_sources() const { return source_node; } + +protected: + YAML::Node source_node; /// Node that contains sources information +}; +} // namespace runtime_configuration +} // namespace specfem diff --git a/pyproject.toml b/pyproject.toml index c538dd322..e1c995966 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ docs = [ cmake.define.CMAKE_BUILD_TYPE = "Release" cmake.define.BUILD_TESTS = "ON" cmake.define.SPECFEMPP_USE_SKBUILD = "ON" -cmake.define.SPECFEMPP_ENABLE_PYTHON = "ON" +cmake.define.SPECFEMPP_BINDING_PYTHON = "ON" build-dir = "./build" [tool.poetry] diff --git a/src/parameter_parser/database_configuration.cpp b/src/parameter_parser/database_configuration.cpp index 056e35d20..2f38b1280 100644 --- a/src/parameter_parser/database_configuration.cpp +++ b/src/parameter_parser/database_configuration.cpp @@ -5,10 +5,20 @@ specfem::runtime_configuration::database_configuration::database_configuration( const YAML::Node &Node) { try { - *this = specfem::runtime_configuration::database_configuration( - Node["mesh-database"].as(), - Node["source-file"].as()); + if (const YAML::Node &source_node = Node["source-file"]) { + *this = specfem::runtime_configuration::database_configuration( + Node["mesh-database"].as(), + source_node.as()); + } else if (const YAML::Node &source_node = Node["source-dict"]) { + *this = specfem::runtime_configuration::database_configuration( + Node["mesh-database"].as(), source_node); + } else { + throw std::runtime_error("Error reading database configuration source " + "field not recognized. \n"); + } + } catch (YAML::ParserException &e) { + std::ostringstream message; message << "Error reading database configuration. \n" << e.what(); diff --git a/src/parameter_parser/setup.cpp b/src/parameter_parser/setup.cpp index 1bffbddba..e9516a18c 100644 --- a/src/parameter_parser/setup.cpp +++ b/src/parameter_parser/setup.cpp @@ -45,6 +45,17 @@ specfem::runtime_configuration::setup::setup(const YAML::Node ¶meter_dict, throw std::runtime_error(message.str()); } + // Get source info + if (const YAML::Node &source_node = n_databases["source-dict"]) { + this->sources = + std::make_unique(source_node); + } else if (const YAML::Node &source_node = n_databases["source-file"]) { + this->sources = std::make_unique( + source_node.as()); + } else { + throw std::runtime_error("Error reading specfem source configuration."); + } + if (const YAML::Node &n_quadrature = simulation_setup["quadrature"]) { this->quadrature = std::make_unique( @@ -90,6 +101,7 @@ specfem::runtime_configuration::setup::setup(const YAML::Node ¶meter_dict, this->property = nullptr; } + // Get receiver info try { this->receivers = std::make_unique( diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 828b57e77..332fab44e 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -113,8 +113,9 @@ void execute(const YAML::Node ¶meter_dict, const YAML::Node &default_dict, // -------------------------------------------------------------- const int nsteps = setup.get_nsteps(); const specfem::simulation::type simulation_type = setup.get_simulation_type(); - auto [sources, t0] = specfem::IO::read_sources( - source_filename, nsteps, setup.get_t0(), setup.get_dt(), simulation_type); + auto [sources, t0] = + specfem::IO::read_sources(setup.get_sources(), nsteps, setup.get_t0(), + setup.get_dt(), simulation_type); setup.update_t0(t0); // Update t0 in case it was changed const auto stations_filename = setup.get_stations_file(); diff --git a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp index 9c869c623..35a6263ef 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp @@ -56,6 +56,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); const auto [database_file, sources_file] = setup.get_databases(); + const auto source_node = setup.get_sources(); // mpi->cout(setup.print_header()); // Set up GLL quadrature points @@ -69,7 +70,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift auto [sources, t0] = - specfem::IO::read_sources(sources_file, setup.get_dt(), mpi); + specfem::IO::read_sources(source_node, setup.get_dt(), mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, diff --git a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp index 2a07ecedd..5724834e7 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp @@ -56,6 +56,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); const auto [database_file, sources_file] = setup.get_databases(); + const auto source_node = setup.get_sources(); // mpi->cout(setup.print_header()); // Set up GLL quadrature points @@ -69,7 +70,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift auto [sources, t0] = - specfem::IO::read_sources(sources_file, setup.get_dt(), mpi); + specfem::IO::read_sources(source_node, setup.get_dt(), mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 451466ba4..349b4b0e6 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -2,13 +2,13 @@ #include "../../MPI_environment.hpp" #include "../../utilities/include/interface.hpp" #include "IO/interface.hpp" +#include "IO/seismogram/reader.hpp" #include "compute/interface.hpp" #include "constants.hpp" #include "domain/domain.hpp" #include "mesh/mesh.hpp" #include "parameter_parser/interface.hpp" #include "quadrature/interface.hpp" -#include "IO/seismogram/reader.hpp" #include "solver/solver.hpp" #include "timescheme/timescheme.hpp" #include "yaml-cpp/yaml.h" @@ -170,6 +170,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { __default_file__); const auto [database_file, sources_file] = setup.get_databases(); + const auto source_node = setup.get_sources(); // Set up GLL quadrature points const auto quadratures = setup.instantiate_quadrature(); @@ -183,7 +184,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift auto [sources, t0] = specfem::IO::read_sources( - sources_file, nsteps, setup.get_t0(), dt, setup.get_simulation_type()); + source_node, nsteps, setup.get_t0(), dt, setup.get_simulation_type()); for (auto &source : sources) { if (mpi->main_proc()) diff --git a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp index b71cb1a62..1f3584849 100644 --- a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp @@ -54,6 +54,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); const auto [database_file, sources_file] = setup.get_databases(); + const auto source_node = setup.get_sources(); // Set up GLL quadrature points auto [gllx, gllz] = setup.instantiate_quadrature(); @@ -65,7 +66,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { // Read sources // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift - auto [sources, t0] = specfem::IO::read_sources(sources_file, 1e-5, mpi); + auto [sources, t0] = specfem::IO::read_sources(source_node, 1e-5, mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, diff --git a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp index 0464a65b8..56309d808 100644 --- a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp @@ -54,6 +54,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); const auto [database_file, sources_file] = setup.get_databases(); + const auto source_node = setup.get_sources(); // Set up GLL quadrature points auto [gllx, gllz] = setup.instantiate_quadrature(); @@ -65,7 +66,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { // Read sources // if start time is not explicitly specified then t0 is determined using // source frequencies and time shift - auto [sources, t0] = specfem::IO::read_sources(sources_file, 1e-5, mpi); + auto [sources, t0] = specfem::IO::read_sources(source_node, 1e-5, mpi); // Generate compute structs to be used by the solver specfem::compute::compute compute(mesh.coorg, mesh.material_ind.knods, gllx, From a9e95afc61d7cdb105e1939cd9f5978a64d5f691 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 16 Jan 2025 13:45:30 -0500 Subject: [PATCH 06/20] first commit to add receiver reading through YAML --- include/IO/interface.hpp | 27 ++++++++- include/parameter_parser/receivers.hpp | 77 ++++++++++++++------------ src/IO/receivers.cpp | 23 ++++++++ src/parameter_parser/receivers.cpp | 14 ++++- 4 files changed, 101 insertions(+), 40 deletions(-) diff --git a/include/IO/interface.hpp b/include/IO/interface.hpp index 783198304..a85c25389 100644 --- a/include/IO/interface.hpp +++ b/include/IO/interface.hpp @@ -24,10 +24,10 @@ specfem::mesh::mesh read_mesh(const std::string filename, const specfem::MPI::MPI *mpi); /** - * @brief Read receiver station file + * @brief Read station file * * Parse receiver stations file and create a vector of - * specfem::source::source * object + * specfem::receiver::receiver * object * * @param stations_file Stations file describing receiver locations * @param angle Angle of the receivers @@ -37,6 +37,29 @@ read_mesh(const std::string filename, const specfem::MPI::MPI *mpi); std::vector > read_receivers(const std::string stations_file, const type_real angle); +/** + * @brief Read receivers from YAML Node + * + * Parse receiver stations file and create a vector of + * specfem::receiver::receiver * object + * + * The receivers are defined in the YAML file as + * + * receivers: + * stations-dict: + * - network: "network_name" + * station: "station_name" + * x: x_coordinate + * z: z_coordinate + * + * @param stations YAML node containing receiver locations + * @param angle Angle of the receivers + * @return std::vector vector of instantiated + * receiver objects + */ +std::vector > +read_receivers(const YAML::Node &stations, const type_real angle); + /** * @brief Read sources file written in .yml format * diff --git a/include/parameter_parser/receivers.hpp b/include/parameter_parser/receivers.hpp index d27704508..ed3590f5f 100644 --- a/include/parameter_parser/receivers.hpp +++ b/include/parameter_parser/receivers.hpp @@ -21,42 +21,49 @@ class receivers { receivers(const YAML::Node &Node); - /** - * @brief Get the path of stations file - * - * @return std::string describing the locations of stations file - */ - std::string get_stations_file() const { return this->stations_file; } - /** - * @brief Get the angle of the receiver - * - * @return type_real describing the angle of the receiver - */ - type_real get_angle() const { return this->angle; }; - /** - * @brief Get the number of time steps between seismogram sampling - * - * @return int descibing seismogram sampling frequency - */ - int get_nstep_between_samples() const { return this->nstep_between_samples; } - /** - * @brief Get the types of seismogram requested - * - * @return std::vector vector seismogram types - */ - std::vector get_seismogram_types() const { - return stypes; - } + receivers(const YAML::Node &Node, const type_real angle, + const int nstep_between_samples) + : angle(angle), nstep_between_samples(nstep_between_samples) { + ; + + /** + * @brief Get the path of stations file + * + * @return std::string describing the locations of stations file + */ + std::string get_stations_file() const { return this->stations_file; } + /** + * @brief Get the angle of the receiver + * + * @return type_real describing the angle of the receiver + */ + type_real get_angle() const { return this->angle; }; + /** + * @brief Get the number of time steps between seismogram sampling + * + * @return int descibing seismogram sampling frequency + */ + int get_nstep_between_samples() const { + return this->nstep_between_samples; + } + /** + * @brief Get the types of seismogram requested + * + * @return std::vector vector seismogram types + */ + std::vector get_seismogram_types() const { + return stypes; + } -private: - std::string stations_file; ///< path to stations file - type_real angle; ///< Angle of the receiver - int nstep_between_samples; ///< Seismogram sampling frequency - std::vector stypes; ///< std::vector - ///< containing type of - ///< seismograms to be - ///< written -}; + private: + std::string stations_file; ///< path to stations file + type_real angle; ///< Angle of the receiver + int nstep_between_samples; ///< Seismogram sampling frequency + std::vector stypes; ///< std::vector + ///< containing type + ///< of seismograms to + ///< be written + }; } // namespace runtime_configuration } // namespace specfem diff --git a/src/IO/receivers.cpp b/src/IO/receivers.cpp index 61732b268..afb28c842 100644 --- a/src/IO/receivers.cpp +++ b/src/IO/receivers.cpp @@ -46,3 +46,26 @@ specfem::IO::read_receivers(const std::string stations_file, return receivers; } + +std::vector > +specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { + + std::vector > receivers; + + try { + for (const auto &station : stations) { + const std::string network_name = station["network"].as(); + const std::string station_name = station["station"].as(); + const type_real x = station["x"].as(); + const type_real z = station["z"].as(); + + receivers.push_back(std::make_shared( + network_name, station_name, x, z, angle)); + } + } catch (const YAML::Exception &e) { + std::cerr << e.what() << std::endl; + throw std::runtime_error("Error reading receiver stations"); + } + + return receivers; +} diff --git a/src/parameter_parser/receivers.cpp b/src/parameter_parser/receivers.cpp index 5ca28bb9a..037a410ec 100644 --- a/src/parameter_parser/receivers.cpp +++ b/src/parameter_parser/receivers.cpp @@ -6,9 +6,17 @@ specfem::runtime_configuration::receivers::receivers(const YAML::Node &Node) { try { - *this = specfem::runtime_configuration::receivers( - Node["stations-file"].as(), Node["angle"].as(), - Node["nstep_between_samples"].as()); + if (const YAML::Node &n_stations = Node["stations-file"]) { + *this = specfem::runtime_configuration::receivers( + n_stations.as(), Node["angle"].as(), + Node["nstep_between_samples"].as()); + } else if (const YAML::Node &n_stations = Node["stations-dict"]) { + *this = specfem::runtime_configuration::receivers( + n_stations, Node["angle"].as(), + Node["nstep_between_samples"].as()); + } else { + throw std::runtime_error("Error reading specfem receiver configuration."); + } } catch (YAML::ParserException &e) { std::ostringstream message; From c85f503877b97d01a04a8aa0f520fdd4147c0bc0 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 16 Jan 2025 15:10:48 -0500 Subject: [PATCH 07/20] I really do not like the way this is done. receivers can now have a stations-dict or a stations-file --- include/parameter_parser/receivers.hpp | 84 +++++++++---------- include/parameter_parser/setup.hpp | 4 +- src/IO/receivers.cpp | 9 ++ src/parameter_parser/receivers.cpp | 72 ++++++++++++++++ src/specfem2d.cpp | 4 +- .../Newmark/newmark_tests.cpp | 4 +- .../seismogram/acoustic/seismogram_tests.cpp | 4 +- .../seismogram/elastic/seismogram_tests.cpp | 4 +- 8 files changed, 130 insertions(+), 55 deletions(-) diff --git a/include/parameter_parser/receivers.hpp b/include/parameter_parser/receivers.hpp index ed3590f5f..eb34d4e8e 100644 --- a/include/parameter_parser/receivers.hpp +++ b/include/parameter_parser/receivers.hpp @@ -14,56 +14,52 @@ namespace runtime_configuration { */ class receivers { public: - receivers(const std::string stations_file, const int angle, + receivers(const YAML::Node &stations_node, const type_real angle, const int nstep_between_samples) - : stations_file(stations_file), angle(angle), + : stations_node(stations_node), angle(angle), nstep_between_samples(nstep_between_samples){}; - receivers(const YAML::Node &Node); + receivers(const std::string stations_file, const type_real angle, + const int nstep_between_samples); - receivers(const YAML::Node &Node, const type_real angle, - const int nstep_between_samples) - : angle(angle), nstep_between_samples(nstep_between_samples) { - ; + receivers(const YAML::Node &Node); - /** - * @brief Get the path of stations file - * - * @return std::string describing the locations of stations file - */ - std::string get_stations_file() const { return this->stations_file; } - /** - * @brief Get the angle of the receiver - * - * @return type_real describing the angle of the receiver - */ - type_real get_angle() const { return this->angle; }; - /** - * @brief Get the number of time steps between seismogram sampling - * - * @return int descibing seismogram sampling frequency - */ - int get_nstep_between_samples() const { - return this->nstep_between_samples; - } - /** - * @brief Get the types of seismogram requested - * - * @return std::vector vector seismogram types - */ - std::vector get_seismogram_types() const { - return stypes; - } + /** + * @brief Get the path of stations file + * + * @return std::string describing the locations of stations file + */ + YAML::Node get_stations() const { return this->stations_node; } + /** + * @brief Get the angle of the receiver + * + * @return type_real describing the angle of the receiver + */ + type_real get_angle() const { return this->angle; }; + /** + * @brief Get the number of time steps between seismogram sampling + * + * @return int descibing seismogram sampling frequency + */ + int get_nstep_between_samples() const { return this->nstep_between_samples; } + /** + * @brief Get the types of seismogram requested + * + * @return std::vector vector seismogram types + */ + std::vector get_seismogram_types() const { + return stypes; + } - private: - std::string stations_file; ///< path to stations file - type_real angle; ///< Angle of the receiver - int nstep_between_samples; ///< Seismogram sampling frequency - std::vector stypes; ///< std::vector - ///< containing type - ///< of seismograms to - ///< be written - }; +private: + YAML::Node stations_node; ///< YAML node containing receiver information + type_real angle; ///< Angle of the receiver + int nstep_between_samples; ///< Seismogram sampling frequency + std::vector stypes; ///< std::vector + ///< containing type of + ///< seismograms to be + ///< written +}; } // namespace runtime_configuration } // namespace specfem diff --git a/include/parameter_parser/setup.hpp b/include/parameter_parser/setup.hpp index febc31750..e97ce6569 100644 --- a/include/parameter_parser/setup.hpp +++ b/include/parameter_parser/setup.hpp @@ -118,9 +118,7 @@ class setup { * * @return std::string path to stations file */ - std::string get_stations_file() const { - return this->receivers->get_stations_file(); - } + YAML::Node get_stations() const { return this->receivers->get_stations(); } /** * @brief Get the angle of receivers diff --git a/src/IO/receivers.cpp b/src/IO/receivers.cpp index afb28c842..6413ffe1b 100644 --- a/src/IO/receivers.cpp +++ b/src/IO/receivers.cpp @@ -52,6 +52,15 @@ specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { std::vector > receivers; + // Throw error if length of stations is zero or if it is not a sequence + if (stations.IsSequence()) { + if (stations.size() == 0) { + throw std::runtime_error("No receiver stations found in the YAML file"); + } + } else { + throw std::runtime_error("Receiver YAML node is not a sequence"); + } + try { for (const auto &station : stations) { const std::string network_name = station["network"].as(); diff --git a/src/parameter_parser/receivers.cpp b/src/parameter_parser/receivers.cpp index 037a410ec..1925bbbc6 100644 --- a/src/parameter_parser/receivers.cpp +++ b/src/parameter_parser/receivers.cpp @@ -1,8 +1,80 @@ #include "parameter_parser/receivers.hpp" #include "constants.hpp" #include "yaml-cpp/yaml.h" + +// External Includes +#include +#include +#include #include #include +#include + +specfem::runtime_configuration::receivers::receivers( + const std::string stations_file, const type_real angle, + const int nstep_between_samples) { + + // Define basic parameters + this->angle = angle; + this->nstep_between_samples = nstep_between_samples; + + // Open file stream + std::fstream stations; + + // Define separator + boost::char_separator sep(" "); + + // Create empty sequence Node + this->stations_node = YAML::Load("[]"); + + // Open stations file + stations.open(stations_file, std::ios::in); + + if (stations.is_open()) { + + std::string line; + + // Read stations file line by line + while (std::getline(stations, line)) { + + // split every line with " " delimiter + boost::tokenizer > tokens(line, sep); + + // Create a vector to store the current station + std::vector current_station; + + for (const auto &t : tokens) { + current_station.push_back(t); + } + + // check if the read line meets the format + assert(current_station.size() == 6); + + // get the x and z coordinates of the station; + const std::string network_name = current_station[0]; + const std::string station_name = current_station[1]; + const std::string x = current_station[2]; + const std::string z = current_station[3]; + + // Current station node + YAML::Node current_station_node; + + // Edit node to include the current station + current_station_node["network"] = network_name; + current_station_node["station"] = station_name; + current_station_node["x"] = x; + current_station_node["z"] = z; + + // Append current station to the stations node + this->stations_node.push_back(current_station_node); + } + } else { + std::ostringstream message; + message << "Could not open stations file: " << stations_file << "\n"; + message << "Receivers empty."; + return; + } +} specfem::runtime_configuration::receivers::receivers(const YAML::Node &Node) { try { diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 332fab44e..3d7635b02 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -118,9 +118,9 @@ void execute(const YAML::Node ¶meter_dict, const YAML::Node &default_dict, setup.get_dt(), simulation_type); setup.update_t0(t0); // Update t0 in case it was changed - const auto stations_filename = setup.get_stations_file(); + const auto stations_node = setup.get_stations(); const auto angle = setup.get_receiver_angle(); - auto receivers = specfem::IO::read_receivers(stations_filename, angle); + auto receivers = specfem::IO::read_receivers(stations_node, angle); mpi->cout("Source Information:"); mpi->cout("-------------------------------"); diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index 349b4b0e6..eabf1d03a 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -196,9 +196,9 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { // Instantiate the solver and timescheme auto it = setup.instantiate_timescheme(); - const auto stations_filename = setup.get_stations_file(); + const auto stations_node = setup.get_stations(); const auto angle = setup.get_receiver_angle(); - auto receivers = specfem::IO::read_receivers(stations_filename, angle); + auto receivers = specfem::IO::read_receivers(stations_node, angle); std::cout << " Receiver information\n"; std::cout << "------------------------------" << std::endl; diff --git a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp index a254cb12f..5081c54e9 100644 --- a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp @@ -96,8 +96,8 @@ TEST(SEISMOGRAM_TESTS, acoustic_seismograms_test) { std::vector > sources(0); const auto angle = setup.get_receiver_angle(); - const auto stations_filename = setup.get_stations_file(); - auto receivers = specfem::IO::read_receivers(stations_filename, angle); + const auto stations_node = setup.get_stations(); + auto receivers = specfem::IO::read_receivers(stations_node, angle); const auto stypes = setup.get_seismogram_types(); specfem::compute::assembly assembly(mesh, quadratures, sources, receivers, diff --git a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp index 1870291a9..10a044d3f 100644 --- a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp @@ -96,8 +96,8 @@ TEST(SEISMOGRAM_TESTS, elastic_seismograms_test) { std::vector > sources(0); const auto angle = setup.get_receiver_angle(); - const auto stations_filename = setup.get_stations_file(); - auto receivers = specfem::IO::read_receivers(stations_filename, angle); + const auto stations_node = setup.get_stations(); + auto receivers = specfem::IO::read_receivers(stations_node, angle); const auto stypes = setup.get_seismogram_types(); specfem::compute::assembly assembly(mesh, quadratures, sources, receivers, From e6862aa519477830a3be999652fbf9187ca24f3f Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 16 Jan 2025 16:14:16 -0500 Subject: [PATCH 08/20] Put the onus of deciding what format the stations-file is into the read_receivers function. setup.receivers now just a YAML node --- include/parameter_parser/receivers.hpp | 38 ++--- src/IO/receivers.cpp | 13 +- src/parameter_parser/receivers.cpp | 194 +++++++++++++------------ 3 files changed, 130 insertions(+), 115 deletions(-) diff --git a/include/parameter_parser/receivers.hpp b/include/parameter_parser/receivers.hpp index eb34d4e8e..1e408b6e9 100644 --- a/include/parameter_parser/receivers.hpp +++ b/include/parameter_parser/receivers.hpp @@ -14,51 +14,45 @@ namespace runtime_configuration { */ class receivers { public: - receivers(const YAML::Node &stations_node, const type_real angle, - const int nstep_between_samples) - : stations_node(stations_node), angle(angle), - nstep_between_samples(nstep_between_samples){}; - - receivers(const std::string stations_file, const type_real angle, - const int nstep_between_samples); - - receivers(const YAML::Node &Node); + receivers(const YAML::Node &Node) : receivers_node(Node) { + assert(this->receivers_node["stations-file"].IsDefined()); + assert(this->receivers_node["angle"].IsDefined()); + assert(this->receivers_node["nstep_between_samples"].IsDefined()); + assert(this->receivers_node["seismogram-type"].IsDefined()); + }; /** * @brief Get the path of stations file * * @return std::string describing the locations of stations file */ - YAML::Node get_stations() const { return this->stations_node; } + YAML::Node get_stations() const { return this->receivers_node; } /** * @brief Get the angle of the receiver * * @return type_real describing the angle of the receiver */ - type_real get_angle() const { return this->angle; }; + type_real get_angle() const { + return this->receivers_node["angle"].as(); + }; /** * @brief Get the number of time steps between seismogram sampling * * @return int descibing seismogram sampling frequency */ - int get_nstep_between_samples() const { return this->nstep_between_samples; } + int get_nstep_between_samples() const { + return this->receivers_node["nstep_between_samples"].as(); + } + /** * @brief Get the types of seismogram requested * * @return std::vector vector seismogram types */ - std::vector get_seismogram_types() const { - return stypes; - } + std::vector get_seismogram_types() const; private: - YAML::Node stations_node; ///< YAML node containing receiver information - type_real angle; ///< Angle of the receiver - int nstep_between_samples; ///< Seismogram sampling frequency - std::vector stypes; ///< std::vector - ///< containing type of - ///< seismograms to be - ///< written + YAML::Node receivers_node; /// Node that contains receiver information }; } // namespace runtime_configuration } // namespace specfem diff --git a/src/IO/receivers.cpp b/src/IO/receivers.cpp index 6413ffe1b..0c75a1bd8 100644 --- a/src/IO/receivers.cpp +++ b/src/IO/receivers.cpp @@ -50,6 +50,15 @@ specfem::IO::read_receivers(const std::string stations_file, std::vector > specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { + // If stations file is a string then read the stations file from text format + try { + std::string stations_file = stations["stations-file"].as(); + return read_receivers(stations_file, angle); + } catch (const YAML::Exception &e) { + // If stations file is not a string then read the stations from the YAML + // node + } + std::vector > receivers; // Throw error if length of stations is zero or if it is not a sequence @@ -58,7 +67,9 @@ specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { throw std::runtime_error("No receiver stations found in the YAML file"); } } else { - throw std::runtime_error("Receiver YAML node is not a sequence"); + throw std::runtime_error( + "Expected stations-file to be a YAML node sequence,\n but it is " + "neither a sequence nor text file"); } try { diff --git a/src/parameter_parser/receivers.cpp b/src/parameter_parser/receivers.cpp index 1925bbbc6..1f4a855f2 100644 --- a/src/parameter_parser/receivers.cpp +++ b/src/parameter_parser/receivers.cpp @@ -10,105 +10,114 @@ #include #include -specfem::runtime_configuration::receivers::receivers( - const std::string stations_file, const type_real angle, - const int nstep_between_samples) { - - // Define basic parameters - this->angle = angle; - this->nstep_between_samples = nstep_between_samples; - - // Open file stream - std::fstream stations; - - // Define separator - boost::char_separator sep(" "); - - // Create empty sequence Node - this->stations_node = YAML::Load("[]"); - - // Open stations file - stations.open(stations_file, std::ios::in); - - if (stations.is_open()) { - - std::string line; - - // Read stations file line by line - while (std::getline(stations, line)) { - - // split every line with " " delimiter - boost::tokenizer > tokens(line, sep); - - // Create a vector to store the current station - std::vector current_station; - - for (const auto &t : tokens) { - current_station.push_back(t); - } - - // check if the read line meets the format - assert(current_station.size() == 6); - - // get the x and z coordinates of the station; - const std::string network_name = current_station[0]; - const std::string station_name = current_station[1]; - const std::string x = current_station[2]; - const std::string z = current_station[3]; - - // Current station node - YAML::Node current_station_node; - - // Edit node to include the current station - current_station_node["network"] = network_name; - current_station_node["station"] = station_name; - current_station_node["x"] = x; - current_station_node["z"] = z; - - // Append current station to the stations node - this->stations_node.push_back(current_station_node); - } - } else { - std::ostringstream message; - message << "Could not open stations file: " << stations_file << "\n"; - message << "Receivers empty."; - return; - } -} - -specfem::runtime_configuration::receivers::receivers(const YAML::Node &Node) { - try { - if (const YAML::Node &n_stations = Node["stations-file"]) { - *this = specfem::runtime_configuration::receivers( - n_stations.as(), Node["angle"].as(), - Node["nstep_between_samples"].as()); - } else if (const YAML::Node &n_stations = Node["stations-dict"]) { - *this = specfem::runtime_configuration::receivers( - n_stations, Node["angle"].as(), - Node["nstep_between_samples"].as()); - } else { - throw std::runtime_error("Error reading specfem receiver configuration."); - } - } catch (YAML::ParserException &e) { - std::ostringstream message; - - message << "Error reading specfem receiver configuration. \n" << e.what(); - - throw std::runtime_error(message.str()); - } +// specfem::runtime_configuration::receivers::receivers( +// const std::string stations_file, const type_real angle, +// const int nstep_between_samples) { + +// // Define basic parameters +// this->angle = angle; +// this->nstep_between_samples = nstep_between_samples; + +// // Open file stream +// std::fstream stations; + +// // Define separator +// boost::char_separator sep(" "); + +// // Create empty sequence Node +// this->stations_node = YAML::Load("[]"); + +// // Open stations file +// stations.open(stations_file, std::ios::in); + +// if (stations.is_open()) { + +// std::string line; + +// // Read stations file line by line +// while (std::getline(stations, line)) { + +// // split every line with " " delimiter +// boost::tokenizer > tokens(line, sep); + +// // Create a vector to store the current station +// std::vector current_station; + +// for (const auto &t : tokens) { +// current_station.push_back(t); +// } + +// // check if the read line meets the format +// assert(current_station.size() == 6); + +// // get the x and z coordinates of the station; +// const std::string network_name = current_station[0]; +// const std::string station_name = current_station[1]; +// const std::string x = current_station[2]; +// const std::string z = current_station[3]; + +// // Current station node +// YAML::Node current_station_node; + +// // Edit node to include the current station +// current_station_node["network"] = network_name; +// current_station_node["station"] = station_name; +// current_station_node["x"] = x; +// current_station_node["z"] = z; + +// // Append current station to the stations node +// this->stations_node.push_back(current_station_node); +// } +// } else { +// std::ostringstream message; +// message << "Could not open stations file: " << stations_file << "\n"; +// message << "Receivers empty."; +// return; +// } +// } + +// specfem::runtime_configuration::receivers::receivers(const YAML::Node &Node) +// { +// try { +// if (const YAML::Node &n_stations = Node["stations-file"]) { +// *this = specfem::runtime_configuration::receivers( +// n_stations.as(), Node["angle"].as(), +// Node["nstep_between_samples"].as()); +// } else if (const YAML::Node &n_stations = Node["stations-dict"]) { +// *this = specfem::runtime_configuration::receivers( +// n_stations, Node["angle"].as(), +// Node["nstep_between_samples"].as()); +// } else { +// throw std::runtime_error("Error reading specfem receiver +// configuration."); +// } +// } catch (YAML::ParserException &e) { +// std::ostringstream message; + +// message << "Error reading specfem receiver configuration. \n" << +// e.what(); + +// throw std::runtime_error(message.str()); +// } +// } + +std::vector +specfem::runtime_configuration::receivers::get_seismogram_types() const { + + std::vector stypes; // Allocate seismogram types - assert(Node["seismogram-type"].IsSequence()); + assert(this->receivers_node["seismogram-type"].IsSequence()); - for (YAML::Node seismogram_type : Node["seismogram-type"]) { + for (YAML::Node seismogram_type : this->receivers_node["seismogram-type"]) { if (seismogram_type.as() == "displacement") { - this->stypes.push_back(specfem::enums::seismogram::type::displacement); + stypes.push_back(specfem::enums::seismogram::type::displacement); } else if (seismogram_type.as() == "velocity") { - this->stypes.push_back(specfem::enums::seismogram::type::velocity); + stypes.push_back(specfem::enums::seismogram::type::velocity); } else if (seismogram_type.as() == "acceleration") { - this->stypes.push_back(specfem::enums::seismogram::type::acceleration); + stypes.push_back(specfem::enums::seismogram::type::acceleration); } else if (seismogram_type.as() == "pressure") { - this->stypes.push_back(specfem::enums::seismogram::type::pressure); + stypes.push_back(specfem::enums::seismogram::type::pressure); } else { std::ostringstream message; @@ -119,4 +128,5 @@ specfem::runtime_configuration::receivers::receivers(const YAML::Node &Node) { std::runtime_error(message.str()); } } + return stypes; } From 57abbcc5a2561729b2a8a7b6f46195cdeaf37023 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Thu, 16 Jan 2025 16:45:30 -0500 Subject: [PATCH 09/20] Fixed grabbing the stations-file from the stations-node. --- src/IO/receivers.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/IO/receivers.cpp b/src/IO/receivers.cpp index 0c75a1bd8..78753a244 100644 --- a/src/IO/receivers.cpp +++ b/src/IO/receivers.cpp @@ -62,8 +62,8 @@ specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { std::vector > receivers; // Throw error if length of stations is zero or if it is not a sequence - if (stations.IsSequence()) { - if (stations.size() == 0) { + if (stations["stations-file"].IsSequence()) { + if (stations["stations-file"].size() == 0) { throw std::runtime_error("No receiver stations found in the YAML file"); } } else { @@ -73,7 +73,7 @@ specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { } try { - for (const auto &station : stations) { + for (const auto &station : stations["stations-file"]) { const std::string network_name = station["network"].as(); const std::string station_name = station["station"].as(); const type_real x = station["x"].as(); From 070b27e634eb172bee13df043b37d28f4b95abb6 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 17 Jan 2025 13:58:55 -0500 Subject: [PATCH 10/20] Updated wavefield snapshot naming, to zero pad for easier globbing --- src/plotter/plot_wavefield.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plotter/plot_wavefield.cpp b/src/plotter/plot_wavefield.cpp index 92063f51a..465b014d6 100644 --- a/src/plotter/plot_wavefield.cpp +++ b/src/plotter/plot_wavefield.cpp @@ -9,6 +9,7 @@ #else +#include #include #include #include @@ -57,6 +58,15 @@ void specfem::plotter::plot_wavefield::plot() { namespace { +// Convert integer to string with zero leading +std::string to_zero_lead(const int value, const int n_zero) { + auto old_str = std::to_string(value); + int n_zero_fix = + n_zero - std::min(n_zero, static_cast(old_str.length())); + auto new_str = std::string(n_zero_fix, '0') + old_str; + return new_str; +} + // Sigmoid function centered at 0.0 double sigmoid(double x) { return (1 / (1 + std::exp(-100 * x)) - 0.5) * 1.5; } @@ -297,7 +307,7 @@ void specfem::plotter::plot_wavefield::plot() { if (this->output_format == specfem::display::format::PNG) { const auto filename = this->output_folder / - ("wavefield" + std::to_string(this->m_istep) + ".png"); + ("wavefield" + to_zero_lead(this->m_istep, 6) + ".png"); auto writer = vtkSmartPointer::New(); writer->SetFileName(filename.string().c_str()); writer->SetInputConnection(image_filter->GetOutputPort()); From b8da2f70f0f26a4fe2ede1f7c0274b99af9df0e9 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 17 Jan 2025 14:23:31 -0500 Subject: [PATCH 11/20] Updated the docs to only refer to the read function that read from file, and not the from a YAML node --- docs/api/IO/index.rst | 17 ++++-- docs/api/receivers/index.rst | 5 -- include/IO/interface.hpp | 22 ++++---- src/parameter_parser/receivers.cpp | 91 ------------------------------ 4 files changed, 24 insertions(+), 111 deletions(-) diff --git a/docs/api/IO/index.rst b/docs/api/IO/index.rst index 57fa88199..9f1d98ae4 100644 --- a/docs/api/IO/index.rst +++ b/docs/api/IO/index.rst @@ -29,12 +29,19 @@ are exposed through the following modules: reader/index -Read Mesh, Sources and Receivers --------------------------------- - +Read Mesh +--------- .. doxygenfunction:: specfem::IO::read_mesh -.. doxygenfunction:: specfem::IO::read_sources -.. doxygenfunction:: specfem::IO::read_receivers +Read Sources +------------ + +.. doxygenfunction:: specfem::IO::read_sources(const std::string sources_file, const int nsteps, const type_real user_t0, const type_real dt, const specfem::simulation::type simulation_type) + + +Read Receivers +-------------- + +.. doxygenfunction:: specfem::IO::read_receivers(const std::string stations_file, const type_real angle) diff --git a/docs/api/receivers/index.rst b/docs/api/receivers/index.rst index 22832dbdf..7f3476486 100644 --- a/docs/api/receivers/index.rst +++ b/docs/api/receivers/index.rst @@ -10,8 +10,3 @@ The ``receiver`` class provides methods to read, store and process seismogram st :members: :undoc-members: :private-members: - -Auxiliary functions -------------------- - -.. doxygenfunction:: specfem::receivers::read_receivers diff --git a/include/IO/interface.hpp b/include/IO/interface.hpp index 91298ff34..8c1429fb5 100644 --- a/include/IO/interface.hpp +++ b/include/IO/interface.hpp @@ -32,13 +32,13 @@ read_mesh(const std::string filename, const specfem::MPI::MPI *mpi); * * @param stations_file Stations file describing receiver locations * @param angle Angle of the receivers - * @return std::vector vector of instantiated - * receiver objects + * @return vector of instantiated receiver objects */ std::vector > read_receivers(const std::string stations_file, const type_real angle); /** + * @overload * @brief Read receivers from YAML Node * * Parse receiver stations file and create a vector of @@ -46,17 +46,19 @@ read_receivers(const std::string stations_file, const type_real angle); * * The receivers are defined in the YAML file as * - * receivers: - * stations-dict: - * - network: "network_name" - * station: "station_name" - * x: x_coordinate - * z: z_coordinate + * @code + * receivers: + * stations-dict: + * - network: "network_name" + * station: "station_name" + * x: x_coordinate + * z: z_coordinate + * - + * @endcode * * @param stations YAML node containing receiver locations * @param angle Angle of the receivers - * @return std::vector vector of instantiated - * receiver objects + * @return vector of instantiated receiver objects */ std::vector > read_receivers(const YAML::Node &stations, const type_real angle); diff --git a/src/parameter_parser/receivers.cpp b/src/parameter_parser/receivers.cpp index 1f4a855f2..368327011 100644 --- a/src/parameter_parser/receivers.cpp +++ b/src/parameter_parser/receivers.cpp @@ -10,97 +10,6 @@ #include #include -// specfem::runtime_configuration::receivers::receivers( -// const std::string stations_file, const type_real angle, -// const int nstep_between_samples) { - -// // Define basic parameters -// this->angle = angle; -// this->nstep_between_samples = nstep_between_samples; - -// // Open file stream -// std::fstream stations; - -// // Define separator -// boost::char_separator sep(" "); - -// // Create empty sequence Node -// this->stations_node = YAML::Load("[]"); - -// // Open stations file -// stations.open(stations_file, std::ios::in); - -// if (stations.is_open()) { - -// std::string line; - -// // Read stations file line by line -// while (std::getline(stations, line)) { - -// // split every line with " " delimiter -// boost::tokenizer > tokens(line, sep); - -// // Create a vector to store the current station -// std::vector current_station; - -// for (const auto &t : tokens) { -// current_station.push_back(t); -// } - -// // check if the read line meets the format -// assert(current_station.size() == 6); - -// // get the x and z coordinates of the station; -// const std::string network_name = current_station[0]; -// const std::string station_name = current_station[1]; -// const std::string x = current_station[2]; -// const std::string z = current_station[3]; - -// // Current station node -// YAML::Node current_station_node; - -// // Edit node to include the current station -// current_station_node["network"] = network_name; -// current_station_node["station"] = station_name; -// current_station_node["x"] = x; -// current_station_node["z"] = z; - -// // Append current station to the stations node -// this->stations_node.push_back(current_station_node); -// } -// } else { -// std::ostringstream message; -// message << "Could not open stations file: " << stations_file << "\n"; -// message << "Receivers empty."; -// return; -// } -// } - -// specfem::runtime_configuration::receivers::receivers(const YAML::Node &Node) -// { -// try { -// if (const YAML::Node &n_stations = Node["stations-file"]) { -// *this = specfem::runtime_configuration::receivers( -// n_stations.as(), Node["angle"].as(), -// Node["nstep_between_samples"].as()); -// } else if (const YAML::Node &n_stations = Node["stations-dict"]) { -// *this = specfem::runtime_configuration::receivers( -// n_stations, Node["angle"].as(), -// Node["nstep_between_samples"].as()); -// } else { -// throw std::runtime_error("Error reading specfem receiver -// configuration."); -// } -// } catch (YAML::ParserException &e) { -// std::ostringstream message; - -// message << "Error reading specfem receiver configuration. \n" << -// e.what(); - -// throw std::runtime_error(message.str()); -// } -// } - std::vector specfem::runtime_configuration::receivers::get_seismogram_types() const { From 9e3190e5023c619da296565244dc60e9159746dc Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 17 Jan 2025 15:26:57 -0500 Subject: [PATCH 12/20] Updated source-file to always be called sources. It can now be defined as either a file or a YAML Node --- .../anisotropic-crystal/specfem_config.yaml | 2 +- .../fluid-solid-interface/specfem_config.yaml | 2 +- .../dim2/homogeneous-medium/index.rst | 2 +- .../homogeneous-medium/specfem_config.yaml | 2 +- .../adjoint_config.yaml | 2 +- .../forward_config.yaml | 2 +- .../solid-solid-interface/specfem_config.yaml | 2 +- .../fluid-solid-interface/specfem_config.yaml | 2 +- .../specfem_config.yaml.in | 2 +- .../specfem_config.yaml | 2 +- .../specfem_config.yaml.in | 2 +- docs/parameter_documentation/databases.rst | 4 +-- examples/Tromp_2005/CMakeFiles/Snakefile.in | 4 +-- .../Tromp_2005/templates/specfem_config.yaml | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- include/parameter_parser/sources.hpp | 4 --- src/IO/sources.cpp | 35 ++++++++++++++----- .../database_configuration.cpp | 2 +- src/parameter_parser/setup.cpp | 5 +-- .../IO/sources/test_read_sources.cpp | 9 ++++- .../assembly/test_fixture/test_fixture.cpp | 2 ++ .../acoustic/serial/specfem_config.yaml | 2 +- .../elastic/serial/specfem_config.yaml | 2 +- .../Newmark/serial/test1/specfem_config.yaml | 2 +- .../Newmark/serial/test2/specfem_config.yaml | 2 +- .../Newmark/serial/test3/specfem_config.yaml | 2 +- .../Newmark/serial/test4/specfem_config.yaml | 2 +- .../Newmark/serial/test5/specfem_config.yaml | 2 +- .../Newmark/serial/test6/specfem_config.yaml | 2 +- .../Newmark/serial/test7/specfem_config.yaml | 2 +- .../Newmark/serial/test8/specfem_config.yaml | 2 +- .../Newmark/serial/test9/specfem_config.yaml | 2 +- .../domain/serial/test1/specfem_config.yaml | 2 +- .../domain/serial/test2/specfem_config.yaml | 2 +- .../domain/serial/test3/specfem_config.yaml | 2 +- .../domain/serial/test4/specfem_config.yaml | 2 +- .../acoustic/serial/specfem_config.yaml | 2 +- .../elastic/serial/specfem_config.yaml | 2 +- 42 files changed, 77 insertions(+), 56 deletions(-) diff --git a/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml b/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml index b9626c2e2..8a6eae23f 100644 --- a/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml +++ b/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml @@ -58,4 +58,4 @@ parameters: ## databases databases: mesh-database: "./OUTPUT_FILES/database.bin" - source-file: "./source.yaml" + sources: "./source.yaml" diff --git a/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml b/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml index 0098b7d49..31d58f583 100644 --- a/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml +++ b/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml @@ -48,4 +48,4 @@ run-setup: ## databases databases: mesh-database: OUTPUT_FILES/database.bin - source-file: single_source.yaml + sources: single_source.yaml diff --git a/docs/cookbooks/dim2/homogeneous-medium/index.rst b/docs/cookbooks/dim2/homogeneous-medium/index.rst index 594b33423..87d8d4d3e 100644 --- a/docs/cookbooks/dim2/homogeneous-medium/index.rst +++ b/docs/cookbooks/dim2/homogeneous-medium/index.rst @@ -184,7 +184,7 @@ At this point lets focus on a few sections in this file: - Define the path to the meshfem generated database file using the ``mesh-database`` parameter and the path to source description file using - ``source-file`` parameter. Relevant parameter values: + ``sources`` parameter. Relevant parameter values: .. literalinclude:: specfem_config.yaml :caption: specfem_config.yaml diff --git a/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml b/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml index f4132371f..465fbb44d 100644 --- a/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml +++ b/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml @@ -46,4 +46,4 @@ parameters: ## databases databases: mesh-database: OUTPUT_FILES/database.bin - source-file: single_source.yaml + sources: single_source.yaml diff --git a/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml b/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml index d2f98b5c5..da725c68e 100644 --- a/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml +++ b/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml @@ -49,4 +49,4 @@ parameters: databases: mesh-database: OUTPUT_FILES/database.bin - source-file: adjoint_sources.yaml + sources: adjoint_sources.yaml diff --git a/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml b/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml index 4a47b096c..25e6b3547 100644 --- a/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml +++ b/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml @@ -48,4 +48,4 @@ parameters: databases: mesh-database: OUTPUT_FILES/database.bin - source-file: forward_sources.yaml + sources: forward_sources.yaml diff --git a/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml b/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml index 61cd323cd..4d0469aab 100644 --- a/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml +++ b/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml @@ -51,4 +51,4 @@ parameters: ## databases databases: mesh-database: OUTPUT_FILES/database.bin - source-file: sources.yaml + sources: sources.yaml diff --git a/docs/examples/fluid-solid-interface/specfem_config.yaml b/docs/examples/fluid-solid-interface/specfem_config.yaml index 5e561e30f..7ae434ac7 100644 --- a/docs/examples/fluid-solid-interface/specfem_config.yaml +++ b/docs/examples/fluid-solid-interface/specfem_config.yaml @@ -43,7 +43,7 @@ parameters: ## databases databases: mesh-database: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid-solid-interface/OUTPUT_FILES/database.bin" - source-file: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid-solid-interface/sources.yaml" + sources: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid-solid-interface/sources.yaml" seismogram: seismogram-format: ascii diff --git a/docs/examples/fluid-solid-interface/specfem_config.yaml.in b/docs/examples/fluid-solid-interface/specfem_config.yaml.in index bcbf42ca2..a5b58b860 100644 --- a/docs/examples/fluid-solid-interface/specfem_config.yaml.in +++ b/docs/examples/fluid-solid-interface/specfem_config.yaml.in @@ -43,7 +43,7 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/OUTPUT_FILES/database.bin" - source-file: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" + sources: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" seismogram: seismogram-format: ascii diff --git a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml index 975b17658..2d22b62b2 100644 --- a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml +++ b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml @@ -43,4 +43,4 @@ parameters: ## databases databases: mesh-database: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/database.bin" - source-file: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/source.yaml" + sources: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/source.yaml" diff --git a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in index 86ed576f5..039256f5c 100644 --- a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in +++ b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in @@ -43,4 +43,4 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/database.bin" - source-file: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" + sources: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" diff --git a/docs/parameter_documentation/databases.rst b/docs/parameter_documentation/databases.rst index f4a08e1da..52963f048 100644 --- a/docs/parameter_documentation/databases.rst +++ b/docs/parameter_documentation/databases.rst @@ -26,7 +26,7 @@ Parameter definitions **documentation**: Location of the fortran binary database file defining the mesh -**Parameter name** : ``databases.source-file`` +**Parameter name** : ``databases.sources`` ****************************************************** **default value**: None @@ -41,4 +41,4 @@ Parameter definitions databases: mesh-database: /path/to/mesh_database.bin - source-file: /path/to/source_file.yaml + sources: /path/to/source_file.yaml diff --git a/examples/Tromp_2005/CMakeFiles/Snakefile.in b/examples/Tromp_2005/CMakeFiles/Snakefile.in index a07ee4bcf..78b3ff872 100644 --- a/examples/Tromp_2005/CMakeFiles/Snakefile.in +++ b/examples/Tromp_2005/CMakeFiles/Snakefile.in @@ -56,7 +56,7 @@ rule forward_configuration: ## Add forward node to the simulation setup config["parameters"]["simulation-setup"].update(forward) - config["parameters"]["databases"]["source-file"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/forward_source.yaml" + config["parameters"]["databases"]["sources"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/forward_source.yaml" config["parameters"]["receivers"]["stations-file"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/STATIONS" config["parameters"]["databases"]["mesh-database"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/database.bin" @@ -158,7 +158,7 @@ rule adjoint_configuration: ## Add adjoint node to the simulation setup config["parameters"]["simulation-setup"].update(adjoint) - config["parameters"]["databases"]["source-file"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/adjoint_source.yaml" + config["parameters"]["databases"]["sources"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/adjoint_source.yaml" config["parameters"]["databases"]["mesh-database"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/database.bin" with open(output.config, "w") as f: diff --git a/examples/Tromp_2005/templates/specfem_config.yaml b/examples/Tromp_2005/templates/specfem_config.yaml index 4409815eb..e330646a8 100644 --- a/examples/Tromp_2005/templates/specfem_config.yaml +++ b/examples/Tromp_2005/templates/specfem_config.yaml @@ -37,4 +37,4 @@ parameters: databases: mesh-database: placeholder/for/path/to/database.bin - source-file: placeholder/for/path/to/source.yaml + sources: placeholder/for/path/to/source.yaml diff --git a/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in b/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in index e8818a24c..d9d5624f0 100644 --- a/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in +++ b/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in @@ -51,4 +51,4 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/OUTPUT_FILES/database.bin" - source-file: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/sources.yaml" + sources: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/sources.yaml" diff --git a/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in b/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in index 7393aa5c2..2a8a2caaa 100644 --- a/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in +++ b/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in @@ -53,4 +53,4 @@ parameters: ## databases databases: mesh-database: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/OUTPUT_FILES/database.bin - source-file: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/line_sources.yaml + sources: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/line_sources.yaml diff --git a/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in b/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in index b382438c6..7e24ab96f 100644 --- a/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in +++ b/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in @@ -51,4 +51,4 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/OUTPUT_FILES/database.bin" - source-file: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" + sources: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" diff --git a/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in b/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in index 426f338fa..44b0ddca7 100644 --- a/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in +++ b/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in @@ -45,4 +45,4 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/database.bin" - source-file: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" + sources: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" diff --git a/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in b/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in index d89d83e48..3f06b62a9 100644 --- a/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in +++ b/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in @@ -51,4 +51,4 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/database.bin" - source-file: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/sources.yaml" + sources: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/sources.yaml" diff --git a/include/parameter_parser/sources.hpp b/include/parameter_parser/sources.hpp index b1c2697a0..11e0d9aa1 100644 --- a/include/parameter_parser/sources.hpp +++ b/include/parameter_parser/sources.hpp @@ -12,10 +12,6 @@ namespace runtime_configuration { */ class sources { public: - sources(const std::string sources_file) { - source_node = YAML::LoadFile(sources_file); - }; - sources(const YAML::Node &Node) { source_node = Node; }; /** diff --git a/src/IO/sources.cpp b/src/IO/sources.cpp index 17849d356..9225b00db 100644 --- a/src/IO/sources.cpp +++ b/src/IO/sources.cpp @@ -16,19 +16,41 @@ std::tuple >, type_real> specfem::IO::read_sources(const std::string sources_file, const int nsteps, const type_real user_t0, const type_real dt, const specfem::simulation::type simulation_type) { - - return read_sources(YAML::LoadFile(sources_file), nsteps, user_t0, dt, - simulation_type); + YAML::Node source_node = YAML::LoadFile(sources_file); + return read_sources(source_node, nsteps, user_t0, dt, simulation_type); } std::tuple >, type_real> -specfem::IO::read_sources(const YAML::Node yaml, const int nsteps, +specfem::IO::read_sources(const YAML::Node source_node, const int nsteps, const type_real user_t0, const type_real dt, const specfem::simulation::type simulation_type) { const bool user_defined_start_time = (std::abs(user_t0) > std::numeric_limits::epsilon()); + // Need to define it here, otherwise it will be out of scope + YAML::Node source_dict; + + try // reading sources file as string + { + source_dict = YAML::LoadFile(source_node.as()); + } + + // if it fails, assuming that the source-node is already a YAML source node + catch (YAML::Exception &e) { + source_dict = source_node; + } + + // Extract source sequence from the sources node + YAML::Node file_sources = source_dict["sources"]; + + // Double check that the sources are indeed a list + assert(file_sources.IsSequence()); + assert(file_sources.size() > 0); + + // Now we can directly access the source_dict + int nsources = source_dict["number-of-sources"].as(); + const specfem::wavefield::simulation_field source_wavefield_type = [&simulation_type]() -> specfem::wavefield::simulation_field { switch (simulation_type) { @@ -43,9 +65,6 @@ specfem::IO::read_sources(const YAML::Node yaml, const int nsteps, // read sources file std::vector > sources; - int nsources = yaml["number-of-sources"].as(); - YAML::Node Node = yaml["sources"]; - assert(Node.IsSequence()); // Note: Make sure you name the YAML node different from the name of the // source class Otherwise, the compiler will get confused and throw an error @@ -53,7 +72,7 @@ specfem::IO::read_sources(const YAML::Node yaml, const int nsteps, // shows up on CUDA compiler int number_of_sources = 0; int number_of_adjoint_sources = 0; - for (auto N : Node) { + for (auto N : file_sources) { if (YAML::Node force_source = N["force"]) { sources.push_back(std::make_shared( force_source, nsteps, dt, source_wavefield_type)); diff --git a/src/parameter_parser/database_configuration.cpp b/src/parameter_parser/database_configuration.cpp index 2f38b1280..37ea792d4 100644 --- a/src/parameter_parser/database_configuration.cpp +++ b/src/parameter_parser/database_configuration.cpp @@ -5,7 +5,7 @@ specfem::runtime_configuration::database_configuration::database_configuration( const YAML::Node &Node) { try { - if (const YAML::Node &source_node = Node["source-file"]) { + if (const YAML::Node &source_node = Node["sources"]) { *this = specfem::runtime_configuration::database_configuration( Node["mesh-database"].as(), source_node.as()); diff --git a/src/parameter_parser/setup.cpp b/src/parameter_parser/setup.cpp index e9516a18c..57a6625f6 100644 --- a/src/parameter_parser/setup.cpp +++ b/src/parameter_parser/setup.cpp @@ -46,12 +46,9 @@ specfem::runtime_configuration::setup::setup(const YAML::Node ¶meter_dict, } // Get source info - if (const YAML::Node &source_node = n_databases["source-dict"]) { + if (const YAML::Node &source_node = n_databases["sources"]) { this->sources = std::make_unique(source_node); - } else if (const YAML::Node &source_node = n_databases["source-file"]) { - this->sources = std::make_unique( - source_node.as()); } else { throw std::runtime_error("Error reading specfem source configuration."); } diff --git a/tests/unit-tests/IO/sources/test_read_sources.cpp b/tests/unit-tests/IO/sources/test_read_sources.cpp index 6bf19ef85..8cd4948d4 100644 --- a/tests/unit-tests/IO/sources/test_read_sources.cpp +++ b/tests/unit-tests/IO/sources/test_read_sources.cpp @@ -15,6 +15,9 @@ TEST(IO_TESTS, read_sources) { std::string sources_file = "../../../tests/unit-tests/IO/sources/data/single_moment_tensor.yml"; + YAML::Node databases; + databases["sources"] = sources_file; + int nsteps = 100; type_real t0 = 0.0; type_real dt = 0.01; @@ -25,8 +28,12 @@ TEST(IO_TESTS, read_sources) { type_real hdur = 1.0 / f0; type_real t0_final = -1.2 * hdur + tshift; + std::cout << "hello" << std::endl; + std::cout << databases["sources"].as() << std::endl; auto [sources, user_t0] = specfem::IO::read_sources( - sources_file, nsteps, t0, dt, specfem::simulation::type::forward); + databases["sources"], nsteps, t0, dt, specfem::simulation::type::forward); + + std::cout << "world" << std::endl; ASSERT_EQ(sources.size(), 1); auto source = sources[0]; diff --git a/tests/unit-tests/assembly/test_fixture/test_fixture.cpp b/tests/unit-tests/assembly/test_fixture/test_fixture.cpp index 3c9c5ce32..a2c635689 100644 --- a/tests/unit-tests/assembly/test_fixture/test_fixture.cpp +++ b/tests/unit-tests/assembly/test_fixture/test_fixture.cpp @@ -36,6 +36,8 @@ ASSEMBLY::ASSEMBLY() { this->Meshes.push_back(mesh); + std::cout << sources_file << std::endl; + const auto [sources, t0] = specfem::IO::read_sources( sources_file, 1, 0, 0, specfem::simulation::type::forward); diff --git a/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml index 8e2da8125..974fbadb4 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml @@ -43,7 +43,7 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/acoustic/serial/Database00000.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/acoustic/serial/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/acoustic/serial/sources.yaml" # seismogram output seismogram: diff --git a/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml index ec76404ae..4c5ca3195 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml @@ -43,7 +43,7 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/elastic/serial/Database00000.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/elastic/serial/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/elastic/serial/sources.yaml" seismogram: seismogram-format: ascii diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml index 7541a0b2b..3b9bea20d 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml @@ -50,4 +50,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml index 2d1eb5e83..30cc6af07 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml @@ -50,4 +50,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml index 575ef6af9..d043c10a9 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml @@ -51,4 +51,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml index daa21a9d4..04607b27d 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml @@ -51,7 +51,7 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test4/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test4/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test4/sources.yaml" seismogram: seismogram-format: ascii diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml index 6d62bae45..506698256 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml @@ -47,4 +47,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml index e16fa48eb..e07239382 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml @@ -47,4 +47,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml index 5ccf6b073..6b952462d 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml @@ -46,4 +46,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml index 53f27ed06..1bd4c6ee9 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml @@ -46,4 +46,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/source.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/source.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml index 7f32d0dbd..f49084bf3 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml @@ -50,4 +50,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/database.bin" - source-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/sources.yaml" + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/sources.yaml" diff --git a/tests/unit-tests/domain/serial/test1/specfem_config.yaml b/tests/unit-tests/domain/serial/test1/specfem_config.yaml index 2a30b66c2..66d4c3970 100644 --- a/tests/unit-tests/domain/serial/test1/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test1/specfem_config.yaml @@ -41,4 +41,4 @@ parameters: databases: mesh-database: "../../../tests/unit-tests/domain/serial/test1/database.bin" - source-file: "../../../tests/unit-tests/domain/serial/test1/source.yaml" + sources: "../../../tests/unit-tests/domain/serial/test1/source.yaml" diff --git a/tests/unit-tests/domain/serial/test2/specfem_config.yaml b/tests/unit-tests/domain/serial/test2/specfem_config.yaml index 1826df8cc..830c21067 100644 --- a/tests/unit-tests/domain/serial/test2/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test2/specfem_config.yaml @@ -41,4 +41,4 @@ parameters: databases: mesh-database: "../../../tests/unit-tests/domain/serial/test2/database.bin" - source-file: "../../../tests/unit-tests/domain/serial/test2/source.yaml" + sources: "../../../tests/unit-tests/domain/serial/test2/source.yaml" diff --git a/tests/unit-tests/domain/serial/test3/specfem_config.yaml b/tests/unit-tests/domain/serial/test3/specfem_config.yaml index 89dedcd70..7df5d1572 100644 --- a/tests/unit-tests/domain/serial/test3/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test3/specfem_config.yaml @@ -41,4 +41,4 @@ parameters: databases: mesh-database: "../../../tests/unit-tests/domain/serial/test3/database.bin" - source-file: "../../../tests/unit-tests/domain/serial/test3/source.yaml" + sources: "../../../tests/unit-tests/domain/serial/test3/source.yaml" diff --git a/tests/unit-tests/domain/serial/test4/specfem_config.yaml b/tests/unit-tests/domain/serial/test4/specfem_config.yaml index 28c347c9c..65eb39120 100644 --- a/tests/unit-tests/domain/serial/test4/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test4/specfem_config.yaml @@ -41,4 +41,4 @@ parameters: databases: mesh-database: "../../../tests/unit-tests/domain/serial/test4/database.bin" - source-file: "../../../tests/unit-tests/domain/serial/test4/source.yaml" + sources: "../../../tests/unit-tests/domain/serial/test4/source.yaml" diff --git a/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml b/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml index 3c003cbf2..0e7816d36 100644 --- a/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml +++ b/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml @@ -46,4 +46,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/seismogram/acoustic/serial/database.bin" - source-file: "dummy-source.yaml" + sources: "dummy-source.yaml" diff --git a/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml b/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml index a72a17bc2..b69719ef4 100644 --- a/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml +++ b/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml @@ -46,4 +46,4 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/seismogram/elastic/serial/database.bin" - source-file: "dummy-source.yaml" + sources: "dummy-source.yaml" From 35f2ecd46283a0316d6e3a6ba64586e137bb07c2 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 17 Jan 2025 16:18:43 -0500 Subject: [PATCH 13/20] Moved sources from databases to its own space in the runtime config --- .../anisotropic-crystal/specfem_config.yaml | 4 +- .../fluid-solid-interface/specfem_config.yaml | 98 ++++++++++--------- .../homogeneous-medium/specfem_config.yaml | 4 +- .../adjoint_config.yaml | 3 +- .../forward_config.yaml | 3 +- .../solid-solid-interface/specfem_config.yaml | 4 +- .../fluid-solid-interface/specfem_config.yaml | 2 +- .../specfem_config.yaml | 4 +- .../Tromp_2005/templates/specfem_config.yaml | 4 +- .../CMakeFiles/specfem_config.yaml.in | 3 +- .../CMakeFiles/specfem_config.yaml.in | 4 +- .../CMakeFiles/specfem_config.yaml.in | 4 +- .../CMakeFiles/specfem_config.yaml.in | 4 +- .../CMakeFiles/specfem_config.yaml.in | 4 +- .../database_configuration.hpp | 20 +--- include/parameter_parser/setup.hpp | 4 +- .../database_configuration.cpp | 13 +-- src/parameter_parser/setup.cpp | 2 +- src/specfem2d.cpp | 2 +- .../Newmark/acoustic/newmark_tests.cpp | 2 +- .../acoustic/serial/specfem_config.yaml | 3 +- .../Newmark/elastic/newmark_tests.cpp | 2 +- .../elastic/serial/specfem_config.yaml | 3 +- .../Newmark/newmark_tests.cpp | 2 +- .../Newmark/serial/test1/specfem_config.yaml | 3 +- .../Newmark/serial/test2/specfem_config.yaml | 4 +- .../Newmark/serial/test3/specfem_config.yaml | 3 +- .../Newmark/serial/test5/specfem_config.yaml | 3 +- .../Newmark/serial/test6/specfem_config.yaml | 3 +- .../Newmark/serial/test7/specfem_config.yaml | 3 +- .../Newmark/serial/test8/specfem_config.yaml | 3 +- .../Newmark/serial/test9/specfem_config.yaml | 3 +- .../domain/acoustic/rmass_inverse_tests.cpp | 2 +- .../domain/elastic/rmass_inverse_tests.cpp | 2 +- .../unit-tests/domain/rmass_inverse_tests.cpp | 2 +- .../domain/serial/test1/specfem_config.yaml | 3 +- .../domain/serial/test2/specfem_config.yaml | 3 +- .../domain/serial/test4/specfem_config.yaml | 3 +- .../seismogram/acoustic/seismogram_tests.cpp | 2 +- .../seismogram/elastic/seismogram_tests.cpp | 2 +- 40 files changed, 128 insertions(+), 114 deletions(-) diff --git a/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml b/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml index 8a6eae23f..097d9b650 100644 --- a/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml +++ b/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml @@ -58,4 +58,6 @@ parameters: ## databases databases: mesh-database: "./OUTPUT_FILES/database.bin" - sources: "./source.yaml" + + ## Sources + sources: "./source.yaml" diff --git a/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml b/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml index 31d58f583..64cdc937f 100644 --- a/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml +++ b/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml @@ -1,51 +1,53 @@ parameters: -header: - ## Header information is used for logging. It is good practice to give your simulations explicit names - title: Heterogeneous acoustic-elastic medium with 1 acoustic-elastic interface (orientation horizontal) # name for your simulation - # A detailed description for your simulation - description: | - Material systems : Elastic domain (1), Acoustic domain (1) - Interfaces : Acoustic-elastic interface (1) (orientation horizontal with acoustic domain on top) - Sources : Force source (1) - Boundary conditions : Neumann BCs on all edges - Debugging comments: This tests checks coupling acoustic-elastic interface implementation. - The orientation of the interface is horizontal with acoustic domain on top. - -simulation-setup: - ## quadrature setup - quadrature: - quadrature-type: GLL4 - - ## Solver setup - solver: - time-marching: - type-of-simulation: forward - time-scheme: - type: Newmark - dt: 0.85e-3 - nstep: 600 - - simulation-mode: - forward: - writer: - seismogram: - format: ascii - directory: OUTPUT_FILES/seismograms - -receivers: - stations-file: OUTPUT_FILES/STATIONS - angle: 0.0 - seismogram-type: - - displacement - nstep_between_samples: 1 - -## Runtime setup -run-setup: - number-of-processors: 1 - number-of-runs: 1 - -## databases -databases: - mesh-database: OUTPUT_FILES/database.bin + header: + ## Header information is used for logging. It is good practice to give your simulations explicit names + title: Heterogeneous acoustic-elastic medium with 1 acoustic-elastic interface (orientation horizontal) # name for your simulation + # A detailed description for your simulation + description: | + Material systems : Elastic domain (1), Acoustic domain (1) + Interfaces : Acoustic-elastic interface (1) (orientation horizontal with acoustic domain on top) + Sources : Force source (1) + Boundary conditions : Neumann BCs on all edges + Debugging comments: This tests checks coupling acoustic-elastic interface implementation. + The orientation of the interface is horizontal with acoustic domain on top. + + simulation-setup: + ## quadrature setup + quadrature: + quadrature-type: GLL4 + + ## Solver setup + solver: + time-marching: + type-of-simulation: forward + time-scheme: + type: Newmark + dt: 0.85e-3 + nstep: 600 + + simulation-mode: + forward: + writer: + seismogram: + format: ascii + directory: OUTPUT_FILES/seismograms + + receivers: + stations-file: OUTPUT_FILES/STATIONS + angle: 0.0 + seismogram-type: + - displacement + nstep_between_samples: 1 + + ## Runtime setup + run-setup: + number-of-processors: 1 + number-of-runs: 1 + + ## databases + databases: + mesh-database: OUTPUT_FILES/database.bin + + ## Sources sources: single_source.yaml diff --git a/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml b/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml index 465fbb44d..0c9246038 100644 --- a/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml +++ b/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml @@ -46,4 +46,6 @@ parameters: ## databases databases: mesh-database: OUTPUT_FILES/database.bin - sources: single_source.yaml + + ## sources + sources: single_source.yaml diff --git a/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml b/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml index da725c68e..704f6052a 100644 --- a/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml +++ b/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml @@ -49,4 +49,5 @@ parameters: databases: mesh-database: OUTPUT_FILES/database.bin - sources: adjoint_sources.yaml + + sources: adjoint_sources.yaml diff --git a/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml b/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml index 25e6b3547..a9e8991cd 100644 --- a/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml +++ b/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml @@ -48,4 +48,5 @@ parameters: databases: mesh-database: OUTPUT_FILES/database.bin - sources: forward_sources.yaml + + sources: forward_sources.yaml diff --git a/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml b/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml index 4d0469aab..21440f042 100644 --- a/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml +++ b/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml @@ -51,4 +51,6 @@ parameters: ## databases databases: mesh-database: OUTPUT_FILES/database.bin - sources: sources.yaml + + ## sources + sources: sources.yaml diff --git a/docs/examples/fluid-solid-interface/specfem_config.yaml b/docs/examples/fluid-solid-interface/specfem_config.yaml index 7ae434ac7..5e561e30f 100644 --- a/docs/examples/fluid-solid-interface/specfem_config.yaml +++ b/docs/examples/fluid-solid-interface/specfem_config.yaml @@ -43,7 +43,7 @@ parameters: ## databases databases: mesh-database: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid-solid-interface/OUTPUT_FILES/database.bin" - sources: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid-solid-interface/sources.yaml" + source-file: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid-solid-interface/sources.yaml" seismogram: seismogram-format: ascii diff --git a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml index 2d22b62b2..5621197b0 100644 --- a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml +++ b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml @@ -43,4 +43,6 @@ parameters: ## databases databases: mesh-database: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/database.bin" - sources: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/source.yaml" + + ## sources + sources: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/source.yaml" diff --git a/examples/Tromp_2005/templates/specfem_config.yaml b/examples/Tromp_2005/templates/specfem_config.yaml index e330646a8..1b402dce1 100644 --- a/examples/Tromp_2005/templates/specfem_config.yaml +++ b/examples/Tromp_2005/templates/specfem_config.yaml @@ -37,4 +37,6 @@ parameters: databases: mesh-database: placeholder/for/path/to/database.bin - sources: placeholder/for/path/to/source.yaml + + ## sources + sources: placeholder/for/path/to/source.yaml diff --git a/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in b/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in index d9d5624f0..901d1a607 100644 --- a/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in +++ b/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in @@ -51,4 +51,5 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/OUTPUT_FILES/database.bin" - sources: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/sources.yaml" + + sources: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/sources.yaml" diff --git a/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in b/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in index 2a8a2caaa..de26db319 100644 --- a/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in +++ b/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in @@ -53,4 +53,6 @@ parameters: ## databases databases: mesh-database: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/OUTPUT_FILES/database.bin - sources: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/line_sources.yaml + + ## sources + sources: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/line_sources.yaml diff --git a/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in b/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in index 7e24ab96f..a4eccdaa6 100644 --- a/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in +++ b/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in @@ -51,4 +51,6 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/OUTPUT_FILES/database.bin" - sources: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" + + ## sources + sources: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" diff --git a/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in b/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in index 44b0ddca7..554504432 100644 --- a/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in +++ b/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in @@ -45,4 +45,6 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/database.bin" - sources: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" + + ## sources + sources: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" diff --git a/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in b/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in index 3f06b62a9..d01d6b98c 100644 --- a/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in +++ b/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in @@ -51,4 +51,6 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/database.bin" - sources: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/sources.yaml" + + ## sources + sources: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/sources.yaml" diff --git a/include/parameter_parser/database_configuration.hpp b/include/parameter_parser/database_configuration.hpp index 3b9fb3720..0b626a164 100644 --- a/include/parameter_parser/database_configuration.hpp +++ b/include/parameter_parser/database_configuration.hpp @@ -19,19 +19,10 @@ class database_configuration { * @brief Construct a new database configuration object * * @param fortran_database location of fortran database - * @param source_database location of source file */ - database_configuration(std::string fortran_database, - std::string source_database) - : fortran_database(fortran_database), source_database(source_database){}; - /** - * @brief Construct a new database configuration object - * - * @param fortran_database location of fortran database - * @param source_node location of source file - */ - database_configuration(std::string fortran_database, YAML::Node source_node) - : fortran_database(fortran_database), source_database(""){}; + database_configuration(std::string fortran_database) + : fortran_database(fortran_database){}; + /** * @brief Construct a new run setup object * @@ -39,13 +30,10 @@ class database_configuration { */ database_configuration(const YAML::Node &Node); - std::tuple get_databases() const { - return std::make_tuple(this->fortran_database, this->source_database); - } + std::string get_databases() const { return this->fortran_database; } private: std::string fortran_database; ///< location of fortran binary database - std::string source_database; ///< location of sources file }; } // namespace runtime_configuration diff --git a/include/parameter_parser/setup.hpp b/include/parameter_parser/setup.hpp index e97ce6569..c3b9fb282 100644 --- a/include/parameter_parser/setup.hpp +++ b/include/parameter_parser/setup.hpp @@ -102,9 +102,7 @@ class setup { * @return std::tuple std::tuple specifying the path * to mesh database and source yaml file */ - std::tuple get_databases() const { - return databases->get_databases(); - } + std::string get_databases() const { return databases->get_databases(); } /** * @brief Get the sources YAML object diff --git a/src/parameter_parser/database_configuration.cpp b/src/parameter_parser/database_configuration.cpp index 37ea792d4..27cfb77a5 100644 --- a/src/parameter_parser/database_configuration.cpp +++ b/src/parameter_parser/database_configuration.cpp @@ -5,17 +5,8 @@ specfem::runtime_configuration::database_configuration::database_configuration( const YAML::Node &Node) { try { - if (const YAML::Node &source_node = Node["sources"]) { - *this = specfem::runtime_configuration::database_configuration( - Node["mesh-database"].as(), - source_node.as()); - } else if (const YAML::Node &source_node = Node["source-dict"]) { - *this = specfem::runtime_configuration::database_configuration( - Node["mesh-database"].as(), source_node); - } else { - throw std::runtime_error("Error reading database configuration source " - "field not recognized. \n"); - } + *this = specfem::runtime_configuration::database_configuration( + Node["mesh-database"].as()); } catch (YAML::ParserException &e) { diff --git a/src/parameter_parser/setup.cpp b/src/parameter_parser/setup.cpp index 57a6625f6..4e7e8840e 100644 --- a/src/parameter_parser/setup.cpp +++ b/src/parameter_parser/setup.cpp @@ -46,7 +46,7 @@ specfem::runtime_configuration::setup::setup(const YAML::Node ¶meter_dict, } // Get source info - if (const YAML::Node &source_node = n_databases["sources"]) { + if (const YAML::Node &source_node = runtime_config["sources"]) { this->sources = std::make_unique(source_node); } else { diff --git a/src/specfem2d.cpp b/src/specfem2d.cpp index 3d7635b02..6f8045f0d 100644 --- a/src/specfem2d.cpp +++ b/src/specfem2d.cpp @@ -96,7 +96,7 @@ void execute(const YAML::Node ¶meter_dict, const YAML::Node &default_dict, // -------------------------------------------------------------- auto start_time = std::chrono::system_clock::now(); specfem::runtime_configuration::setup setup(parameter_dict, default_dict); - const auto [database_filename, source_filename] = setup.get_databases(); + const auto database_filename = setup.get_databases(); mpi->cout(setup.print_header(start_time)); // -------------------------------------------------------------- diff --git a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp index 35a6263ef..4f7827f10 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/newmark_tests.cpp @@ -55,7 +55,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); const auto source_node = setup.get_sources(); // mpi->cout(setup.print_header()); diff --git a/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml index 974fbadb4..3f92f65bb 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml @@ -43,7 +43,8 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/acoustic/serial/Database00000.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/acoustic/serial/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/acoustic/serial/sources.yaml" # seismogram output seismogram: diff --git a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp index 5724834e7..f8f9a988b 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/newmark_tests.cpp @@ -55,7 +55,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); const auto source_node = setup.get_sources(); // mpi->cout(setup.print_header()); diff --git a/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml index 4c5ca3195..ccf529c45 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml @@ -43,7 +43,8 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/elastic/serial/Database00000.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/elastic/serial/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/elastic/serial/sources.yaml" seismogram: seismogram-format: ascii diff --git a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp index eabf1d03a..96ee9f2cd 100644 --- a/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp +++ b/tests/unit-tests/displacement_tests/Newmark/newmark_tests.cpp @@ -169,7 +169,7 @@ TEST(DISPLACEMENT_TESTS, newmark_scheme_tests) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); const auto source_node = setup.get_sources(); // Set up GLL quadrature points diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml index 3b9bea20d..7339c837f 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml @@ -50,4 +50,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml index 30cc6af07..84026a21a 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml @@ -50,4 +50,6 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/sources.yaml" + + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml index d043c10a9..3894174eb 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml @@ -51,4 +51,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml index 506698256..3cb73b385 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml @@ -47,4 +47,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml index e07239382..58ddfd89a 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml @@ -47,4 +47,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml index 6b952462d..16e3fd9b9 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml @@ -46,4 +46,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/sources.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml index 1bd4c6ee9..6238c130e 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml @@ -46,4 +46,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/source.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/source.yaml" diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml index f49084bf3..e96b5d34a 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml @@ -50,4 +50,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/database.bin" - sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/sources.yaml" + + sources: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/sources.yaml" diff --git a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp index 1f3584849..cae380b42 100644 --- a/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/acoustic/rmass_inverse_tests.cpp @@ -53,7 +53,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); const auto source_node = setup.get_sources(); // Set up GLL quadrature points diff --git a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp index 56309d808..ba243c067 100644 --- a/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/elastic/rmass_inverse_tests.cpp @@ -53,7 +53,7 @@ TEST(DOMAIN_TESTS, rmass_inverse_elastic_test) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); const auto source_node = setup.get_sources(); // Set up GLL quadrature points diff --git a/tests/unit-tests/domain/rmass_inverse_tests.cpp b/tests/unit-tests/domain/rmass_inverse_tests.cpp index dee8f3310..49f65d480 100644 --- a/tests/unit-tests/domain/rmass_inverse_tests.cpp +++ b/tests/unit-tests/domain/rmass_inverse_tests.cpp @@ -109,7 +109,7 @@ TEST(DOMAIN_TESTS, rmass_inverse) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); // Set up GLL quadrature points auto quadratures = setup.instantiate_quadrature(); diff --git a/tests/unit-tests/domain/serial/test1/specfem_config.yaml b/tests/unit-tests/domain/serial/test1/specfem_config.yaml index 66d4c3970..16abd1e97 100644 --- a/tests/unit-tests/domain/serial/test1/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test1/specfem_config.yaml @@ -41,4 +41,5 @@ parameters: databases: mesh-database: "../../../tests/unit-tests/domain/serial/test1/database.bin" - sources: "../../../tests/unit-tests/domain/serial/test1/source.yaml" + + sources: "../../../tests/unit-tests/domain/serial/test1/source.yaml" diff --git a/tests/unit-tests/domain/serial/test2/specfem_config.yaml b/tests/unit-tests/domain/serial/test2/specfem_config.yaml index 830c21067..873b44a9c 100644 --- a/tests/unit-tests/domain/serial/test2/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test2/specfem_config.yaml @@ -41,4 +41,5 @@ parameters: databases: mesh-database: "../../../tests/unit-tests/domain/serial/test2/database.bin" - sources: "../../../tests/unit-tests/domain/serial/test2/source.yaml" + + sources: "../../../tests/unit-tests/domain/serial/test2/source.yaml" diff --git a/tests/unit-tests/domain/serial/test4/specfem_config.yaml b/tests/unit-tests/domain/serial/test4/specfem_config.yaml index 65eb39120..88dce1fdc 100644 --- a/tests/unit-tests/domain/serial/test4/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test4/specfem_config.yaml @@ -41,4 +41,5 @@ parameters: databases: mesh-database: "../../../tests/unit-tests/domain/serial/test4/database.bin" - sources: "../../../tests/unit-tests/domain/serial/test4/source.yaml" + + sources: "../../../tests/unit-tests/domain/serial/test4/source.yaml" diff --git a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp index 5081c54e9..196064fd4 100644 --- a/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/acoustic/seismogram_tests.cpp @@ -84,7 +84,7 @@ TEST(SEISMOGRAM_TESTS, acoustic_seismograms_test) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); // mpi->cout(setup.print_header()); // Set up GLL quadrature points diff --git a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp index 10a044d3f..067f81fa5 100644 --- a/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp +++ b/tests/unit-tests/seismogram/elastic/seismogram_tests.cpp @@ -84,7 +84,7 @@ TEST(SEISMOGRAM_TESTS, elastic_seismograms_test) { specfem::runtime_configuration::setup setup(parameter_file, __default_file__); - const auto [database_file, sources_file] = setup.get_databases(); + const auto database_file = setup.get_databases(); // mpi->cout(setup.print_header()); // Set up GLL quadrature points From 7beffb070cb644f5e9583fc5c753c8f250ac9b4d Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 17 Jan 2025 16:44:10 -0500 Subject: [PATCH 14/20] Removed the -file from the stations-file descriptor --- .../dim2/anisotropic-crystal/specfem_config.yaml | 2 +- .../dim2/fluid-solid-interface/specfem_config.yaml | 2 +- .../dim2/homogeneous-medium/specfem_config.yaml | 2 +- .../kernels-example-tromp-2005/adjoint_config.yaml | 2 +- .../kernels-example-tromp-2005/forward_config.yaml | 2 +- .../dim2/solid-solid-interface/specfem_config.yaml | 2 +- .../examples/fluid-solid-interface/specfem_config.yaml | 2 +- .../fluid-solid-interface/specfem_config.yaml.in | 2 +- .../specfem_config.yaml | 2 +- .../specfem_config.yaml.in | 2 +- docs/parameter_documentation/receivers.rst | 8 ++++---- examples/Tromp_2005/CMakeFiles/Snakefile.in | 2 +- examples/Tromp_2005/templates/specfem_config.yaml | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- .../CMakeFiles/specfem_config.yaml.in | 2 +- include/parameter_parser/receivers.hpp | 2 +- src/IO/receivers.cpp | 10 +++++----- .../Newmark/acoustic/serial/specfem_config.yaml | 2 +- .../Newmark/elastic/serial/specfem_config.yaml | 2 +- .../Newmark/serial/test1/specfem_config.yaml | 2 +- .../Newmark/serial/test2/specfem_config.yaml | 2 +- .../Newmark/serial/test3/specfem_config.yaml | 2 +- .../Newmark/serial/test4/specfem_config.yaml | 2 +- .../Newmark/serial/test5/specfem_config.yaml | 2 +- .../Newmark/serial/test6/specfem_config.yaml | 2 +- .../Newmark/serial/test7/specfem_config.yaml | 2 +- .../Newmark/serial/test8/specfem_config.yaml | 2 +- .../Newmark/serial/test9/specfem_config.yaml | 2 +- .../unit-tests/domain/serial/test1/specfem_config.yaml | 2 +- .../unit-tests/domain/serial/test2/specfem_config.yaml | 2 +- .../unit-tests/domain/serial/test3/specfem_config.yaml | 2 +- .../unit-tests/domain/serial/test4/specfem_config.yaml | 2 +- .../seismogram/acoustic/serial/specfem_config.yaml | 2 +- .../seismogram/elastic/serial/specfem_config.yaml | 5 +++-- 37 files changed, 46 insertions(+), 45 deletions(-) diff --git a/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml b/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml index 097d9b650..4173c9d86 100644 --- a/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml +++ b/docs/cookbooks/dim2/anisotropic-crystal/specfem_config.yaml @@ -44,7 +44,7 @@ parameters: time-interval: 100 receivers: - stations-file: "./OUTPUT_FILES/STATIONS" + stations: "./OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml b/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml index 64cdc937f..a72c0cd3b 100644 --- a/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml +++ b/docs/cookbooks/dim2/fluid-solid-interface/specfem_config.yaml @@ -34,7 +34,7 @@ parameters: directory: OUTPUT_FILES/seismograms receivers: - stations-file: OUTPUT_FILES/STATIONS + stations: OUTPUT_FILES/STATIONS angle: 0.0 seismogram-type: - displacement diff --git a/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml b/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml index 0c9246038..a8068a2fd 100644 --- a/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml +++ b/docs/cookbooks/dim2/homogeneous-medium/specfem_config.yaml @@ -32,7 +32,7 @@ parameters: directory: OUTPUT_FILES/seismograms receivers: - stations-file: OUTPUT_FILES/STATIONS + stations: OUTPUT_FILES/STATIONS angle: 0.0 seismogram-type: - velocity diff --git a/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml b/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml index 704f6052a..8f0036cc3 100644 --- a/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml +++ b/docs/cookbooks/dim2/kernels-example-tromp-2005/adjoint_config.yaml @@ -37,7 +37,7 @@ parameters: directory: OUTPUT_FILES/kernels receivers: - stations-file: OUTPUT_FILES/STATIONS + stations: OUTPUT_FILES/STATIONS angle: 0.0 seismogram-type: - displacement diff --git a/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml b/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml index a9e8991cd..1e4142af4 100644 --- a/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml +++ b/docs/cookbooks/dim2/kernels-example-tromp-2005/forward_config.yaml @@ -36,7 +36,7 @@ parameters: directory: OUTPUT_FILES/seismograms receivers: - stations-file: OUTPUT_FILES/STATIONS + stations: OUTPUT_FILES/STATIONS angle: 0.0 seismogram-type: - displacement diff --git a/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml b/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml index 21440f042..46e89b5a7 100644 --- a/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml +++ b/docs/cookbooks/dim2/solid-solid-interface/specfem_config.yaml @@ -37,7 +37,7 @@ parameters: directory: OUTPUT_FILES/seismograms receivers: - stations-file: OUTPUT_FILES/STATIONS + stations: OUTPUT_FILES/STATIONS angle: 0.0 seismogram-type: - displacement diff --git a/docs/examples/fluid-solid-interface/specfem_config.yaml b/docs/examples/fluid-solid-interface/specfem_config.yaml index 5e561e30f..8364c9bb3 100644 --- a/docs/examples/fluid-solid-interface/specfem_config.yaml +++ b/docs/examples/fluid-solid-interface/specfem_config.yaml @@ -28,7 +28,7 @@ parameters: nstep: 800 receivers: - stations-file: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid_solid_interface/OUTPUT_FILES/STATIONS" + stations: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/fluid_solid_interface/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/docs/examples/fluid-solid-interface/specfem_config.yaml.in b/docs/examples/fluid-solid-interface/specfem_config.yaml.in index a5b58b860..d15fa3f76 100644 --- a/docs/examples/fluid-solid-interface/specfem_config.yaml.in +++ b/docs/examples/fluid-solid-interface/specfem_config.yaml.in @@ -28,7 +28,7 @@ parameters: nstep: 800 receivers: - stations-file: "@CMAKE_SOURCE_DIR@/examples/fluid_solid_interface/OUTPUT_FILES/STATIONS" + stations: "@CMAKE_SOURCE_DIR@/examples/fluid_solid_interface/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml index 5621197b0..c1aa13cb6 100644 --- a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml +++ b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml @@ -25,7 +25,7 @@ parameters: nstep: 1600 receivers: - stations-file: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/STATIONS" + stations: "/scratch/gpfs/rk9481/specfem2d_kokkos/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - velocity diff --git a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in index 039256f5c..296718948 100644 --- a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in +++ b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in @@ -25,7 +25,7 @@ parameters: nstep: 1600 receivers: - stations-file: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/STATIONS" + stations: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - velocity diff --git a/docs/parameter_documentation/receivers.rst b/docs/parameter_documentation/receivers.rst index d7c2c2eee..fa2256a21 100644 --- a/docs/parameter_documentation/receivers.rst +++ b/docs/parameter_documentation/receivers.rst @@ -16,7 +16,7 @@ Receivers section defines receiver information required to calculate seismograms **documentation** : receiver information required to calculate seismograms. -**Parameter Name** : ``receivers.stations-file`` +**Parameter Name** : ``receivers.stationse`` ****************************************************** **default value** : None @@ -35,7 +35,7 @@ Receivers section defines receiver information required to calculate seismograms **documentation** : Angle to rotate components at receivers **Parameter Name** : ``receivers.seismogram-type`` -****************************************************** +************************************************** **default value** : None @@ -69,7 +69,7 @@ Receivers section defines receiver information required to calculate seismograms - displacement **Parameter Name** : ``receivers.nstep_between_samples`` -********************************************************* +******************************************************** **default value** : None @@ -82,7 +82,7 @@ Receivers section defines receiver information required to calculate seismograms .. code-block:: yaml receivers: - stations-file: /path/to/stations_file + stations: /path/to/stations_file angle: 0.0 seismogram-type: - velocity diff --git a/examples/Tromp_2005/CMakeFiles/Snakefile.in b/examples/Tromp_2005/CMakeFiles/Snakefile.in index 78b3ff872..bdf68ff05 100644 --- a/examples/Tromp_2005/CMakeFiles/Snakefile.in +++ b/examples/Tromp_2005/CMakeFiles/Snakefile.in @@ -57,7 +57,7 @@ rule forward_configuration: ## Add forward node to the simulation setup config["parameters"]["simulation-setup"].update(forward) config["parameters"]["databases"]["sources"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/forward_source.yaml" - config["parameters"]["receivers"]["stations-file"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/STATIONS" + config["parameters"]["receivers"]["stations"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/STATIONS" config["parameters"]["databases"]["mesh-database"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/database.bin" with open(output.config, "w") as f: diff --git a/examples/Tromp_2005/templates/specfem_config.yaml b/examples/Tromp_2005/templates/specfem_config.yaml index 1b402dce1..f48f7a8b5 100644 --- a/examples/Tromp_2005/templates/specfem_config.yaml +++ b/examples/Tromp_2005/templates/specfem_config.yaml @@ -25,7 +25,7 @@ parameters: t0: 8.0 receivers: - stations-file: placeholder/for/path/to/STATIONS + stations: placeholder/for/path/to/STATIONS angle: 0.0 seismogram-type: - displacement diff --git a/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in b/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in index 901d1a607..38d6b94ac 100644 --- a/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in +++ b/examples/anisotropic-crystal/CMakeFiles/specfem_config.yaml.in @@ -37,7 +37,7 @@ parameters: directory: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/OUTPUT_FILES/results" receivers: - stations-file: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/OUTPUT_FILES/STATIONS" + stations: "@CMAKE_SOURCE_DIR@/examples/anisotropic-crystal/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in b/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in index de26db319..34b17461e 100644 --- a/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in +++ b/examples/fluid-solid-bathymetry/CMakeFiles/specfem_config.yaml.in @@ -39,7 +39,7 @@ parameters: time-interval: 100 receivers: - stations-file: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/OUTPUT_FILES/STATIONS + stations: @CMAKE_SOURCE_DIR@/examples/fluid-solid-bathymetry/OUTPUT_FILES/STATIONS angle: 0.0 seismogram-type: - pressure diff --git a/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in b/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in index a4eccdaa6..128c6de1f 100644 --- a/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in +++ b/examples/fluid-solid-interface/CMakeFiles/specfem_config.yaml.in @@ -37,7 +37,7 @@ parameters: directory: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/OUTPUT_FILES/results" receivers: - stations-file: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/OUTPUT_FILES/STATIONS" + stations: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in b/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in index 554504432..cd62a3a8b 100644 --- a/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in +++ b/examples/homogeneous-medium-flat-topography/CMakeFiles/specfem_config.yaml.in @@ -31,7 +31,7 @@ parameters: directory: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/results" receivers: - stations-file: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/STATIONS" + stations: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - velocity diff --git a/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in b/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in index d01d6b98c..314366541 100644 --- a/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in +++ b/examples/solid-solid-interface/CMakeFiles/specfem_config.yaml.in @@ -37,7 +37,7 @@ parameters: directory: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/results" receivers: - stations-file: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/STATIONS" + stations: "@CMAKE_SOURCE_DIR@/examples/solid-solid-interface/OUTPUT_FILES/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/include/parameter_parser/receivers.hpp b/include/parameter_parser/receivers.hpp index 1e408b6e9..f74a0a5cf 100644 --- a/include/parameter_parser/receivers.hpp +++ b/include/parameter_parser/receivers.hpp @@ -15,7 +15,7 @@ namespace runtime_configuration { class receivers { public: receivers(const YAML::Node &Node) : receivers_node(Node) { - assert(this->receivers_node["stations-file"].IsDefined()); + assert(this->receivers_node["stations"].IsDefined()); assert(this->receivers_node["angle"].IsDefined()); assert(this->receivers_node["nstep_between_samples"].IsDefined()); assert(this->receivers_node["seismogram-type"].IsDefined()); diff --git a/src/IO/receivers.cpp b/src/IO/receivers.cpp index 78753a244..5b1024f30 100644 --- a/src/IO/receivers.cpp +++ b/src/IO/receivers.cpp @@ -52,7 +52,7 @@ specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { // If stations file is a string then read the stations file from text format try { - std::string stations_file = stations["stations-file"].as(); + std::string stations_file = stations["stations"].as(); return read_receivers(stations_file, angle); } catch (const YAML::Exception &e) { // If stations file is not a string then read the stations from the YAML @@ -62,18 +62,18 @@ specfem::IO::read_receivers(const YAML::Node &stations, const type_real angle) { std::vector > receivers; // Throw error if length of stations is zero or if it is not a sequence - if (stations["stations-file"].IsSequence()) { - if (stations["stations-file"].size() == 0) { + if (stations["stations"].IsSequence()) { + if (stations["stations"].size() == 0) { throw std::runtime_error("No receiver stations found in the YAML file"); } } else { throw std::runtime_error( - "Expected stations-file to be a YAML node sequence,\n but it is " + "Expected stations to be a YAML node sequence,\n but it is " "neither a sequence nor text file"); } try { - for (const auto &station : stations["stations-file"]) { + for (const auto &station : stations["stations"]) { const std::string network_name = station["network"].as(); const std::string station_name = station["station"].as(); const type_real x = station["x"].as(); diff --git a/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml index 3f92f65bb..c034ce23f 100644 --- a/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/acoustic/serial/specfem_config.yaml @@ -28,7 +28,7 @@ parameters: nstep: 100 receivers: - stations-file: "../DATA/STATIONS" + stations: "../DATA/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml index ccf529c45..68d2e34b8 100644 --- a/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/elastic/serial/specfem_config.yaml @@ -28,7 +28,7 @@ parameters: nstep: 100 receivers: - stations-file: "../DATA/STATIONS" + stations: "../DATA/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml index 7339c837f..ec7d2fd96 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test1/specfem_config.yaml @@ -33,7 +33,7 @@ parameters: directory: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test1/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml index 84026a21a..6fb7da8dd 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test2/specfem_config.yaml @@ -33,7 +33,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test2/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml index 3894174eb..146211658 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test3/specfem_config.yaml @@ -37,7 +37,7 @@ parameters: directory: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test3/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml index 04607b27d..e0fbf998f 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test4/specfem_config.yaml @@ -37,7 +37,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test4/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test4/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml index 3cb73b385..d6fb69131 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test5/specfem_config.yaml @@ -33,7 +33,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test5/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml index 58ddfd89a..87da28b70 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test6/specfem_config.yaml @@ -33,7 +33,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test6/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml index 16e3fd9b9..d8c0cd6a0 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test7/specfem_config.yaml @@ -32,7 +32,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test7/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml index 6238c130e..c33d82b25 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test8/specfem_config.yaml @@ -32,7 +32,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test8/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml b/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml index e96b5d34a..d9c8109d2 100644 --- a/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml +++ b/tests/unit-tests/displacement_tests/Newmark/serial/test9/specfem_config.yaml @@ -33,7 +33,7 @@ parameters: directory: "." receivers: - stations-file: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/STATIONS" + stations: "../../../tests/unit-tests/displacement_tests/Newmark/serial/test9/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/domain/serial/test1/specfem_config.yaml b/tests/unit-tests/domain/serial/test1/specfem_config.yaml index 16abd1e97..e23fe9293 100644 --- a/tests/unit-tests/domain/serial/test1/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test1/specfem_config.yaml @@ -27,7 +27,7 @@ parameters: output-folder: "." receivers: - stations-file: "../DATA/STATIONS" + stations: "../DATA/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/domain/serial/test2/specfem_config.yaml b/tests/unit-tests/domain/serial/test2/specfem_config.yaml index 873b44a9c..48d625722 100644 --- a/tests/unit-tests/domain/serial/test2/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test2/specfem_config.yaml @@ -27,7 +27,7 @@ parameters: output-folder: "." receivers: - stations-file: "../DATA/STATIONS" + stations: "../DATA/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/domain/serial/test3/specfem_config.yaml b/tests/unit-tests/domain/serial/test3/specfem_config.yaml index 7df5d1572..e4fd9303a 100644 --- a/tests/unit-tests/domain/serial/test3/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test3/specfem_config.yaml @@ -27,7 +27,7 @@ parameters: output-folder: "." receivers: - stations-file: "../DATA/STATIONS" + stations: "../DATA/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/domain/serial/test4/specfem_config.yaml b/tests/unit-tests/domain/serial/test4/specfem_config.yaml index 88dce1fdc..6283290af 100644 --- a/tests/unit-tests/domain/serial/test4/specfem_config.yaml +++ b/tests/unit-tests/domain/serial/test4/specfem_config.yaml @@ -27,7 +27,7 @@ parameters: output-folder: "." receivers: - stations-file: "../DATA/STATIONS" + stations: "../DATA/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml b/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml index 0e7816d36..cd54a12fa 100644 --- a/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml +++ b/tests/unit-tests/seismogram/acoustic/serial/specfem_config.yaml @@ -30,7 +30,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/seismogram/acoustic/serial/STATIONS" + stations: "../../../tests/unit-tests/seismogram/acoustic/serial/STATIONS" angle: 0.0 seismogram-type: - displacement diff --git a/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml b/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml index b69719ef4..32d193ed8 100644 --- a/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml +++ b/tests/unit-tests/seismogram/elastic/serial/specfem_config.yaml @@ -30,7 +30,7 @@ parameters: output-folder: "." receivers: - stations-file: "../../../tests/unit-tests/seismogram/elastic/serial/STATIONS" + stations: "../../../tests/unit-tests/seismogram/elastic/serial/STATIONS" angle: 0.0 seismogram-type: - displacement @@ -46,4 +46,5 @@ parameters: ## databases databases: mesh-database: "../../../tests/unit-tests/seismogram/elastic/serial/database.bin" - sources: "dummy-source.yaml" + + sources: "dummy-source.yaml" From 0c96a69720f36fcf7886df03a912946fe67b5ce2 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Fri, 17 Jan 2025 17:09:43 -0500 Subject: [PATCH 15/20] Fixed kernel example --- examples/Tromp_2005/CMakeFiles/Snakefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/Tromp_2005/CMakeFiles/Snakefile.in b/examples/Tromp_2005/CMakeFiles/Snakefile.in index bdf68ff05..33f32e9d7 100644 --- a/examples/Tromp_2005/CMakeFiles/Snakefile.in +++ b/examples/Tromp_2005/CMakeFiles/Snakefile.in @@ -56,7 +56,7 @@ rule forward_configuration: ## Add forward node to the simulation setup config["parameters"]["simulation-setup"].update(forward) - config["parameters"]["databases"]["sources"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/forward_source.yaml" + config["parameters"]["sources"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/forward_source.yaml" config["parameters"]["receivers"]["stations"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/STATIONS" config["parameters"]["databases"]["mesh-database"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/database.bin" @@ -158,7 +158,7 @@ rule adjoint_configuration: ## Add adjoint node to the simulation setup config["parameters"]["simulation-setup"].update(adjoint) - config["parameters"]["databases"]["sources"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/adjoint_source.yaml" + config["parameters"]["sources"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/adjoint_source.yaml" config["parameters"]["databases"]["mesh-database"] = "@CMAKE_SOURCE_DIR@/examples/Tromp_2005/OUTPUT_FILES/database.bin" with open(output.config, "w") as f: From 153407f6c3e70e615784cc2e37a3218dfb2a614f Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 21 Jan 2025 10:44:34 -0500 Subject: [PATCH 16/20] fixed the sources parameters documenation --- .../fluid-solid-interface/specfem_config.yaml.in | 4 +++- .../specfem_config.yaml.in | 4 +++- docs/parameter_documentation/databases.rst | 9 --------- docs/parameter_documentation/index.rst | 1 + docs/parameter_documentation/sources.rst | 15 +++++++++++++++ 5 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 docs/parameter_documentation/sources.rst diff --git a/docs/examples/fluid-solid-interface/specfem_config.yaml.in b/docs/examples/fluid-solid-interface/specfem_config.yaml.in index d15fa3f76..6120b92f3 100644 --- a/docs/examples/fluid-solid-interface/specfem_config.yaml.in +++ b/docs/examples/fluid-solid-interface/specfem_config.yaml.in @@ -43,7 +43,9 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/OUTPUT_FILES/database.bin" - sources: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" + + ## Sources + sources: "@CMAKE_SOURCE_DIR@/examples/fluid-solid-interface/sources.yaml" seismogram: seismogram-format: ascii diff --git a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in index 296718948..655f9fe7d 100644 --- a/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in +++ b/docs/examples/homogeneous-medium-flat-topography/specfem_config.yaml.in @@ -43,4 +43,6 @@ parameters: ## databases databases: mesh-database: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/OUTPUT_FILES/database.bin" - sources: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" + + ## Sources + sources: "@CMAKE_SOURCE_DIR@/examples/homogeneous-medium-flat-topography/source.yaml" diff --git a/docs/parameter_documentation/databases.rst b/docs/parameter_documentation/databases.rst index 52963f048..35ee27310 100644 --- a/docs/parameter_documentation/databases.rst +++ b/docs/parameter_documentation/databases.rst @@ -26,14 +26,6 @@ Parameter definitions **documentation**: Location of the fortran binary database file defining the mesh -**Parameter name** : ``databases.sources`` -****************************************************** - -**default value**: None - -**possible values**: [string] - -**documentation**: Location of source file (yaml) defining the location of sources .. admonition:: Example of databases section @@ -41,4 +33,3 @@ Parameter definitions databases: mesh-database: /path/to/mesh_database.bin - sources: /path/to/source_file.yaml diff --git a/docs/parameter_documentation/index.rst b/docs/parameter_documentation/index.rst index 2fe745d8e..ecac2253d 100644 --- a/docs/parameter_documentation/index.rst +++ b/docs/parameter_documentation/index.rst @@ -10,6 +10,7 @@ The run-time behaviour of the code is controlled by YAML parameter files. The pa header simulation_setup + sources receivers run_setup databases diff --git a/docs/parameter_documentation/sources.rst b/docs/parameter_documentation/sources.rst new file mode 100644 index 000000000..a74fd9eee --- /dev/null +++ b/docs/parameter_documentation/sources.rst @@ -0,0 +1,15 @@ +**Parameter name** : ``sources`` +****************************************************** + +**default value**: None + +**possible values**: [string] + +**documentation**: Location of source file (yaml) defining the location of sources + +.. admonition:: Example of databases section + + .. code-block:: yaml + + sources: + sources: path/to/sources.yaml From 450d15a784db652dcc6ba5deb3519e53251a6302 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 21 Jan 2025 11:17:36 -0500 Subject: [PATCH 17/20] Fixed inconsistent indentation of the meshfem2d CMakelists --- fortran/meshfem2d/CMakeLists.txt | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/fortran/meshfem2d/CMakeLists.txt b/fortran/meshfem2d/CMakeLists.txt index 0ae663fe3..766596de2 100644 --- a/fortran/meshfem2d/CMakeLists.txt +++ b/fortran/meshfem2d/CMakeLists.txt @@ -188,14 +188,14 @@ add_custom_target(compute_elements_load ALL ) set( meshfem2D_OBJECTS - determine_abs_surface.mesh.o - determine_acoustic_surface.mesh.o - get_node_number.mesh.o - repartition_coupling.mesh.o - rotate_mesh.mesh.o - save_databases.mesh.o - save_gnuplot_file.mesh.o - save_stations_file.mesh.o + determine_abs_surface.mesh.o + determine_acoustic_surface.mesh.o + get_node_number.mesh.o + repartition_coupling.mesh.o + rotate_mesh.mesh.o + save_databases.mesh.o + save_gnuplot_file.mesh.o + save_stations_file.mesh.o ) foreach(module_files ${meshfem2D_OBJECTS}) @@ -207,21 +207,21 @@ add_custom_target(meshfem_mesh ALL ) set( meshfem2D_PREPROCESSOR_OBJECTS - decompose_mesh.mesh.o - metis_partitioning.mesh.o - part_unstruct.mesh.o - read_external_mesh_files.mesh.o - read_mesh_files.mesh.o - scotch_partitioning.mesh.o - meshfem2D.mesh.o + decompose_mesh.mesh.o + metis_partitioning.mesh.o + part_unstruct.mesh.o + read_external_mesh_files.mesh.o + read_mesh_files.mesh.o + scotch_partitioning.mesh.o + meshfem2D.mesh.o ) foreach(module_files ${meshfem2D_PREPROCESSOR_OBJECTS}) - build_fortran_command_preprocess(${module_files} compute_elements_load) + build_fortran_command_preprocess(${module_files} compute_elements_load) endforeach() add_custom_target(mesh_mpi ALL - DEPENDS ${meshfem2D_PREPROCESSOR_OBJECTS} + DEPENDS ${meshfem2D_PREPROCESSOR_OBJECTS} ) set( MESHFEM_OBJECTS @@ -232,13 +232,13 @@ set( MESHFEM_OBJECTS ) add_custom_command( - OUTPUT meshfem2D - COMMAND ${CMAKE_Fortran_COMPILER} ${FCFLAGS_f90} -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xmeshfem2D ${MESHFEM_OBJECTS} ${MESHFEM_SHARED_OBJECTS} - DEPENDS ${MESHFEM_OBJECTS} ${MESHFEM_SHARED_OBJECTS} + OUTPUT meshfem2D + COMMAND ${CMAKE_Fortran_COMPILER} ${FCFLAGS_f90} -o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xmeshfem2D ${MESHFEM_OBJECTS} ${MESHFEM_SHARED_OBJECTS} + DEPENDS ${MESHFEM_OBJECTS} ${MESHFEM_SHARED_OBJECTS} ) add_custom_target(meshfem2D_exec ALL - DEPENDS meshfem2D + DEPENDS meshfem2D ) add_custom_target(xadj_seismogram ALL From 7b4429b937e04c4061ec124472e334cd5db38991 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 21 Jan 2025 15:06:09 -0500 Subject: [PATCH 18/20] Seismograms were only written until nt < nstep - 1 writing on to few steps --- include/compute/receivers/receivers.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/compute/receivers/receivers.hpp b/include/compute/receivers/receivers.hpp index 217f2694f..1a6b35443 100644 --- a/include/compute/receivers/receivers.hpp +++ b/include/compute/receivers/receivers.hpp @@ -185,9 +185,9 @@ class SeismogramIterator { } Iterator end() { - return Iterator(irec, iseis, max_sig_step - 1, dt, t0, - nstep_between_samples, h_sine_receiver_angle, - h_cosine_receiver_angle, h_seismogram_components); + return Iterator(irec, iseis, max_sig_step, dt, t0, nstep_between_samples, + h_sine_receiver_angle, h_cosine_receiver_angle, + h_seismogram_components); } /** From a92f9fb33d6d5458c0cca9df382013eb5532586e Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 21 Jan 2025 15:10:28 -0500 Subject: [PATCH 19/20] Anisotropic crystal example broken. Multiple receivers in one element. --- examples/anisotropic-crystal/CMakeFiles/Snakefile.in | 4 ++-- examples/fluid-solid-interface/Snakefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/anisotropic-crystal/CMakeFiles/Snakefile.in b/examples/anisotropic-crystal/CMakeFiles/Snakefile.in index a81f1ed8e..8b55ec3d7 100644 --- a/examples/anisotropic-crystal/CMakeFiles/Snakefile.in +++ b/examples/anisotropic-crystal/CMakeFiles/Snakefile.in @@ -30,7 +30,7 @@ rule run_solver: config="specfem_config.yaml", output: seismograms=expand( - "OUTPUT_FILES/results/{station_name}{network_name}{component}.semd", + "OUTPUT_FILES/results/{station_name}.{network_name}.S2.{component}.semd", station_name=[ "S0010", "S0020", @@ -59,7 +59,7 @@ rule run_solver: rule plot_seismogram: input: trace_files=expand( - "OUTPUT_FILES/results/{station_name}{network_name}{component}.semd", + "OUTPUT_FILES/results/{station_name}.{network_name}.S2.{component}.semd", station_name=[ "S0010", "S0020", diff --git a/examples/fluid-solid-interface/Snakefile b/examples/fluid-solid-interface/Snakefile index c10c447d2..7bde155bc 100644 --- a/examples/fluid-solid-interface/Snakefile +++ b/examples/fluid-solid-interface/Snakefile @@ -27,7 +27,7 @@ rule run_solver: database="OUTPUT_FILES/database.bin", stations="OUTPUT_FILES/STATIONS", source="sources.yaml", - config="forward_config.yaml", + config="specfem_config.yaml", output: seismograms=expand( "OUTPUT_FILES/results/{station_name}.{network_name}.S2.{component}.semd", From 83cb40530d6e0729b210baafd50681a5bbca8419 Mon Sep 17 00:00:00 2001 From: Lucas Sawade Date: Tue, 21 Jan 2025 15:14:13 -0500 Subject: [PATCH 20/20] Fixed remaining examples --- examples/fluid-solid-bathymetry/Snakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/fluid-solid-bathymetry/Snakefile b/examples/fluid-solid-bathymetry/Snakefile index 0a7bcc8a6..ed1a3e751 100644 --- a/examples/fluid-solid-bathymetry/Snakefile +++ b/examples/fluid-solid-bathymetry/Snakefile @@ -52,8 +52,8 @@ rule run_simulation: line_sources="line_sources.yaml", specfem_config="specfem_config.yaml", output: - pressure_siesmograms=expand( - "OUTPUT_FILES/results/{station_name}{network_name}{component}.semp", + pressure_seismograms=expand( + "OUTPUT_FILES/results/{station_name}.{network_name}.S2.{component}.semp", station_name=[ "S0001", "S0002", @@ -68,8 +68,8 @@ rule run_simulation: runtime=40, shell: """ - module purge - module load boost/1.73.0 + # module purge + # module load boost/1.73.0 mkdir -p OUTPUT_FILES/results mkdir -p OUTPUT_FILES/display echo "Hostname: $(hostname)" > output.log @@ -78,8 +78,8 @@ rule run_simulation: rule plot_seismogram: input: - pressure_siesmograms=expand( - "OUTPUT_FILES/results/{station_name}{network_name}{component}.semp", + pressure_seismograms=expand( + "OUTPUT_FILES/results/{station_name}.{network_name}.S2.{component}.semp", station_name=[ "S0001", "S0002",