Skip to content

Neutrals flux limiters#451

Open
malamast wants to merge 31 commits into
masterfrom
neutrals-flux-limmiters
Open

Neutrals flux limiters#451
malamast wants to merge 31 commits into
masterfrom
neutrals-flux-limmiters

Conversation

@malamast
Copy link
Copy Markdown
Contributor

@malamast malamast commented Dec 30, 2025

Just a few suggestions for neutral_mixed and other components:

  1. added a functionality to initialize n and p from grid variables.
  2. Changed the way we calculate the flux limiters and transport coefficients of neutrals. I separate the gradients for the flux limiters in parallel and perpendicular directions. They do something similar in uedge as well.
  3. Added the contribution of ion velocities to the neutral perpendicular velocity. This term comes for momentum sources in the derivation of the neutral perpendicular velocity. How can we generalize it here for multiple species?
  4. minor changes to zero_current and braginskii_collisions components.

MK edits:

I am taking the PR over from Malamas and finishing it. Tasks:

  • Changes from Malamas: separate limiters for parallel/perpendicular conductivity and viscosity, perpendicular ion velocity coupling, and so on
  • Change limiter formulation to AFN style
  • Add user settable limiters for each flux
  • Change free streaming velocities to AFN definition
  • Remove double-counting of neutral_lmax
  • Make perpendicular ion velocity coupling a user option
  • Test against historical SOLPS comparison results
  • Update 2D-Production test
  • Add flux limiter reconstruction to 2D-recycling and rename to 2D-reconstruct
  • Documentation

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 20.15504% with 103 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.27%. Comparing base (e0f1ebf) to head (07ea3b3).

Files with missing lines Patch % Lines
src/neutral_mixed.cxx 0.00% 86 Missing ⚠️
src/zero_current.cxx 44.44% 5 Missing ⚠️
include/fixed_density.hxx 50.00% 2 Missing and 1 partial ⚠️
src/evolve_density.cxx 50.00% 2 Missing and 1 partial ⚠️
src/evolve_pressure.cxx 62.50% 2 Missing and 1 partial ⚠️
src/isothermal.cxx 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #451      +/-   ##
==========================================
- Coverage   26.41%   26.27%   -0.15%     
==========================================
  Files          90       90              
  Lines        8105     8221     +116     
  Branches     1133     1146      +13     
==========================================
+ Hits         2141     2160      +19     
- Misses       5745     5836      +91     
- Partials      219      225       +6     

☔ View full report in Codecov by Sentry.
📢 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.

@mikekryjak
Copy link
Copy Markdown
Collaborator

Thanks for this @malamast. My own re-implementation of this (mikekryjak#15) has been hopelessly delayed by several conferences and an unrelated paper. These are now done so I will be moving onto this soon. I need to compare the performance of these limiters against my SOLPS and SOLEDGE2D results. I can also implement some unit tests.

@malamast
Copy link
Copy Markdown
Contributor Author

malamast commented Jan 7, 2026

Thanks for this @malamast. My own re-implementation of this (mikekryjak#15) has been hopelessly delayed by several conferences and an unrelated paper. These are now done so I will be moving onto this soon. I need to compare the performance of these limiters against my SOLPS and SOLEDGE2D results. I can also implement some unit tests.

Hi Mike. Sounds good. Sorry, I hadn't seen your pull request. Maybe we could try to merge the changes in the two PRs together.

@mikekryjak
Copy link
Copy Markdown
Collaborator

I'm happy to deal with it - I need this to finish my ST40 comparison and paper.

bendudson and others added 9 commits February 11, 2026 16:12
Added jacobian_persists option
…er density and pressure from grid variables with names varName_init.

fixed_density and isothermal: Added a functionality to read the fixed denstiy or temperature from grid variables with names varName_init
…mponents. This willbe needed in neutral_mixed for calculating the contribution of the ion velocity.
…perpendicular velocity to make it consistent with AFN models.
…the perpendicular and parallel directions. This is what they do in UEDGE as well.

-Added the contibution of ion velocities to the neural diffusion perpendicular velocity. This term comes form momentum source terms due to collisions of neutrals  with ions. See eq 20 amd 21 of Horsten 2017.
@mikekryjak mikekryjak force-pushed the neutrals-flux-limmiters branch from 07ea3b3 to 8f2081f Compare February 25, 2026 14:32
@mikekryjak
Copy link
Copy Markdown
Collaborator

Rebased to master. @malamast the answer changes a small bit because of #494.

I have made a backup of the branch before the rebase here just in case: https://github.com/mikekryjak/hermes-3/tree/neutrals-flux-limmiters-backup

@mikekryjak mikekryjak force-pushed the neutrals-flux-limmiters branch 2 times, most recently from d517a26 to 4bc4a46 Compare February 26, 2026 14:57
mikekryjak and others added 12 commits February 26, 2026 14:57
neutral_lmax was already used in Dnn, it shouldn't be also put into Dmax as this limits it twice! The flag enables legacy behaviour by default.
Left a flag for legacy behaviour.
This was boolean before. Now it's the numerical setting for the limiter.
With intuitive defaults.
Unlike the previous form, there is a sharpness setting. This is referred to as gamma in the AFN parlance.
@mikekryjak
Copy link
Copy Markdown
Collaborator

Changes:

  1. Replaced flux limiter formulation with a harmonic average with a sharpness setting as per the AFN. legacy form available via legacy_limiter_form = true (on by default)
  2. Implemented separate limiter alpha values for each flux. Perpendicular conductivity and viscosity default to the same as the advection limiter. Parallel conductivity and viscosity default to the same as perpendicular conductivity and viscosity.
  3. Corrected free streaming velocity definitions to be 1D flow in a 3D maxwellian. This means Vnth is multiplied by 0.4. Old formulations available via legacy_thermal_speed = true (on by default)
  4. neutral_lmax shouldn't be in both D and Dmax because this is double counting. Removed, but old behaviour available through double_count_lmax = true (on by default)
  5. Made the coupling with perpendicular ion velocity an optional setting (perp_ion_coupling, true by default)
  6. Refactored for clarity
  7. Formatting
    @malamast

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.

3 participants