juliagni / geometricequations.jl Goto Github PK
View Code? Open in Web Editor NEWProvides data structures for defining differential equations and initial value problems for the GeometricIntegrators ecosystem
License: MIT License
Provides data structures for defining differential equations and initial value problems for the GeometricIntegrators ecosystem
License: MIT License
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
So I'm not 100% sure if this belongs to GeometricEquations
or GeometricProblems
, but I have the following problem:
I used to be able to do:
using GeometricIntegrators: integrate, ImplicitMidpoint
using GeometricEquations: EnsembleProblem
using GeometricProblems.CoupledHarmonicOscillator: hodeproblem, default_parameters, tspan, tstep, hamiltonian, p₀, q₀
const m₁ = default_parameters.m₁
const m₂ = default_parameters.m₂
const k₁ = default_parameters.k₁
const k₂ = default_parameters.k₂
const k = Float64.(0.0:0.1:4)
params_collection = [(m₁ = m₁, m₂ = m₂, k₁ = k₁, k₂ = k₂, k = k_val) for k_val in k]
ensemble_problem = EnsembleProblem(hodeproblem().equation, tspan, tstep, (q = q₀, p = p₀), params_collection)
ensemble_solution = integrate(ensemble_problem, ImplicitMidpoint())
But now I get the following error:
julia> ensemble_solution = integrate(ensemble_problem, ImplicitMidpoint())
ERROR: MethodError: no method matching vectorfield(::Vector{Float64})
Closest candidates are:
vectorfield(::GeometricBase.AbstractStateVariable)
@ GeometricBase ~/.julia/packages/GeometricBase/d27AC/src/data/state_variables.jl:131
Stacktrace:
[1] (::GeometricIntegrators.Integrators.var"#15#21")(::Int64)
@ GeometricIntegrators.Integrators ./none:0
[2] iterate
@ ./generator.jl:47 [inlined]
[3] collect(itr::Base.Generator{UnitRange{Int64}, GeometricIntegrators.Integrators.var"#15#21"})
@ Base ./array.jl:834
[4] GeometricIntegrators.Integrators.SolutionStepPODE(t::Float64, q::Vector{…}, p::Vector{…}, parameters::@NamedTuple{…}; nhistory::Int64, internal::@NamedTuple{…})
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/solutions/solution_step_pode.jl:67
[5] SolutionStepPODE
@ ~/.julia/packages/GeometricIntegrators/yNYjW/src/solutions/solution_step_pode.jl:63 [inlined]
[6] GeometricIntegrators.Integrators.SolutionStep(problem::HODEProblem{…}, extrap::GeometricIntegrators.Extrapolators.MidpointExtrapolation; kwargs::@Kwargs{…})
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/solutions/solution_step_constructors.jl:17
[7] GeometricIntegrators.Integrators.SolutionStep(problem::HODEProblem{…}, method::GeometricIntegrators.Integrators.IPRK{…}, extrap::GeometricIntegrators.Extrapolators.MidpointExtrapolation)
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/solutions/solution_step_constructors.jl:52
[8] SolutionStep
@ ~/.julia/packages/GeometricIntegrators/yNYjW/src/solutions/solution_step_constructors.jl:52 [inlined]
[9] GeometricIntegrators.Integrators.GeometricIntegrator(problem::HODEProblem{…}, integratormethod::GeometricIntegrators.Integrators.IPRK{…}, solvermethod::SimpleSolvers.Newton, iguess::GeometricIntegrators.Extrapolators.HermiteExtrapolation)
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/integrators/integrator.jl:165
[10] #GeometricIntegrator#82
@ ~/.julia/packages/GeometricIntegrators/yNYjW/src/integrators/integrator.jl:185 [inlined]
[11] GeometricIntegrators.Integrators.GeometricIntegrator(problem::HODEProblem{Float64, Float64, Vector{…}, HODE{…}, @NamedTuple{…}, @NamedTuple{}, @NamedTuple{…}, @NamedTuple{…}}, method::GeometricIntegrators.Integrators.IPRK{RungeKutta.PartitionedTableau{…}})
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/integrators/integrator.jl:178
[12] GeometricIntegrators.Integrators.GeometricIntegrator(::HODEProblem{Float64, Float64, Vector{…}, HODE{…}, @NamedTuple{…}, @NamedTuple{}, @NamedTuple{…}, @NamedTuple{…}}, ::ImplicitMidpoint; kwargs::@Kwargs{})
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/integrators/rk/abstract.jl:58
[13] integrate(problems::HODEEnsemble{Float64, Float64, Vector{…}, HODE{…}, @NamedTuple{…}, @NamedTuple{}, Vector{…}, Vector{…}}, method::ImplicitMidpoint; kwargs::@Kwargs{})
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/integrators/integrator.jl:37
[14] integrate(problems::HODEEnsemble{Float64, Float64, Vector{…}, HODE{…}, @NamedTuple{…}, @NamedTuple{}, Vector{…}, Vector{…}}, method::ImplicitMidpoint)
@ GeometricIntegrators.Integrators ~/.julia/packages/GeometricIntegrators/yNYjW/src/integrators/integrator.jl:33
[15] top-level scope
@ REPL[14]:1
Some type information was truncated. Use `show(err)` to see complete types.
I get the same error when supplying a vector of initial conditions instead of a vector of parameters.
If I want to build an EnsembleProblem
the initial conditions need to be NamedTuple
s (https://github.com/JuliaGNI/GeometricEquations.jl/blob/main/src/problems/ensemble_problem.jl), but sometimes they are not in that form (in e.g. https://github.com/JuliaGNI/GeometricProblems.jl/blob/main/src/lotka_volterra_3d.jl).
Can the constructor easily be generalized to the case when the initial conditions are an Array and not a NamedTuple?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.