Skip to content

Bug: Coarsening+Viscosity - #397

Open
glesur wants to merge 2 commits into
developfrom
fixViscosityCoarsening
Open

Bug: Coarsening+Viscosity#397
glesur wants to merge 2 commits into
developfrom
fixViscosityCoarsening

Conversation

@glesur

@glesur glesur commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

fix the computation of velocity gradients in the viscosity module when coarsening is enabled.

@glesur
glesur requested review from svalat and a lite review from Copilot August 12, 2026 08:26
@glesur glesur added the bug Something isn't working label Aug 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes viscous velocity-gradient computations when grid coarsening is enabled by applying coarsening-aware effective cell spacing before forming derivatives/stress terms.

Changes:

  • Introduce per-cell effective dx1/dx2/dx3 in Viscosity::AddViscousFlux and scale them by the local coarsening factor.
  • Use the corrected spacings consistently across IDIR/JDIR/KDIR sweeps for gradient, divergence, and stress-tensor terms.
Suppressed comments (1)

src/fluid/viscosity.cpp:464

  • dx3 is computed unconditionally but only used when DIMENSIONS == 3 in this sweep. In 2D builds this can produce an unused-variable warning. Mark it [[maybe_unused]] to keep builds warning-clean.
      real dx1 = dx1Array(i);
      real dx2 = dx2Array(j);
      real dx3 = dx3Array(k);

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/fluid/viscosity.cpp
Comment on lines +213 to +215
real dx1 = dx1Array(i);
real dx2 = dx2Array(j);
real dx3 = dx3Array(k);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants