Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation case val2a #189

Merged
merged 28 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8755bcc
Draft version
lin-yang-ly Oct 14, 2024
a8e92db
Update documentation
lin-yang-ly Oct 14, 2024
c7425d4
Apply suggestions from code review
lin-yang-ly Oct 15, 2024
bf35b71
Simplify input files
lin-yang-ly Oct 15, 2024
4489c32
Update figures in documentation
lin-yang-ly Oct 15, 2024
e196afd
Fix typos
lin-yang-ly Oct 15, 2024
6f31341
Update model
lin-yang-ly Oct 17, 2024
74a12cc
update_model
lin-yang-ly Oct 21, 2024
86b6c3e
Update documentation
lin-yang-ly Oct 21, 2024
4d862ca
Remove the data from TMAP7
lin-yang-ly Oct 22, 2024
96369ce
fix typo
lin-yang-ly Oct 22, 2024
27fefd3
Apply suggestions from code review
lin-yang-ly Oct 24, 2024
ee540cd
Update documentation
lin-yang-ly Oct 24, 2024
5938078
Update documentation
lin-yang-ly Oct 24, 2024
7f1be1c
Update test cases
lin-yang-ly Oct 25, 2024
5fa5925
attempt to fix issue on checks
lin-yang-ly Oct 25, 2024
165bc2b
update mesh and add exodus
lin-yang-ly Oct 25, 2024
ab0dbf7
change nm to mum
lin-yang-ly Oct 25, 2024
f0f2174
update interval with time_step_interval
lin-yang-ly Oct 25, 2024
7ee8e31
Apply suggestions from code review
lin-yang-ly Oct 28, 2024
967ffe4
plot figure from python script
lin-yang-ly Oct 28, 2024
6c043ea
update gold files with latest input
lin-yang-ly Oct 28, 2024
94ecc89
Apply suggestions from code review
lin-yang-ly Oct 28, 2024
fa1ad2b
add factor explaination
lin-yang-ly Oct 28, 2024
f61dc23
update limited gold files
lin-yang-ly Oct 28, 2024
fe118d5
improve convergence and clean up:
simopier Oct 28, 2024
4cd5dad
Apply suggestions from code review
lin-yang-ly Oct 29, 2024
4755cf1
update typo
lin-yang-ly Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
2 changes: 1 addition & 1 deletion doc/content/verification_and_validation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ TMAP8 also contains [example cases](examples/tmap_index.md), which showcase how

| Case | Title |
| ------ | ---------------------------------------------- |
| val-2a | [Ion Beam Experiment](val-2a.md) |
| val-2a | [Ion Implantation Experiment](val-2a.md) |
| val-2b | [Diffusion Experiment in Beryllium](val-2b.md) |
75 changes: 38 additions & 37 deletions doc/content/verification_and_validation/val-2a.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
# val-2a
simopier marked this conversation as resolved.
Show resolved Hide resolved

# Ion Beam Experiment
# Ion Implantation Experiment

## Case Description

This validation problem is taken from [!cite](anderl1985tritium). This paper describes an ion implantation experiment on a modified 316 stainless steel called Primary Candidate Alloy (PCA). This case is part of the validation suite of TMAP4 and TMAP7 as val-2a [!citep](longhurst1992verification,ambrosek2008verification). The PCA sample is a 0.5 mm thick disk with a diameter of 2.5 cm. It is exposed to a deuterium ion beam on the left side (also called the upstream side of the sample). The TRIM code [!citep](biersack1982stopping) was used in [!cite](longhurst1992verification,ambrosek2008verification) to determine that the average implantation depth for the ions is 11 nm $\pm$ 5.4 nm. Reemission data from the TRIM calculation shows that only 75 % of the incident flux remained in the metal and other 25 % is re-emitted.

This model considers the diffusion in PCA and the recombination of deuterium on the two sides. First, the diffusion of deuterium in PCA is described as:
This model considers the diffusion in PCA and the recombination of deuterium on both sides. First, the diffusion of deuterium in PCA is described as:

\begin{equation} \label{eq:diffusion}
\frac{d C}{d t} = D \frac{d^2 C}{d x^2} + S,
\frac{d C}{d t} = \nabla D \nabla C + S,
\end{equation}

where $C$ is the concentration of deuterium in PCA, $t$ is the time, $x$ is the distance from the upstream side, $D$ is the diffusivity of deuterium in PCA, and $S$ is the source term in PCA due to the deuterium ion beam.
where $C$ is the concentration of deuterium in PCA, $t$ is the time, $D$ is the diffusivity of deuterium in PCA, and $S$ is the source term in PCA due to the deuterium ion implantation.

Second, the deuterium become gas on the two sides of PCA during recommendation process, which is described as:
Second, the deuterium recombines into gas on both sides of the PCA sample. By assuming that the recombination process is at steady state (which is not a necessary assumption in TMAP8, but appropriate in this case), it is described as the following surface flux:

\begin{equation} \label{eq:recommendation}
J = A (K_r C^2 - K_d P^2),
J = A (K_r C^2 - K_d P),
\end{equation}

where $J$ is the recommendation flux out of the upstream or downstream side, $A$ is the area on the upstream or downstream side, $P$ is the pressure on corresponding side, and $K_r$ and $K_d$ are the recommendation coefficient and dissociation coefficient, respectively.
where $J$ is the recombination flux out of the sample sides, $A$ is the area on the upstream or downstream side, $P$ is the pressure on the corresponding side, and $K_r$ and $K_d$ are the recombination and dissociation coefficients, respectively.

The objective of the model is to determine the permeate flux on the downstream side and match the experimental data published in [!cite](anderl1985tritium) and reproduced in [val-2a_comparison].
The objective of this simulation is to determine the permeation flux on the downstream side and match the experimental data published in [!cite](anderl1985tritium) and reproduced in [val-2a_comparison].

## Model Description

In this case, TMAP8 simulates a one-dimensional domain to represent the deuterium diffusion. The deuterium is generated by ion beam and leave from upstream and downstream side by recommendation. Note that this case can easily be extended to a two- or three-dimensional case.
In this case, TMAP8 simulates a one-dimensional domain to represent the deuterium implantation, diffusion, and recombination. Note that this case can easily be extended to a two- or three-dimensional case.

The source term in the model is described as a normal distribution instead of a piecewise function from TMAP4. The source term of deuterium versus the coordinate is defined as:
The source term in the model is described as a normal distribution instead of the piecewise function from TMAP4 [!citep](longhurst1992verification). The source term of deuterium from ion beam implantation is defined as:

\begin{equation} \label{eq:normal_distribution}
S = \frac{1.5}{\sigma \sqrt(2 \pi) \exp \left( -0.5 * ((x - \mu ) / \sigma)^2 \right)},
S = F \frac{1.5}{\sigma \sqrt(2 \pi)} \exp \left( - \frac{(x - \mu )^2}{2 \sigma^2} \right),
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved
simopier marked this conversation as resolved.
Show resolved Hide resolved
\end{equation}

where $\sigma$ is the characteristic width of the normal distribution, and $\mu$ is the depth of the normal distribution from the upstream side. The comparison between the normal distribution from TMAP8 and piecewise function from TMAP4 is shown in [val-2a_normal_distribution]. The normal distribution has the similar distribution with the piecewise function, and also provide a smooth distribution, which is close to the real situation.
where $F$ is the implantation flux, $\sigma = 2.4 \times 10^{-9}$ m is the characteristic width of the normal distribution, and $\mu = 14 \times 10^{-9}$ m is the depth of the normal distribution from the upstream side. The comparison between the normal distribution from TMAP8 and piecewise function from TMAP4 is shown in [val-2a_normal_distribution]. The normal distribution has a similar distribution to the piecewise function, but the distribution profile is closer to the expected implantation profile.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

!media figures/val-2a_normal_distribution.png
!media comparison_val-2a.py
image_name=val-2a_comparison_normal_distribution.png
style=width:50%;margin-bottom:2%;margin-left:auto;margin-right:auto
id=val-2a_normal_distribution
caption= Comparison between the normal distribution from TMAP8 and piecewise function from TMAP4. The area of both functions are normalized as 1.
caption= Comparison between the normal distribution from TMAP8 and piecewise function from TMAP4 for the source term due to deuterium ion beam implantation.

The pressures on the upstream and downstream sides are close to the vacuum situation, and have less impact for the recommendation on two sides. Thus, TMAP8 ignore the impact of pressure on the boundary conditions to simplify the model. The recommendation is described as:
The pressures on the upstream and downstream sides are close to vacuum pressures, and have only little impact for the recombination on both sides [!citep](longhurst1992verification,ambrosek2008verification). Thus, TMAP8 ignores the impact of pressure on the boundary conditions to simplify the model. The recombination is described asa simplified version of [eq:recommendation]:
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

\begin{equation} \label{eq:recommendation_ignore_Pressure}
J = A K_r C^2.
\end{equation}

## Case and Model Parameters

The beam flux on the upstream side of the sample during the experiment are presented in [val-2a_flux_and_pressure_TMAP4]. Other case and model parameters in TMAP8 are listed in [val-2a_set_up_values_TMAP4]. Some of the parameters are directly leveraged from [!cite](anderl1985tritium,longhurst1992verification,ambrosek2008verification), but others were adapted to better match the experimental data.
The beam flux on the upstream side of the sample during the experiment is presented in [val-2a_flux_and_pressure_TMAP4], and only 75 % of the flux remain in the sample. Other case and model parameters used in TMAP8 are listed in [val-2a_set_up_values_TMAP4]. Some of the parameters are directly leveraged from [!cite](anderl1985tritium,longhurst1992verification,ambrosek2008verification), but others were adapted to better match the experimental data.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

!table id=val-2a_flux_and_pressure_TMAP4 caption=Values of beam flux on the upstream side of the sample during the experiment [!citep](longhurst1992verification).
| time (s) | Beam flux (atom/m$^2$/s) |
| time (s) | Beam flux F (atom/m$^2$/s) |
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved
| --------- | ---------------------------- |
| 0 - 5820 | 4.9$\times 10^{19}$ |
| 5820 - 9056 | 0 |
Expand All @@ -62,28 +63,28 @@ The beam flux on the upstream side of the sample during the experiment are prese
| 17678 - 20000 | 0 |

!alert warning title=Typo in [!cite](longhurst1992verification)
The times of starting and stopping the beam from TMAP4 in [!cite](longhurst1992verification) are not accurate, TMAP8 uses the times from [!cite](anderl1985tritium) directly to get better fit on results.
The times listed in [!cite](longhurst1992verification) for TMAP8 for the starts and ends the beam are not accurate. instead, TMAP8 uses the times directly from [!cite](anderl1985tritium) to better correspond to experimental conditions.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

!table id=val-2a_set_up_values_TMAP4 caption=Values of material properties.
simopier marked this conversation as resolved.
Show resolved Hide resolved
| Parameter | Description | Value | Units |
| --------- | ------------------------------------ | ----------------------------------------------------------- | --------------------- |
| $K_{d,l}$ | dissociation coefficient upstream | 8.959 $\times 10^{18} (1-0.9999 \exp(-6 \times 10^{-5} t))$ | at/m$^2$/s/Pa$^{0.5}$ |
| $K_{d,r}$ | dissociation coefficient on downstream | 1.7918$\times 10^{15}$ | at/m$^2$/s/Pa$^{0.5}$ |
| $K_{r,l}$ | recombination coefficient on upstream | 1$\times 10^{-27} (1-0.9999 \exp(-6 \times 10^{-5} t))$ | m$^4$/at/s |
| $K_{r,r}$ | recombination coefficient on downstream | 2$\times 10^{-31}$ | m$^4$/at/s |
| $P_{l}$ | pressure on downstream | 0 | Pa |
| $P_{r}$ | pressure on downstream | 0 | Pa |
| $D$ | deuterium diffusivity in PCA | 3$\times 10^{-10}$ | m$^2$/2 |
| $d$ | diameter of PCA | 0.025 | m |
| $l$ | thickness of PCA | 5$\times 10^{-4}$ | m |
| $T$ | temperature | 703 | K |


!alert note title=This validation case replicate TMAP4 rather than TMAP7 due to inconsistent experiment results with [!cite](anderl1985tritium).
TMAP4 [!citep](longhurst1992verification) and TMAP7 [!citep](ambrosek2008verification) both replicate this validation case. However, they use different model parameters and configurations, and the experimental data presented in the experimental data in [!citep](ambrosek2008verification) for TMAP7 do not correspond to the data published in [!cite](anderl1985tritium). We therefore replicate only the data from TMAP4 in this TMAP8 validation case.

!alert note title=The recombination and dissociation coefficient on upstream are simple exponential.
Both TMAP4 [!citep](longhurst1992verification) and TMAP7 [!citep](ambrosek2008verification) simplify the recombination and dissociation coefficients on upstream as exponential in time rather than an integrated ion influence in experiment. Thus, TMAP8 uses the same exponential on recombination and dissociation coefficients.
| Parameter | Description | Value | Units | Reference |
| --------- | ------------------------------------ | ----------------------------------------------------------- | --------------------- | --------------------- |
| $K_{d,l}$ | upstream dissociation coefficient | 8.959 $\times 10^{18} (1-0.9999 \exp(-6 \times 10^{-5} t))$ | at/m$^2$/s/Pa$^{0.5}$ | [!cite](longhurst1992verification) |
| $K_{d,r}$ | downstream dissociation coefficient | 1.7918$\times 10^{15}$ | at/m$^2$/s/Pa$^{0.5}$ | [!cite](longhurst1992verification) |
| $K_{r,l}$ | upstream recombination coefficient | 1$\times 10^{-27} (1-0.9999 \exp(-6 \times 10^{-5} t))$ | m$^4$/at/s | [!cite](longhurst1992verification) |
| $K_{r,r}$ | downstream recombination coefficient | 2$\times 10^{-31}$ | m$^4$/at/s | [!cite](anderl1985tritium) |
| $P_{l}$ | upstream pressure | 0 | Pa | [!cite](anderl1985tritium) |
| $P_{r}$ | downstream pressure | 0 | Pa | [!cite](anderl1985tritium) |
| $D$ | deuterium diffusivity in PCA | 3$\times 10^{-10}$ | m$^2$/2 | [!cite](anderl1985tritium) |
| $d$ | diameter of PCA | 0.025 | m | [!cite](anderl1985tritium) |
| $l$ | thickness of PCA | 5$\times 10^{-4}$ | m | [!cite](anderl1985tritium) |
| $T$ | temperature | 703 | K | [!cite](anderl1985tritium) |


!alert note title=This validation case replicates TMAP4 rather than TMAP7 due to inconsistent experiment results with [!cite](anderl1985tritium).
TMAP4 [!citep](longhurst1992verification) and TMAP7 [!citep](ambrosek2008verification) both replicate this validation case. However, they use different model parameters and configurations, and the experimental data presented in [!citep](ambrosek2008verification) for TMAP7 do not correspond to the data published in [!cite](anderl1985tritium). We therefore replicate only the data from TMAP4 and [!cite](anderl1985tritium) in this TMAP8 validation case.

!alert note title=The upstream recombination and dissociation coefficients as time-dependent exponentials.
Both TMAP4 [!citep](longhurst1992verification) and TMAP7 [!citep](ambrosek2008verification) describe the upstream recombination and dissociation coefficients as time-dependent exponentials rather than mechanistically capture the influence of ion irradiation on material performance. TMAP8 uses the same expressions.

## Results

Expand Down
35 changes: 32 additions & 3 deletions test/tests/val-2a/comparison_val-2a.py
simopier marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from matplotlib import gridspec
import pandas as pd
from scipy import special
import scipy.stats as stats
import os

# Changes working directory to script directory (for consistent MooseDocs usage)
script_folder = os.path.dirname(__file__)
os.chdir(script_folder)

lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

def numerical_solution_on_experiment_input(experiment_input, tmap_input, tmap_output):
"""Get new numerical solution based on the experimental input data points

Expand Down Expand Up @@ -38,7 +38,6 @@ def numerical_solution_on_experiment_input(experiment_input, tmap_input, tmap_ou
simulation_recom_flux_left_TMAP4 = simulation_TMAP4_data['scaled_recombination_flux_left']
simulation_recom_flux_right_TMAP4 = simulation_TMAP4_data['scaled_recombination_flux_right']

lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

# Read experiment data
if "/TMAP8/doc/" in script_folder: # if in documentation folder
csv_folder = "../../../../test/tests/val-2a/gold/experiment_data_paper.csv"
Expand All @@ -49,7 +48,7 @@ def numerical_solution_on_experiment_input(experiment_input, tmap_input, tmap_ou
experiment_flux_TMAP4 = experiment_TMAP4_data['permeation flux (atom/m^2/s)']

TMAP4_file_base = 'val-2a_comparison'
############################ TMAP4 atom/m$^2$/s ############################
############################ recommendation flux - atom/m$^2$/s ############################
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved
fig = plt.figure(figsize=[6.5, 5.5])
gs = gridspec.GridSpec(1, 1)
ax = fig.add_subplot(gs[0])
Expand All @@ -71,3 +70,33 @@ def numerical_solution_on_experiment_input(experiment_input, tmap_input, tmap_ou
ax.ticklabel_format(axis='y', style='sci', scilimits=(15,15))
plt.savefig(f'{TMAP4_file_base}.png', bbox_inches='tight')
plt.close(fig)


############################ implantation - atom/m$^2$/s ############################
sigma = 2.4e-9 # m
mu = 14e-9 # m
flux = 4.9e19 * 0.75 # atom/m$^2$/s
coordinate_x = np.arange(0, 25e-9,0.1e-9)

normal_distribution = flux * 1.5 * stats.norm.pdf(coordinate_x, mu, sigma)
piecewise = np.zeros(len(coordinate_x))
piecewise[80:120] = flux * 0.25 / 4e-9
piecewise[120:160] = flux * 1.00 / 4e-9
piecewise[160:200] = flux * 0.25 / 4e-9

fig = plt.figure(figsize=[6.5, 5.5])
gs = gridspec.GridSpec(1, 1)
ax = fig.add_subplot(gs[0])

ax.plot(coordinate_x, normal_distribution, linestyle='-', label=r"normal distribution", c='k')
ax.plot(coordinate_x, piecewise, linestyle='-', label=r"piecewise", c='gray')

ax.set_xlabel(u'depth (m)')
ax.set_ylabel(u"Source rate (atom/m$^3$/s)")
ax.legend(loc="best")
ax.set_ylim(bottom=0)
ax.set_xlim(left=0,right=3e-8)
plt.grid(visible=True, which='major', color='0.65', linestyle='--', alpha=0.3)
ax.minorticks_on()
plt.savefig(f'val-2a_comparison_normal_distribution.png', bbox_inches='tight')
plt.close(fig)
Loading