pf_generic_residual Subroutine

public subroutine pf_generic_residual(this, lev, dt, flags)

Generic residual Each sweeper can define its own residual, or use this generic one Compute the integral of F

add tau if it exists subtract out the solution value

Arguments

Type IntentOptional AttributesName
class(pf_sweeper_t), intent(in) :: this
class(pf_level_t), intent(inout) :: lev
real(kind=pfdp), intent(in) :: dt
integer, intent(in), optional :: flags

Called by

proc~~pf_generic_residual~~CalledByGraph proc~pf_generic_residual pf_generic_residual proc~imexq_residual imexQ_residual proc~imexq_residual->proc~pf_generic_residual proc~misdc_residual misdc_residual proc~misdc_residual->proc~pf_generic_residual proc~amisdc_residual amisdc_residual proc~amisdc_residual->proc~pf_generic_residual proc~misdcq_residual misdcQ_residual proc~misdcq_residual->proc~pf_generic_residual proc~imex_residual imex_residual proc~imex_residual->proc~pf_generic_residual

Contents

Source Code


Source Code

  subroutine pf_generic_residual(this, lev, dt, flags)
    class(pf_sweeper_t), intent(in)  :: this
    class(pf_level_t),  intent(inout) :: lev
    real(pfdp),        intent(in)    :: dt
    integer,  intent(in), optional  :: flags

    integer :: m
    
    !>  Compute the integral of F
    call lev%ulevel%sweeper%integrate(lev, lev%Q, lev%F, dt, lev%I, flags)

    !> add tau if it exists
    if (allocated(lev%tauQ)) then
       do m = 1, lev%nnodes-1
          call lev%I(m)%axpy(1.0_pfdp, lev%tauQ(m), flags)
       end do
    end if

    !> subtract out the solution value
    if (present(flags)) then
      do m = 1, lev%nnodes-1      
        if( (flags .eq. 0) .or. (flags .eq. 1) ) then
          call lev%R(m)%copy(lev%I(m), 1)
          call lev%R(m)%axpy(1.0_pfdp, lev%Q(1), 1)
          call lev%R(m)%axpy(-1.0_pfdp, lev%Q(m+1), 1)
        end if
        if( (flags .eq. 0) .or. (flags .eq. 2) ) then
          call lev%R(m)%copy(lev%I(m), 2)
          call lev%R(m)%axpy(1.0_pfdp, lev%Q(lev%nnodes), 2)
          call lev%R(m)%axpy(-1.0_pfdp, lev%Q(m), 2)
        end if
      end do
    else
      do m = 1, lev%nnodes-1      
        call lev%R(m)%copy(lev%I(m))
        call lev%R(m)%axpy(1.0_pfdp, lev%Q(1))
        call lev%R(m)%axpy(-1.0_pfdp, lev%Q(m+1))
      end do
    end if

  end subroutine pf_generic_residual