Skip to content

Conservative transfer 3D - #350

Open
jacobmerson wants to merge 23 commits into
SCOREC:developfrom
jacobmerson:conservative-transfer-3D
Open

Conservative transfer 3D#350
jacobmerson wants to merge 23 commits into
SCOREC:developfrom
jacobmerson:conservative-transfer-3D

Conversation

@jacobmerson

Copy link
Copy Markdown
Collaborator

No description provided.

Generalize the intersection-based and Monte Carlo transfer machinery
from 2D triangles to linear simplices in both 2D and 3D:

  - get_vert_coords_of_elem and adjBasedIntersectSearch are templated on
    the spatial dimension and gather Dim+1 vertices per element
  - the form integrator utilities compute reference-element mappings,
    barycentric coordinates and quadrature on triangles or tetrahedra
  - MassMatrixIntegrator sizes its element blocks from
    FieldElement::MeshEntDim + 1 rather than a hard coded 3, and
    integrates against the unsigned volume element so tets with negative
    orientation contribute positively
  - the MC RHS integrator carries the number of barycentric DOFs per
    sample instead of assuming 3

The BFS ring buffers in queue_visited.hpp are enlarged for 3D, where a
target tet can overlap many more source elements than a triangle, and
their capacities are now exposed as the PCMS_INTERSECTION_QUEUE_SIZE and
PCMS_INTERSECTION_TRACK_SIZE cache variables so device builds can lower
the per-thread stack footprint.
Cover the tetrahedral paths added to the transfer machinery:

  - test_omega_h_3d_conservative_projection.cpp exercises conservative
    L2 projection between 3D tet meshes and checks that the integral of
    the field is preserved
  - test_omega_h_form_integrator_utils.cpp unit tests the reference
    mapping and barycentric helpers in 2D and 3D
  - test_intersections.cpp is updated for the dimension-templated
    intersection search

Both new tests use the shared helpers in field_test_utils.h.
@abhiyanpaudel

Copy link
Copy Markdown
Collaborator

It looks good to me. I have updated it with an additional 3D test case.

CHKERRABORT(PETSC_COMM_WORLD, ierr);
ierr = KSPSetFromOptions(ksp_);
CHKERRABORT(PETSC_COMM_WORLD, ierr);
ierr = KSPSetTolerances(ksp_, 1e-14, 1e-14, PETSC_DEFAULT, PETSC_DEFAULT);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@abhiyan123 why are you hardcoding tolerances instead of using the defaults / passing options?

@jacobmerson

Copy link
Copy Markdown
Collaborator Author

Something strange happened with the merge/rebase @abhiyan123 . Let me see if I can resolve that so we don't have so many unrelated changes...

@jacobmerson

Copy link
Copy Markdown
Collaborator Author

This has some work to deal with the merge with develop due to the meshfields 1.0 transition.

…nsfer-3D

# Conflicts:
#	src/pcms/transfer/omega_h_form_integrator_utils.hpp
#	src/pcms/transfer/omega_h_mass_integrator.cpp
@jacobmerson
jacobmerson marked this pull request as ready for review August 17, 2026 06:37
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.

3 participants