The KS aggregate of the shadow function at a row's samples, for the given start epoch,
final epoch [days] and initial rotating-frame state (a copy of the segment is propagated,
with output every eclipse_opt_sample_step seconds).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(mission_type), | intent(in) | :: | mission | |||
| type(segment), | intent(in) | :: | seg | |||
| type(eclipse_row), | intent(in) | :: | row | |||
| real(kind=wp), | intent(in) | :: | t0 | |||
| real(kind=wp), | intent(in) | :: | tf | |||
| real(kind=wp), | intent(in), | dimension(6) | :: | x0_rotating | ||
| logical, | intent(out) | :: | ok |
false if the segment has none of the row's samples (e.g., a trial point that moved its epochs far): the row can't be evaluated there |
function row_ks(mission, seg, row, t0, tf, x0_rotating, ok) result(ks) class(mission_type),intent(in) :: mission type(segment),intent(in) :: seg type(eclipse_row),intent(in) :: row real(wp),intent(in) :: t0, tf real(wp),dimension(6),intent(in) :: x0_rotating logical,intent(out) :: ok !! false if the segment has none of the row's samples (e.g., a trial point !! that moved its epochs far): the row can't be evaluated there real(wp) :: ks type(segment) :: s real(wp),dimension(:),allocatable :: phi real(wp),dimension(6) :: rv real(wp) :: step, rho, pmin integer :: i, k, n, np step = mission%eclipse_opt_sample_step rho = mission%eclipse_opt_ks_rho s = seg call s%traj_inertial%destroy() call s%traj_rotating%destroy() call s%traj_se_rotating%destroy() call s%set_input(t0, tf, x0_rotating) call s%propagate(mode=2, tstep=step) if (s%failed) then ok = .false. ks = zero return end if ! the samples: the points at k*step from the start (the last point, at tf, is only one ! of them if it falls on the grid) n = size(s%traj_inertial%et) allocate(phi(row%k_hi - row%k_lo + 1)) np = 0 do k = row%k_lo, row%k_hi i = k + 1 if (i > n) exit if (abs(abs(s%traj_inertial%et(i) - s%traj_inertial%et(1)) - k*step) > 1.0e-3_wp) exit rv = [s%traj_inertial%x(i), s%traj_inertial%y(i), s%traj_inertial%z(i), & s%traj_inertial%vx(i), s%traj_inertial%vy(i), s%traj_inertial%vz(i)] np = np + 1 phi(np) = get_sun_fraction(s%eph, s%traj_inertial%et(i), rv, mission%eclipse_opt_bubble) end do ok = np > 0 if (.not. ok) then ks = zero return end if pmin = minval(phi(1:np)) ks = pmin - log(sum(exp(-rho*(phi(1:np) - pmin)))) / rho end function row_ks