-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added ComponentsConvergence #31039
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?
Added ComponentsConvergence #31039
Conversation
|
@lindsayad @GiudGiud @licharlot For anyone interested, I'm putting up this PR for the concept to be reviewed. This is how I'm planning to handle convergence for Components. I'm still working on the pieces I plan to use for the individual convergence checks. Here's generally what I'm thinking might be "good" criteria:
|
|
i like the idea. I think this mirrors the component-scaling that was done in SAM but without modifying the nonlinear solve performance |
|
Job Documentation, step Docs: sync website on 75bfb3d wanted to post the following: View the site here This comment will be updated on new commits. |
|
Job Coverage, step Generate coverage on 75bfb3d wanted to post the following: Framework coverage
Modules coverageThermal hydraulics
Full coverage reportsReports
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.
Looks sensical to me
21be217 to
f64f739
Compare
a74a5c2 to
7945b8a
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.
Not a formal review, just an early curious look with some suggestions. I can see how great this is going to be now! This should bring the long-sought robustness to THM. or at least help
| } | ||
|
|
||
| bool | ||
| FEProblemBase::hasMaterial(const std::string & name, const THREAD_ID tid) |
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.
| FEProblemBase::hasMaterial(const std::string & name, const THREAD_ID tid) | |
| FEProblemBase::hasActiveMaterial(const std::string & name, const THREAD_ID tid) |
considering the implementation below
|
|
||
| This [IterationCountConvergence.md] can be used with the [Components system](Components/index.md) to check the convergence of all Components that return a Convergence object with `getNonlinearConvergence()`. The inner convergence check returns its convergence status as follows: | ||
|
|
||
| - `CONVERGED`: All Components returning a Convergence object are `CONVERGED` |
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.
| - `CONVERGED`: All Components returning a Convergence object are `CONVERGED` | |
| - `CONVERGED`: All Convergence objects created by Components are `CONVERGED` |
same for the other?
modules/thermal_hydraulics/doc/content/source/convergence/FlowChannel1PhaseConvergence.md
Show resolved
Hide resolved
| @@ -0,0 +1,14 @@ | |||
| # (AD)FlowModel1PhaseFunctorMaterial | |||
|
|
|||
| This [functor material](/FunctorMaterials/index.md) computes the following quantities | |||
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 [functor material](/FunctorMaterials/index.md) computes the following quantities | |
| This [functor material](/FunctorMaterials/index.md) creates functor material properties for the following quantities |
can you add something like "the names of the functor material properties" are specified by ...
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 guess you need to use a listing of THM.h to get the names
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'll add the names of the properties manually
| This post-processor normalizes [ElementExtremeFunctorValue.md] by a provided | ||
| constant, for use by [FlowChannel1PhaseConvergence.md]. |
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 name of that PP does not really convey this function. Could be renamed imo
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 struggled with making it a reasonable length, but I'm open to suggestions. I decided to name it based on concept
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 not just add a scaling factor for ElementExtremeFunctorValue ?
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'll do that
| const std::vector<std::pair<std::string, Real>> var_norm_pairs{ | ||
| {THM::PRESSURE, _p_ref}, {THM::TEMPERATURE, _T_ref}, {THM::VELOCITY, _vel_ref}}; | ||
| for (const auto & var_norm_pair : var_norm_pairs) | ||
| addTHMNormalizedVariableStep(var_norm_pair.first, var_norm_pair.second); |
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 does not seem 1 phase or THM specific? Maybe it should be in a ConvergneceUtils
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 step PP itself you mean? Not sure what you're suggesting with ConvergenceUtils. I had considered modifying ElementExtremeFunctorValue but didn't want to "pollute" it. I also considered just using an existing PP to scale, but didn't want the 2nd PP existing (it'd probably be ok though).
| return Convergence::MooseConvergenceStatus::DIVERGED; | ||
| else if (status == Convergence::MooseConvergenceStatus::ITERATING) | ||
| all_converged = 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.
maybe check else == converged
so we are future proof if a 4th option is created for MooseConvergenceStatus::
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.
an assert should be enough to do 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.
I feel pretty good about keeping these 3 options into eternity - to me it feels like a basic design of the system
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.
even basic design can change
eternity sounds like a very long time. and who knows where AI-driven completely automated development will take moose..
| addPressureFunctorProperty<true>(); | ||
| addPressureFunctorProperty<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.
do you need both? what for?
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 need to take better notes... I'll put some comments in the code after I refresh my memory. But basically error messages would come up regarding mismatch of AD and non-AD.
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.
ok let s document who s requesting this stuff in both flavors. that might be a hidden issue
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.
Looks like only the non-AD is needed, so I'll just add that for now. I'm guessing that earlier, I was trying to leverage the functor property in some other places.
| template <bool is_ad> | ||
| void | ||
| FlowModel1PhaseFunctorMaterial::addPressureFunctorProperty() |
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 all these templates should move to the source, as you are not using them from another file
|
|
||
| const auto variable = getParam<VariableName>("variable"); | ||
| if (variable == "rhoA") | ||
| return rho_ref * A_ref * h_min; |
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 there a reason for h_min rather than L_component?
is the residual proportional to 1/dx for THM solves?
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.
Right, it's targeted at the residual for each nonlinear equation, which is proportional to dx (finite volume).
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 residual for each cell. how do we get the residual for the whole equation? Is an operation more like infinite norm or sum of absolute residuals?
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 base class computes a discrete norm (l1, l2, or linf) of the element residuals for that variable. I choose linf.
7945b8a to
75bfb3d
Compare
|
Job Test, step Results summary on 75bfb3d wanted to post the following: Framework test summaryCompared against bb0a08b in job civet.inl.gov/job/3353620. Removed testsAdded testsRun time changesModules test summaryCompared against bb0a08b in job civet.inl.gov/job/3353620. Removed testsAdded tests
Run time changes
|
ComponentsConvergencethat checks convergence of all componentsComponent::getNonlinearConvergence()to return that Component's convergence, if anyRefs #31038