-
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
Conversation
@Lee01Atom, please update the comment at the top of the page to list the related issue (see what i did on your previous PR). |
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.
Here are some general comments after a rapid preliminary review:
- Please add a couple metrics to make this a verification case (we need comparison to an analytical solution. You could add a postprocessor to keep track of mass conservation (see tests in interfaceSorption), and another to measure the concentration jump at the interface and make sure that it is equal to the expected value from Henry's law (see tests in interfaceSorption).
- Please explain why you use both
InterfaceDiffusion
andInterfaceSorption
. InterfaceSorption should be enough since it also accounts for diffusion through the interface. This might be over constraining your system. Note that InterfaceSorption also takes in the diffusivities (see Add val 2c to TMAP8 for Test Cell Experiment #197). - You will need a
tests
file to run this case - Your
nl_abs_tol = 1e-6
andnl_rel_tol = 1e-6
are quite large (defaults are 1e-30 and 1e-8, respectively). Do you really need them to be this high? (see input files in interfaceSorption) - I think your petsc options should be more like what is used in interfaceSorption tests
Job Documentation, step Sync to remote on bd6bdc6 wanted to post the following: View the site here This comment will be updated on new commits. |
You currently get the following error:
Check both these links out to automatically solve these issues in VSCode: |
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.
Thanks for the update @Lee01Atom!
- you are missing the alias for comparison_ver-1kb.py in the
doc/content/verification_and_validation/figures
folder. - The documentation currently does not show any verification, in the sense that it does not verify mass conservation or the fact that the solubility law is properly computed. You need to check these metrics in a quantitative way to make it a valuable verification case. (see the last figure in the documentation in Clean up and Update val-2b #202 as an example).
|
||
## 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 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.
[] | ||
[] | ||
|
||
[Postprocessors] |
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.
Plot and discuss some of the values of the pps in the documentation to show that the case is being properly modeled. Of particular interest are mass conservation and the fact that the solubility law is properly computed.
test/tests/ver-1kb/ver-1kb.i
Outdated
initial_pressure_2 = ${units 1e-10 Pa} | ||
initial_concentration_1 = ${fparse initial_pressure_1 / (R*T)} # mol/m^3 | ||
initial_concentration_2 = ${fparse initial_pressure_2 / (R*T)} # mol/m^3 | ||
solubility = ${fparse 1.082e20/Na} # Henry's law constant |
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.
Units?
Co-authored-by: Pierre-Clement Simon <[email protected]>
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're getting there. The main remaining gaps are (1) the documentation, which meeds more more content to detail the case and explain the results and quantitatively show that TMAP8 accurately models this case in a way (see specific comments), and (2) the solubility value.
I looked at the input file and the case a little bit, and I think I understand why you are not getting the expected results.
Henry's law states C2 = KP1
, and the TMAP7 case explains that the pressures of the two enclosures are expected to equilibrate at the same value, which is also shown in their figure with the results. For that reason, I believe that they defined the solubility K
in a way that ensured that at equilibrium: P1=P2
, or C2 = C1
. Since C2 = KP1 = K C R T
, I think they picked K = 1/R/T
. The reason you are not getting the same result as them with the same K
value is because you are not using the same units. If you set up K = 1 / R / T
, you will be able to reproduce their results.
However, I don't think this is a a very interested result since the concentration jump at the interface is effectively 0. So here's what I think would make this case more valuable:
Create two different sub-cases within this case, one with (a) K = 1 / R / T
, and one with (b) K = 10 / R / T
or any other value to show that TMAP8 can reproduce the TMAP7 case without any jump (i.e., a) and model a concentration jump at the interface (i.e., b). For both case, plot the pressure evolution over time in both enclosure, show that mass is conserved, and show that the concentration jump is properly simulated (0 for sub-case a, and KRT for sub-case b).
You can create subcase (b) simply by creating a new test in the tests
file and update the solubility value with the cli_agrs
argument (see case ver-1jb
as an example on how to do that).
Please let me know if you have any questions, or if anything is unclear.
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 already ran into this issue in your previous PR (#183) and the solution was (here adapted for ver-1kb):
We do not want the absolute path because Users/lee/ is very specific to your local machine.
Please run:
cd ~/projects/TMAP8/doc/content/verification_and_validation/figures/
rm -rf comparison_ver-1kb.py
ln -s ../../../../test/tests/ver-1kb/comparison_ver-1kb.py comparison_ver-1kb.py
That should do it and solve the current documentation failure.
@@ -0,0 +1,64 @@ | |||
import numpy as np |
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.
The new figures created here need to be added to the documentation and commented there.
Co-authored-by: Pierre-Clement Simon <[email protected]>
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.
@Lee01Atom, here are some additional comments that should help you fix the failure in the test environment and improve this case.
Let me know if you have any questions. You're on the right track!
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.
This one is not fixed yet.
|
||
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) | ||
C_1 = K P_2^n = K \left( \frac{C_2 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 comment
The reason will be displayed to describe this comment to others. Learn more.
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$. |
|
||
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) | ||
C_1 = K P_2^n = K \left( \frac{C_2 RT}{n} \right) |
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.
C_1 = K P_2^n = K \left( \frac{C_2 RT}{n} \right) | |
C_1 = K P_2^n = K \left( C_2 RT \right)^n |
The diffusion process in each of the two enclosures can be described by the following equations: | ||
|
||
\begin{equation} | ||
\frac{\partial C_1}{\partial t} = D \nabla^2 C_1 |
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.
\frac{\partial C_1}{\partial t} = D \nabla^2 C_1 | |
\frac{\partial C_1}{\partial t} = \nabla D \nabla C_1 |
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.
D \nabla^2 C_1
is only valid if the diffusion coefficient does not depend on the position. The expression I am proposing is more general.
\end{equation} | ||
|
||
\begin{equation} | ||
\frac{\partial C_1}{\partial t} = D \nabla^2 C_1 |
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.
\frac{\partial C_1}{\partial t} = D \nabla^2 C_1 | |
\frac{\partial C_1}{\partial t} = - \nabla D \nabla C_1 |
cli_args = 'solubility=${fparse 10/(8.31446261815324*500)} | ||
Outputs/file_base=ver-1kb_out_k10' | ||
csvdiff = ver-1kb_out_k10.csv | ||
requirement = 'The system shall be able to model the diffusion of H2 across a membrane separating two enclosures in accordance with Henry’s law. Model a concentration jump at the interface' |
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.
requirement = 'The system shall be able to model the diffusion of H2 across a membrane separating two enclosures in accordance with Henry’s law. Model a concentration jump at the interface' | |
requirement = 'The system shall be able to model the diffusion of H2 across a membrane separating two enclosures in accordance with Henry’s law with a concentration jump at the interface' |
@@ -0,0 +1,25 @@ | |||
[Tests] |
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.
Please add an exodus test for the case K=10/RT.
You can look at tests specification files in other verification cases to see how to do it.
[ver-1kb_csv_concentration_jump] | ||
type = CSVDiff | ||
input = ver-1kb.i | ||
cli_args = 'solubility=${fparse 10/(8.31446261815324*500)} |
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.
cli_args = 'solubility=${fparse 10/(8.31446261815324*500)} | |
cli_args = "solubility='${fparse 10/(R*temperature)}' |
You should b able to leverage the values you have already defined for R and the temperature. This makes sure things are (and remain) consistent.
When using cli_args
, you need to make sure to use ' [...] '
around arguments that have spaces in them to pass it as a string. Right now, your tests are failing because of this.
type = CSVDiff | ||
input = ver-1kb.i | ||
cli_args = 'solubility=${fparse 10/(8.31446261815324*500)} | ||
Outputs/file_base=ver-1kb_out_k10' |
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.
Outputs/file_base=ver-1kb_out_k10' | |
Outputs/file_base=ver-1kb_out_k10" |
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 might want to re-gold this file, it is currently failing - the predictions in the testing environment are different from this gold file. Make sure it is up to date.
(Ref. #12)