ddawts Subroutine

pure subroutine ddawts(neq, iwt, rtol, atol, y, wt, rpar, ipar)

Uses

  • proc~~ddawts~~UsesGraph proc~ddawts ddawts module~daskr_kinds daskr_kinds proc~ddawts->module~daskr_kinds iso_fortran_env iso_fortran_env module~daskr_kinds->iso_fortran_env

This subroutine sets the error weight vector, wt, according to:

     wt(i) = rtol(i) * abs(y(i)) + atol(i)

where rtol and atol are scalars if iwt = 0, and vectors if iwt = 1.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: neq

Problem size.

integer, intent(in) :: iwt

Flag indicating whether rtol and atol are scalars or vectors. If iwt = 0, then rtol and atol are scalars. If iwt = 1, then rtol and atol are vectors.

real(kind=rk), intent(in) :: rtol(*)

Relative error tolerance.

real(kind=rk), intent(in) :: atol(*)

Absolute error tolerance.

real(kind=rk), intent(in) :: y(neq)

Solution vector.

real(kind=rk), intent(out) :: wt(neq)

Error weight vector.

real(kind=rk), intent(in) :: rpar(*)

User real workspace.

integer, intent(in) :: ipar(*)

User integer workspace.


Source Code

pure subroutine ddawts(neq, iwt, rtol, atol, y, wt, rpar, ipar)
!! This subroutine sets the error weight vector, `wt`, according to:
!!```
!!     wt(i) = rtol(i) * abs(y(i)) + atol(i)
!!```
!! where `rtol` and `atol` are scalars if `iwt = 0`, and vectors if `iwt = 1`.

   use daskr_kinds, only: rk

   integer, intent(in) :: neq
      !! Problem size.
   integer, intent(in) :: iwt
      !! Flag indicating whether `rtol` and `atol` are scalars or vectors.
      !! If `iwt = 0`, then `rtol` and `atol` are scalars.
      !! If `iwt = 1`, then `rtol` and `atol` are vectors.
   real(rk), intent(in) :: rtol(*)
      !! Relative error tolerance.
   real(rk), intent(in) :: atol(*)
      !! Absolute error tolerance.
   real(rk), intent(in) :: y(neq)
      !! Solution vector.
   real(rk), intent(out) :: wt(neq)
      !! Error weight vector.
   real(rk), intent(in) :: rpar(*)
      !! User real workspace.
   integer, intent(in) :: ipar(*)
      !! User integer workspace.

   if (iwt == 0) then
      wt = rtol(1)*abs(y) + atol(1)
   else
      wt = rtol(1:neq)*abs(y) + atol(1:neq)
   end if

end subroutine ddawts