-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: devel
Are you sure you want to change the base?
Ver 1kb #201
Changes from 4 commits
06038bc
bda1e65
7365d5e
ce50a86
381e41d
72bfe63
913e354
bd6bdc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||||||
|
||||||
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$. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,50 @@ | ||||||||||||||
import numpy as np | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
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') |
There was a problem hiding this comment.
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.