Skip to content

VanAlbada and WENO3 slope limiters#3388

Merged
bendudson merged 4 commits into
nextfrom
more-limiters
Jun 11, 2026
Merged

VanAlbada and WENO3 slope limiters#3388
bendudson merged 4 commits into
nextfrom
more-limiters

Conversation

@bendudson

Copy link
Copy Markdown
Contributor

Smoother than MC, MinMod or SuperBee, hopefully improving solver convergence.

Smooth alternative to MC/MinMod/SuperBee that has a continuous
derivative. Hopefully improves nonlinear solver performance.

@github-actions github-actions Bot 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.

clang-tidy made some suggestions

Comment thread include/bout/fv_ops.hxx
const BoutReal dl = n.c - n.m;
const BoutReal dr = n.p - n.c;

const BoutReal denom = dl * dl + dr * dr;

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
const BoutReal denom = dl * dl + dr * dr;
p - n.c;()

Comment thread include/bout/fv_ops.hxx

const BoutReal denom = dl * dl + dr * dr;

// Smoothness parameters:

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
// Smoothness parameters:
(dr * dr);

Comment thread include/bout/fv_ops.hxx
// - keep division well-defined when dl=dr=0
// - provide a differentiable approximation to max(dl*dr, 0)
const BoutReal eps = 1e-12 * denom + 1e-30;

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
dl*dr, 0)
+ 1e-30;()

Comment thread include/bout/fv_ops.hxx
const BoutReal eps = 1e-12 * denom + 1e-30;

const BoutReal ab = dl * dr;
const BoutReal ab_pos = 0.5 * (ab + sqrt(ab * ab + eps * eps));

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
const BoutReal ab_pos = 0.5 * (ab + sqrt(ab * ab + eps * eps));
dl * dr;(

include/bout/fv_ops.hxx:203:

- * eps));
+ * eps)));

Comment thread include/bout/fv_ops.hxx
const BoutReal eps = 1e-12 * denom + 1e-30;

const BoutReal ab = dl * dr;
const BoutReal ab_pos = 0.5 * (ab + sqrt(ab * ab + eps * eps));

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
const BoutReal ab_pos = 0.5 * (ab + sqrt(ab * ab + eps * eps));
dl * dr;()

Comment thread include/bout/fv_ops.hxx

// Smoothness parameter (scaled to local variation)
const BoutReal eps = 1e-12 * (beta0_r + beta1_r) + 1e-30;

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
ariation)
+ 1e-30;()

Comment thread include/bout/fv_ops.hxx
const BoutReal w0_l = a0_l / wsum_l;
const BoutReal w1_l = a1_l / wsum_l;

n.R = w0_r * p0_r + w1_r * p1_r;

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
n.R = w0_r * p0_r + w1_r * p1_r;
wsum_l;()

Comment thread include/bout/fv_ops.hxx
const BoutReal w1_l = a1_l / wsum_l;

n.R = w0_r * p0_r + w1_r * p1_r;
n.L = w0_l * p0_l + w1_l * p1_l;

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
n.L = w0_l * p0_l + w1_l * p1_l;
wsum_l;
r * p1_r;()

Comment thread include/bout/fv_ops.hxx
const BoutReal w1_l = a1_l / wsum_l;

n.R = w0_r * p0_r + w1_r * p1_r;
n.L = w0_l * p0_l + w1_l * p1_l;

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
n.L = w0_l * p0_l + w1_l * p1_l;
r * p1_r;(

include/bout/fv_ops.hxx:265:

- ;
+ );

Comment thread include/bout/fv_ops.hxx
const BoutReal w1_l = a1_l / wsum_l;

n.R = w0_r * p0_r + w1_r * p1_r;
n.L = w0_l * p0_l + w1_l * p1_l;

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.

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
n.L = w0_l * p0_l + w1_l * p1_l;
r * p1_r;()

@bendudson bendudson merged commit c7020b4 into next Jun 11, 2026
23 checks passed
@bendudson bendudson deleted the more-limiters branch June 11, 2026 21:31
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