-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecay_output.py
More file actions
27 lines (21 loc) · 871 Bytes
/
decay_output.py
File metadata and controls
27 lines (21 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import FESTIM as F
import fenics as f
class DecayXDMF(F.XDMFExport):
def __init__(
self, label="decay", filename=None, mode=1, checkpoint=True, folder=None
) -> None:
field = "retention"
super().__init__(field, label, filename, mode, checkpoint, folder)
def write(self, t):
functionspace = self.function.function_space()
density_as_function = f.project(self.make_decay(), functionspace)
self.function = density_as_function
super().write(t)
def make_decay(self):
tritium_half_life = 12.4 # years
tritium_half_life *= 364.25 # days
tritium_half_life *= 24 # hours
tritium_half_life *= 3600 # seconds
decay_constant = 0.69 / tritium_half_life # ln(2)/half_life in s-1
decay_mobile = decay_constant * self.function
return decay_mobile