Skip to content

Conversation

@lsawade
Copy link
Collaborator

@lsawade lsawade commented Oct 16, 2025

Description

... now we just need to figure out whether it's garbage

  • core/assembly/boundaries/dim3 — NEEDS FIXING
  • core/assembly/boundary_values/dim3 — Probably NEEDS FIXING
  • core/assembly/jacobian_matrix/dim3 — Probably NEEDS FIXING
  • core/Point/stress::operator() — New
  • core/periodic_tasks/ — dimension templated, but 3d not implemented yet
  • include/algorithm/interpolate — NEEDS FIXING
  • include/parameter_parser/setup — dimension independent
  • include/parameter_parser/solver — dimension independent
  • src/specfem3d — Updated

Uses: #1292 so that will need updating down the line

Issue Number

Not a specific number...

Checklist

Please make sure to check developer documentation on specfem docs.

  • I ran the code through pre-commit to check style
  • THE DOCUMENTATION BUILDS WITHOUT WARNINGS/ERRORS
  • I have added labels to the PR (see right hand side of the PR page)
  • My code passes all the integration tests
  • I have added sufficient unittests to test my changes
  • I have added/updated documentation for the changes I am proposing
  • I have updated CMakeLists to ensure my code builds
  • My code builds across all platforms

@lsawade lsawade added the enhancement New feature or request label Oct 16, 2025
@lsawade lsawade requested a review from icui October 16, 2025 01:38
@lsawade lsawade changed the base branch from devel to issue-1275 October 16, 2025 01:38
@lsawade lsawade mentioned this pull request Oct 16, 2025
8 tasks
@lsawade lsawade linked an issue Oct 16, 2025 that may be closed by this pull request
1 task
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper function looks like its dimension independent. Should it be a single implementaiton for 2D/3D?

#include "boundaries/dim2/boundaries.tpp"
#include "boundaries/dim2/impl/acoustic_free_surface.tpp"
#include "boundaries/dim2/impl/stacey.tpp"
// TODO: Implement dim3 boundaries - requires adapting to different mesh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO: Implement dim3 boundaries - requires adapting to different mesh
// TODO(Lucas : DIM3_BOUNDARIES_UPDATE): Implement dim3 boundaries - requires adapting to different mesh

Just to make it easier to grep

Comment on lines 38 to 53
template <typename MappingType, typename IndexType>
KOKKOS_FORCEINLINE_FUNCTION
std::enable_if_t<IndexType::dimension_tag == specfem::dimension::type::dim2,
std::size_t>
get_flat_index(const MappingType &mapping, const IndexType &index) {
return mapping(index.ispec, index.iz, index.ix);
}

// Helper function to get flat index from mapping for dim3
template <typename MappingType, typename IndexType>
KOKKOS_FORCEINLINE_FUNCTION
std::enable_if_t<IndexType::dimension_tag == specfem::dimension::type::dim3,
std::size_t>
get_flat_index(const MappingType &mapping, const IndexType &index) {
return mapping(index.ispec, index.iz, index.iy, index.ix);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be inside an impl namespace.

Base automatically changed from issue-1275 to devel October 20, 2025 13:07
lsawade and others added 20 commits October 20, 2025 09:55
…ent. Updated locate point to match the specfem3d algo. Updated t0 update in specfem3d
- fixes jacobian reading and population
- fixes wrong use of index in the gradient calculation
- Updates source stations and specfem_config to fully match the fortran simulation
- updates plot_seismograms and includes reference seismograms
also:
- fixes issue related to local running of snakemakes that was introduced with
  the nightly benchmarks
- UPDATES UV.LOCK which should have been updated in Kentaro's PR for gmeshlayer builder
Issue 1289 - Implements 3D VTK writing.
commit ba84272ec61d28be7eca5eefb41494a655f0c989
Author: Lucas Sawade <[email protected]>
Date:   Thu Oct 30 14:34:17 2025 -0400

    Updated the Mesh generation to be <100MB

commit 7cd4035191ffdb82ce770c812d3d36b7cc31ddd5
Author: Lucas Sawade <[email protected]>
Date:   Wed Oct 29 17:16:24 2025 -0400

    This moves channel file generator from utilities to
    io/seismogram/impl

    note that in newmark_tests.cpp I'm explicitly creating one since
    writer output directory and trace reader directory are not necessarily
    the same.

    The alternativ is static_casting the writer to seismogram_writer and
    making the writer output directory the same as the reference trace directory.

    Either way writer now inherits from the channelgenerator making file naming in
    the writer easier.

commit 2abbdeb8e66a516cc8533f50501d19bede30bff5
Author: Lucas Sawade <[email protected]>
Date:   Wed Oct 29 14:42:33 2025 -0400

    This commit does a bunch of things to make the first 3D displacement test pass

    - [x] Enables reading of seismograms
    - [x] Creates a new set of functions
      - get_band_code to use the timestep interval to figure out the FDSN seismometer band code
      - get_channel_code defines the channel to from component and timestep (0.011, 'X') -> 'BXX'
      - get_file_extension -> uses wavefield::type to return, e.g. `semd` for displacement
      - get_seismogram_file_names which combines output_directory, network, and station with
        the above three to return a vector of appropriate filenames.
    - [x] Update the mesh/source-station geometry and hence traces to minimize the simulation time
          yet still have an ok simulation without reflections
@Rohit-Kakodkar Rohit-Kakodkar self-requested a review October 31, 2025 13:04
Copy link
Collaborator

@Rohit-Kakodkar Rohit-Kakodkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple of TODO tags, that can be addressed soonish

Comment on lines 45 to 49
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
// TODO(Rohit : DIM3_SIMD) Enable simd implementation for dim3 solver
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif

Comment on lines 70 to 74
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
// TODO(Rohit : DIM3_SIMD) Enable simd execution for dim3 solver
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif

Comment on lines 23 to 27
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
// TODO(Rohit : DIM3_SIMD)
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif

Comment on lines 23 to 27
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
constexpr bool using_simd = true;
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif
#if defined(KOKKOS_ENABLE_CUDA) || defined(KOKKOS_ENABLE_HIP)
constexpr bool using_simd = false;
#else
// TODO (Rohit : DIM3_SIMD)
constexpr bool using_simd = (DimensionTag == specfem::dimension::type::dim2) ? true : false;
#endif

#include "enumerations/medium.hpp"
#include <boost/preprocessor.hpp>

namespace specfem::medium::impl {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a look at this merge conflict coming from PR #1329

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dimension template or Assembly template periodic_tasks

3 participants