Skip to content

Commit 79d8fa7

Browse files
Merge pull request #941 from KulaginVladimir/surfacekinetics_refactoring
`SurfaceKinetics` minor update
2 parents 03ed7d5 + 8007810 commit 79d8fa7

File tree

5 files changed

+34
-39
lines changed

5 files changed

+34
-39
lines changed

docs/source/theory.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,14 @@ The fluxes for subsurface-to-surface and surface-to-subsurface transitions are d
339339
.. math::
340340
:label: eq_Jbs
341341
342-
J_\mathrm{bs} = k_\mathrm{bs} \lambda_\mathrm{abs} c_\mathrm{m} \left(1-\dfrac{c_\mathrm{s}}{n_\mathrm{surf}}\right)
342+
J_\mathrm{bs} = k_\mathrm{bs} c_\mathrm{m} \left(1-\dfrac{c_\mathrm{s}}{n_\mathrm{surf}}\right)
343343
344344
.. math::
345345
:label: eq_Jsb
346346
347347
J_\mathrm{sb} = k_\mathrm{sb} c_\mathrm{s} \left(1-\dfrac{c_\mathrm{m}}{n_\mathrm{IS}}\right)
348348
349-
where :math:`n_\mathrm{surf}\,[\mathrm{m}^{-2}]` is the surface concentration of adsorption sites, :math:`n_\mathrm{IS}\,[\mathrm{m}^{-3}]` is the bulk concentration of interstitial sites,
350-
:math:`\lambda_\mathrm{abs}=n_\mathrm{surf}/n_\mathrm{IS}\,[\mathrm{m}]` is the characteristic distance between surface and subsurface sites, :math:`k_\mathrm{bs}\,[\mathrm{s}^{-1}]`
349+
where :math:`n_\mathrm{surf}\,[\mathrm{m}^{-2}]` is the surface concentration of adsorption sites, :math:`n_\mathrm{IS}\,[\mathrm{m}^{-3}]` is the bulk concentration of interstitial sites, :math:`k_\mathrm{bs}\,[\mathrm{m}\,\mathrm{s}^{-1}]`
351350
and :math:`k_\mathrm{sb}\,[\mathrm{s}^{-1}]` are the rate constants for subsurface-to-surface and surface-to-subsurface transitions, respectively.
352351
Usually, these rate constants are expressed in the Arrhenius form: :math:`k_i=k_{i,0}\exp(-E_{k,i} / kT)`. Both these processes are assumed to take place
353352
if there are available sites on the surface (in the subsurface). Possible surface/subsurface saturation is accounted for with terms in brackets.

docs/source/userguide/boundary_conditions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ The current class is supported for 1D simulations only. Refer to the :ref:`Kinet
116116
from festim import t
117117
import fenics as f
118118

119-
def k_bs(T, surf_conc, t):
119+
def k_bs(T, surf_conc, mobile_conc, t):
120120
return 1e13*f.exp(-0.2/k_b/T)
121121

122-
def k_sb(T, surf_conc, t):
122+
def k_sb(T, surf_conc, mobile_conc, t):
123123
return 1e13*f.exp(-1.0/k_b/T)
124124

125-
def J_vs(T, surf_conc, t):
125+
def J_vs(T, surf_conc, mobile_conc, t):
126126

127127
J_des = 2e5*surf_conc**2*f.exp(-1.2/k_b/T)
128128
J_ads = 1e17*(1-surf_conc/1e17)**2*f.conditional(t<10, 1, 0)

festim/boundary_conditions/fluxes/surface_kinetics.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,14 @@ class SurfaceKinetics(FluxBC):
2222
2323
.. math::
2424
25-
J_{\mathrm{bs}} = k_{\mathrm{bs}} c_{\mathrm{m}} \lambda_{\mathrm{abs}} \left(1 - \dfrac{c_\mathrm{s}}{n_{\mathrm{surf}}}\right),
25+
J_{\mathrm{bs}} = k_{\mathrm{bs}} c_{\mathrm{m}} \left(1 - \dfrac{c_\mathrm{s}}{n_{\mathrm{surf}}}\right),
2626
2727
the H flux from surface to subsurface :math:`J_{\mathrm{sb}}` (in :math:`\mathrm{m}^{-2} \ \mathrm{s}^{-1}`) is:
2828
2929
.. math::
3030
3131
J_{\mathrm{sb}} = k_{\mathrm{sb}} c_{\mathrm{s}} \left(1 - \dfrac{c_{\mathrm{m}}}{n_\mathrm{IS}}\right),
3232
33-
:math:`\lambda_{\mathrm{abs}}=n_{\mathrm{surf}}/n_{\mathrm{IS}}` is the characteristic distance between surface and
34-
subsurface sites (:math:`\mathrm{m}`).
35-
3633
For more details see:
3734
E.A. Hodille et al 2017 Nucl. Fusion 57 056002; Y. Hamamoto et al 2020 Nucl. Mater. Energy 23 100751
3835
@@ -43,7 +40,7 @@ class SurfaceKinetics(FluxBC):
4340
Args:
4441
k_sb (float or callable): rate constant for the surface-to-subsurface transition (:math:`\mathrm{s}^{-1}`),
4542
can accept additional parameters (see example)
46-
k_bs (float or callable): rate constant for the subsurface-to-surface transition (:math:`\mathrm{s}^{-1}`),
43+
k_bs (float or callable): rate constant for the subsurface-to-surface transition (:math:`\mathrm{m} \ \mathrm{s}^{-1}`),
4744
can accept additional parameters (see example)
4845
lambda_IS (float): characteristic distance between two iterstitial sites (:math:`\mathrm{m}`)
4946
n_surf (float): surface concentration of adsorption sites (:math:`\mathrm{m}^{-2}`)
@@ -63,13 +60,13 @@ class SurfaceKinetics(FluxBC):
6360
6461
Example::
6562
66-
def K_sb(T, surf_conc, prm1, prm2):
67-
return 1e13 * f.exp(-2.0/F.k_B/T)
63+
def K_sb(T, surf_conc, mobile_conc, prm1, prm2):
64+
return 1e13 * f.exp(-2.0/F.k_B/T) + mobile_conc
6865
69-
def K_bs(T, surf_conc, prm1, prm2):
66+
def K_bs(T, surf_conc, mobile_conc, prm1, prm2):
7067
return 1e13 * f.exp(-0.2/F.k_B/T)
7168
72-
def J_vs(T, surf_conc, prm1, prm2):
69+
def J_vs(T, surf_conc, mobile_conc, prm1, prm2):
7370
return (1-surf_conc/5) ** 2 * fenics.exp(-2/F.k_B/T) + prm1 * prm2
7471
7572
my_surf_model = SurfaceKinetics(
@@ -133,25 +130,22 @@ def create_form(self, solute, solute_prev, solute_test_function, T, ds, dt):
133130
lambda_IS = self.lambda_IS
134131
n_surf = self.n_surf
135132
n_IS = self.n_IS
136-
lambda_abs = (
137-
n_surf / n_IS
138-
) # characteristic distance between surface and subsurface sites
139133
self.form = 0
140134

141135
for i, surf in enumerate(self.surfaces):
142136

143137
J_vs = self.J_vs
144138
if callable(J_vs):
145-
J_vs = J_vs(T.T, self.solutions[i], **self.prms)
139+
J_vs = J_vs(T.T, self.solutions[i], solute, **self.prms)
146140
k_sb = self.k_sb
147141
if callable(k_sb):
148-
k_sb = k_sb(T.T, self.solutions[i], **self.prms)
142+
k_sb = k_sb(T.T, self.solutions[i], solute, **self.prms)
149143
k_bs = self.k_bs
150144
if callable(k_bs):
151-
k_bs = k_bs(T.T, self.solutions[i], **self.prms)
145+
k_bs = k_bs(T.T, self.solutions[i], solute, **self.prms)
152146

153147
J_sb = k_sb * self.solutions[i] * (1 - solute / n_IS)
154-
J_bs = k_bs * (solute * lambda_abs) * (1 - self.solutions[i] / n_surf)
148+
J_bs = k_bs * solute * (1 - self.solutions[i] / n_surf)
155149

156150
if dt is not None:
157151
# Surface concentration form

test/system/test_system.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,23 +1226,25 @@ def test_MMS_surface_kinetics():
12261226
"""
12271227
MMS test for SurfaceKinetics BC
12281228
"""
1229-
exact_solution_cm = lambda x, t: 1 + 2 * x**2 + x + 2 * t
1230-
exact_solution_cs = (
1231-
lambda t: n_surf * (1 + 2 * t + 2 * lambda_IS - D) / (2 * n_IS - 1 - 2 * t)
1232-
)
12331229

12341230
n_IS = 20
12351231
n_surf = 5
12361232
D = 7
12371233
lambda_IS = 2
1238-
k_bs = n_IS / n_surf
1234+
k_bs = 3
12391235
k_sb = 2 * n_IS / n_surf
12401236

1237+
exact_solution_cm = lambda x, t: 1 + 2 * x**2 + x + 2 * t
1238+
exact_solution_cs = (
1239+
lambda t: n_surf
1240+
* (3 * (1 + 2 * t) + 2 * lambda_IS - D)
1241+
/ (2 * n_IS + 1 + 2 * t)
1242+
)
12411243
solute_source = 2 * (1 - 2 * D)
12421244

1243-
def J_vs(T, surf_conc, t):
1245+
def J_vs(T, surf_conc, solute, t):
12441246
return (
1245-
2 * n_surf * (2 * n_IS + 2 * lambda_IS - D) / (2 * n_IS - 1 - 2 * t) ** 2
1247+
2 * n_surf * (6 * n_IS - 2 * lambda_IS + D) / (2 * n_IS + 1 + 2 * t) ** 2
12461248
+ 2 * lambda_IS
12471249
- D
12481250
)

test/unit/test_boundary_conditions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -620,14 +620,14 @@ def test_create_form_surf_kinetics():
620620
"""
621621

622622
# build
623-
def k_sb(cs, T, prm1, prm2):
624-
return 2 * T + cs**2 + prm1 - prm2
623+
def k_sb(T, cs, cm, prm1, prm2):
624+
return 2 * T + cs**2 / cm + prm1 - prm2
625625

626-
def k_bs(cs, T, prm1, prm2):
627-
return 2 * T + 3 * cs + prm1 + prm2
626+
def k_bs(T, cs, cm, prm1, prm2):
627+
return 2 * T + 3 * cs + cm + prm1 + prm2
628628

629-
def J_vs(cs, T, prm1, prm2):
630-
return 2 * T + 1
629+
def J_vs(T, cs, cm, prm1, prm2):
630+
return 2 * T + 5 * cm - 3 * cs
631631

632632
lambda_IS = 1
633633
n_surf = 1
@@ -678,11 +678,11 @@ def J_vs(cs, T, prm1, prm2):
678678
# test
679679
p1 = my_bc.sub_expressions[0]
680680
p2 = my_bc.sub_expressions[1]
681-
K_sb = k_sb(T.T, adsorbed, p1, p2)
682-
K_bs = k_bs(T.T, adsorbed, p1, p2)
683-
j_vs = J_vs(T.T, adsorbed, p1, p2)
681+
K_sb = k_sb(T.T, adsorbed, solute, p1, p2)
682+
K_bs = k_bs(T.T, adsorbed, solute, p1, p2)
683+
j_vs = J_vs(T.T, adsorbed, solute, p1, p2)
684684
J_sb = K_sb * adsorbed * (1 - solute / n_IS)
685-
J_bs = K_bs * (solute * n_surf / n_IS) * (1 - adsorbed / n_surf)
685+
J_bs = K_bs * solute * (1 - adsorbed / n_surf)
686686

687687
expected_form = (
688688
(adsorbed - adsorbed_prev) / dt.value * adsorbed_test_function * ds(1)

0 commit comments

Comments
 (0)