Hello,
I’m reproducing an experiment with FESTIM 2.0 alpha where I expose a tungstene material to D fluxes, with a fixed temperature between the two.
At the third phase the calculation has an issue, probably solving in 0 iterations each step until the end.
I tried to implement milestones in the stepsize objet but I may be missing something.
Thanks in advance for your help !
import festim as F
import ufl
import numpy as np
import numpy.typing as npt
import matplotlib.pyplot as plt
model = F.HydrogenTransportProblem()
L=10e-5
vertice = np.concatenate(
[
np.linspace(0, 100e-9, num=100, endpoint=False),
np.linspace(100e-9, 10e-6, num=200, endpoint=False),
np.linspace(10e-6, L, num=200),
]
)
vertice = np.asarray(vertice)
model.mesh = F.Mesh1D(vertice)
difW = 1.9e-7
E_diff = 0.2
tungst = F.Material(name="W", D_0=difW, E_D=E_diff)
vol = F.VolumeSubdomain1D(id=1, borders=[0,L], material=tungst)
surf_left = F.SurfaceSubdomain1D(id=1, x=0)
surf_right = F.SurfaceSubdomain1D(id=2, x=L)
W_atom_density = 19.25e3 / (183.84 * 1.66e-27)
model.subdomains= [vol, surf_left, surf_right]
mobile_D = F.Species("D")
trapAD = F.Species("trapAD", mobile = False)
trapA = F.ImplicitSpecies(n=0.0019*W_atom_density, others=[trapAD], name="trapA")
model.species = [mobile_D, trapAD]#, trapAH, trapBH, trapBD, trapCH, trapCD, mobile_H]
model.reactions = [
F.Reaction(
k_0 = 1e13/W_atom_density,
E_k = E_diff,
p_0 = 1e13,
E_p = 1.65,
reactant = [mobile_D, trapA],
product = trapAD,
volume = vol,
),
]
D_expo = 48*3600
t_TDS = D_expo + 48*3600
D2_expo = t_TDS + 23.5*3600
def implant_surf_D(t):
if t < D_expo or t > t_TDS:
return 1.41e18
else:
return 0
model.boundary_conditions = [
F.DirichletBC(subdomain=surf_left, value = implant_surf_D, species= mobile_D),
F.DirichletBC(subdomain=surf_right, value = 0, species=mobile_D),
]
model.temperature = 600
invent_mobD = F.TotalVolume(field=mobile_D, volume=vol)
invent_trapAD = F.TotalVolume(field=trapAD, volume=vol)
model.exports=[
F.XDMFExport("trap_1_D.xdmf", field=trapAD),
invent_mobD,
invent_trapAD,
]
mlstns = [D_expo - 5, D_expo, D_expo + 5, D_expo + 10, D_expo + 15, D_expo + 20, t_TDS,
t_TDS + 5, t_TDS + 10, t_TDS + 15, t_TDS + 20, t_TDS + 25, t_TDS + 30, t_TDS + 35, t_TDS + 40, t_TDS + 45,
D2_expo - 45, D2_expo - 40, D2_expo - 35, D2_expo - 30, D2_expo - 25, D2_expo - 20, D2_expo - 15, D2_expo - 10, D2_expo - 5]
model.settings = F.Settings(atol= 1e10, rtol= 1e-10, max_iterations=30, final_time=D2_expo)
model.settings.stepsize = F.Stepsize(initial_value=0.1,growth_factor=1.05,target_nb_iterations=20, cutback_factor=0.95, max_stepsize=100)
model.settings.stepsize.milestones = mlstns
model.initialise()
model.run()