eclipse_fc Subroutine

subroutine eclipse_fc(x, f, c, status, data)

The objective and the constraints for sqpopt: halo's continuity constraints, then the eclipse rows.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(:) :: x
real(kind=wp), intent(out) :: f
real(kind=wp), intent(out), dimension(:) :: c
integer, intent(inout) :: status
class(*), intent(inout), optional :: data

Calls

proc~~eclipse_fc~~CallsGraph proc~eclipse_fc eclipse_fc constraint_violations constraint_violations proc~eclipse_fc->constraint_violations proc~epochs_in_range epochs_in_range proc~eclipse_fc->proc~epochs_in_range proc~eval_rows eval_rows proc~eclipse_fc->proc~eval_rows proc~ks_aggregate ks_aggregate proc~eclipse_fc->proc~ks_aggregate proc~row_ks row_ks proc~eval_rows->proc~row_ks proc~destroy_trajectory trajectory%destroy_trajectory proc~row_ks->proc~destroy_trajectory proc~get_sun_fraction get_sun_fraction proc~row_ks->proc~get_sun_fraction proc~propagate_segment segment%propagate_segment proc~row_ks->proc~propagate_segment proc~set_segment_inputs segment%set_segment_inputs proc~row_ks->proc~set_segment_inputs apparent_position apparent_position proc~get_sun_fraction->apparent_position cubic_shadow_model cubic_shadow_model proc~get_sun_fraction->cubic_shadow_model from_j2000body_to_j2000ssb from_j2000body_to_j2000ssb proc~get_sun_fraction->from_j2000body_to_j2000ssb first_call first_call proc~propagate_segment->first_call icrf_frame icrf_frame proc~propagate_segment->icrf_frame integrate integrate proc~propagate_segment->integrate proc~identity_stm identity_stm proc~propagate_segment->proc~identity_stm proc~set_segment_outputs segment%set_segment_outputs proc~propagate_segment->proc~set_segment_outputs transform transform proc~propagate_segment->transform two_body_rotating_frame two_body_rotating_frame proc~propagate_segment->two_body_rotating_frame proc~set_segment_inputs->icrf_frame proc~set_segment_inputs->transform proc~set_segment_inputs->two_body_rotating_frame

Source Code

    subroutine eclipse_fc(x, f, c, status, data)

    real(wp),dimension(:),intent(in)    :: x
    real(wp),intent(out)                :: f
    real(wp),dimension(:),intent(out)   :: c
    integer,intent(inout)               :: status
    class(*),optional,intent(inout)     :: data

    real(wp),dimension(:),allocatable :: ks
    logical :: ok

    if (.not. present(data)) error stop 'eclipse_fc: no data'
    select type (data)
    type is (eclipse_opt_data)
        ! (x here is the optimization's variable y = x/r)
        if (data%mission%eclipse_opt_objective == 0) then
            f = zero  ! (a feasibility problem: as SNOPT's feasible point mode)
        else
            f = 0.5_wp * sum((x - data%x0/data%r)**2)
        end if
        if (.not. epochs_in_range(data, x*data%r)) then
            c = zero
            status = 1  ! (outside the splined ephemeris: can't evaluate here)
            return
        end if
        call data%mission%constraint_violations(x*data%r, c(1:data%m_halo))  ! (also puts x in the segments)
        c(1:data%m_halo) = c(1:data%m_halo) * data%w
        if (data%single) then
            allocate(ks(size(data%rows)))
            call eval_rows(data, ks, ok=ok)
            c(data%m_halo+1) = ks_aggregate(ks, data%mission%eclipse_opt_ks_rho)
        else
            call eval_rows(data, c(data%m_halo+1:), ok=ok)
        end if
        if (.not. ok .or. any(data%mission%segs%failed)) status = 1  ! (can't evaluate here: sqpopt shortens the step)
    class default
        error stop 'eclipse_fc: invalid data'
    end select

    end subroutine eclipse_fc