Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Suggestion: Add maximum iterations option. #85

@RebelMoogle

Description

@RebelMoogle

I have a few experiments with analytical flow fields that don't behave nicely in some areas and cause the integration to explode (too many integration steps), even with setting larger minimum step sizes.

I would love the ability to set a maximum step number, optionally. something like the following:
(In runge_kutta.jl, line 223

function oderk_adapt{N,S}(fn, y0::AbstractVector, tspan, btab_::TableauRKExplicit{N,S};
                          reltol = 1.0e-5, abstol = 1.0e-8,
                          norm=Base.norm,
                          minstep=abs(tspan[end] - tspan[1])/1e18,
                          maxstep=abs(tspan[end] - tspan[1])/2.5,
                          initstep=0.,
                          points=:all,
                          maxIterations=0 #optional argument through kwords...
                          )

same file, line 289

## Integration loop
    islaststep = abs(t+dt-tend)<=eps(tend) ? true : false
    timeout = 0 # for step-control
    iter = 2 # the index into tspan and ys
    while true
        # check number of iterations
        if(maxIterations > 0 && iter > maxIterations) #ignore at 0
            warn("Exceeded maximum number of iterations at #$iter.")
            # raise exception here?
            break
        end
        # ...  rest of loop ...
    end

Apologies if this is already present in some other way and I overlooked it.
Let me know if you want a test case for the problem mentioned at the beginning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions