Changing temperature settings at a certain time in the simulation

Hi! :slightly_smiling_face:

I am trying to reproduct a series of simulations from plasma irradiation to TDS.
But, I faced one problem.

During plasma irradiation, sample temperature is transient settings.

model.T = F.HeatTransferProblem(
    transient=True, 
    initial_condition= F.InitialCondition(field="T", value=300)
)

On the other hand, in the TDS process after plasma irradiation, I’d like to raise the temperature of the sample uniformly throughout like
model.T = F.Temperature(value = 300 + t) .
Therefore, the sample temperature does not need to be transient in the TDS process.

Is there any way to use a transient temperature during plasma irradiation and a non-transient temperature during TDS?

Yes this is absolutely possible, you can access the simulation time in FESTIM using F.t.

Say you have an implantation temperature of 300K, exposure for 100s, then start a TDS with a temperature ramp of 1 K/min, it would look like this:

implantation_temperature = 300  # K
start_tds = 100 # s
temperature_ramp = 1/60 # K/s

model.T = F.Temperature(
    value=sp.Piecewise(
        (implantation_temperature, F.t < start_tds),
        (implantation_temperature+ temperature_ramp * (F.t - start_tds), True),
    )
)

You can check out an example of modelling TDS in the new : V&V report.

And we have an example in the workshop task 10

Hi! Thank you for your replying :slightly_smiling_face:

It’s certainly a powerful method. However, what I’d like to do is a little different.

What I want to do is like this: (Note that this code doesn’t actually work)

implantation_temperature = 300  # K
start_tds = 100 # s
temperature_ramp = 1/60 # K/s

if F.t < start_tds:
    condition = F.HeatTransferProblem(transient=True, initial_condition=F.InitialCondition(field="T", value=300))
elif F.t >= start_tds:
    condition = F.Temperature(value=implantation_temperature+ temperature_ramp * (F.t - start_tds))

model.T = condition

For example, such a condition is required in the following cases: During plasma irradiation, it is necessary to resolve transient temperature changes, and the subsequent TDS step requires a constant temperature increase condition.

Is there any way to make such conditions possible?

Hi @iamryo!

What are the boundary conditions for the HeatTransferProblem?

Meanwhile, one possible solution is to split your problem into two (i.e. two different FESTIM models):

  1. Implantation phase with F.HeatTransferProblem: At the end, you could write your final profiles of solute/trapped species to XDMF
  2. TDS phase with F.Temperature: the profiles then could be read from XDMF and used as initial condition for the corresponding fields

Hi @iamryo , if I understand correctly, would want to start with a HeatTransferProblem and then switch to a F.Temperature.

I can see a hacky way of doing this by manually changing the model.T attribute in the middle of the simulation, but before doing this I guess it’s important to see if the heat transfer problem can be replaced by a Temperature object.

What is the size of your sample? What material? is it a 1D sim? what BCs? etc.

Hi @VVKulagin! Thank you for your replying :slightly_smiling_face:

With 1D FESTIM simulation, I am trying to reproduce an experimental sample in which plasma and pulsed heating were performed simultaneously.
Therefore, on the front side, we use F.CustomFlux(), which combines heat flux from plasma and heating from pulses.
On the reverse side, F.ConvectiveFlux() is used to simulate water cooling

The boundary conditions are as follows (Detailed parameters are not written):

def bc_1(T, solute, q_pulse):
    q_plasma =  # W/m2
    T_chamber = 300 
    emi_W = 0.4
    sigma = 5.67e-8  # W/m2/K4
    q_radiation = emi_W*sigma*(T**4-T_chamber**4)
    return q_pulse + q_plasma - q_radiation

def pulse(t):
    a = 
    b = 
    c = 
    d = 
    amp = 
    t = 
    S = 
    r = 
    y = (1-r) * amp * a * (1 + sp.exp(-(t-b)/c))**(-1) * sp.exp(-(t-b)/d) * S**(-1)
    return y

model_1d.boundary_conditions = [
    F.CustomFlux(surfaces=1, function=bc_1, field="T", q_pulse=pulse(F.t)),
    F.ConvectiveFlux(h_coeff= , T_ext=300, surfaces=2)
]

This is a great idea!

If a profile exported to XDMF in the implantation phase is used in the TDS phase, Is a trapped concentration input as an initial condition, treated as “trapped in a defect”? Or is it treated as a mobile condition?

Hi @remidm! Thank you as always :slightly_smiling_face:

Yes, that is correct. Glad you got my thoughts.

It may be difficult to replace the heat transfer problem with a Temperature object because of the boundary conditions as mentioned in the previous reply to @VVKulagin.

You can export each species to individual XDMF-files. Then, set initial conditions for each species. Consider:

model.initial_conditions = [
    F.InitialCondition(field='solute', 
                        value='filename_solute.xdmf', 
                        label = 'label_solute', 
                        time_step=-1),
    F.InitialCondition(field='1', 
                        value='filename_trap1.xdmf', 
                        label = 'label_trap1', 
                        time_step=-1),
    F.InitialCondition(field='2', 
                        value='filename_trap2.xdmf', 
                        label = 'label_trap2', 
                        time_step=-1),
    ...
]

Therefore, the profile of solute species will be set for solute species and trapped profiles for trapped in defects species. Does it help?

1 Like

Thank you, this is very informative!
I am surprised to see such a useful feature.

I will try the following things you suggested

Thank you very much!

1 Like

@iamryo just for your information, you can set multiple flux bcs on a single surface instead of bundling everything in one object like you do.

For instance:

def radiation_flux_value(T, solute):
    T_chamber = 300 
    emi_W = 0.4
    sigma = 5.67e-8  # W/m2/K4
    return -emi_W*sigma*(T**4-T_chamber**4)

radiation_flux = F.CustomFlux(surfaces=1, function=radiation_flux_value, field="T")
heat_flux_from_plasma = F.HeatFlux(value=q_plasma, surfaces=1)
pulsed_heat_flux = F.HeatFlux(
    value=(1-r) * amp * a * (1 + sp.exp(-(F.t-b)/c))**(-1) * sp.exp(-(F.t-b)/d) * S**(-1),
    surfaces=1
)

model_1d.boundary_conditions = [
    radiation_flux,
    heat_flux_from_plasma,
    pulsed_heat_flux,
    F.ConvectiveFlux(h_coeff= , T_ext=300, surfaces=2)
]

This will help simplify your code a bit.

1 Like

@iamryo have you been able to fix your issue?

Hi @remidm @VVKulagin .
Sorry for my late reply.
The FESTIM model split in two worked fine!
Thank you for the helpful advice :slightly_smiling_face:

1 Like