imk_actually_sweep Subroutine

public subroutine imk_actually_sweep(this, pf, level_index, t0, dt, nsweeps)

Uses

  • proc~~imk_actually_sweep~~UsesGraph proc~imk_actually_sweep imk_actually_sweep module~pf_mod_hooks pf_mod_hooks proc~imk_actually_sweep->module~pf_mod_hooks module~pf_mod_timer pf_mod_timer proc~imk_actually_sweep->module~pf_mod_timer module~pf_mod_dtype pf_mod_dtype module~pf_mod_hooks->module~pf_mod_dtype module~pf_mod_timer->module~pf_mod_dtype iso_c_binding iso_c_binding module~pf_mod_dtype->iso_c_binding

Assign level pointer

Loop over sweeps

Loop over substeps Accumulate rhs Add the tau term

Compute explicit function on new value End substep loop

Arguments

Type IntentOptional AttributesName
class(pf_imk_t), intent(inout) :: this

Inputs

type(pf_pfasst_t), intent(inout), target:: pf

PFASST structure

integer, intent(in) :: level_index

which level to sweep on

real(kind=pfdp), intent(in) :: t0

Time at beginning of time step

real(kind=pfdp), intent(in) :: dt

time step size

integer, intent(in) :: nsweeps

number of sweeps to do


Calls

proc~~imk_actually_sweep~~CallsGraph proc~imk_actually_sweep imk_actually_sweep proc~pf_residual pf_residual proc~imk_actually_sweep->proc~pf_residual proc~start_timer start_timer proc~imk_actually_sweep->proc~start_timer proc~end_timer end_timer proc~imk_actually_sweep->proc~end_timer proc~pf_residual->proc~start_timer proc~pf_residual->proc~end_timer

Called by

proc~~imk_actually_sweep~~CalledByGraph proc~imk_actually_sweep imk_actually_sweep proc~imk_sweep imk_sweep proc~imk_sweep->proc~imk_actually_sweep

Contents

Source Code


Source Code

  subroutine imk_actually_sweep(this, pf, level_index, t0, dt, nsweeps)
    use pf_mod_timer
    use pf_mod_hooks

    !>  Inputs
    class(pf_imk_t), intent(inout) :: this
    type(pf_pfasst_t), intent(inout),target :: pf      !!  PFASST structure
    integer,             intent(in)    :: level_index  !!  which level to sweep on
    real(pfdp),        intent(in   ) :: t0             !!  Time at beginning of time step
    real(pfdp),        intent(in   ) :: dt             !!  time step size
    integer,             intent(in)    :: nsweeps      !!  number of sweeps to do

    !>  Local variables
    class(pf_level_t), pointer :: lev    !!  points to current level

    integer     :: m, n,k   !!  Loop variables
    real(pfdp)  :: t        !!  Time at nodes
    lev => pf%levels(level_index)   !!  Assign level pointer

    call start_timer(pf, TLEVEL+lev%index-1)

    do k = 1,nsweeps   !!  Loop over sweeps

       ! compute integrals and add fas correction
       do m = 1, lev%nnodes-1
          call lev%I(m)%setval(0.0_pfdp)
          do n = 1, lev%nnodes
             call lev%I(m)%axpy(dt*this%QdiffE(m,n), lev%F(n,1))
          end do
          if (level_index < pf%nlevels) then
             call lev%I(m)%axpy(1.0_pfdp, lev%tauQ(m))
          end if
       end do

       !  Recompute the first function value if this is first sweep
       if (k .eq. 1) then
          call lev%Q(1)%setval(0.0_pfdp) ! likely an unnecessary setting of Omega=0
          call this%evaluate(lev, t0, 1)
       end if

       t = t0
       ! do the sub-stepping in sweep
       do m = 1, lev%nnodes-1  !!  Loop over substeps
          t = t + dt*this%dtsdc(m)

          !>  Accumulate rhs
          call lev%Q(m+1)%setval(0.0_pfdp)
          do n = 1, m
             call lev%Q(m+1)%axpy(dt*this%QtilE(m,n), lev%F(n,1))
          end do
          !>  Add the tau term
          call lev%Q(m+1)%axpy(1.0_pfdp, lev%I(m))

          !>  Compute explicit function on new value
          call this%evaluate(lev, t, m+1)
       end do  !!  End substep loop

       call pf_residual(pf, lev, dt)
       call lev%qend%copy(lev%Q(lev%nnodes), 1)

    end do  !  End loop on sweeps

    call end_timer(pf, TLEVEL+lev%index-1)
  end subroutine imk_actually_sweep