-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Bifurcation kit extension #2300
Closed
Closed
Changes from 2 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
e56de20
split parameters linearize bug
cee69ed
added old MatrixGain definition for comparison
b4f821e
new promote_to_concrete
e62e3ee
improvements to protmote_to_concrete
ee4deb9
remake issue
a9c56b6
Suppose heterogeneous parameters for linearize and remake
YingboMa 1a96915
Fix zero_dummy_der
YingboMa 023e024
Relax tests
YingboMa 119cb27
Don't use SciMLBase 2
YingboMa 6bb0b2e
Merge branch 'master' into bgc/split_params_bug
YingboMa 29aec7b
Fix eq ordering
YingboMa addf335
Change bounds back
YingboMa 2e4c1bb
Format
YingboMa 2a553a7
Be careful with string sorting
YingboMa f9ea3a6
Update LaTeXify ref tests
YingboMa c2f92f1
init
TorkelE b05bc5f
makefunction
TorkelE f2d80b0
1.6 has a different term ordering
YingboMa ae05041
Fix DiscreteProblem construction
YingboMa 2309f9f
Merge pull request #2283 from SciML/bgc/split_params_bug
YingboMa fb7c3af
Update Project.toml
YingboMa 6e795b8
Fix recursive structure and setup precompilation
ChrisRackauckas 7949761
Merge pull request #2301 from SciML/precompile_workload
ChrisRackauckas c5bd821
docs(refactor): update acausal components tutorial with `@mtkmodel`
ven-k 6ac545d
docs(refactor): update structural identifiability tutorial with `@mtk…
ven-k 278698b
docs(fix): set a `u0` within the constraint for the optimization problem
ven-k 94fb749
docs(refactor): refactor "Getting Started" section with `@mtkmodel`
ven-k 438a225
docs(refactor): rename the `@mtkmodel` docs page as "Defining compone…
ven-k ff2a778
docs: reword Components and Connectors and elaborate Connectors and M…
ven-k 2ef4752
docs: add `connect` section to Variable metadata
ven-k 3034c9f
Merge pull request #2286 from ven-k/vkb/mtkmodel-examples
ChrisRackauckas c4868e3
Add `@mtkbuild` greatly simplify the tutorials
ChrisRackauckas ac75e77
Add `parent` to hierarchical systems and set it in `structural_simplify`
YingboMa b0c2938
Format
YingboMa c3c030e
Add "docs/src/assets/*.toml" to gitignore
YingboMa cd0f04a
Add tests
YingboMa 0d5ab59
Fix CI
YingboMa 7370a45
fix tutorial syntax
ChrisRackauckas 137d3d1
Support implicit name unpack in `at extend`
YingboMa c679dd9
fix acausal tutorial
ChrisRackauckas 17a3b6a
Merge pull request #2305 from SciML/mtkbuild
ChrisRackauckas 3d83c4c
one more tutorial simplification
ChrisRackauckas 0a9dca1
Merge branch 'master' into myb/extend
YingboMa 73f9e0a
Stop using `at testset` macro
YingboMa 718ae81
Remove ODAEProblem from acausal tutorial
ChrisRackauckas 0bcdee8
Merge pull request #2308 from SciML/odaeproblem
YingboMa 379161f
Merge pull request #2307 from SciML/tuts
YingboMa 314bb1d
Merge pull request #2306 from SciML/myb/extend
YingboMa 298a9a5
patch system names
ChrisRackauckas bdc45d1
Simplify `at extend`
YingboMa 1152f30
update docs for new extension syntax
ChrisRackauckas 9e45fee
fix for simplified extend
ChrisRackauckas 563f04f
Merge pull request #2310 from SciML/myb/extend
ChrisRackauckas 2c17d63
Merge pull request #2309 from SciML/extend
ChrisRackauckas d4239a7
Update Project.toml
ChrisRackauckas bc93796
non canonical docstrings
ArnoStrouwen b54b05b
update contributing docs
ArnoStrouwen 0ef0bb4
Merge pull request #2315 from ArnoStrouwen/docs
ChrisRackauckas 2c86306
updates
TorkelE 3249aeb
init
TorkelE 7f5d8be
makefunction
TorkelE c4a1a20
updates
TorkelE 918f5e6
Merge remote-tracking branch 'TorkelE/BifurcationKitExtension' into B…
TorkelE 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 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 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,40 @@ | ||
module MTKBifurcationKitExt | ||
|
||
println("BifurcationKit extension loaded") | ||
|
||
### Preparations ### | ||
|
||
# Imports | ||
using ModelingToolkit, Setfield | ||
import BifurcationKit | ||
|
||
### Creates BifurcationProblem Overloads ### | ||
|
||
# When input is a NonlinearSystem. | ||
function BifurcationKit.BifurcationProblem(nsys::NonlinearSystem, u0_guess, p_start, bif_par, args...; plot_var=nothing, record_from_solution=BifurcationKit.record_sol_default, kwargs...) | ||
# Creates F and J functions. | ||
ofun = NonlinearFunction(nsys; jac=true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the jac required? The user should request it if it's not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will make it optional. |
||
F = ofun.f | ||
J = ofun.jac | ||
|
||
# Computes bifurcation parameter and plot var indexes. | ||
bif_idx = findfirst(isequal(bif_par), parameters(nsys)) | ||
if !isnothing(plot_var) | ||
plot_idx = findfirst(isequal(plot_var), states(nsys)) | ||
record_from_solution = (x, p) -> x[plot_idx] | ||
end | ||
|
||
# Converts the input state guess. | ||
u0_guess = ModelingToolkit.varmap_to_vars(u0_guess, states(nsys)) | ||
|
||
return BifurcationKit.BifurcationProblem(F, u0_guess, [p_start], (@lens _[1]), args...; record_from_solution = record_from_solution, J = J, kwargs...) | ||
end | ||
|
||
# When input is a ODESystem. | ||
function BifurcationKit.BifurcationProblem(osys::ODESystem, u0, p, args...; kwargs...) | ||
return BifurcationProblem(convert(NonlinearProblem, osys), args...; kwargs...) | ||
end | ||
|
||
|
||
|
||
end # module |
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.
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.
fix the naming.
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.
what should I name it?