Skip to content

Add corrected and limitedCorrected faceNormalGradient schemes#477

Draft
HendriceH wants to merge 2 commits into
developfrom
feat/snGradLimitedCorrected
Draft

Add corrected and limitedCorrected faceNormalGradient schemes#477
HendriceH wants to merge 2 commits into
developfrom
feat/snGradLimitedCorrected

Conversation

@HendriceH
Copy link
Copy Markdown
Collaborator

Implement non-orthogonality correction for surface normal gradients:

  • Rename updateNonOrthDeltaCoeffs(Vec3) to updateNonOrthCorrectionVec3s in GeometrySchemeFactory and BasicGeometryScheme to match its actual purpose, and implement the correction vector computation: corrVec[f] = n̂ - delta * nonOrthDeltaCoeff

  • Add corrected scheme: snGrad = nonOrthDeltaCoeff*(phi_N - phi_O)

    • corrVec · (w*grad(phi)_O + (1-w)*grad(phi)_N)
  • Add limitedCorrected scheme: same as corrected but with a limiter that bounds the correction relative to the orthogonal part. Accepts limitCoeff from TokenList or Dictionary (default 0.333).

  • Both schemes use a fused single kernel per face group and reuse GaussGreenGrad for cell-centred gradient computation.

  • Add unit tests on a 1D uniform mesh (orthogonal, corrVec=0) verifying that corrected and limitedCorrected reduce to uncorrected.

@github-actions
Copy link
Copy Markdown

Thank you for your PR, here are some useful tips:

Implement non-orthogonality correction for surface normal gradients:

- Rename updateNonOrthDeltaCoeffs(Vec3) to updateNonOrthCorrectionVec3s
  in GeometrySchemeFactory and BasicGeometryScheme to match its actual
  purpose, and implement the correction vector computation:
  corrVec[f] = n̂ - delta * nonOrthDeltaCoeff

- Add corrected scheme: snGrad = nonOrthDeltaCoeff*(phi_N - phi_O)
  + corrVec · (w*grad(phi)_O + (1-w)*grad(phi)_N)

- Add limitedCorrected scheme: same as corrected but with a limiter
  that bounds the correction relative to the orthogonal part.
  Accepts limitCoeff from TokenList or Dictionary (default 0.333).

- Both schemes use a fused single kernel per face group and reuse
  GaussGreenGrad for cell-centred gradient computation.

- Add unit tests on a 1D uniform mesh (orthogonal, corrVec=0) verifying
  that corrected and limitedCorrected reduce to uncorrected.
Expose hasImplicitCorrection()/implicitCorrection() virtual interface on
FaceNormalGradientFactory so corrected and limitedCorrected schemes can
contribute a deferred correction term to the implicit Laplacian RHS.

- faceNormalGradient.hpp: add default-false hasImplicitCorrection() and
  default no-op implicitCorrection() virtuals; add forwarders on wrapper
- corrected.hpp/cpp: override to return true; add computeCorrectionTerm
  free function (corrVec · interpGrad per internal face, zero on boundary)
- limitedCorrected.hpp/cpp: same; add computeLimitedCorrectionTerm with
  limiter = min(lc*|ortho| / ((1-lc)*|corr| + ROOTVSMALL), 1)
- gaussGreenLaplacian.cpp: after matrix assembly, call implicitCorrection
  and accumulate corrFlux = corrTerm * gamma * |Sf| onto RHS owner/neighbour
@HendriceH HendriceH force-pushed the feat/snGradLimitedCorrected branch from 6f466ff to bf9d5fa Compare April 30, 2026 09:47
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.

1 participant