Skip to content

Ion viscosity permissions - #628

Open
malamast wants to merge 6 commits into
masterfrom
3/ion-viscosity-permissions
Open

Ion viscosity permissions#628
malamast wants to merge 6 commits into
masterfrom
3/ion-viscosity-permissions

Conversation

@malamast

Copy link
Copy Markdown
Contributor

WIP

  1. Fixed permissions. We need AA when bounce_frequency is enabled.
  2. Apply parallel BC for eta. We probably don't need the values of eta at the parallel guard cells. It depends on how the parallel operators are implemented.
  3. Applied a softFloor to collision frequency 1/nu as in head_conduction.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 26.92308% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.44%. Comparing base (a1c3ba3) to head (f45aea2).

Files with missing lines Patch % Lines
src/braginskii_ion_viscosity.cxx 26.92% 16 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #628      +/-   ##
==========================================
- Coverage   57.51%   57.44%   -0.08%     
==========================================
  Files          98       98              
  Lines       10239    10262      +23     
  Branches     1469     1478       +9     
==========================================
+ Hits         5889     5895       +6     
- Misses       3758     3772      +14     
- Partials      592      595       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

eta.applyBoundary("neumann");

// Note: We need parallel boundary conditions on eta
if (eta.hasParallelSlices()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't understand parallel slices well, but Claude tells me that this if statement is always going to be true since eta.getMesh()->communicate(eta) always calculates the parallel slices.

A similar BC in braginskii_conduction has a simpler implementation:

for (RangeIterator r = mesh->iterateBndryLowerY(); !r.isDone(); r++) {
for (int jz = 0; jz < mesh->LocalNz; jz++) {
auto i = indexAt(kappa_par, r.ind, mesh->ystart, jz);
auto im = i.ym();
kappa_par[im] = kappa_par[i];
}
}
for (RangeIterator r = mesh->iterateBndryUpperY(); !r.isDone(); r++) {
for (int jz = 0; jz < mesh->LocalNz; jz++) {
auto i = indexAt(kappa_par, r.ind, mesh->yend, jz);
auto ip = i.yp();
kappa_par[ip] = kappa_par[i];
}
}

@mikekryjak

Copy link
Copy Markdown
Collaborator

Hi @malamast! Thanks for this. I'm not an expert on viscosity but found a possible issue and left a comment. I have two other suggestions:

  • Can you change the name of the PR so that it mentions the fact this changes the ion viscosity parallel boundary condition? I think that is probably the most important change in this PR.
  • Now that eta is neumann, it is non-zero at the boundary, which means viscosity will now flow through the parallel boundary. Is this intended? If so, could you mention the reason in the PR description?
  • In braginskii_conduction we set kappa to Neumann but then disable conduction through the boundary by passing a bool to Div_par_k_Grad:

add(species["energy_source"],
Div_par_K_Grad_par_mod(kappa_par, T, flow_ylow_conduction, false));

{{"time_dimension", "t"},
{"units", "Pa s"},
{"conversion", Pnorm / Omega_ci},
{"long_name", std::string("Ion viscosity coefficient") + species_name},

@mikekryjak mikekryjak Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

For consistency with conduction:

Suggested change
{"long_name", std::string("Ion viscosity coefficient") + species_name},
{"long_name", species_name + std::string(" ion viscosity coefficient")},

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