Skip to content

Conversation

@int-ptr-ptr
Copy link
Collaborator

Description

(formerly #1259, this PR removes some history, since the "changed files" tab on GitHub was messed up)

Please describe the changes/features in this pull request.
- [ ] uncomments + populates NCI kernel from #1202
- [ ] closes dependencies for kernel implementation (#1256, #1257)

  • adds a test to verify, for conforming mesh(es), that the nonconforming and conforming kernel gives the same result when calling kernel.update_wavefields<...>().

Edit: This will only be the unit test.

Issue Number

If there is an issue created for these changes, link it here
closes #1258

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

@int-ptr-ptr int-ptr-ptr linked an issue Nov 1, 2025 that may be closed by this pull request
2 tasks
@int-ptr-ptr
Copy link
Collaborator Author

I do feel like this test could be difficult to understand, and might benefit from a rework (say issue #1226). Otherwise, it may be that #1226 is not necessary.

Copy link
Collaborator

@lsawade lsawade left a comment

Choose a reason for hiding this comment

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

I think the idea of this test is great. I'm not quite understanding though of the core part where you update the field. You

  • clear the fields (zero them out)
  • compute a single time step (update_wavefield), which
    • couples zero's (??)
    • adds some source term to the acceleration
    • computes some stiffness etc.

Meaning that in the end unless the source element is on the boundary you are not testing that a field is actually traversing the interface, but only that the source term is added in the same fashion in both kernels. Am I misunderstanding this?

@int-ptr-ptr
Copy link
Collaborator Author

int-ptr-ptr commented Nov 3, 2025

I think the idea of this test is great. I'm not quite understanding though of the core part where you update the field. You

* clear the fields (zero them out)

* compute a single time step (update_wavefield),  which
  
  * couples zero's (??)
  * adds some source term to the acceleration
  * computes some stiffness etc.

Meaning that in the end unless the source element is on the boundary you are not testing that a field is actually traversing the interface, but only that the source term is added in the same fashion in both kernels. Am I misunderstanding this?

There are no source terms added directly to the acceleration. The fields are cleared except for a single shape function. See the README.md for the test (already in the PR).

In essence, these are the lines that correspond to the displacement field setting. (also below for your convenience)

            for (const auto &[nc_iglob, inds] : nodes_to_check) {
              const auto &[nc_index, c_index] = inds;
              for (int icomp = 0; icomp < PointDisplacementType::components;
                   icomp++) {
                displacement(icomp) = 1;                            // <<< HERE
                // ===================================
                // (foreach degree of freedom i) then:
                // ===================================


                clear_field<specfem::point::acceleration>(nc_assembly);
                clear_field<specfem::point::acceleration>(c_assembly);


                specfem::assembly::store_on_host(nc_index, nc_field,
                                                 displacement);
                specfem::assembly::store_on_host(c_index, c_field,
                                                 displacement);

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add test for NCI kernel

2 participants