-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add multi-system to FEProblemSolve and deploy on Physics syntax #29021
base: next
Are you sure you want to change the base?
Conversation
bda2b80
to
665b214
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.
It's looking good!
abbcc10
to
b2069b1
Compare
Job Documentation, step Docs: sync website on 8f0ff16 wanted to post the following: View the site here This comment will be updated on new commits. |
a64d0c1
to
7dc574e
Compare
Job Coverage, step Generate coverage on 4c83d80 wanted to post the following: Framework coverage
Modules coverageContact
Heat transfer
Navier stokes
Optimization
Scalar transport
Full coverage reportsReports
Warnings
This comment will be updated on new commits. |
Got to add doco and fix the odd straggler tests but otherwise ready to get looked at |
Add documentation for multi-system fixed point
- more careful distinction between linear and nonlinear systems - fix error messages Co-authored-by: joshuahansel <[email protected]>
- remove extra space on Solve converged - check for the existence of a single default NL conv - make the minimalApp test more resilient to ordering of object creation
…ariable name Re-order tasks to make adding variables before checking integrity in physics (checks variables & systems) Add missing required tasks
…oners to function They rely on solving only one system, then performing operations in their OTHER solveObject (not fixed point solve, not inner_solve) then solving the second one
4c83d80
to
4368c4d
Compare
// We seek to prevent the MultiSystemSolveObject from solving both systems | ||
// This is abusing input parameters, but SolveObjects do not have their own syntax | ||
// and we need to send this parameter from the executioner to the default nested SolveObject | ||
params.addPrivateParam<bool>("solve_only_first_system", true); |
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.
could also be cleaner to set the system_names here and not make it private. I have not made up my mind!
Either way it's messy to be sending parameters like this in my opinion
6d60fe9
to
8f0ff16
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.
gonna be substantial merge conflicts for me 😢
/// @param index index of the nonlinear system | ||
/// @return parameter for that nonlinear system | ||
template <typename T> | ||
T getParamFromNonlinearSystemVectorParam(std::string param_name, unsigned int index) const; |
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.
T getParamFromNonlinearSystemVectorParam(std::string param_name, unsigned int index) const; | |
T getParamFromNonlinearSystemVectorParam(const std::string & param_name, unsigned int index) const; |
_systems.push_back(&_problem.getSolverSystem(_problem.nlSysNum(sys_name))); | ||
_num_nl_systems++; | ||
} | ||
else if (std::find(linear_sys_names.begin(), linear_sys_names.end(), sys_name) != | ||
linear_sys_names.end()) | ||
_systems.push_back(&_problem.getSolverSystem(_problem.nlSysNum(sys_name))); |
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 store these separately and avoid the dynamic cast in FEProblemSolve
?
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 that preferred? Is the dynamic cast a worse problem than having to double up any loop acting on the list of systems?
expect_out = "FEProblem\nDefaultNonlinearConvergence\nGeneratedMesh" | ||
expect_out = "FEProblem\n*GeneratedMesh" |
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.
You could just move the convergence object ahead of the problem
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 saw someone on discussion get a test failure there. I think this test is brittle
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.
Yes it's because @joshuahansel must have done a git sed
to change the name and then didn't change the order here
/// Whether to only solve the first nonlinear system, which is the legacy behavior | ||
const bool _solve_only_first_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.
I don't like this data member. If this can be true, then this class is not truly a MultiSystemSolveObject
. I think either this data member needs to go away or FEProblemSolve
should not inherit from MultiSystemSolveObject
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 that's fair. I did not need this, until I tried to get the optimization module tests to pass. It uses two solve objects m, one for each system.
I have a different solution you might like more.
/// Convergence object to assess the convergence of the multi-system fixed point iteration | ||
Convergence * _multi_sys_fp_convergence; |
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.
If we had a class dedicated to multisystem solves then this could be a reference. Trying to retro-fit FEProblemSolve
as a multi-system solve really is feeling like a poor fit.
On a different note, I do not know if there are segregated solve options that do not fit in a fixed-point class of algorithms? In which case there may not be a need for this _fp_
denotion
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 problem is that there is no dedicated solve object syntax.
So what you are asking means duplicating the executioners instead, adding a MultiSystemSteady and a MiltiSystemTrnsient. This PR makes it work without doing 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.
This also takes it down the path of objects like IterationAdaptiveDT
where we just keep bolting on pieces instead of having a modular system. What I am asking is that we have syntax for solve objects, e.g. executors
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 @joshuahansel wants to work with @loganharbour to finish executors? He knocked down convergence objects
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.
Feels more like they knocked me down 😁 I'd be happy to try to help with executors, but Sockeye deadlines demand my attention for at least two months.
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 see executors as removing the executioner/solve object separation. This separation is not that natural and performed inconsistently.
This also takes it down the path of objects like IterationAdaptiveDT where we just keep bolting on pieces instead of having a modular system.
No I don't think that s a great analogy because I don't see how you would implement multi-system without the lines I added. I am replacing a single system object with a multi system solve object, not adding multi system as an option to single-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.
I think in a world of executors and not this current solve object paradigm, it would be quite easy to implement multisystem. You just have a MultiSystem executor which logically would have some kind of convergence object that works naturally with multisystem. Additionally the MultiSystem or MultiXXX executor would have a parameter that takes a vector of other executors to execute. Some of these may be SingleSystem executors, for whom such a vector parameter would not make sense and for whom a multi-system or multi-executor convergence object also doesn't make sense. A MultiXXX object is fundamentally different thatn a SingleXXX object because the MultiXXX object immediately introduces the possibility of iteration. I think there should be clear distinction between objects with MultiXXX functionality and SingleXXX functionality because the parameter set is logically much more complex for the former.
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 in a world of executors and not this current solve object paradigm, it would be quite easy to implement multisystem. You just have a MultiSystem executor which logically would have some kind of convergence object that works naturally with multisystem
Agree
Additionally the MultiSystem or MultiXXX executor would have a parameter that takes a vector of other executors to execute. Some of these may be SingleSystem executors, for whom such a vector parameter would not make sense and for whom a multi-system or multi-executor convergence object also doesn't make sense
Agree
A MultiXXX object is fundamentally different thatn a SingleXXX object because the MultiXXX object immediately introduces the possibility of iteration. I think there should be clear distinction between objects with MultiXXX functionality and SingleXXX functionality because the parameter set is logically much more complex for the former.
Agree for executors. And for solveObjects I am moving FEProblemSolve from a singleXXX to a MultiXXX, and the parameters are adapted to be vectors.
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.
@lindsayad Seems like a good design at first glance - are you requesting that executors be finished before this PR? Or just discussing future refactoring?
while (_multi_sys_fp_convergence | ||
? (_multi_sys_fp_convergence->checkConvergence(num_fp_multisys_iters) == | ||
Convergence::MooseConvergenceStatus::ITERATING) | ||
: !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.
If you don't have the convergence object and have multisystem could you iterate forever? I think that if you have multisystem, the convergence object should be a required parameter
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.
See the constructor, it is required
/// Convergence object to assess the convergence of the multi-system fixed point iteration | ||
Convergence * _multi_sys_fp_convergence; |
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 in a world of executors and not this current solve object paradigm, it would be quite easy to implement multisystem. You just have a MultiSystem executor which logically would have some kind of convergence object that works naturally with multisystem. Additionally the MultiSystem or MultiXXX executor would have a parameter that takes a vector of other executors to execute. Some of these may be SingleSystem executors, for whom such a vector parameter would not make sense and for whom a multi-system or multi-executor convergence object also doesn't make sense. A MultiXXX object is fundamentally different thatn a SingleXXX object because the MultiXXX object immediately introduces the possibility of iteration. I think there should be clear distinction between objects with MultiXXX functionality and SingleXXX functionality because the parameter set is logically much more complex for the former.
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 this PR should be split into two. Can we change the title to highlight some of the more fundamental additions/changes in this PR? The things I'm concerned about are separate from the Physics classes.
I also do not like that we have hard-coded a certain type of fixed point iteration (for which conceptually we would hope to have something like a FixedPointSolveObject
electable from the input file) in a FEProblemSolve
object
The same issues will come up with this I think: Maybe it has an excuse that currently there is no executioner that can run a linear system on its own in the framework. |
closes #29019
Includes:
Next items we need (TODO but not in this PR?)
This is requiring this PR in libmesh: Add a parameter object on the system, use it in derived classes libMesh/libmesh#4007
For these last two tasks, i think the solutions will be fairly close to what gets used for MultiAppFixedPointConvergence when that gets figured out.