Skip to content

Commit 88c1477

Browse files
added expression
1 parent 1ae4c44 commit 88c1477

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/festim/exports/vtx.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from dolfinx import fem, io
99

1010
from festim.helpers import get_interpolation_points
11+
from festim import k_B as _k_B
1112
from festim.species import Species
1213
from festim.subdomain.volume_subdomain import VolumeSubdomain
1314
from festim.reaction import Reaction
@@ -331,11 +332,14 @@ def __init__(
331332
subdomain: VolumeSubdomain | None = None,
332333
checkpoint: bool = False,
333334
):
334-
# for example
335-
def expression(T, c_a, c_b, c_c):
336-
return reaction.reaction_term(
337-
T, reactant_concentrations=[c_a, c_b], product_concentrations=[c_c]
338-
)
335+
def expression(T, reactants, products):
336+
k = reaction.k_0 * ufl.exp(-reaction.E_k / (_k_B * T))
337+
if reaction.p_0 and reaction.E_p:
338+
p = reaction.p_0 * ufl.exp(-reaction.E_p / (_k_B * T))
339+
elif reaction.p_0:
340+
p = reaction.p_0
341+
342+
return k * ufl.product(reactants) - p * ufl.product(products)
339343

340344
super().__init__(
341345
filename=filename,

0 commit comments

Comments
 (0)