Skip to content

Add a tutorial for initialization handling #2518

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
merged 7 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
the `parameter_dependencies` keyword argument of `ODESystem`, `SDESystem` and `JumpSystem`. The dependent
parameters are updated whenever other parameters are modified, e.g. in callbacks.
- Support for `IfElse.jl` has been dropped. `Base.ifelse` can be used instead.
- DAE initailization and the solving for consistent initial conditions has been changed to use a customized
- DAE initialization and the solving for consistent initial conditions has been changed to use a customized
initialization solve. This change adds `guess` semantics which are clearly delinated from the behavior of
the defaults, where `default` (and `u0`) is designed to be always satisfied and error if unsatisfiable,
while `guess` is an initial guess to the initializer. In previous iterations, initialization with the
Expand Down
1 change: 1 addition & 0 deletions docs/pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pages = [
"tutorials/ode_modeling.md",
"Tutorials" => Any["tutorials/acausal_components.md",
"tutorials/nonlinear.md",
"tutorials/initialization.md",
"tutorials/optimization.md",
"tutorials/modelingtoolkitize.md",
"tutorials/programmatically_generating.md",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/basics/MTKModel_Connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ julia> @mtkbuild model_c2 = ModelC(; p1 = 2.0)
- Whenever components are created with `@named` macro, these can be accessed with `.` operator as `subcomponent_name.argname`
- In the above example, as `k` of `model_a` isn't listed while defining the sub-component in `ModelC`, its default value can't be modified by users. While `k_array` can be set as:

```@example mtkmodel-example
```julia
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ven-k note your doc build is broken.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that; working on the fix. Will add that separately.

using ModelingToolkit: getdefault

@mtkbuild model_c3 = ModelC(; model_a.k_array = [1.0, 2.0])
Expand Down
Loading