Skip to content

Add Wedge topology and LinearWedgeShape - #113

Open
abhiyanpaudel wants to merge 14 commits into
SCOREC:mainfrom
abhiyanpaudel:linear-wedge
Open

abhiyanpaudel wants to merge 14 commits into
SCOREC:mainfrom
abhiyanpaudel:linear-wedge

Conversation

@abhiyanpaudel

@abhiyanpaudel abhiyanpaudel commented Oct 14, 2026 •

Copy link
Copy Markdown

Summary

Adds the Wedge topology and a linear wedge (triangular prism) shape function, as the first step toward wedge elements for field-aligned coupling applications. The basis is linear in the triangle coordinates and linear in zeta (tensor product, six nodes).

Changes

  • src/MeshField_Defines.hpp: add Wedge to Mesh_Topology
  • src/MeshField_ShapeField.hpp: add numWedge to MeshInfo
  • src/MeshField_Shape.hpp: add LinearWedgeShape, following Zienkiewicz, Taylor & Zhu, The Finite Element Method, 7th ed., Section 6.4, Fig. 6.16a
  • test/testLinearWedgeShape.cpp (new): Kronecker delta, partition of unity, reproduction of a function in span{1, $\xi_0, \xi_1, \zeta, \xi_0\zeta, \xi_1\zeta$}, and gradients checked by central differences
  • test/testLinearWedgeElement.cpp (new): FieldElement evaluate, Jacobian and determinant on a right prism and a skewed wedge, checked against the hand-derived map
  • CMakeLists.txt: register the two tests

Add Wedge to Mesh_Topology and numWedge to MeshInfo for wedge
(triangular prism) elements. Wedge is appended after Pyramid so no
existing enum value changes; Prism and numPrism are unchanged.
LinearWedgeShape is the linear wedge (triangular prism): the tensor
product of the linear triangle in (xi0, xi1) and the linear edge in
zeta in [-1, 1]. Nodes 0-2 are the triangle vertices at zeta = -1 and
nodes 3-5 those at zeta = +1, following Zienkiewicz, Taylor and Zhu,
Section 6.4, Fig. 6.16a.

test/testWedgeShape.cpp checks the Kronecker delta property at the
nodes and, at interior points, partition of unity, reproduction of
the bilinear functions spanned by the basis and their gradients, and
the analytic gradients against finite differences.

test/testWedgeElement.cpp builds a FieldElement from a coordinate
field, LinearWedgeShape and a small wedge-to-vertex map, and checks
MeshField::evaluate, getJacobians and getJacobianDeterminants on a
right prism and a skewed wedge against the geometric map written out
by hand.
Comment thread src/MeshField_Shape.hpp
Comment on lines +581 to +585
* Shape functions and ordering from:
* Zienkiewicz, Taylor, and Zhu
* 'The Finite Element Method: Its Basis and Fundamentals', 2013, Section 6.4,
* Fig. 6.16a: \f$N_a = \frac{1}{2} L_a (1 + \zeta_a \zeta)\f$, with
* \f$\zeta_a = -1\f$ for nodes 0-2 and \f$+1\f$ for nodes 3-5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you review this book?

Comment thread src/MeshField_Shape.hpp
Comment on lines +589 to +590
static const size_t numNodes = 6; ///< Number of nodes (6 for linear wedge)
static const size_t meshEntDim = 3; ///< Mesh entity dimension (3D)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why are these const but not constexpr?

using MeshField::Real;
using Shape = MeshField::LinearWedgeShape;

KOKKOS_INLINE_FUNCTION bool isClose(Real a, Real b, Real tol) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this sort of utility should be in a utility header.

Comment on lines +25 to +27
bool isClose(Real a, Real b) {
return Omega_h::are_close(a, b, 1e-12, 1e-12);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a repeat of the same function you added previously..., but now you hardcoded the tolerances. Make sure you move it to a utility header. Also, tolerances should be based on the MeshFIeld config tolerances.

This branch has not been deployed

No deployments
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.

2 participants