Skip to content

Enclosure cylindrical - #1277

Open
hhy2022 wants to merge 2 commits into
festim-dev:mainfrom
hhy2022:enclosure-cylindrical
Open

hhy2022 wants to merge 2 commits into
festim-dev:mainfrom
hhy2022:enclosure-cylindrical

Conversation

@hhy2022

@hhy2022 hhy2022 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Description

Summary

Gas enclosures can now be used on cylindrical and spherical meshes. The surface term of the pressure balance is multiplied by CoordinateSystem.integration_weight (added in #1264), and the NotImplementedError raised for non-cartesian meshes is removed.

The value given for each surface in Enclosure.surfaces is the extent that the mesh and coordinate system cannot provide:

Coordinate system Mesh Value to give
cartesian 1D area (m2), required
cartesian 2D out-of-plane depth (m), required
cylindrical 1D axial length (m), required
cartesian 3D, cylindrical 2D, spherical 1D nothing, a plain list is accepted

Cartesian behaviour is unchanged.

Related Issues

Fixes #1271

Motivation and Context

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🔨 Code refactoring (no functional changes, no API changes)
  • 📝 Documentation update
  • ✅ Test update (adding missing tests or correcting existing tests)
  • 🔧 Build/CI configuration change

Testing

  • All existing tests pass locally (pytest)
  • I have added new tests that prove my fix is effective or that my feature works

Code Quality Checklist

  • My code follows the code style of this project (Ruff formatted: ruff format .)
  • My code passes linting checks (ruff check .)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

Documentation

  • I have updated the documentation accordingly (if applicable)
  • I have added docstrings to new functions/classes following the project conventions

Breaking Changes

Screenshots/Examples

Additional Notes

Known limitation, not addressed here. With a weakly enforced HenrysBC / SievertsBC coupled to an enclosure, conservation is exact in cartesian but only approximate on non-cartesian meshes (1D, 60 cells):

Henry Sieverts
cartesian 2.6e-11 1.1e-16
cylindrical 3.7e-06 4.4e-07
spherical 1.7e-04 2.4e-05

The drift comes from the symmetry term of the Nitsche formulation in dirichlet_bc.py, which uses grad(v). Replacing it with r * grad(v / r) in a local experiment restored exact conservation in cylindrical. This affects every weakly enforced Dirichlet BC on non-cartesian meshes, not only enclosures.

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.07%. Comparing base (43d5018) to head (7af04f0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1277      +/-   ##
==========================================
+ Coverage   96.05%   96.07%   +0.01%     
==========================================
  Files          57       57              
  Lines        5069     5068       -1     
==========================================
  Hits         4869     4869              
+ Misses        200      199       -1     
Flag Coverage Δ
dolfinx-v0.11.0 95.93% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@RemDelaporteMathurin RemDelaporteMathurin mentioned this pull request Oct 5, 2026

@RemDelaporteMathurin RemDelaporteMathurin 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 for this @hhy2022, do you plan to do more with this?

@hhy2022

hhy2022 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I was planning to also fix the issue with the weakly enforced HenrysBC / SievertsBC mentioned in the additional notes. Since it's a separate issue and you've already opened an issue for it, I will address that in a separate PR instead.
This PR should be ready for review now.

@hhy2022
hhy2022 marked this pull request as ready for review October 5, 2026 15:37
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.

Support cylindrical meshes in the gas enclosure

2 participants