-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Create CheckInit and add tagging of initializations to callbacks #783
Conversation
src/callbacks.jl
Outdated
""" | ||
struct ContinuousCallback{F1, F2, F3, F4, F5, T, T2, T3, I, R} <: AbstractContinuousCallback | ||
struct ContinuousCallback{F1, F2, F3, F4, F5, T, T2, T3, T4, I, R} <: AbstractContinuousCallback |
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.
[JuliaFormatter] reported by reviewdog 🐶
struct ContinuousCallback{F1, F2, F3, F4, F5, T, T2, T3, T4, I, R} <: AbstractContinuousCallback | |
struct ContinuousCallback{F1, F2, F3, F4, F5, T, T2, T3, T4, I, R} <: | |
AbstractContinuousCallback |
src/callbacks.jl
Outdated
The effect of using a callback with a DAE needs to be done with care because the solution | ||
`u` needs to satisfy the algebraic constraints before taking the next step. For this reason, | ||
a consistent initialization calculation must be run after running the callback. If the | ||
chosen initialization alg is `BrownBasicInit()` (the default for `solve`), then the initialization | ||
will change the algebraic variables to satisfy the conditions. Thus if `x` is an algebraic | ||
variable and the callback performs `x+=1`, the initialization may "revert" the change to | ||
satisfy the constraints. This behavior can be removed by setting `initializealg = CheckInit()`, | ||
which simply checks that the state `u` is consistent, but requires that the result of the | ||
`affect!` satisfies the constraints (or else errors). It is not recommended that `NoInit()` is | ||
used as that will lead to an unstable step following initialization. This warning can be | ||
ignored for non-DAE ODEs. |
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.
[JuliaFormatter] reported by reviewdog 🐶
The effect of using a callback with a DAE needs to be done with care because the solution | |
`u` needs to satisfy the algebraic constraints before taking the next step. For this reason, | |
a consistent initialization calculation must be run after running the callback. If the | |
chosen initialization alg is `BrownBasicInit()` (the default for `solve`), then the initialization | |
will change the algebraic variables to satisfy the conditions. Thus if `x` is an algebraic | |
variable and the callback performs `x+=1`, the initialization may "revert" the change to | |
satisfy the constraints. This behavior can be removed by setting `initializealg = CheckInit()`, | |
which simply checks that the state `u` is consistent, but requires that the result of the | |
`affect!` satisfies the constraints (or else errors). It is not recommended that `NoInit()` is | |
used as that will lead to an unstable step following initialization. This warning can be | |
ignored for non-DAE ODEs. | |
The effect of using a callback with a DAE needs to be done with care because the solution | |
`u` needs to satisfy the algebraic constraints before taking the next step. For this reason, | |
a consistent initialization calculation must be run after running the callback. If the | |
chosen initialization alg is `BrownBasicInit()` (the default for `solve`), then the initialization | |
will change the algebraic variables to satisfy the conditions. Thus if `x` is an algebraic | |
variable and the callback performs `x+=1`, the initialization may "revert" the change to | |
satisfy the constraints. This behavior can be removed by setting `initializealg = CheckInit()`, | |
which simply checks that the state `u` is consistent, but requires that the result of the | |
`affect!` satisfies the constraints (or else errors). It is not recommended that `NoInit()` is | |
used as that will lead to an unstable step following initialization. This warning can be | |
ignored for non-DAE ODEs. |
src/callbacks.jl
Outdated
DiscreteCallback(condition, affect!, initialize, finalize, save_positions) | ||
save_positions = (true, true), | ||
initializealg = nothing) | ||
DiscreteCallback(condition, affect!, initialize, finalize, save_positions, initializealg) |
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.
[JuliaFormatter] reported by reviewdog 🐶
DiscreteCallback(condition, affect!, initialize, finalize, save_positions, initializealg) | |
DiscreteCallback( | |
condition, affect!, initialize, finalize, save_positions, initializealg) |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
No description provided.