Skip to content

Commit 80c570b

Browse files
author
oscarddssmith
committed
add file
1 parent 1e2511d commit 80c570b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

src/ODE_nlsolve.jl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""
2+
$(TYPEDEF)
3+
4+
A collection of all the data required for custom ODE Nonlinear problem solving
5+
"""
6+
struct ODE_NLProb{NLProb, UNLProb, NLProbMap, NLProbPmap}
7+
"""
8+
The `AbstractNonlinearProblem` to define custom nonlinear problems to be used for
9+
implicit time discretizations. This allows to use extra structure of the ODE function (e.g.
10+
multi-level structure). The nonlinear function must match that form of the function implicit
11+
ODE integration algorithms need do solve the a nonlinear problems,
12+
specifically of the form `z = outer_tmp + dt⋅f(γ⋅z+inner_tmp,p,t)`.
13+
Here `z` is the stage solution vector, `p` is the parameter of the ODE problem, `t` is
14+
the time, `dt` the respective time increment`, `γ` is some scaling factor and the temporary
15+
variables are some compatible vectors set by the specific solver.
16+
Note that this field will not be used for integrators such as fully-implicit Runge-Kutta methods
17+
that need to solve different nonlinear systems.
18+
The inner nonlinear function of the nonlinear problem is in general of the form `g(z,p') = 0`
19+
where `p'` is a NamedTuple with all information about the specific nonlinear problem at hand to solve
20+
for a specific time discretization. Specifically, it is `(;dt, γ, inner_tmp, outer_tmp, t, p)`, such that
21+
`g(z,p') = dt⋅f(γ⋅z+inner_tmp,p,t) + outer_tmp - z = 0`.
22+
"""
23+
nlprob::NLProb
24+
"""
25+
A function which takes `(nlprob, value_provider)` and updates
26+
the parameters of the former with their values in the latter.
27+
If absent (`nothing`) this will not be called, and the parameters
28+
in `nlprob` will be used without modification. `value_provider`
29+
refers to a value provider as defined by SymbolicIndexingInterface.jl.
30+
Usually this will refer to a problem or integrator.
31+
"""
32+
update_nlprob!::UNLProb
33+
"""
34+
A function which takes the solution of `nlprob` and returns
35+
the state vector of the original problem.
36+
"""
37+
nlprobmap::NLProbMap
38+
"""
39+
A function which takes the solution of `nlprob` and returns
40+
the parameter object of the original problem. If absent (`nothing`),
41+
this will not be called and the parameters of the problem being
42+
solved will be returned as-is.
43+
"""
44+
nlprobpmap::NLProbPmap
45+
46+
function ODE_NLProb(nlprob::I, update_nlprob!::J, nlprobmap::K,
47+
nlprobpmap::L) where {I, J, K, L}
48+
return new{I, J, K, L}(nlprob, update_nlprob!, nlprobmap, nlprobpmap)
49+
end
50+
end
51+

0 commit comments

Comments
 (0)