step_limits Function

function step_limits(d) result(lim)

The largest change of each of the optimization's variables in one sqpopt iteration (problem%set_max_step), from the limits in physical units (eclipse_opt_max_step_*): a variable's unscaled value is y*r*xscale (plus its offset), so its limit is limit/(r*xscale). A variable without a limit gets sqpopt_infinity.

Arguments

Type IntentOptional Attributes Name
type(eclipse_opt_data), intent(in) :: d

Return Value real(kind=wp), dimension(:), allocatable

(allocatable: sized by the problem, so not on the stack)


Calls

proc~~step_limits~~CallsGraph proc~step_limits step_limits proc~define_problem_size mission_type%define_problem_size proc~step_limits->proc~define_problem_size proc~removed_columns mission_type%removed_columns proc~step_limits->proc~removed_columns proc~removed_columns->proc~define_problem_size

Called by

proc~~step_limits~~CalledByGraph proc~step_limits step_limits proc~eclipse_optimize eclipse_optimize proc~eclipse_optimize->proc~step_limits interface~eclipse_optimize my_solver_type%eclipse_optimize interface~eclipse_optimize->proc~eclipse_optimize proc~halo_solver_main halo_solver_main proc~halo_solver_main->interface~eclipse_optimize

Source Code

    function step_limits(d) result(lim)

    type(eclipse_opt_data),intent(in) :: d
    real(wp),dimension(:),allocatable :: lim  !! (allocatable: sized by the problem, so not on the stack)

    integer :: i, k, n_full, cc
    integer,dimension(:),allocatable :: removed
    real(wp) :: phys

    call d%mission%define_problem_size(n=n_full, full_problem=.true.)
    removed = d%mission%removed_columns()
    allocate(lim(size(d%r)))
    lim = sqpopt_infinity
    k = 0
    do i = 1, n_full
        if (any(removed==i)) cycle
        k = k + 1
        cc = mod(i-1,7) + 1
        select case (cc)
        case (1);   phys = d%mission%eclipse_opt_max_step_epoch
        case (2:4); phys = d%mission%eclipse_opt_max_step_position
        case default; phys = d%mission%eclipse_opt_max_step_velocity
        end select
        if (phys > zero) lim(k) = phys / (d%r(k)*d%mission%xscale(k))
    end do

    end function step_limits