Skip to content

Commit cd31781

Browse files
authored
Merge pull request #181 from JuliaDynamics/hw/function2model
2 parents f321e1e + 60e0ecc commit cd31781

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+604
-602
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# rename Edge/Vertex/ComponentFunction -> EdgeVertex/ComponentModel
2+
10b8809cd185e5bc65f9c78ed5c1408b9e622802

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Users of the package should probably read the new documentation carefully.
88
The most important changes are:
99

1010
- Explicit split in `f` and `g` function: There is no split into `ODE` and
11-
`Static` components anymore, verything is unified in component functions with
11+
`Static` components anymore, everything is unified in component models with
1212
internal function `f` and output function `g`.
1313
- Parameters handling: Parameters are allways stored in a flat array. The
1414
Symbolic Indexing Interfaces helps to set and retrieve parameters.

benchmark/benchmark_compat.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ end
3030

3131
function _syms_old_order(nd::Network)
3232
syms = []
33-
for (i,cf) in enumerate(nd.im.vertexf)
33+
for (i,cf) in enumerate(nd.im.vertexm)
3434
isdynamic(cf) || continue
3535
append!(syms, collect(VIndex(i, 1:dim(cf))))
3636
end
37-
for (i,cf) in enumerate(nd.im.edgef)
37+
for (i,cf) in enumerate(nd.im.edgem)
3838
isdynamic(cf) || continue
3939
append!(syms, collect(EIndex(i, 1:dim(cf))))
4040
end
4141
syms
4242
end
4343
function _psyms_old_order(nd::Network)
4444
syms = []
45-
for (i,cf) in enumerate(nd.im.vertexf)
45+
for (i,cf) in enumerate(nd.im.vertexm)
4646
append!(syms, collect(VPIndex(i, 1:pdim(cf))))
4747
end
48-
for (i,cf) in enumerate(nd.im.edgef)
48+
for (i,cf) in enumerate(nd.im.edgem)
4949
append!(syms, collect(EPIndex(i, 1:pdim(cf))))
5050
end
5151
syms

benchmark/benchmark_models.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,40 @@ Base.@propagate_inbounds function diffusionedge!(e, v_s, v_d, _, _)
66
e[1] = v_s[1] - v_d[1]
77
nothing
88
end
9-
diffusion_edge() = EdgeFunction(; g=AntiSymmetric(diffusionedge!), outdim=1, pdim=0)
9+
diffusion_edge() = EdgeModel(; g=AntiSymmetric(diffusionedge!), outdim=1, pdim=0)
1010

1111
Base.@propagate_inbounds function diffusion_dedge!(de, e, v_s, v_d, _, _)
1212
de[1] = 100.0 * (sin(v_s[1] - v_d[1]) - e[1])
1313
de[2] = 100.0 * (sin(v_d[1] - v_s[1]) - e[2])
1414
nothing
1515
end
16-
diffusion_dedge() = EdgeFunction(; f=diffusion_dedge!, dim=2, pdim=0, g=Fiducial(dst=1:1, src=2:2))
16+
diffusion_dedge() = EdgeModel(; f=diffusion_dedge!, dim=2, pdim=0, g=Fiducial(dst=1:1, src=2:2))
1717

1818
Base.@propagate_inbounds function diffusionvertex!(dv, _, esum, _, _)
1919
dv[1] = esum[1]
2020
nothing
2121
end
22-
diffusion_vertex() = VertexFunction(; f=diffusionvertex!, dim=1, pdim=0, g=StateMask(1:1))
22+
diffusion_vertex() = VertexModel(; f=diffusionvertex!, dim=1, pdim=0, g=StateMask(1:1))
2323

2424
####
2525
#### inhomogenious kuramoto system
2626
####
2727
Base.@propagate_inbounds function kuramoto_edge!(e, θ_s, θ_d, (K,), t)
2828
e[1] = K * sin(θ_s[1] - θ_d[1])
2929
end
30-
static_kuramoto_edge() = EdgeFunction(; g=AntiSymmetric(kuramoto_edge!), outdim=1, pdim=1)
30+
static_kuramoto_edge() = EdgeModel(; g=AntiSymmetric(kuramoto_edge!), outdim=1, pdim=1)
3131

3232
Base.@propagate_inbounds function kuramoto_vertex!(dθ, θ, esum, (ω,), t)
3333
dθ[1] = ω + esum[1]
3434
end
35-
kuramoto_vertex_1d() = VertexFunction(; f=kuramoto_vertex!, pdim=1, sym=[], g=StateMask(1:1))
35+
kuramoto_vertex_1d() = VertexModel(; f=kuramoto_vertex!, pdim=1, sym=[], g=StateMask(1:1))
3636

3737
Base.@propagate_inbounds function kuramoto_inertia!(dv, v, esum, (P,), t)
3838
dv[1] = v[2]
3939
dv[2] = P - 1.0 * v[2]
4040
dv[2] += esum[1]
4141
end
42-
kuramoto_vertex_2d() = VertexFunction(; f=kuramoto_inertia!, dim=2, pdim=1, sym=[, ], g=StateMask(1:1));
42+
kuramoto_vertex_2d() = VertexModel(; f=kuramoto_inertia!, dim=2, pdim=1, sym=[, ], g=StateMask(1:1));
4343

4444
####
4545
#### powergrid model
@@ -60,7 +60,7 @@ Base.@propagate_inbounds function piline!(out_src, out_dst, src, dst, p, t)
6060
out_src[2] = -imag(isrc)
6161
nothing
6262
end
63-
piline() = EdgeFunction(; g=piline!, outsym=(;src=[:src_i_r, :src_i_i], dst=[:dst_i_r, :dst_i_i]),
63+
piline() = EdgeModel(; g=piline!, outsym=(;src=[:src_i_r, :src_i_i], dst=[:dst_i_r, :dst_i_i]),
6464
psym=[:L, :R, :C1, :C2])
6565

6666
Base.@propagate_inbounds function pq!(du, u, isum, (P,Q), t)
@@ -71,7 +71,7 @@ Base.@propagate_inbounds function pq!(du, u, isum, (P,Q), t)
7171
du[2] = imag(uc)
7272
nothing
7373
end
74-
pqnode() = VertexFunction(; f=pq!, sym=[:u_r, :u_i], g=StateMask(1:2), psym=[:P, :Q], mass_matrix=0)
74+
pqnode() = VertexModel(; f=pq!, sym=[:u_r, :u_i], g=StateMask(1:2), psym=[:P, :Q], mass_matrix=0)
7575

7676
Base.@propagate_inbounds function gen!(dv, v, isum, p, T)
7777
# unpack parameters
@@ -107,5 +107,5 @@ Base.@propagate_inbounds function gen!(dv, v, isum, p, T)
107107

108108
nothing
109109
end
110-
generator() = VertexFunction(; f=gen!, sym=[:u_r, :u_i, , ], g=StateMask(1:2),
110+
generator() = VertexModel(; f=gen!, sym=[:u_r, :u_i, , ], g=StateMask(1:2),
111111
psym=[:H, :P, :D, , :E_f, :T_d_dash, :T_q_dash, :X_d_dash, :X_q_dash, :X_d, :X_q])

docs/examples/StochasticSystem.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Here, $dW_i = \xi_i dt$ is the infinitesimal increment of the Wiener process. Pr
4242
4343
## Implementing the Swing Equation
4444
45-
First we will implement the node and edge functions for the deterministic case
45+
First we will implement the node and edge models for the deterministic case
4646
without the fluctuations. We set the defaults for the inertia and damping
4747
parameters to be $M_i = 1.0$ and $D_i = 0.1$. The default coupling strength is $K=6$.
4848
=#
@@ -55,13 +55,13 @@ function swing_equation!(dv, v, esum, (M, P, D), t)
5555
dv[2] = 1/M *(P - D * v[2] + esum[1])
5656
nothing
5757
end
58-
swing_vertex = VertexFunction(f=swing_equation!, g=1, sym=[, ], psym=[:M=>1, :P, :D=>0.1])
58+
swing_vertex = VertexModel(f=swing_equation!, g=1, sym=[, ], psym=[:M=>1, :P, :D=>0.1])
5959
#-
6060

6161
function powerflow!(e, v_s, v_d, (K,), t)
6262
e[1] = K * sin(v_s[1] - v_d[1])
6363
end
64-
powerflow_edge = EdgeFunction(g=AntiSymmetric(powerflow!), outdim=1, psym=[:K=>6])
64+
powerflow_edge = EdgeModel(g=AntiSymmetric(powerflow!), outdim=1, psym=[:K=>6])
6565

6666
#=
6767
## Contructing the Deterministic Dynamics
@@ -132,11 +132,11 @@ FIXME: stochastic system should be simulated using symbolic indexing, this is js
132132
# nothing #hide #md
133133

134134
#=
135-
Now we can construct the dynamics of the second layer by using `network_dynamics()`. Since the graph structure of the stochastic layer has no edges we can take the edge function of the deterministic case as a placeholder.
135+
Now we can construct the dynamics of the second layer by using `network_dynamics()`. Since the graph structure of the stochastic layer has no edges we can take the edge model of the deterministic case as a placeholder.
136136
=#
137137

138-
# fluctuation_vertex = VertexFunction(f=fluctuation!, g=1:2, dim=2)
139-
# nd_noise = Network(h, fluctuation_vertex, NetworkDynamics.EdgeFunction[])
138+
# fluctuation_vertex = VertexModel(f=fluctuation!, g=1:2, dim=2)
139+
# nd_noise = Network(h, fluctuation_vertex, NetworkDynamics.EdgeModel[])
140140
nothing #hide #md
141141

142142
#=

docs/examples/cascading_failure.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function swing_equation(dv, v, esum, p,t)
3737
dv[2] = dv[2] / I
3838
nothing
3939
end
40-
vertex = VertexFunction(f=swing_equation, g=1, sym=[, ], psym=[:P_ref, :I=>1, =>0.1])
40+
vertex = VertexModel(f=swing_equation, g=1, sym=[, ], psym=[:P_ref, :I=>1, =>0.1])
4141

4242
#=
4343
Lets define a simple purely active power line whose active power flow is
@@ -48,7 +48,7 @@ We give an additonal parameter, the line limit, which we'll use later in the cal
4848
function simple_edge(e, v_s, v_d, (K,), t)
4949
e[1] = K * sin(v_s[1] - v_d[1])
5050
end
51-
edge = EdgeFunction(;g=AntiSymmetric(simple_edge), outsym=:P, psym=[:K=>1.63, :limit=>1])
51+
edge = EdgeModel(;g=AntiSymmetric(simple_edge), outsym=:P, psym=[:K=>1.63, :limit=>1])
5252

5353
#=
5454
With the definition of the graph topology we can build the `Network` object:

docs/examples/directed_and_weighted_graphs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ nothing #hide #md
7676
#=
7777
## Setting up the ODEProblem
7878
79-
Defining `VertexFunction` and `EdgeFunction` is similar to the example before. The macro `Base.@propagate_inbounds` tells the compiler to inline the function and propagate the inbounds context. For more details see the julia [documentation](https://docs.julialang.org/en/v1/devdocs/boundscheck/).
79+
Defining the `VertexModel` and `EdgeModel` is similar to the example before. The macro `Base.@propagate_inbounds` tells the compiler to inline the function and propagate the inbounds context. For more details see the julia [documentation](https://docs.julialang.org/en/v1/devdocs/boundscheck/).
8080
8181
=#
8282

@@ -86,14 +86,14 @@ Base.@propagate_inbounds function fhn_electrical_vertex!(dv, v, esum, p, t)
8686
dv[2] = (v[1] - a) * ϵ
8787
nothing
8888
end
89-
vertex = VertexFunction(f=fhn_electrical_vertex!, g=1, sym=[:u, :v], psym=[:a=>0.5, =>0.05])
89+
vertex = VertexModel(f=fhn_electrical_vertex!, g=1, sym=[:u, :v], psym=[:a=>0.5, =>0.05])
9090
#-
9191

9292
Base.@propagate_inbounds function electrical_edge!(e, v_s, v_d, (w, σ), t)
9393
e[1] = w * (v_s[1] - v_d[1]) * σ
9494
nothing
9595
end
96-
electricaledge = EdgeFunction(g=Directed(electrical_edge!), outdim=1, psym=[:weight, =>0.5])
96+
electricaledge = EdgeModel(g=Directed(electrical_edge!), outdim=1, psym=[:weight, =>0.5])
9797
#-
9898

9999
fhn_network! = Network(g_directed, vertex, electricaledge)

docs/examples/gas_network.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,25 +234,25 @@ nothing #hide
234234
To bild the Network we first need to define the components. This is a two step process:
235235
236236
- first create the symbolic `ODESystem` using ModelingToolkit
237-
- secondly build a NetworkDynamics component function ([`VertexFunction`](@ref)/[`EdgeFunction`](@ref)) based on the symbolic system.
237+
- secondly build a NetworkDynamics component model ([`VertexModel`](@ref)/[`EdgeModel`](@ref)) based on the symbolic system.
238238
239239
In the first step we can use the keyword arguments to pass "default" values for our parameters and states.
240-
Those values will be automaticially transfered to the metadata of the component function the second step.
240+
Those values will be automaticially transfered to the metadata of the component model the second step.
241241
242242
The second step requires to define the interface variables, i.e. what are the "input" states of your
243-
component function and what are the "output" states.
244-
For `VertexFunction` the input state is the aggregated flow of all connected pipes. The output state is the pressure of the node.
243+
component model and what are the "output" states.
244+
For `VertexModel` the input state is the aggregated flow of all connected pipes. The output state is the pressure of the node.
245245
=#
246246
@named v1_mtk = ConstantPressureNode(p_set=p₁_set)
247-
v1 = VertexFunction(v1_mtk, [:q̃_nw], [:p]; name=:v1, vidx=1)
247+
v1 = VertexModel(v1_mtk, [:q̃_nw], [:p]; name=:v1, vidx=1)
248248
#
249249

250250
@named v2_mtk = VariablePressureNode(C=C₂, load_profile=load2)
251-
v2 = VertexFunction(v2_mtk, [:q̃_nw], [:p]; name=:v2, vidx=2)
251+
v2 = VertexModel(v2_mtk, [:q̃_nw], [:p]; name=:v2, vidx=2)
252252
#
253253

254254
@named v3_mtk = VariablePressureNode(C=C₃, load_profile=load3)
255-
v3 = VertexFunction(v3_mtk, [:q̃_nw], [:p]; name=:v3, vidx=3)
255+
v3 = VertexModel(v3_mtk, [:q̃_nw], [:p]; name=:v3, vidx=3)
256256

257257
#=
258258
For the edge Model we have two inputs: the pressure on both source and destination end.
@@ -264,9 +264,9 @@ meas that the source end will recieve the same flow, just inverted sign.
264264
@named e13_mtk = Pipe(; L=L₁₃, sinθ=sinθ₁₃, D, A, γ, η, r, g, T, Tc, pc, Rs, c̃, ρ̃, p̃)
265265
@named e23_mtk = Pipe(; L=L₂₃, sinθ=sinθ₂₃, D, A, γ, η, r, g, T, Tc, pc, Rs, c̃, ρ̃, p̃)
266266

267-
e12 = EdgeFunction(e12_mtk, [:p_src], [:p_dst], AntiSymmetric([:q̃]); name=:e12, src=1, dst=2)
268-
e13 = EdgeFunction(e13_mtk, [:p_src], [:p_dst], AntiSymmetric([:q̃]); name=:e13, src=1, dst=3)
269-
e23 = EdgeFunction(e23_mtk, [:p_src], [:p_dst], AntiSymmetric([:q̃]); name=:e23, src=2, dst=3)
267+
e12 = EdgeModel(e12_mtk, [:p_src], [:p_dst], AntiSymmetric([:q̃]); name=:e12, src=1, dst=2)
268+
e13 = EdgeModel(e13_mtk, [:p_src], [:p_dst], AntiSymmetric([:q̃]); name=:e13, src=1, dst=3)
269+
e23 = EdgeModel(e23_mtk, [:p_src], [:p_dst], AntiSymmetric([:q̃]); name=:e23, src=2, dst=3)
270270

271271
#=
272272
To build the network object we just need to pass the vertices and edges to the constructor.

docs/examples/getting_started_with_network_dynamics.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ From the above considerations we see that in this model the nodes do not have an
3333
3434
In order to bring this equation into the form required by NetworkDynamics.jl we need split the dynamics into edge and vertex parts and bring them into the correct input-output formulation.
3535
The vertices have one internal state $v$ which is also the output. The input is
36-
the sum over all flows of connected edges. This directly correspons to the component function definition outlined in [Mathematical Model](@ref):
36+
the sum over all flows of connected edges. This directly correspons to the component model definition outlined in [Mathematical Model](@ref):
3737
```math
3838
\begin{aligned}
3939
\dot x^\mathrm{v} &= f^{\mathrm v}(u^{\mathrm v}, \sum_k^{\text{incident}} y^{\mathrm e}_k, p^{\mathrm v}, t) &&= \sum_k^\mathrm{incident} y^\mathrm{e}_k \\
@@ -50,7 +50,7 @@ y^{\mathrm e}_{\mathrm{src}} &= g_\mathrm{src}^{\mathrm e}(u^{\mathrm e}, y^{\ma
5050
\end{aligned}
5151
```
5252
53-
### Definition of `EdgeFunction`
53+
### Definition of `EdgeModel`
5454
=#
5555
function diffusionedge_g!(e_dst, v_src, v_dst, p, t)
5656
## e_dst, v_src, v_dst are arrays, hence we use the broadcasting operator
@@ -64,12 +64,12 @@ The function `diffusionedge_g!` takes as inputs the current state of the edge `e
6464
6565
`diffusionedge_g!` is called a **mutating** function, since it modifies (or *mutates*) one of its inputs, namely the edge state `e`. As a convention in Julia names of mutating functions end with an `!`. The use of mutating functions reduces allocations and thereby speeds up computations. After the function call the edge's output value `e` equals the difference between its source and its destination vertex (i.e. the discrete gradient along that edge).
6666
67-
Notably, this function only models $g_\mathrm{dst}$. However we can wrap this single-sided output function in an [`AntiSymmetric`](@ref) output wrapper to construct the [`EdgeFunction`](@ref):
67+
Notably, this function only models $g_\mathrm{dst}$. However we can wrap this single-sided output function in an [`AntiSymmetric`](@ref) output wrapper to construct the [`EdgeModel`](@ref):
6868
=#
69-
nd_diffusion_edge = EdgeFunction(; g=AntiSymmetric(diffusionedge_g!), outsym=[:flow])
69+
nd_diffusion_edge = EdgeModel(; g=AntiSymmetric(diffusionedge_g!), outsym=[:flow])
7070

7171
#=
72-
### Definition of `VertexFunction`
72+
### Definition of `VertexModel`
7373
For undirected graphs, the `edgefunction!` specifies the coupling from a source- to a destination vertex. The contributions of the connected edges to a single vertex are "aggregated". Default aggregation is the summation of all incident edge states. The aggregated edge state is made available via the `esum` argument of the vertex function.
7474
=#
7575
function diffusionvertex_f!(dv, v, esum, p, t)
@@ -84,7 +84,7 @@ Just like above the input arguments `v, esum, p, t` are mandatory for the syntax
8484
8585
The output function `g` is just taking part of the internal states. For that we can use the [`StateMask`](@ref) helper function `g = StateMaks(1:1)`
8686
=#
87-
nd_diffusion_vertex = VertexFunction(; f=diffusionvertex_f!, g=StateMask(1:1), dim=1)
87+
nd_diffusion_vertex = VertexModel(; f=diffusionvertex_f!, g=StateMask(1:1), dim=1)
8888

8989

9090
#=
@@ -104,7 +104,7 @@ nothing #hide #md
104104
nd = Network(g, nd_diffusion_vertex, nd_diffusion_edge)
105105

106106
#=
107-
The constructor `Network` combines the component function with the topological information contained in the graph **`g`** and returns an `Network` compatible with the solvers of `DifferentialEquations.jl`.
107+
The constructor `Network` combines the component model with the topological information contained in the graph **`g`** and returns an `Network` compatible with the solvers of `DifferentialEquations.jl`.
108108
=#
109109

110110
rng = StableRNG(1)
@@ -129,16 +129,16 @@ In oder to collect multiple indices we can use the helper function [`vidxs`](@re
129129
130130
To illustrate a very simple multi-dimensional case, in the following we simulate two independent diffusions on an identical graph. The first uses the symbol `x` and is started with initial conditions drawn from the standard normal distribution $N(0,1)$, the second uses the symbol `ϕ` with squared standard normal inital conditions.
131131
132-
The symbols have to be passed with the keyword **`sym`** to `VertexFunction`.
132+
The symbols have to be passed with the keyword **`sym`** to `VertexModel`.
133133
=#
134134

135135
N = 10 # number of nodes
136136
k = 4 # average degree
137137
g = barabasi_albert(N, k) # a little more exciting than a bare random graph
138138

139139
## We will have two independent diffusions on the network, hence dim = 2
140-
nd_diffusion_vertex_2 = VertexFunction(; f=diffusionvertex_f!, g=1:2, dim=2, sym=[:x, ])
141-
nd_diffusion_edge_2 = EdgeFunction(; g=AntiSymmetric(diffusionedge_g!), outsym=[:flow_x, :flow_ϕ])
140+
nd_diffusion_vertex_2 = VertexModel(; f=diffusionvertex_f!, g=1:2, dim=2, sym=[:x, ])
141+
nd_diffusion_edge_2 = EdgeModel(; g=AntiSymmetric(diffusionedge_g!), outsym=[:flow_x, :flow_ϕ])
142142
nd_2 = Network(g, nd_diffusion_vertex_2, nd_diffusion_edge_2)
143143

144144
x0_2 = vec(transpose([randn(rng, N) .^ 2 randn(rng, N)])) # x ~ N(0,1)^2; ϕ ~ N(0,1)

docs/examples/heterogeneous_system.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ function kuramoto_edge!(e, θ_s, θ_d, (K,), t)
2121
e[1] = K * sin(θ_s[1] - θ_d[1])
2222
nothing
2323
end
24-
edge! = EdgeFunction(g=AntiSymmetric(kuramoto_edge!), outdim=1, psym=[:K=>3])
24+
edge! = EdgeModel(g=AntiSymmetric(kuramoto_edge!), outdim=1, psym=[:K=>3])
2525
#-
2626

2727
function kuramoto_vertex!(dθ, θ, esum, (ω0,), t)
2828
dθ[1] = ω0 + esum[1]
2929
nothing
3030
end
31-
vertex! = VertexFunction(f=kuramoto_vertex!, g=StateMask(1:1), sym=[], psym=[:ω0], name=:kuramoto)
31+
vertex! = VertexModel(f=kuramoto_vertex!, g=StateMask(1:1), sym=[], psym=[:ω0], name=:kuramoto)
3232
#-
3333

3434
nw = Network(g, vertex!, edge!)
@@ -78,7 +78,7 @@ function static_g(out, u, p, t)
7878
out[1] = p[1]
7979
nothing
8080
end
81-
static! = VertexFunction(g=static_g, outsym=[], psym=[:θfix => ω[1]], name=:static)
81+
static! = VertexModel(g=static_g, outsym=[], psym=[:θfix => ω[1]], name=:static)
8282

8383
#=
8484
But wait! NetworkDynamics classified this as [`PureFeedForward`](@ref), because it cannot
@@ -90,7 +90,7 @@ g(out, ins, p, t) # NoFeedForward
9090
and since `dim(u)=0` it wrongfully assumes that the latter is meant.
9191
We can overwrite the classification by passing the ff keyword:
9292
=#
93-
static! = VertexFunction(g=static_g, outsym=[], psym=[:θfix => ω[1]], ff=NoFeedForward(), name=:static)
93+
static! = VertexModel(g=static_g, outsym=[], psym=[:θfix => ω[1]], ff=NoFeedForward(), name=:static)
9494

9595
#=
9696
A Kuramoto model with inertia consists of two internal variables leading to
@@ -102,15 +102,15 @@ function kuramoto_inertia!(dv, v, esum, (ω0,), t)
102102
nothing
103103
end
104104

105-
inertia! = VertexFunction(f=kuramoto_inertia!, g=1:1, sym=[, ], psym=[:ω0], name=:inertia)
105+
inertia! = VertexModel(f=kuramoto_inertia!, g=1:1, sym=[, ], psym=[:ω0], name=:inertia)
106106

107107
#=
108108
Since now we model a system with heterogeneous node dynamics we can no longer
109-
straightforwardly pass a single VertexFunction to the `Network` constructor but
109+
straightforwardly pass a single VertexModel to the `Network` constructor but
110110
instead have to hand over an Array.
111111
=#
112112

113-
vertex_array = VertexFunction[vertex! for i in 1:N]
113+
vertex_array = VertexModel[vertex! for i in 1:N]
114114
vertex_array[1] = static!
115115
vertex_array[5] = inertia! # index should correspond to the node's index in the graph
116116
nw_hetero! = Network(g, vertex_array, edge!)

0 commit comments

Comments
 (0)