-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Cleanup and adify Reaction and MatReaction #31728
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
base: next
Are you sure you want to change the base?
Conversation
f7109ae to
55e582f
Compare
|
Job Documentation, step Docs: sync website on 1c6058b wanted to post the following: View the site here This comment will be updated on new commits. |
|
Job Coverage, step Generate coverage on 1c6058b wanted to post the following: Framework coverage
Modules coveragePhase field
Full coverage reportsReports
This comment will be updated on new commits. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
1 similar comment
0dd10cd to
6bd88cd
Compare
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.
Check above in #31728 (comment).
New tests are too long!
| /// Reaction rate material property | ||
| const ADMaterialProperty<Real> & _reaction_rate; | ||
| }; | ||
| #include "MatReaction.h" |
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.
Can remove this after MARMOT is patched after this PR is in.
| class CoefReaction : public CoefReactionTempl<false> | ||
| { | ||
| public: | ||
| static InputParameters validParams(); | ||
|
|
||
| CoefReaction(const InputParameters & parameters); | ||
|
|
||
| using CoefReactionTempl<false>::CoefReactionTempl; | ||
|
|
||
| protected: | ||
| virtual Real computeQpJacobian() override; | ||
| }; |
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.
what's the reason for these new lines? It seems like things were already working before with the simple typedefs ?
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.
It's due to needing to override computeQpJacobian due to changes in Reaction. I couldn't figure out a better way to do it.
lindsayad
left a comment
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 think you should be able to make the exact same implementation changes without adding additional class hierarchy
|
You were probably running into template type dependent base class compilation issues. In the commit I just pushed I show how you can overcome that with |
|
Another solution would be to qualify all of those data members with |
interesting...thanks!! |
framework/include/kernels/Reaction.h
Outdated
| class Reaction : public ReactionTempl<false> | ||
| { | ||
| public: | ||
| static InputParameters validParams(); | ||
|
|
||
| Reaction(const InputParameters & parameters); | ||
|
|
||
| using ReactionTempl<false>::ReactionTempl; | ||
|
|
||
| protected: | ||
| virtual Real computeQpJacobian() override; | ||
| }; |
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.
Remove
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.
oooh I see, computeQpJacobian is defined in ADKernel.h...
| return _coef * ReactionTempl<is_ad>::computeQpJacobian(); | ||
| return _coef * _test[_i][_qp] * _rate * _phi[_j][_qp]; |
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 did you change this line? I like what was there before better for code re-use
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.
Huh. I would think you'd want to reduce code duplication?
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.
recoding the phi * test * rate is code duplication
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.
so, which version is desired here?
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 old one
| // This function will never be called for the AD version. But because C++ does | ||
| // not support an optional function declaration based on a template parameter, | ||
| // we must keep this template for all cases. | ||
| mooseAssert(!is_ad, | ||
| "In ADReaction, computeQpJacobian should not be called. Check computeJacobian " | ||
| "implementation."); |
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 did you remove this?
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.
It shouldn't get here anyways, but I removed it because I thought the jacobian was never defined for AD version of Reaction, or at least that it was already at final (liked ADKernelValue). All the fancy working before was under this assumption.
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 agree it shouldn't get here. The assert is sanity checking just that
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.
yeah I can add that back.
|
|
||
| registerMooseObject("StochasticToolsTestApp", MaterialReaction); | ||
|
|
||
| registerMooseObjectReplaced("StochasticToolsTestApp", MaterialReaction, "01/01/2027 00:00", Matreaction); |
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.
| registerMooseObjectReplaced("StochasticToolsTestApp", MaterialReaction, "01/01/2027 00:00", Matreaction); | |
| registerMooseObjectReplaced("StochasticToolsTestApp", MaterialReaction, "01/01/2027 00:00", MatReaction); |
| input = 'mat_reaction.i' | ||
| difference_tol = 1e-7 | ||
| design = 'MatReaction.md' | ||
| requirement = 'The system shall calculate the correct Jacobian of MatReaction.' |
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 calculate the correct Jacobian of MatReaction.' | |
| requirement = 'The system shall calculate the correct hand-coded Jacobian for a steady-state diffusion-reaction problem.' |
| difference_tol = 1e-7 | ||
| design = 'MatReaction.md' | ||
| requirement = 'The system shall calculate the correct Jacobian of MatReaction.' | ||
| [../] |
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.
| [../] | |
| [] |
| difference_tol = 1e-7 | ||
| cli_args = 'AD=AD' | ||
| design = 'ADMatReaction.md' | ||
| requirement = 'The system shall calculate the correct Jacobian of ADMatReaction using automatic differentiation.' |
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 calculate the correct Jacobian of ADMatReaction using automatic differentiation.' | |
| requirement = 'The system shall calculate the correct Jacobian via automatic differentiation for a steady-state diffusion-reaction problem.' |
| cli_args = 'AD=AD' | ||
| design = 'ADMatReaction.md' | ||
| requirement = 'The system shall calculate the correct Jacobian of ADMatReaction using automatic differentiation.' | ||
| [../] |
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.
| [../] | |
| [] |
|
Job Test, step Results summary on 1c6058b wanted to post the following: Framework test summaryRemoved tests
Added tests
Run time changes
Modules test summaryRemoved testsNone Added testsNone Run time changes
|
#29888 showed a nice way of combining AD and nonAD while including jacobians in the non-ad without muddying up the AD classes. This PR cleans up
Reactionin this new method, and combines AD and nonADMatReaction. Also cleans up tests and clarifies internal naming conventions along the way. Also, deprecating duplicative classes.Ref #15915