Use reaction chain in visco plastic model - #7331
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. |
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: