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

Ver 1kb #201

Open
wants to merge 8 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
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 @@ -32,6 +32,7 @@ TMAP8 also contains [example cases](examples/tmap_index.md), which showcase how
| ver-1ja | [Radioactive Decay of Mobile Tritium in a Slab](ver-1ja.md) |
| ver-1jb | [Radioactive Decay of Mobile Tritium in a Slab with a Distributed Trap Concentration](ver-1jb.md) |
| ver-1ka | [Simple Volumetric Source](ver-1ka.md) |
| ver-1kb | [Henry’s Law Boundaries with No Volumetric Source](ver-1kb.md) |

# List of benchmarking cases

Expand Down
40 changes: 40 additions & 0 deletions doc/content/verification_and_validation/ver-1kb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ver-1kb

# Henry’s Law Boundaries with No Volumetric Source

## General Case Description

Two enclosures are separated by a membrane that allows diffusion according to Henry’s law, with no volumetric source present. Enclosure 2 has twice the volume of Enclosure 1.

## Case Set Up
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should document the values used in this case, like the system dimensions, the initial pressures, the diffusivities and solubilities used, etc. With all the corresponding units, of course.

Make sure to also add the equation for diffusion.


This verification problem is taken from [!cite](ambrosek2008verification).

Over time, the pressures of H$_2$ and T$_2$, which diffuse across the membrane in accordance with Henry’s law, will gradually equilibrate between the two enclosures.
Lee01Atom marked this conversation as resolved.
Show resolved Hide resolved

The concentration in Enclosure 1 is related to the partial pressure and concentration in Enclosure 2 via the interface sorption law:

\begin{equation}
C_s = K P^n = K \left( \frac{C_g RT}{n} \right)
\end{equation}

where $R$ is the ideal gas constant in J/mol/K, $T$ is the temperature in K, $K$ is the solubility, and $n$ is the exponent of the sorption law. For the Henry’s law, $n=1$.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
where $R$ is the ideal gas constant in J/mol/K, $T$ is the temperature in K, $K$ is the solubility, and $n$ is the exponent of the sorption law. For the Henry’s law, $n=1$.
where $R$ is the ideal gas constant in J/mol/K, $T$ is the temperature in K, $K$ is the solubility, and $n$ is the exponent of the sorption law. For Henry’s law, $n=1$.


Meanwhile, the heteronuclear species, HT, does not follow this diffusion process and remains stable, maintaining a constant pressure throughout the system.
Lee01Atom marked this conversation as resolved.
Show resolved Hide resolved

## Results

The TMAP8 pressure evolutions in the two enclosures are shown in [ver-1kb_comparison_time] as a function of time.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please discuss how the results compare to the expected behavior. In particular, you'll want to check that the concentration values at the interface are properly computed based on the sorption law, and that mass is conserved.


!media comparison_ver-1kb.py
image_name=ver-1kb_comparison_time.png
style=width:50%;margin-bottom:2%;margin-left:auto;margin-right:auto
id=ver-1kb_comparison_time
caption=Equilibration of species pressures under Henry’s law.
Lee01Atom marked this conversation as resolved.
Show resolved Hide resolved

## Input files

!style halign=left
The input file for this case can be found at [/ver-1kb.i], which is also used as tests in TMAP8 at [/ver-1kb/tests].

!bibtex bibliography
50 changes: 50 additions & 0 deletions test/tests/ver-1kb/comparison_ver-1kb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import numpy as np
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new figures created here need to be added to the documentation and commented there.

import pandas as pd
import os
from matplotlib import gridspec
import matplotlib.pyplot as plt

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

# Extract time and pressure data
if "/TMAP8/doc/" in script_folder: # if in documentation folder
csv_folder = "../../../../test/tests/ver-1kb/gold/ver-1kb_out.csv"
else: # if in test folder
csv_folder = "./gold/ver-1kb_out.csv"
Comment on lines +13 to +15
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
csv_folder = "../../../../test/tests/ver-1kb/gold/ver-1kb_out.csv"
else: # if in test folder
csv_folder = "./gold/ver-1kb_out.csv"
csv_folder = "../../../../test/tests/ver-1kb/gold/ver-1kb_out_k1.csv"
else: # if in test folder
csv_folder = "./gold/ver-1kb_out_k1.csv"

expt_data = pd.read_csv(csv_folder)
TMAP8_time = expt_data['time']
TMAP8_pressure_enclosure_1 = expt_data['pressure_enclosure_1']
TMAP8_pressure_enclosure_2 = expt_data['pressure_enclosure_2']

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

# Plot the experimental data
ax.plot(TMAP8_time/3600, TMAP8_pressure_enclosure_1, label=r"H2 Encl 1", c='tab:gray',linestyle='-')

# Plot the selected theoretical data
ax.plot(TMAP8_time/3600, TMAP8_pressure_enclosure_2, label=r"H2 Encl 2",c='k', linestyle='--')

# Format the y-axis to use scientific notation
plt.gca().yaxis.set_major_formatter(plt.FuncFormatter(lambda val, pos: '{:.1e}'.format(val)))

# Label the axes
ax.set_xlabel('Time (hr)')
ax.set_ylabel('Pressure (Pa)')

# define axis range
ax.set_xlim(left=0)
ax.set_xlim(right=3)
ax.set_ylim(bottom=0)

# Add a legend
ax.legend(loc="best")

# Add a grid
plt.grid(which='major', color='0.65', linestyle='--', alpha=0.3)

# Save the plot as a PNG file
plt.savefig('ver-1kb_comparison_time.png', bbox_inches='tight')
Loading