- Join over
**1.5M+ people** - Join over
**100K+ communities** - Free
**without limits** - Create
**your own community**

- 16:38coveralls commented #891
- 16:38coveralls commented #891
- 16:04StefanKarpinski commented #891
- 15:57ChrisRackauckas commented #891
- 14:51LucasReSilva starred JuliaDiffEq/DifferentialEquations.jl
- 14:42devmotion edited #891
- 14:42devmotion opened #891
- 14:40
devmotion on upperbound

Upper bound DiffEqBase and Expo… (compare)

- 14:27devmotion closed #876
- 14:26
devmotion on master

add calcJ! for oop simplify calc_J! and add jacobi… Merge pull request #876 from hu… (compare)

- 14:25devmotion commented #876
- 13:28anandijain starred JuliaDiffEq/DiffEqTutorials.jl
- 12:19
- 10:24
Vaibhavdixit02 on sobolci

Making sure differential equati… (compare)

- 09:06Vaibhavdixit02 synchronize #91
- 09:02
- 09:02SinSiXX starred JuliaDiffEq/DiffEqOperators.jl
- 09:02
- 08:49
- 08:49

that's why i wanted to use the Integrator interface in the first place. to save myself from combining 3 solutions. Runtime performance maybe another concern but isn't critical

[slack] <chrisrackauckas> I still don't have that JSON though. Is it in the repo?

[slack] <chrisrackauckas> the path doesn't reference the package dir.

yes, on the "PowerDrop" branch. https://github.com/JuliaEnergy/PowerDynamics.jl/blob/PowerDrop/ieee-14-minimal.json

@SebastianM-C We also had a look at this. This could be another approach but is not easy for us since we have a lot of code that generates the systems of ODE's.

[slack] <chrisrackauckas> ```

using Pkg

pkg"add PowerDynamics#PowerDrop"

using PowerDynamics: read_powergrid, Json, find_operationpoint, rhs, simulate, PowerDrop

using OrdinaryDiffEq

powergrid = read_powergrid(Pkg.dir("PowerDynamics")*"/ieee-14-minimal.json", Json)

operationpoint = find_operationpoint(powergrid)

function PowerDynamics.simulate(pd::PowerDrop, powergrid, x0, timespan)

@assert first(timespan) <= pd.tspan_fault[1] "fault cannot begin in the past"

@assert pd.tspan_fault[2] <= last(timespan) "fult cannot end in the future"

```
problem = ODEProblem{true}(rhs(powergrid), x0.vec, timespan)
integrator = init(problem, Rodas4(autodiff=false))
step!(integrator, pd.tspan_fault[1], true)
# update integrator with error
integrator.f = rhs(pd(powergrid))
step!(integrator, pd.tspan_fault[2], true)
# update integrator, clear error
integrator.f = rhs(powergrid)
solve!(integrator)
return PowerGridSolution(integrator.sol, powergrid)
```

end

result = simulate(PowerDrop(

fraction = 0.9,

node_number = 1,

tspan_fault = (2.,3.)),

powergrid, operationpoint, (0., 5.))

```

is the MWE. In the future it would be nice if the reproducible example was shared.

[slack] <chrisrackauckas> I'll dig in. If it's not a timing thing then :shrug:

and thanks @ChrisRackauckas !

[slack] <chrisrackauckas> yes, I said there is no bridging distribution

[slack] <chrisrackauckas> and no Z0

[slack] <chrisrackauckas> do

`w = TruncatedWienerProcess(0.0,zeros(5),zeros(5))`

[slack] <chrisrackauckas> yeah @janlisse, the issue is in your

`f`

there, something to do with what you're caching
[slack] <chrisrackauckas> ```

function PowerDynamics.simulate(pd::PowerDrop, powergrid, x0, timespan)

@assert first(timespan) <= pd.tspan_fault[1] "fault cannot begin in the past"

@assert pd.tspan_fault[2] <= last(timespan) "fult cannot end in the future"

```
problem = ODEProblem{true}(deepcopy(rhs(pd(powergrid))), x0.vec, timespan)
integrator = init(problem, Rodas4(autodiff=false))
@show pd.tspan_fault
OrdinaryDiffEq.step!(integrator, pd.tspan_fault[1], true)
# update integrator with error
integrator.f = rhs(pd(powergrid))
u_modified!(integrator,true)
OrdinaryDiffEq.step!(integrator, pd.tspan_fault[2], true)
# update integrator, clear error
integrator.f = rhs(powergrid)
solve!(integrator)
return PowerDynamics.PowerGridSolution(integrator.sol, powergrid)
```

end

```

[slack] <chrisrackauckas> that works, with the only change being the

`deepcopy`

[slack] <chrisrackauckas> so basically that means that some values from the first part are entering the second part that you didn't intend?

instead of

`deepcopy(rhs(pd(powergrid))`

If i reverse that, than even with deepcopy() i get back to the infinite looping.

AFAIK there is no caching involved in the f.

@ChrisRackauckas There are arrays used internally. The powergrid model we are using basically consists of edges representing the lines and vertices representing electrical nodes. We then use a dedicated layer where we transform this graph structure into an ODEFunction that we could use for DiffEq. The most relevant code snippets for this transformation are:

```
function network_dynamics(vertices!::Array{ODEVertex,1}, edges!::Array{StaticEdge,1}, graph)
@assert length(vertices!) == length(vertices(graph))
@assert length(edges!) == length(edges(graph))
dim_v = [v.dim for v in vertices!]
dim_e = [e.dim for e in edges!]
dim_nd = sum(dim_v)
e_int = zeros(sum(dim_e))
graph_stucture = create_graph_structure(graph, dim_v, dim_e, e_int)
nd! = nd_ODE_Static(vertices!, edges!, graph, graph_stucture)
# Construct mass matrix
mass_matrix = construct_mass_matrix([v.mass_matrix for v in vertices!], dim_nd, graph_stucture)
symbols = [Symbol(vertices![i].sym[j],"_",i) for i in 1:length(vertices!) for j in 1:dim_v[i]]
ODEFunction(nd!,mass_matrix = mass_matrix,syms=symbols)
end
```

And:

```
function (d::nd_ODE_Static)(dx, x, p, t)
gs = d.graph_stucture
@views begin
for i in 1:gs.num_e
d.edges![i].f!(gs.e_int[gs.e_idx[i]], x[gs.s_idx[i]], x[gs.d_idx[i]], p, t)
end
for i in 1:gs.num_v
d.vertices![i].f!(dx[gs.v_idx[i]], x[gs.v_idx[i]], gs.e_s[i], gs.e_d[i], p, t)
end
end # views
nothing
end
```

Since for this case only the vertices contain dynamic behaviour and the lines/edges are static and not used in the ODE.

[slack] <ashton.bradley> has anyone noticed any speed regressions today? I see a major speed regression once

`solve`

has completed. After that, even simple function calls are taking seconds, and the REPL feels cludgy, like it is out of memory. Julia claims to be only using about 3GB of 16. There was an atom update this morning, just testing on another machine to see if that could be it …
[slack] <ashton.bradley> no, still on 1.1. Should I be updating yet?

[slack] <isaacsas> No, just noticed some people complaining about increased plotting times on 1.2 on discourse so was curious.

[slack] <ashton.bradley> It doesn’t seem to be anything to do with the Atom update

[slack] <tbeason> If so, do you have any examples where you solve the actual pricing equation, such as the very first equation presented here https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_equation

[slack] <chrisrackauckas> we need a higher level interface for defining PDEProblems

[slack] <chrisrackauckas> for now it would still be useful to directly define the ODE described by the PDE though.

[slack] <chrisrackauckas> The library is squarely about the SDEs right now though

Hi all! I have been working with Julia's ODE tools and I find them amazing! I have a quick, possibly dumb question, however: Let's say my ODE has a rate parameter that should vary in time as a deterministic function of an external, empirical time series (e.g. a temperature curve from weather data). I think this would require something like a subfunction that (a) knows the absolute value of time-after-start-point, and (b) looks up the relevant temperature on the (smoothed) temperature curve. Is this kind of thing possible? Cheers and thanks!

[slack] <chrisrackauckas> @nmatzke mix @yingbo_ma’s answer with https://github.com/PumasAI/DataInterpolations.jl