Hi, all!
Assume a multi-material problem (for example, W-Cu) with traps defined within one material only. There are two points that I’d like to discuss.
1.If the initial condition for traps is provided with a float, then the traps are initialised within the whole geometry rather than within one material. Consider the following MWE:
import festim as F
import fenics as f
import numpy as np
import matplotlib.pyplot as plt
model = F.Simulation()
vertices = np.linspace(0, 1, num=1000)
model.mesh = F.MeshFromVertices(vertices)
tungsten = F.Material(id=1, D_0=1, E_D=0, S_0=1, E_S=0, borders=[0, 0.5])
copper = F.Material(id=2, D_0=1, E_D=0, S_0=1, E_S=0, borders=[0.5, 1])
model.materials = [tungsten, copper]
trap_1 = F.Trap(
k_0=1,
E_k=0,
p_0=2,
E_p=0,
density=1,
materials=tungsten,
)
model.traps = [trap_1]
model.initial_conditions = [
F.InitialCondition(field="1", value=5),
]
model.boundary_conditions = [F.DirichletBC(surfaces=[1, 2], value=0, field=0)]
model.T = 300
model.dt = F.Stepsize(
initial_value=0.1,
stepsize_change_ratio=1.1,
max_stepsize=1,
dt_min=1,
)
model.settings = F.Settings(
absolute_tolerance=1e10,
relative_tolerance=1e-10,
final_time=0,
chemical_pot=True,
traps_element_type="DG",
)
model.initialise()
f.plot(model.h_transport_problem.traps[0].previous_solution)
plt.ylabel("Trap concentration")
plt.xlabel("x")
plt.show()
it produces:
I suppose a workaround is to use sp.Piecewise
for the initial condition (or maybe I miss something?). If so, isn’t it confusing?
2.The second point concerns the material interface. If I suppose that hydrogen cannot diffuse from the first material into the second (e.g., there is another thin layer between these materials: W-CuO/CuO2-Cu, that prevents hydrogen migration into copper), what’d be a better option to simulate such a case?