Skip to content

Fixups for compiling with 3D metrics - #586

Merged
bendudson merged 85 commits into
compile-3dmetricfrom
compile-3dmetric-clean
Jul 3, 2026
Merged

Fixups for compiling with 3D metrics#586
bendudson merged 85 commits into
compile-3dmetricfrom
compile-3dmetric-clean

Conversation

@dschwoerer

Copy link
Copy Markdown
Collaborator

No description provided.

bendudson and others added 30 commits June 11, 2026 16:46
Comparing three implementations, selected by constexpr setting for now
- Original method, interpolating all factors to cell edge
- SOLPS-inspired method, interpolating (KJ) to cell edges
- Harmonic average rather than geometric mean

Once tested, all except one method should be removed
Changes to boundary regions require changes to fake_mesh in the unit
tests.
Smooth slope limiters for a happier solver (hopefully).
Dataset.hermes.extract_[12]_tokamak_geometry() calls now result in an
error:
```
Traceback (most recent call last):
  File "/home/runner/work/hermes-3/hermes-3/build/tests/integrated/2D-recycling/runtest", line 144, in <module>
    ds = ds.hermes.extract_2d_tokamak_geometry()
  File "/home/runner/.local/lib/python3.10/site-packages/xhermes/accessors.py", line 172, in extract_2d_tokamak_geometry
    raise Exception(
Exception: extract_2d_tokamak_geometry was called twice! Note: this is now done automatically upon loading
```
Still fails, now with difference in solution
Parallel heat conduction discretisation method used in
`Div_par_K_Grad_par_mod`

- `Original`: Separately average `K`, `J`, `g_22` and `dy` at cell
  edge then multiply. Seems to be the worst option.

- `ProductJK`: Average the product `J * K` but otherwise the same as
  `Original`

- `Harmonic`: Use harmonic average of `K * J / (g_22 * dy)`. This is
  the most correct in representing the conductivity of two half-cells.

The default is still `Original` to allow time for testing.
Adds descriptions of the slope limiter and conduction method choices.
This function changed behavior in BOUT++ PR
3308 (boutproject/BOUT-dev#3308 , New
Y-Boundaries for unified sheath code).
Region selections changed with latest xhermes version.
Attempt to fix dangling reference warnings
Makes the script also executable from outside CI
abs is for integers (from C)
std::abs is for anything (from C++)
bendudson and others added 20 commits June 25, 2026 20:45
Contains:
- Fix for uninitialised dt in SNES
- PETSc preconditioner for CVODE
- BinaryExpr performance improvements
…encies

Update Python test dependency SHAs
…encies

Update Python test dependency SHAs
* Remove enable_c.patch

* Fix formatting error
actions/checkout defaulted to this repository, so it failed to find the
PR's head branch when the PR was opened from a fork (e.g. #232). Explicitly
checkout the PR's head repository.
After switching the format-command checkout to the PR head repo (which
may be a fork), `origin/<base>` no longer resolves reliably, so prek
fell back to scanning every file in the repo. Fetch the base repo's
branch explicitly and diff against the merge-base so prek only checks
files changed by the PR.
CI: scope clang-format check to PR files for fork PRs
@dschwoerer

Copy link
Copy Markdown
Collaborator Author

This is based on #577 and also includes #585 to allow working with the latest BOUT++ branch.

Note that this uses BOUT++ from boutproject/BOUT-dev#3335 to have the ported fv operators.

@dschwoerer

Copy link
Copy Markdown
Collaborator Author

@bendudson if you do not object within the next days, I am going to merge this into your branch.

@bendudson bendudson left a comment

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.

Thanks @dschwoerer !

@bendudson
bendudson merged commit 2687d1a into compile-3dmetric Jul 3, 2026
7 checks passed
@bendudson
bendudson deleted the compile-3dmetric-clean branch July 3, 2026 22:33
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.

5 participants