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 19 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
16 changes: 16 additions & 0 deletions doc/content/bib/tmap8.bib
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,19 @@ @book{Incropera2002
title = {Fundamentals of Heat and Mass Transfer},
year = {2002},
}

@techreport{anderl1985tritium,
title={Tritium permeation in stainless-steel structures exposed to plasma ions},
author={Anderl, RA and Holland, DF and Struttmann, DA and Longhurst, GR and Merrill, BJ},
year={1985},
institution={Idaho National Engineering Lab., Idaho Falls (USA)}
}

@inproceedings{biersack1982stopping,
title={The stopping and range of ions in solids},
author={Biersack, JP and Ziegler, JF},
booktitle={Ion Implantation Techniques: Lectures given at the Ion Implantation School in Connection with Fourth International Conference on Ion Implantation: Equipment and Techniques Berchtesgaden, Fed. Rep. of Germany, September 13--15, 1982},
pages={122--156},
year={1982},
organization={Springer}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/content/verification_and_validation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ TMAP8 also contains [example cases](examples/tmap_index.md), which showcase how

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

# Ion Beam Experiment
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

## 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:
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

\begin{equation} \label{eq:diffusion}
\frac{d C}{d t} = D \frac{d^2 C}{d x^2} + S,
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved
\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.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

Second, the deuterium become gas on the two sides of PCA during recommendation process, which is described as:
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

\begin{equation} \label{eq:recommendation}
J = A (K_r C^2 - K_d P^2),
\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.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

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].
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

## 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.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

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:
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

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

!media figures/val-2a_normal_distribution.png
simopier marked this conversation as resolved.
Show resolved Hide resolved
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.
simopier marked this conversation as resolved.
Show resolved Hide resolved
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

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:
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.
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) |
| --------- | ---------------------------- |
| 0 - 5820 | 4.9$\times 10^{19}$ |
| 5820 - 9056 | 0 |
| 9056 - 12062 | 4.9$\times 10^{19}$ |
| 12062 - 14572 | 0 |
| 14572 - 17678 | 4.9$\times 10^{19}$ |
| 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.
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 |
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved
| $P_{l}$ | pressure on downstream | 0 | Pa |
| $P_{r}$ | pressure on downstream | 0 | Pa |
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved
| $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.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

!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.
lin-yang-ly marked this conversation as resolved.
Show resolved Hide resolved

## Results

[val-2a_comparison] shows the comparison of the TMAP8 calculation and the experimental data from [!cite](anderl1985tritium). There is reasonable agreement between the TMAP predictions and the experimental data with a root mean square percentage error of RMSPE = 26.10 %. Note that the agreement could be improved by adjusting the model parameters. It is also possible to perform this optimization with [MOOSE's stochastic tools module](https://mooseframework.inl.gov/modules/stochastic_tools/index.html).

!media comparison_val-2a.py
image_name=val-2a_comparison.png
style=width:50%;margin-bottom:2%;margin-left:auto;margin-right:auto
id=val-2a_comparison
caption=Comparison of TMAP8 calculation with the experimental data on the downstream side of the sample. TMAP8 accurately replicate the experimental data.

## Input files

!style halign=left
The input file for this case can be generated by [/val-2a.i]. The file are also used as test in TMAP8 at [/val-2a/tests].

!bibtex bibliography
73 changes: 73 additions & 0 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
@@ -0,0 +1,73 @@
import matplotlib.pyplot as plt
simopier marked this conversation as resolved.
Show resolved Hide resolved
import numpy as np
from matplotlib import gridspec
import pandas as pd
from scipy import special
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

Args:
experiment_input (float, ndarray): experimental input data points
tmap_input (float, ndarray): numerical input data points
tmap_output (float, ndarray): numerical output data points

Returns:
float, ndarray: updated tmap_output based on the data points in experiment_input
"""
new_tmap_output = np.zeros(len(experiment_input))
for i in range(len(experiment_input)):
left_limit = np.argwhere((np.diff(tmap_input < experiment_input[i])))[0][0]
right_limit = left_limit + 1
new_tmap_output[i] = (experiment_input[i] - tmap_input[left_limit]) / (tmap_input[right_limit] - tmap_input[left_limit]) * (tmap_output[right_limit] - tmap_output[left_limit]) + tmap_output[left_limit]
return new_tmap_output

# Read simulation data
if "/TMAP8/doc/" in script_folder: # if in documentation folder
csv_folder = "../../../../test/tests/val-2a/gold/val-2a_out.csv"
else: # if in test folder
csv_folder = "./gold/val-2a_out.csv"
simulation_TMAP4_data = pd.read_csv(csv_folder)
simulation_time_TMAP4 = simulation_TMAP4_data['time']
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"
else: # if in test folder
csv_folder = "./gold/experiment_data_paper.csv"
experiment_TMAP4_data = pd.read_csv(csv_folder)
experiment_time_TMAP4 = experiment_TMAP4_data['time (s)']
experiment_flux_TMAP4 = experiment_TMAP4_data['permeation flux (atom/m^2/s)']

TMAP4_file_base = 'val-2a_comparison'
############################ TMAP4 atom/m$^2$/s ############################
fig = plt.figure(figsize=[6.5, 5.5])
gs = gridspec.GridSpec(1, 1)
ax = fig.add_subplot(gs[0])

ax.plot(simulation_time_TMAP4/3600, simulation_recom_flux_right_TMAP4, linestyle='-', label=r"TMAP8", c='tab:brown')
ax.plot(experiment_time_TMAP4/3600, experiment_flux_TMAP4, linestyle='--', label=r"experiment", c='k')

ax.set_xlabel(u'time (hr)')
ax.set_ylabel(u"Deuterium flux (atom/m$^2$/s)")
ax.legend(loc="best")
ax.set_ylim(bottom=0)
ax.set_xlim(left=-0.1,right=2e4/3600)
plt.grid(visible=True, which='major', color='0.65', linestyle='--', alpha=0.3)
tmap_flux_for_rmspe = numerical_solution_on_experiment_input(experiment_time_TMAP4, simulation_time_TMAP4, simulation_recom_flux_right_TMAP4)
RMSE = np.sqrt(np.mean((tmap_flux_for_rmspe-experiment_flux_TMAP4)**2) )
RMSPE = RMSE*100/np.mean(experiment_flux_TMAP4)
ax.text(1e4/3600.0,40e15, 'RMSPE = %.2f '%RMSPE+'%',fontweight='bold')
ax.minorticks_on()
ax.ticklabel_format(axis='y', style='sci', scilimits=(15,15))
plt.savefig(f'{TMAP4_file_base}.png', bbox_inches='tight')
plt.close(fig)
67 changes: 67 additions & 0 deletions test/tests/val-2a/gold/experiment_data_paper.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
time (s),permeation flux (atom/m^2/s)
75.79449318707059, 2850359529343405
80.06107061813086, 18989686228936664
91.60592719629393, 41395355171411970
109.29967477804385, 64141033556072056
139.66766708147279, 88052912550842540
153.84776266117308, 111345148169668800
169.53370909889466, 133499782103428240
186.09806853712863, 158244207582800700
208.81131897894946, 181927295177222560
229.89323099124724, 207548754357931460
253.735869576584, 229925824375363170
284.7312997375218, 250374055781522370
288.6214144540768, 271559503922138300
331.2871887646794, 289853282975014500
368.6824850722076, 303618898895990700
455.26890940843066, 310937046048808800
555.0315287523398, 300581057524695000
572.7252763340897, 287473216879721100
614.5126376441799, 274123874201045920
654.9196356677508, 258013146426496220
705.6166145544668, 242617391778036030
767.4819873048407, 225655051568855330
846.162694636452, 206979953515398050
934.0039946876927, 190506972690296350
1029.6255241720435, 173373038930854180
1122.1098643688497, 156207328588030200
1263.0324071653401, 136706039366647300
1373.8379328014055, 120852701917489840
1520.5329038869775, 104907212376525280
1752.1829608792495, 88535916618245220
2037.4162109027784, 73067075828006980
2380.750206531628, 60931598634514820
2871.9085613895654, 49975032684485770
3409.8737804176644, 40947305345729230
4005.9397450510837, 33228773242300988
4587.072688675792, 28322468768158050
5153.774561577797, 25008171121441024
5795.643489809363, 22211831783846600
6127.181653717046, 14077026438117374
6468.633335773369, 8211069145845439
6865.801499576479, 5128740557815224
7283.173162391375, 2942511621150494
7760.402396812615, 2090899186519465.5
8248.172587240006, 1518920685647879.2
8721.637194516192, 1449012202208018.8
9054.681209281896, 1877996077861708.5
9312.809143861043, 8649585996513655
9675.970175787172, 15659500290528762
9952.54478337708, 17499364468332366
10517.61531784956, 17499364468332366
11079.423175462996, 17515252760023242
11652.775889654595, 17334126234747240
12062.618298179385, 16806634950610112
12385.87428236795, 11776401801278326
12760.203708157736, 5888200900639163
13242.57793301055, 2729608512492737
13773.51584803455, 1309195235328297.5
14263.795789891976, 734039076118535.8
14574.25204178736, 854790092969204
14865.634182814476, 6590463393375944
15217.12487059094, 11179002033701336
15661.727336421722, 12253050552004648
16090.141905528772, 12771008861127252
16599.87242096897, 12554928094131320
17034.184905936607, 11954350668216154
17224.8005270478, 11360128558977340
Loading