Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1289 +/- ##
=======================================
Coverage 96.14% 96.15%
=======================================
Files 57 57
Lines 5165 5177 +12
=======================================
+ Hits 4966 4978 +12
Misses 199 199
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Not quite sure I understand what the Nitsche method cannot be fixed in spherical too here. @jorgensd any pointer? |
|
The Nitsche term is fixed in spherical too. The drift that remains doesn't come from the BC but from the bulk formulation with P1 elements ( FESTIM writes the spherical diffusion term as With P2 elements (
2.77e-11 is the same level as cartesian (2.59e-11), set by the solver tolerance. Making spherical exact with P1 would need the formulation written the other way, Side note: to run the P2 case I had to pass |
Description
Summary
The symmetry term of weakly enforced Dirichlet BCs (Nitsche) is now written like the bulk diffusion term in cylindrical and spherical coordinates:
n·grad(v)n·grad(v)(unchanged)n·grad(v)r n·grad(v / r)n·grad(v)r**2 n·grad(v / r**2)This follows the diffusion term in
HydrogenTransportProblem.create_formulationandfestim.drift.drift_form.DirichletBCBase.weak_formulationtakes a newcoordinate_systemargument (default cartesian), passed by bothHydrogenTransportProblemandHydrogenTransportProblemDiscontinuous.Related Issues
Fixes #1278
-m c v·grad(w/m)instead of-c v·grad(w).Motivation and Context
In cylindrical coordinates, conservation comes from the test function
v = r, which is in the P1 space. The bulk termr grad(u)·grad(v/r)vanishes for it, but the symmetry termn·grad(v)does not (grad(r) = 1), so particles are not conserved when a weakly enforcedHenrysBC/SievertsBCis coupled to an enclosure.With the MWE posted in #1278 (largest relative change of the total number of H atoms):
Type of Change
Testing
pytest)Code Quality Checklist
ruff format .)ruff check .)Documentation
Additional Notes
Spherical is not exact, and cannot be with P1 elements. Conservation would need
v = r**2in the test space. The remaining drift is the same as withSurfaceReactionBC(no Nitsche) and is O(h^2):SurfaceReactionBCThe spherical symmetry term is changed for consistency with the bulk term.
With assistance from AI.