Assign level pointer
Loop over sweeps
Loop over substeps Accumulate rhs Add the tau term
Compute explicit function on new value End substep loop
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
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