@@ -51,6 +51,10 @@ struct NonlinearSystem <: AbstractTimeIndependentSystem
51
51
"""
52
52
connector_type:: Any
53
53
"""
54
+ connections: connections in a system
55
+ """
56
+ connections:: Any
57
+ """
54
58
tearing_state: cache for intermediate tearing state
55
59
"""
56
60
tearing_state:: Any
@@ -59,11 +63,11 @@ struct NonlinearSystem <: AbstractTimeIndependentSystem
59
63
"""
60
64
substitutions:: Any
61
65
62
- function NonlinearSystem (eqs, states, ps, var_to_name, observed, jac, name, systems, defaults, connector_type, tearing_state= nothing , substitutions= nothing ; checks:: Bool = true )
66
+ function NonlinearSystem (eqs, states, ps, var_to_name, observed, jac, name, systems, defaults, connector_type, connections, tearing_state= nothing , substitutions= nothing ; checks:: Bool = true )
63
67
if checks
64
68
all_dimensionless ([states;ps]) || check_units (eqs)
65
69
end
66
- new (eqs, states, ps, var_to_name, observed, jac, name, systems, defaults, connector_type, tearing_state, substitutions)
70
+ new (eqs, states, ps, var_to_name, observed, jac, name, systems, defaults, connector_type, connections, tearing_state, substitutions)
67
71
end
68
72
end
69
73
@@ -85,7 +89,9 @@ function NonlinearSystem(eqs, states, ps;
85
89
#
86
90
# # we cannot scalarize in the loop because `eqs` itself might require
87
91
# scalarization
88
- eqs = [0 ~ x. rhs - x. lhs for x in scalarize (eqs)]
92
+ eqs = [
93
+ x. lhs isa Union{Symbolic,Number} ? 0 ~ x. rhs - x. lhs : x for x in scalarize (eqs)
94
+ ]
89
95
90
96
if ! (isempty (default_u0) && isempty (default_p))
91
97
Base. depwarn (" `default_u0` and `default_p` are deprecated. Use `defaults` instead." , :NonlinearSystem , force= true )
@@ -105,7 +111,7 @@ function NonlinearSystem(eqs, states, ps;
105
111
process_variables! (var_to_name, defaults, ps)
106
112
isempty (observed) || collect_var_to_name! (var_to_name, (eq. lhs for eq in observed))
107
113
108
- NonlinearSystem (eqs, states, ps, var_to_name, observed, jac, name, systems, defaults, connector_type, checks = checks)
114
+ NonlinearSystem (eqs, states, ps, var_to_name, observed, jac, name, systems, defaults, connector_type, nothing , checks = checks)
109
115
end
110
116
111
117
function calculate_jacobian (sys:: NonlinearSystem ; sparse= false , simplify= false )
0 commit comments