Repository navigation
Add StressDriftTerm: stress-assisted diffusion (closes #1261) - #1288
Merged
Merged
Conversation
Drift of an interstitial species along a hydrostatic stress gradient, J = -D grad(c) + D c V_H / (R T) grad(sigma_h) (Sofronis & McMeeking 1989), built on DriftTermBase like SoretTerm and ElectromigrationTerm. The stress is an input field (float, callable or fenics object), e.g. the hydrostatic part of a separate dolfinx mechanics solve on the same mesh. Tests: constructor/validation parametrisations, structural-zero warning for a uniform stress, velocity expression, sign (drift towards tension for V_H > 0), and a system test that a closed slab relaxes to c ~ exp(V_H sigma_h / RT). Docs: user guide section, theory equation, Sofronis1989 reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1288 +/- ##
==========================================
+ Coverage 96.14% 96.15% +0.01%
==========================================
Files 57 57
Lines 5165 5181 +16
==========================================
+ Hits 4966 4982 +16
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:
|
Collaborator
|
Thanks for this @zer00318 i’ll try to give it a look later today |
RemDelaporteMathurin
approved these changes
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Summary
Adds
festim.StressDriftTerm, stress-assisted diffusion of an interstitial species along a hydrostatic stress gradient (Sofronis & McMeeking, 1989):with$V_H$ in m³/mol and $\sigma_h$ in Pa (positive in tension). It is a
partial_molar_volumehydrostatic_stressDriftTermBasesubclass built exactly likeSoretTermandElectromigrationTerm, so it reuses the conservativedrift_form, the 0D handling and the structural-zero warning. FESTIM does not solve for the stress: like the potential ofElectromigrationTerm, it is an input (float, callable ofx/t/T, or a fenics object), typically the hydrostatic part of a separate dolfinx mechanics solve on the same mesh.Related Issues
Closes #1261
Motivation and Context
Hydrogen accumulation in tensile regions matters for crack tips and for thermally mismatched joints such as W/CuCrZr plasma-facing components, where the cool-down after joining leaves large residual stresses at the interface.
Type of Change
Testing
pytest) — dolfinx 0.10.0, macOS arm64, conda-forge env: 1206 passed, 66 skipped; the one failure,test_heat_transfer_problem.py::test_sympify, isModuleNotFoundErrorbecause sympy is not installed in my envNew tests in
test/test_drift.py: the term joins the existing parametrisations (0D warning, subdomain/species validation, shared base class); a uniform stress gives a structural-zero velocity and the "no effect" warning; the velocity equalsD V_H / (R T) grad(sigma_h); the drift points towards tension forV_H > 0and reverses with the sign ofV_H.New system test in
test/system_tests/test_drift.py: a closed slab under a linear stress gradient relaxes to the closed formc ∝ exp(V_H σ_h / RT)(max relative error < 1e-5), with the stress span chosen so that the tensile end holds e times the unstressed end.I also checked the fenics-object path end to end (not added to the suite, script below): plane-strain elasticity of a bent beam in dolfinx,
σ_h = tr(σ)/3interpolated into P1 and passed toStressDriftTermon the same mesh. The closed transient run givesc_top / c_bottom = 1.0030against the Boltzmann value1.0030.bent-beam check
Code Quality Checklist
ruff format .)ruff check .)Documentation
eq_stress_drift,Sofronis1989reference)Additional Notes
V_H = 2e-6 m³/molin the examples is the classic value for H in iron used by Sofronis & McMeeking; the docstring says so rather than suggesting a tungsten value.