-
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?
Changes from 7 commits
a53ac86
9afff6c
c97dbd4
2ed12e4
c87f2c5
add17e3
6bd88cd
660e05e
0e20ff1
ac55f54
1c6058b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| MatReaction.md |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,22 @@ class CoefReactionTempl : public ReactionTempl<is_ad> | |
|
|
||
| protected: | ||
| virtual GenericReal<is_ad> computeQpResidual() override; | ||
| virtual Real computeQpJacobian() override; | ||
|
|
||
| /// input parameter multiplied by the reaction kernel | ||
| const Real _coef; | ||
| }; | ||
|
|
||
| typedef CoefReactionTempl<false> CoefReaction; | ||
| class CoefReaction : public CoefReactionTempl<false> | ||
| { | ||
| public: | ||
| static InputParameters validParams(); | ||
|
|
||
| CoefReaction(const InputParameters & parameters); | ||
|
|
||
| using CoefReactionTempl<false>::CoefReactionTempl; | ||
|
|
||
| protected: | ||
| virtual Real computeQpJacobian() override; | ||
| }; | ||
|
||
|
|
||
lindsayad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| typedef CoefReactionTempl<true> ADCoefReaction; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,13 +24,24 @@ class ReactionTempl : public GenericKernel<is_ad> | |
|
|
||
| protected: | ||
| virtual GenericReal<is_ad> computeQpResidual() override; | ||
| virtual Real computeQpJacobian() override; | ||
|
|
||
| /// Scalar coefficient representing the relative amount consumed per unit time | ||
| const Real & _rate; | ||
|
|
||
| usingGenericKernelMembers; | ||
| }; | ||
|
|
||
| typedef ReactionTempl<false> Reaction; | ||
| class Reaction : public ReactionTempl<false> | ||
| { | ||
| public: | ||
| static InputParameters validParams(); | ||
|
|
||
| Reaction(const InputParameters & parameters); | ||
|
|
||
| using ReactionTempl<false>::ReactionTempl; | ||
|
|
||
| protected: | ||
| virtual Real computeQpJacobian() override; | ||
| }; | ||
|
||
|
|
||
| typedef ReactionTempl<true> ADReaction; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,8 +9,8 @@ | |
|
|
||
| #include "CoefReaction.h" | ||
|
|
||
| registerMooseObject("MooseApp", CoefReaction); | ||
| registerMooseObject("MooseApp", ADCoefReaction); | ||
| registerMooseObjectReplaced("MooseApp", CoefReaction, "01/01/2027 00:00", Reaction); | ||
| registerMooseObjectReplaced("MooseApp", ADCoefReaction, "01/21/2027 00:00", ADReaction); | ||
|
|
||
| template <bool is_ad> | ||
| InputParameters | ||
|
|
@@ -35,17 +35,21 @@ CoefReactionTempl<is_ad>::computeQpResidual() | |
| return _coef * ReactionTempl<is_ad>::computeQpResidual(); | ||
| } | ||
|
|
||
| template <bool is_ad> | ||
| InputParameters | ||
| CoefReaction::validParams() | ||
| { | ||
| return CoefReactionTempl<false>::validParams(); | ||
| } | ||
|
|
||
| CoefReaction::CoefReaction(const InputParameters & parameters) | ||
| : CoefReactionTempl<false>(parameters) | ||
| { | ||
| } | ||
|
|
||
lindsayad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Real | ||
| CoefReactionTempl<is_ad>::computeQpJacobian() | ||
| CoefReaction::computeQpJacobian() | ||
lindsayad marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| // 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 ADCoefReaction, computeQpJacobian should not be called. Check computeJacobian " | ||
| "implementation."); | ||
| return _coef * ReactionTempl<is_ad>::computeQpJacobian(); | ||
| return _coef * _test[_i][_qp] * _rate * _phi[_j][_qp]; | ||
|
Comment on lines
-48
to
+42
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh. I would think you'd want to reduce code duplication?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. recoding the phi * test * rate is code duplication
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so, which version is desired here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the old one |
||
| } | ||
|
|
||
| template class CoefReactionTempl<false>; | ||
|
|
||
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.