Skip to content

MLNodeLaplacian: route mknewu through anisotropic sigma path#5380

Merged
drummerdoc merged 10 commits intoAMReX-Codes:developmentfrom
drummerdoc:nodal-mknewu-ha
May 1, 2026
Merged

MLNodeLaplacian: route mknewu through anisotropic sigma path#5380
drummerdoc merged 10 commits intoAMReX-Codes:developmentfrom
drummerdoc:nodal-mknewu-ha

Conversation

@drummerdoc
Copy link
Copy Markdown
Member

Summary

When setMapped(true) is used, MLNodeLaplacian stores sigma with AMREX_SPACEDIM components so each velocity/flux direction can carry its own diffusivity. However, MLNodeLaplacian::updateVelocity and MLNodeLaplacian::getFluxes both read only m_sigma[amrlev][0][0] (sigma_x) and applied it to every velocity component, leaving the caller with

u_i = u_entry - sigma_x * (grad phi)_i

instead of the correct per-component

u_i = u_entry - sigma_i * (grad phi)_i

Add mlndlap_mknewu_ha (2D and 3D) as an anisotropic-sigma sibling of mlndlap_mknewu, and route both updateVelocity and getFluxes through it when m_use_mapped is true. 2D preserves the RZ axial correction. EB is intentionally left on the scalar sigma_x path: producing mlndlap_mknewu_eb_ha is a separate task and no in-tree consumer needs it today.

Downstream codes can detect the fix via the new feature macro AMREX_MLNODELAP_HAS_MKNEWU_HA in AMReX_MLNodeLaplacian.H.

Additional background

This was recognized and fixed as part of an effort to add mapped grids into PeleLMeX - PR coming soon.

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

When setMapped(true) is used, MLNodeLaplacian stores sigma with
AMREX_SPACEDIM components so each velocity/flux direction can carry
its own diffusivity.  However, MLNodeLaplacian::updateVelocity and
MLNodeLaplacian::getFluxes both read only m_sigma[amrlev][0][0]
(sigma_x) and applied it to every velocity component, leaving the
caller with

    u_i = u_entry - sigma_x * (grad phi)_i

instead of the correct per-component

    u_i = u_entry - sigma_i * (grad phi)_i

Add mlndlap_mknewu_ha (2D and 3D) as an anisotropic-sigma sibling of
mlndlap_mknewu, and route both updateVelocity and getFluxes through
it when m_use_mapped is true.  2D preserves the RZ axial correction.
EB is intentionally left on the scalar sigma_x path: producing
mlndlap_mknewu_eb_ha is a separate task and no in-tree consumer needs
it today.

Downstream codes can detect the fix via the new feature macro
AMREX_MLNODELAP_HAS_MKNEWU_HA in AMReX_MLNodeLaplacian.H.
@drummerdoc drummerdoc enabled auto-merge (squash) April 30, 2026 20:22
@drummerdoc drummerdoc merged commit ff47211 into AMReX-Codes:development May 1, 2026
73 checks passed
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