time_window Subroutine

public subroutine time_window(time, tsigma, norder, tfac, dtfac_dt, d2tfac_dt2)

Routine to calculate a smooth "Gaussian" type time window function, and it's first and second time derivative.

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in) :: time

The time at which to calculate the time window function, .

real(kind=wp), intent(in) :: tsigma

The width of the time window function, .

integer(kind=ip), intent(in) :: norder

The order of the time window function, .

real(kind=wp), intent(out) :: tfac

On output contains

real(kind=wp), intent(out) :: dtfac_dt

On output contains

real(kind=wp), intent(out) :: d2tfac_dt2

On output contains


Called by

proc~~time_window~~CalledByGraph proc~time_window time_window proc~get_force get_force proc~get_force->proc~time_window

Contents

Source Code


Source Code

  subroutine time_window ( time, tsigma, norder, tfac, dtfac_dt, d2tfac_dt2 )
  !! Routine to calculate a smooth "Gaussian" type time window function,
  !! \(f_t\) and it's first \(f_t'\) and second \(f_t''\) time derivative.

    implicit none

    real(wp), intent(in) :: time
    !! The time at which to calculate the time window function, \(t\).
    real(wp), intent(in) :: tsigma
    !! The width of the time window function, \(\sigma_t\).
    integer(ip), intent(in) :: norder
    !! The order of the time window function, \(n\).
    real(wp), intent(out) :: tfac
    !! On output contains \(f_t = 1-e^{\left (\frac{t}{\sigma_t}\right )^n}.\)
    real(wp), intent(out) :: dtfac_dt
    !! On output contains \(f_t'\)
    real(wp), intent(out) :: d2tfac_dt2
    !! On output contains \(f_t''\)
    real(wp) :: tfactor, expfactor

    tfactor = (time/tsigma)**norder
    expfactor = exp(-tfactor)
    tfac = 1.0_wp - expfactor
    dtfac_dt = norder*time**(norder-1)/tsigma**norder*expfactor
    d2tfac_dt2 = -norder*(1.0_wp+norder*(tfactor-1.0_wp)) &
                  *time**(norder-2)/tsigma**norder*expfactor
  end subroutine time_window