Using BoundaryValueDiffEqFIRK: How many boundary condition residual elements allowed?

Again, I’m trying to use BVProblem with solver RadauIIa5.
In the boundary condition function called by the solver, what is the maximum length of the
residual vector, which is the first argument of this function?
I am getting an error when I try to assign values to more elements than there are solution vectors, suggesting that only one residual element is allowed per solution vector.
(This would imply that constraints on both the solution vector and its derivative would need to be combined as sums of absolute values, which would complicates the search for a minimum.)
But this restriction seems to be inconsistent with the two examples here, which both apply
two constraints to only the first of two solution vectors. In this case, the residuals are not assigned to corresponding solution vectors.
Please advise.
Thanks

Not sure.

It is math that dictates how the residual elements should be defined to solve either a boundary or initial value problem.

Does it help here to explain what you are aiming at?

Domenico, thanks for your interest, but I have to disagree with you about constraint by math.
I see no mathematical restriction against having any number of constraints
on each solution vector, corresponding to various features and derivatives of that vector.
I think it can be restricted only by the code design. That’s what I’m asking about.
Andy

Thanks, Andy.

Again, I am not sure that I understand the matter.

Again, does it help here to pose a problem that you are trying to solve? This might help to reach some concensus.

What do you think?

I am guessing you are trying to solve an overconstrained BVP right? BoundaryValueDiffEq.jl does support that, here is a simple example:

function f1!(du, u, p, t)
    du[1] = u[2]
    du[2] = -u[1]
end

function bc1!(resid, sol, p, t)
    solₜ₁ = sol(0.0)
    solₜ₂ = sol(100.0)
    resid[1] = solₜ₁[1]
    resid[2] = solₜ₂[1] - 1
    resid[3] = solₜ₂[2] + 1.729109
end
prob = BVProblem(BVPFunction(f1!, bc1!; bcresid_prototype = zeros(3)), u0, tspan),
sol = solve(prob, RadauIIa5(), dt=0.01)

You need to specify bcresid_prototype to explicitly state the number of boundary conditions

1 Like

hmmm, it seems that bcresid_prototype so far may have appeared only in examples for TwoPointBVProblem.
And BVPFunction not at all?
So news about this feature is welcome!

Are there alternatives to “zeros” in “bcresid_prototype = zeros” ?

thanks