Repository navigation
Conversation
gassmoeller
left a comment
There was a problem hiding this comment.
I like it, we should make sure to use the new interface.
One question though: As far as I understand, this for now uses ReactionChain to clamp the reaction progress values, but it does not yet use ReactionChain to actually progress the reaction, do I understand this correctly?
| const unsigned int n_reaction_progress_fields = | ||
| this->introspection().get_number_of_fields_of_type(CompositionalFieldDescription::reaction_progress); | ||
|
|
||
| if (n_reaction_progress_fields > 0) | ||
| { | ||
| reaction_chain.initialize_simulator(this->get_simulator()); | ||
| reaction_chain.parse_parameters(prm); | ||
|
|
||
| AssertThrow(reaction_chain.n_reactions() == n_reaction_progress_fields, | ||
| ExcMessage("The number of reactions configured in 'Reaction chain/Kinetic models' must match " | ||
| "the number of reaction progress compositional fields.")); | ||
| AssertThrow(reaction_progress_mapping.size() == n_reaction_progress_fields, | ||
| ExcMessage("The number of entries in 'Reaction progress mapping' must match the number of " | ||
| "reaction progress compositional fields.")); | ||
| } |
There was a problem hiding this comment.
I would say unconditionally always initialize and parse the reaction chain parameters, and move the asserts into the parse_parameters function of reaction_chain. This way you will always have a fully functional reaction_chain object, that may just happen to manage 0 reactions. But that is safer than the current state, in which reaction_chain may or may not be initialized.
There was a problem hiding this comment.
Changed. But there are questions. See my other comments
Just wanted to flag something for your attention @gassmoeller and @lhy11009. @lhy11009 may or may not have already noticed issue #7287 in this updated visco plastic model. I have two open PRs that ensure:
Together, these PRs solve #7287. I have tested this in cookbook #7119. I would suggest we merge #7319 and buchanankerswell#1 before going too much further. Otherwise all material models with ReactionChain will run into issue #7287, including this one. |
|
Good point. I wanted to get to your PRs next week. My comment above still applies, but we should figure out the other issues before merging this PR. |
|
Thanks to both of you for the heads-up. I left my comments #7287 This is indeed an important issue to solve. Let me know how I can contribute. @buchanankerswell, would you be able to join the user meeting next Mon to discuss? On the other hand, it wouldn't change much what we need to do in this PR. |
Exactly, that is the case. In the existing test, I basically assign an initial value to the transition progress field. My intention is to first connect all the interfaces before using ReactionChain to actually progress the reaction. |
22dcdc2 to
2ded8e4
Compare
| void | ||
| ViscoPlastic<dim>::initialize() | ||
| { | ||
| reaction_chain.initialize(); |
There was a problem hiding this comment.
I have put the initialize function here, but the initial_simulator call is in the parse_parameters. Feel free to suggest otherwise.
| reaction_progress_mapping = Utilities::string_to_unsigned_int | ||
| (Utilities::split_string_list(prm.get ("Reaction progress mapping"))); | ||
|
|
||
| AssertThrow(reaction_progress_mapping.size() == n_reaction_progress_fields, |
There was a problem hiding this comment.
I leave this assert here, because this is checking the number of reaction_progress_mapping that is parsed in here.
| Patterns::List(Patterns::Selection(ReactionModelPluginList<dim>::get_pattern_of_names()), | ||
| 1, Patterns::List::max_int_value, "|"), | ||
| "", | ||
| Patterns::List(Patterns::Anything()), |
There was a problem hiding this comment.
I have changed the patterns here, to allow 0 kinetic models by default, similar to the "name of fields" entry for the "Composition".
| 1, Patterns::List::max_int_value, "|"), | ||
| "", | ||
| Patterns::List(Patterns::Anything()), | ||
| "'|'-separated list of registered reaction kinetics model names, one per reaction in the chain. The number of entries " |
There was a problem hiding this comment.
In addition, should we change "|" to ","?
| const unsigned int n_reaction_progress_fields = | ||
| this->introspection().get_number_of_fields_of_type(CompositionalFieldDescription::reaction_progress); | ||
|
|
||
| AssertThrow(n_reactions == n_reaction_progress_fields, |
There was a problem hiding this comment.
I move one of the asserts here. For these assertions to work, things should be parsed in this order: compositions -> reaction chains -> the assigned "mapping" in the material model. Tests passed, so this should be the case.
|
@gassmoeller, please take another look when available. And check my posts above. |
|
Hi @lhy11009, very sorry this took so long. Your changes are ok, but I think there are quite a few things inside the ReactionChain class I would like to improve before activating it in ViscoPlastic. I will open a separate PR about that. In the meantime, can you check why the testers are not compiling with this PR? I think there is something wrong about the creation/initialization order of some objects. |
|
@gassmoeller, I also think it might be good to test the series of composite PRs before merging them. Last week, I found several things to update in the existing PRs by trying to put them in the same branch. Do you think creating an issue with just bullet points of the potential changes is a good idea? This way, we can keep track of where the curve is. |
|
Yes, I think it would be good to have an issue that tracks the progress on this. Additionally I dont think we need to coordinate all your PRs from the start to work perfectly together. We can start with small independent pieces that individually make sense, and then adjust the larger pieces later to fit into the existing structure. |
|
Sorry, I didn't reply to the QS about this PR. There are things I want to change about this one, and it will fix the test issue here. I'll renew this one before our next biweekly meeting. |
|
Hi @gassmoeller, I have included a few changes in the implementation of the PR; I can explain why: Move the reaction-count validation to ViscoPlasticViscoPlastic knows which compositional fields are used for reaction progress. Therefore, it should check whether the number of these fields matches the number of reactions. This keeps ReactionChain independent while maintaining the validation. Allow cases without reaction-progress fieldsRegular visco-plastic models should work without reactions. When no reaction-progress fields exist, we skip parsing ReactionChain. However, if a kinetics list is provided, we raise an error to avoid silently ignoring the reactions. Require at least one reaction when parsing ReactionChainWhen ReactionChain is explicitly parsed, it should contain at least one kinetic model. An empty kinetics list will raise an error. Models that do not use reactions simply skip this step. Update tests and add a regression testAdd a regression test to confirm that ViscoPlastic still detects mismatches between the number of reactions and reaction-progress fields. Update the unit tests to account for the empty default kinetics list and explicitly define kinetic models where needed. These tests can now run without initializing a simulator. All the tests except for documentation passed. It is ready for review. We can discuss tomorrow during meeting. |
2ded8e4 to
54f9dec
Compare
Pull Request Checklist. Please read and check each box with an X. Delete any part not applicable. Ask on the forum if you need help with any step.
This is a PR that modified the usage of reaction progress in the Visco Plastic model, with the new reaction chain interface from @buchanankerswell
Before your first pull request:
For all pull requests:
Codex does the actual implementation. I assure that I read all the lines and performed tests myself.
For new features/models or changes of existing features: