Skip to content

Mapped element - #109

Open
jacobmerson wants to merge 12 commits into
SCOREC:mainfrom
jacobmerson:mapped-element
Open

jacobmerson wants to merge 12 commits into
SCOREC:mainfrom
jacobmerson:mapped-element

Conversation

@jacobmerson

Copy link
Copy Markdown
Contributor

This PR is an alternative strategy to handle non isoparametric geometry. The mapping policies should be extensible to handle the Bell elements from M3DC1 and when we get to it, vector elements.

See discussion in #100. This is an alternative strategy to what @Sichao25 implemented in #99.

Note: this PR is based on changes in #108. If you merge that PR rather than rebase it, it'll make merging this PR much simpler.

jacobmerson and others added 5 commits October 11, 2026 13:24
To support non-isoparametic elements, we split the evaluation of the
nodal coefficients and the multiplication with the shape functions
MappedElement composes a field element with a geometry element over the
coordinate field (see SCOREC#100)
In the case of affine (straight sided) and isoparametric elements
we will want to take compile-time optimized code paths so the
performance of a MappedElement is similar to a base FieldElement
@jacobmerson

Copy link
Copy Markdown
Contributor Author

@cwsmith can you please take a look at this PR sometime this week? There are a number of ongoing activities that need this support for non-isoparametric elements.

@cwsmith cwsmith left a comment •

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.

I merged main, fixed some issues causing test failures, and then some very minor typos etc.

This looks good and should be ready to merge.

A few minor comments are below.

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.

should unit tests be added for this?

Comment thread src/MeshField.hpp


template <int dim, typename Element, typename CoordinateMap>
struct InterpolateElementFunctor

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 doesn't appear to be used anymore - can it be removed?

Comment thread src/MeshField_Element.hpp

/**
* @brief
* contract an element's coefficients with the basis at a parametric

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.

I think we should add 'contract' to the nomenclature (and, if so, other related tensor algebra terms), or replace its use with a verbose description.


/** @brief the geometry map is affine, so the Jacobian is constant over
* each element */
static constexpr bool IsAffine = decltype(GeomElem::shapeFn)::Order == 1;

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.

a bilinear quad and trilinear hex will be Order = 1 but their Jacobians are not constant (disclosure: claude tipped me off to this when checking the changes against docs/addingShapeFunctionsForOmegah.md) - it looks like this can be caught by also checking for simplicies via getTopology()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right...the xi*eta term.

MeshField::Real dvFromGrad = 0;
for (size_t j = 0; j < dim; ++j)
dvFromGrad += (posP[j] - posM[j]) / (2 * h) * g[j];
if (!(Kokkos::fabs(dvFromGrad - dv) <= 1e-7))

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.

can we use MeshField::Epsilon (1e-12) instead of 1e-7 here? If not, should we define a looser constant in MeshFields_Defines.hpp or would a smaller value of h help?

This branch was previously deployed

1 inactive deployment
asics — 18fd6970 Deployed Nov 3, 2026 by cwsmith via build_and_test #34
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