Add option for IDA consistent initial conditions mode - #542
Add option for IDA consistent initial conditions mode#542Steven-Roberts wants to merge 7 commits into
Conversation
nkoukpaizan
left a comment
There was a problem hiding this comment.
Looks good to me in terms of providing the option to set the initialization type. I am not sure that if addresses the underlying question about steady-state initialization.
| Model::ConsistentICTypeEvaluator<ScalarT, IdxT> model; | ||
|
|
||
| Ida<ScalarT, IdxT> ida(&model); | ||
| ida.setConsistentICType(AnalysisManager::Sundials::IdaConsistentICType::YA_YDP); |
There was a problem hiding this comment.
This works well to make yp consistent with the equations. If I understood @pelesh's plan correctly, the question is whether we can use IdaConsistentICType::Y to solve for inconsistent y while fixing yp=0 (for a system with differential equations that admits a steady state solution).
I tried to use IdaConsistentICType::Y for the Texas test case, unsuccessfully. @Steven-Roberts My understanding was that this would not work, but is it expected to?
[IDAICFailFlag] The linesearch algorithm failed: step too small or too many backtracks.
29: terminate called after throwing an instance of 'AnalysisManager::Sundials::SundialsException'
29: what(): Method in Ida class failed!
I could be misunderstanding the plans...
There was a problem hiding this comment.
Yes, I'm seeing the same issue for the Texas case. Can you explain why you don't expect it to work?
It seems a necessary condition for this working is
I'll need to look closer at the logs to understand why it's failing to converge.
There was a problem hiding this comment.
From debugging the solver, it's seemingly getting stuck in a local minimum rather than a true root. I think a better initial guess is needed to get it to converge.
…#543) * std::abs--> isEqual * Make all checks explicity in IDATest::consistentICType, including unchanged states. * Add test for IDATest::consistentICType with initially consistent derivative. * Change IDATest::consistentICType model to something that admits a steady-state solution. * Increasing consistentICType tolerances. * Update tolerance comment. --------- Co-authored-by: nkoukpaizan <nkoukpaizan@users.noreply.github.com>
Description
As discussed Monday, this adds the option to pick between IDA's two modes for computing consistent initial conditions.
Proposed changes
This add
Ida::setConsistentICType(IdaConsistentICType consistent_ic_type)and a correspondingconsistent_ic_typeJSON property to set the mode. It keeps thebool findConsistentargument toIda::initializeSimulation, so it is still possible to skip the solve.Checklist
-Wall -Wpedantic -Wconversion -Wextra.