res Subroutine

public pure subroutine res(t, y, ydot, cj, delta, ires, rpar, ipar)

Residuals routine.

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: t
real(kind=rk), intent(in) :: y(neq)
real(kind=rk), intent(in) :: ydot(neq)
real(kind=rk), intent(in) :: cj
real(kind=rk), intent(out) :: delta(neq)
integer, intent(out) :: ires
real(kind=rk), intent(inout) :: rpar
integer, intent(inout) :: ipar

Source Code

   pure subroutine res(t, y, ydot, cj, delta, ires, rpar, ipar)
   !! Residuals routine.

      real(rk), intent(in):: t
      real(rk), intent(in):: y(neq)
      real(rk), intent(in):: ydot(neq)
      real(rk), intent(in):: cj
      real(rk), intent(out):: delta(neq)
      integer, intent(out) :: ires
      real(rk), intent(inout):: rpar
      integer, intent(inout) :: ipar

      ! Check Y to make sure that it is valid input.
      ! If Y is less than or equal to zero, this is invalid input.
      if (y(1) <= zero) then
         ires = -1
      else
         call f(t, y, delta)
         delta = ydot - delta
      end if

   end subroutine res