-
Notifications
You must be signed in to change notification settings - Fork 21
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 ver-1kc-2 #231
base: devel
Are you sure you want to change the base?
Add ver-1kc-2 #231
Conversation
Job Documentation, step Sync to remote on aea9aea wanted to post the following: View the site here This comment will be updated on new commits. |
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 is not a full review, I'm just providing suggestions to solve the current test failures.
Also, make sure to add a reference to the issue number in the PR message at the top of the page.
Hi @simopier , I had a question regarding the reaction Could you please advise on how to ensure the equilibrium law is respected in TMAP8? I tried to illustrate this in the last Python subplot figure, but the equilibrium isn’t fully reached yet. Also, I set an arbitrary reaction rate constant Thanks in advance for your help! |
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 on the right track!
Here's a partial review with some suggestions. I'll need to do a deeper review once you have all the pieces together.
This comment was marked as duplicate.
This comment was marked as duplicate.
1 similar comment
Great questions! You correctly identified that while TMAP7 uses an equilibrium condition, we probably want to use a kinetic description in TMAP8 to be more general. However, we need to reconcile the two to obtain the same equilibrium condition. at equilibrium: So, to obtain the same equilibrium as in TMAP7, you can define Please double check the math above, but that should give you all you need to address your questions above. Here, you'll need to add blocks for the chemical reactions (feel free to check other cases if you are unsure how to do it), and select appropriate values for I hope that helps! Let me know if you have other questions. |
Co-authored-by: Pierre-Clement Simon <[email protected]>
Hi @simopier, |
The ver-1kc branch has already been merged in your previous PR. Right now, you are getting failures because you have not updated ver-1kc.md into ver-1kc-1.md everywhere. For example, in the test specification file for ver-1kc-1, it still says
instead of
|
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's a new round of reviews. Let me know if you have any questions.
Thus, it is crucial to ensure that the chemical equilibrium between HT, T$_2$ and H$_2$ is achieved. This can be verified in both enclosures by examining the ratio between $P_{\text{HT}}$ and $\sqrt{P_{\text{H}_2} P_{\text{T}_2}}$, which must equal $\eta=2$. | ||
As shown in [ver-1kc-2_equilibrium_constant_k10], this ratio approaches $\eta=2$ for both enclosures, as observed in TMAP7. However, achieving this balance involves a compromise. On one hand, $K_1$ must be sufficiently large to ensure that the chemical kinetics in Enclosure 1 are significantly faster than other processes, such as diffusion and surface sorption. On the other hand, $K_2$ should not be excessively large, as this could hinder the diffusion of species into Enclosure 2, where no species are initially present. | ||
|
||
The concentration ratios for T$_2$, H$_2$, and HT between enclosures 1 and 2, shown in [ver-1kc-2_concentration_ratio_T2_k10], [ver-1kc-2_concentration_ratio_H2_k10], and [ver-1kc-2_concentration_ratio_HT_k10], demonstrate that the results obtained with TMAP8 are consistent with the analytical results derived from the sorption law for $K \sqrt{RT} = 10$. | ||
|
||
As shown in [ver-1kc-2_mass_conservation_k10], mass is conserved between the two enclosures over time for all species. The variation in mass is only $0.4$ % for T$_2$ and H$_2$. This variation in mass can be further minimized by refining the mesh, i.e., increasing the number of segments in the domain. |
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 mass variation shown in the figure below is actually much larger, and the results do not correspond to the TMAP7 predictions. The kernels you have defined might not conserve mass, probably because one uses the wrong coefficients or added/missed a term - or maybe your formula for mas conservation is incorrect.
Make sure to resolve this issue, explain any difference with the TMAP7 case if some still remain, and update this line of the documentation with the latest number.
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.
Things are looking good!
My main remaining concerns are:
- the very loose tolerances. They should be much smaller.
- the fact that we do not match the right equilibrium condition (very likely due to large tolerances and large time steps)
- The discussion about K1 and K2 in the documentation, where we are not exactly on the same page.
As you try to refine the tolerances, feel free to play with the values of K_1 and K_2. Try to make them lower and higher (still with eta=2) to understand their impact on the results and on convergence.
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
nl_max_its = 6 | ||
[TimeStepper] | ||
type = IterationAdaptiveDT | ||
dt = 0.01 |
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.
dt = 0.01 | |
dt = 1e-3 |
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
dt = 0.01 | ||
optimal_iterations = 5 | ||
iteration_window = 3 | ||
growth_factor = 1.05 |
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.
growth_factor = 1.05 | |
growth_factor = 1.1 |
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
optimal_iterations = 5 | ||
iteration_window = 3 | ||
growth_factor = 1.05 | ||
cutback_factor_at_failure = 0.8 |
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.
cutback_factor_at_failure = 0.8 | |
cutback_factor = 0.9 | |
cutback_factor_at_failure = 0.9 |
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
nl_abs_tol = 1e-3 | ||
nl_rel_tol = 1e-2 |
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.
These tolerances are very large. Try to get them closer to what we commonly use.
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
[Executioner] | ||
type = Transient | ||
end_time = ${simulation_time} | ||
dtmax = 10 |
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.
dtmax = 10 | |
dtmax = 0.1 |
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
node_size_TMAP7 = '${units 1.25e-5 m}' | ||
long_total = '${units ${fparse nb_segments_TMAP7 * node_size_TMAP7} m}' | ||
nb_segments_TMAP8 = 1e2 | ||
simulation_time = '${units 1 s}' |
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.
simulation_time = '${units 1 s}' | |
simulation_time = '${units 0.25 s}' |
Not much seems to happen after that.
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.
The equilibrium is much better with tighter tolerances! But I think we still have some room for improvement, especially for enclosure 2.
What was your experience playing with the tolerances and seeing their impact on the results?
test/tests/ver-1kc-2/tests
Outdated
input = ver-1kc-2.i | ||
exodiff = ver-1kc-2_out_k10.e | ||
prereq = ver-1kc-2_csv | ||
prereq = ver-1kc-2_csv_heavy | ||
should_execute = false # this test relies on the output files from ver-1kc-2_csv, so it shouldn't be run twice |
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.
should_execute = false # this test relies on the output files from ver-1kc-2_csv, so it shouldn't be run twice | |
should_execute = false # this test relies on the output files from ver-1kc-2_csv_heavy, so it shouldn't be run twice |
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
optimal_iterations = 20 | ||
iteration_window = 10 |
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.
Why are you using such large numbers for these two?
This means that for fewer than 20-10=10 iterations, the timestep is increased, nothing is done between 20-10=10 and 20+10=30 iterations, and the timestep is refined above 20+10=30 iterations.
However, note that since you have nl_max_its = 20
, it actually never goes above 20, and immediately refines the timestep above 20 iterations.
These numbers are usually set up lower than this, especially the iteration window.
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.
A significant number of nonlinear convergences occur for iterations exceeding 10. By setting nl_max_its = 20
and preventing the decrease in time steps between 10 and 20 (with optimal_iterations = 20
and iteration_window = 10
), I observed that the time steps increased sufficiently to achieve quicker results. However, I agree that this approach is not common in other cases, there is maybe a drawback somewhere.
test/tests/ver-1kc-2/ver-1kc-2.i
Outdated
nl_abs_tol = 1e-6 | ||
nl_rel_tol = 1e-5 |
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.
Is that the smallest you could get for this case?
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.
I tested with nl_abs_tol = 1e-8
and nl_rel_tol = 1e-6
, as used in ver-1kc-1, but the testing times were excessively long, exceeding even the limit for the heavy test.
|
||
As shown in [ver-1kc-2_mass_conservation_k10], mass is conserved between the two enclosures over time. The variation in mass is only $0.4$ %. This variation in mass can be further minimized by refining the mesh, i.e., increasing the number of segments in the domain. | ||
|
||
!media comparison_ver-1kc-2.py |
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 legend should be put in a different spot to avoid overlap with curves (bottom right, for example).
Compared to the previous solving parameters, the results are noticeably better and faster. Specifically, increasing the growth factor has helped reduce the testing time, as larger time steps can be used. In this case, I set Moreover, this is quite strange that, while both the standard and heavy tests fail here, running them locally works without issues (no mismatches in the CSV files). |
Hi @simopier, |
(Ref. #12)