-
-
Notifications
You must be signed in to change notification settings - Fork 106
fix nlprob to match the initialization system #860
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
Merged
ChrisRackauckas
merged 11 commits into
SciML:master
from
oscardssmith:os/refactor-nlprob-to-nlprob_data
Nov 16, 2024
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cec0c19
fix nlprob to match the initialization system
oscardssmith 1e2511d
typo
oscardssmith 80c570b
add file
oscardssmith 70f6a32
import
oscardssmith cab9450
adress review
oscardssmith 1c1e31b
address review
oscardssmith 39be7e4
Update ODE_nlsolve.jl
oscardssmith 5ce4abd
fix include order
oscardssmith 07fdb85
fix ordering
oscardssmith 3791ff6
fixes
oscardssmith 067a926
typo
oscardssmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
$(TYPEDEF) | ||
|
||
A collection of all the data required for custom ODE Nonlinear problem solving | ||
""" | ||
struct ODE_NLProb{NLProb, UNLProb, NLProbMap, NLProbPmap} | ||
""" | ||
The `AbstractNonlinearProblem` to define custom nonlinear problems to be used for | ||
implicit time discretizations. This allows to use extra structure of the ODE function (e.g. | ||
multi-level structure). The nonlinear function must match that form of the function implicit | ||
ODE integration algorithms need do solve the a nonlinear problems, | ||
specifically of the form `z = outer_tmp + dt⋅f(γ⋅z+inner_tmp,p,t)`. | ||
Here `z` is the stage solution vector, `p` is the parameter of the ODE problem, `t` is | ||
the time, `dt` the respective time increment`, `γ` is some scaling factor and the temporary | ||
variables are some compatible vectors set by the specific solver. | ||
Note that this field will not be used for integrators such as fully-implicit Runge-Kutta methods | ||
that need to solve different nonlinear systems. | ||
The inner nonlinear function of the nonlinear problem is in general of the form `g(z,p') = 0` | ||
where `p'` is a NamedTuple with all information about the specific nonlinear problem at hand to solve | ||
for a specific time discretization. Specifically, it is `(;dt, γ, inner_tmp, outer_tmp, t, p)`, such that | ||
`g(z,p') = dt⋅f(γ⋅z+inner_tmp,p,t) + outer_tmp - z = 0`. | ||
""" | ||
nlprob::NLProb | ||
""" | ||
A function which takes `(nlprob, value_provider)` and updates | ||
the parameters of the former with their values in the latter. | ||
If absent (`nothing`) this will not be called, and the parameters | ||
in `nlprob` will be used without modification. `value_provider` | ||
refers to a value provider as defined by SymbolicIndexingInterface.jl. | ||
Usually this will refer to a problem or integrator. | ||
""" | ||
update_nlprob!::UNLProb | ||
""" | ||
A function which takes the solution of `nlprob` and returns | ||
the state vector of the original problem. | ||
""" | ||
nlprobmap::NLProbMap | ||
""" | ||
A function which takes the solution of `nlprob` and returns | ||
the parameter object of the original problem. If absent (`nothing`), | ||
this will not be called and the parameters of the problem being | ||
solved will be returned as-is. | ||
""" | ||
nlprobpmap::NLProbPmap | ||
|
||
function ODE_NLProb(nlprob::I, update_nlprob!::J, nlprobmap::K, | ||
nlprobpmap::L) where {I, J, K, L} | ||
return new{I, J, K, L}(nlprob, update_nlprob!, nlprobmap, nlprobpmap) | ||
end | ||
end | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.