Remi Delaporte-Mathurin
We need a numerical tool
W
Cu
CuCrZr
Particle and heat fluxes
Convection
14 mm
Problem: predict T retention and permeation
User inputs
Heat transfer model
Hydrogen transport model
FESTIM
Outputs
2022
2019
Start of development
open-source
Oct 2023
v1.0 release
2024
Jonathan Dufour
CEA, France
+ other contributors
✅ More transparency
✅ More collaborations
✅ More flexibility
The code is missing a feature?
Just add it!
Found a bug?
Report it and we'll fix it!
fork
fork
pull request
FESTIM
Jane Doe
FESTIM
John Doe
FESTIM
festim-dev
pull request
Documentation
and installation instructions
conda install -c conda-forge fenics
pip install festim
Two lines to install!
import festim as F
import numpy as np
my_model = F.Simulation()
my_model.mesh = F.MeshFromVertices(
vertices=np.linspace(0, 1e-6, num=1001)
)
my_model.materials = F.Material(id=1, D_0=1.9e-7, E_D=0.2)
my_model.T = 500 # K
my_model.boundary_conditions = [
F.DirichletBC(
surfaces=[1, 2],
value=1e15, # H/m3/s
field=0
)
]
my_model.settings = F.Settings(
absolute_tolerance=1e10,
relative_tolerance=1e-10,
final_time=100 # s
)
my_model.dt = F.Stepsize(0.1) # s
my_model.initialise()
my_model.run()
The FESTIM workshop is a series of tutorials
from basic problems to more advanced cases
Check out the complete documentation at
Installation instructions
User guide
festim-vv-report.readthedocs.io
14 verification cases (4 in progress)
6 validation cases (5 in progress)
Effective-diffusion through a slab
2D multi-material
Exact
Computed concentration
governing equations
exact solutions
parameters (sources, BCs, ICs)
FESTIM
computed solutions
solve
run
compare
⚠️sometimes very complex!
governing equations
manufactured solutions
source terms, BCs and ICs
FESTIM
computed solutions
compare
8 private companies
13 universities
18 research organisations
IPP soon?
📈5 years of development
📑13+ publications
🗣️110+ citations
🧑💻20+ contributors
🏛️26+ institutions using the code
🧑💻70+ Slack members
⭐88+ stars on GitHub
Evolution of GitHub stars
Open source
SOFE
New reference paper
Kyoto Fusioneering
UKAEA
James Dark et al 2021 Nucl. Fusion 61 116076
courtesy of K. Dunnell (MIT)
courtesy of K. Dunnell (MIT)
① neutrons are generated
② tritium is created from nuclear reactions
③ tritium is transported in the salt
④ tritium is released into the gas phase
⑤ tritium is collected and counted
👀 Presentation tomorrow...
Velocity
Temperature
Tritium concentration
Benedikt & Day, (2017) Fusion Engineering and Design
No barrier
with barrier
Permeation barrier
Substrate
High H pressure
Low H pressure
Conservation of chemical potential
Permeation flux
Text
to be submitted
New in v1.3!
Parallel scaling issues
Technical debt
Legacy FEniCS deprecated
Current interface condition does not scale well
Many hard coded foudations
More complex implementationof new features
Bugs not being fixed
Can't take advantage of new features
FEniCSx
FEniCS deprecated in 2019
FEniCSx
Mailing list
Multi-isotope transport
New mesh types
Validation on PFCs
Chemical reactions
External physics integration
Anisotropic diffusion
Multilevel trapping
Massively parallel
Chemical reactions
Multi-species transport
Finite element engine upgrade
Graphical user interface?
same underlying equations!
Can be represented by festim.Reaction
my_model.species = [
mobile_H,
mobile_D,
trapped_H,
trapped_D,
]
my_model.reactions = [
F.Reaction(
k_0=k_0,
E_k=0.39,
p_0=1e13,
E_p=1.2,
reactant1=mobile_H,
reactant2=empty_trap,
product=trapped_H,
volume=my_subdomain,
),
F.Reaction(
k_0=k_0,
E_k=0.39,
p_0=1e13,
E_p=1.2,
reactant1=mobile_D,
reactant2=empty_trap,
product=trapped_D,
volume=my_subdomain,
),
F.Reaction(
k_0=k_0,
E_k=0.1,
p_0=k_0,
E_p=0.1,
reactant1=mobile_H,
reactant2=trapped_D,
product=[mobile_D, trapped_H],
volume=my_subdomain,
),
]
Usual trapping reactions
Swapping reaction
4 species are defined
\( \mathrm{H} \) = mobile H
\( \mathrm{D} \) = mobile D
\( [\mathrm{H}_x\mathrm{D}_y] \) = \(x\) H and \(y\) D in trap
see Zibrov and Schmid, NME, 2024
for complete description
Example dolfinx code available in issue #719
FESTIM 1
with dolfinx
1 mesh for the whole domain
1 mesh for the whole domain
Submesh 1
Submesh 2
VectorFunctionSpace \(V\) (eg. 3 components)
Function \(u\) (eg. 3 components)
VectorFunctionSpace \(V_1\)
\(V_2\)
Function \(u_1\) (eg. 2 comps.)
\(u_2\) (eg. 3 comps.)
1 function for the whole domain
1 function per subdomain
📖Tasks
Basic
Advanced
Bonus
💪Challenges
You'll need a GitHub account for this
We curated a list of easy issues for this workshop:
fork
fork
pull request
FESTIM
Jane
FESTIM
John
FESTIM
festim-dev
pull request
✅
❌
docs
folder locallycd docs/source
make html
def add_two(x):
return x + 2
def test_add_two():
assert add_two(2) == 4
assert add_two(3) == 5
assert add_two(4) == 6
assert add_two(5) == 7
test_add_two()
test_example.py
$ python test_example.py
We want to test this function
We write a test function
def add_two(x):
return x + 2
def add_three(x):
return x + 3
def test_add_two():
assert add_two(2) == 4
assert add_two(3) == 5
assert add_two(4) == 6
assert add_two(5) == 7
def test_add_three():
assert add_three(2) == 5
assert add_three(3) == 6
assert add_three(4) == 7
assert add_three(5) == 8
test_add_two()
test_add_three()
test_example.py
$ python test_example.py
pytest
insteaddef add_two(x):
return x + 2
def add_three(x):
return x + 3
def test_add_two():
assert add_two(2) == 4
assert add_two(3) == 5
assert add_two(4) == 6
assert add_two(5) == 7
def test_add_three():
assert add_three(2) == 5
assert add_three(3) == 6
assert add_three(4) == 7
assert add_three(5) == 8
test_example.py
$ python -m pytest test_example.py
================================================================ test session starts ================================================================
platform linux -- Python 3.11.9, pytest-7.4.4, pluggy-1.0.0
rootdir: /home/remidm/FESTIM-workshop
collected 2 items
example_test.py .. [100%]
================================================================= 2 passed in 0.01s =================================================================
from example import *
def test_add_two():
assert add_two(2) == 4
assert add_two(3) == 5
assert add_two(4) == 6
assert add_two(5) == 7
def test_add_three():
assert add_three(2) == 5
assert add_three(3) == 6
assert add_three(4) == 7
assert add_three(5) == 8
test_example.py
$ python -m pytest test_example.py
def add_two(x):
return x + 2
def add_three(x):
return x + 3
example.py
================================================================ test session starts ================================================================
platform linux -- Python 3.11.9, pytest-7.4.4, pluggy-1.0.0
rootdir: /home/remidm/FESTIM-workshop
collected 2 items
example_test.py .. [100%]
================================================================= 2 passed in 0.01s =================================================================
from example import *
def test_add_two():
assert add_two(2) == 4
assert add_two(3) == 5
assert add_two(4) == 6
assert add_two(5) == 7
def test_add_three():
assert add_three(2) == 5
assert add_three(3) == 6
assert add_three(4) == 7
assert add_three(5) == 8
test_example.py
def add_two(x):
return x + 2
def add_three(x):
return x + 3
example.py
festim/festim
festim/test
name: CI
on: [pull_request, push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: myenv
channels: conda-forge, defaults
- name: Create Conda environment
shell: bash -l {0}
run: |
conda install -c conda-forge fenics numpy=1.24
- name: Install dependencies
shell: bash -l {0}
run: |
pip install pytest pytest-cov
- name: Run tests
shell: bash -l {0}
run: |
pytest test/ --cov festim --cov-report xml --cov-report term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Triggered by pushes and PRs
Runs-on cloud ubuntu machine
Clone FESTIM repository
Install dependencies
Run the tests
Upload code coverage
Workflow file stored in .github/workflows/
We also have automation for