module_time.f90 Source File


This file depends on

sourcefile~~module_time.f90~~EfferentGraph sourcefile~module_time.f90 module_time.f90 sourcefile~module_kinds.f90 module_kinds.f90 sourcefile~module_time.f90->sourcefile~module_kinds.f90

Files dependent on this one

sourcefile~~module_time.f90~~AfferentGraph sourcefile~module_time.f90 module_time.f90 sourcefile~submodule_osc_schw_implementation.f90 submodule_osc_schw_implementation.f90 sourcefile~submodule_osc_schw_implementation.f90->sourcefile~module_time.f90 sourcefile~module_self_force.f90 module_self_force.f90 sourcefile~submodule_osc_schw_implementation.f90->sourcefile~module_self_force.f90 sourcefile~submodule_scalar_schw_implementation.f90 submodule_scalar_schw_implementation.f90 sourcefile~submodule_scalar_schw_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_scalar_schw_implementation.f90->sourcefile~module_self_force.f90 sourcefile~submodule_analytic_circular_orbit_implementation.f90 submodule_analytic_circular_orbit_implementation.f90 sourcefile~submodule_analytic_circular_orbit_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_analytic_circular_orbit_implementation.f90->sourcefile~module_self_force.f90 sourcefile~submodule_grid_function_implementation.f90 submodule_grid_function_implementation.f90 sourcefile~submodule_grid_function_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_singular_observer_implementation.f90 submodule_singular_observer_implementation.f90 sourcefile~submodule_singular_observer_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_rk4_implementation.f90 submodule_rk4_implementation.f90 sourcefile~submodule_rk4_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_geod_schw_implementation.f90 submodule_geod_schw_implementation.f90 sourcefile~submodule_geod_schw_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_geod_schw_implementation.f90->sourcefile~module_self_force.f90 sourcefile~submodule_rk5_implementation.f90 submodule_rk5_implementation.f90 sourcefile~submodule_rk5_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_self_force_observer_implementation.f90 submodule_self_force_observer_implementation.f90 sourcefile~submodule_self_force_observer_implementation.f90->sourcefile~module_time.f90 sourcefile~submodule_observers_implementation.f90 submodule_observers_implementation.f90 sourcefile~submodule_observers_implementation.f90->sourcefile~module_time.f90 sourcefile~module_self_force.f90->sourcefile~module_time.f90 sourcefile~submodule_abmv5_implementation.f90 submodule_abmv5_implementation.f90 sourcefile~submodule_abmv5_implementation.f90->sourcefile~module_time.f90 sourcefile~test.f90 test.f90 sourcefile~test.f90->sourcefile~module_time.f90 sourcefile~test.f90->sourcefile~module_self_force.f90

Contents

Source Code


Source Code

module time_info
!! Module with variables and routines to keep track of time.

!! There are both working and quad precision copies of the time variable that
!! gets updated synchronously when the routines provided here are used.

  use kinds

  implicit none

  real(wp), private :: time
  !! Working precision copy of the time, \(t\).
  real(wp), private :: time_save
  !! Working precision backup copy of the time.
  real(wp), private :: dtime
  !! \(\Delta t\).
  real(qp), private :: qtime
  !! Quad precision copy of the time, \(t\).
  real(qp), private :: qtime_save
  !! Quad precision backup copy of the time.
  logical :: short_timesteps_active = .false.
  !! Variable to keep track of whether small \(\Delta t\) is used for quick
  !! but smooth turn on of the effective source.

contains

  subroutine init_time ( t0 )
  !! Routine to initialize the time variables.

    implicit none

    real(wp), intent(in) :: t0
    !! The initial time, \(t_0\).

    time = t0
    qtime = t0
 
  end subroutine init_time


  subroutine save_time ( )
  !! Routine to make a backup copy of the time.

    implicit none

    time_save = time
    qtime_save = qtime
  end subroutine save_time  


  subroutine restore_and_increment_time ( dt )
  !! Routine to restore and increment a backup copy of the time.
  !!
  !! Needed for some Runge-Kutta integrators.

    implicit none

    real(wp), intent(in) :: dt
    !! The \(\Delta t\) to use for the increment.

    time = time_save + dt
    qtime = qtime_save + dt

  end subroutine restore_and_increment_time


  subroutine set_dtime ( dt )
  !! Routine that sets \(\Delta t\).

    implicit none
 
    real(wp), intent(in) :: dt
    !! The value to use for \(\Delta t\).

    dtime = dt

  end subroutine set_dtime


  subroutine increment_time ( dt )
  !! Routine to increment \(t\) by \(\Delta t\).

    implicit none

    real(wp), intent(in) :: dt
    !! The value to use for \(\Delta t\).

    time = time + dt
    qtime = qtime + dt

  end subroutine increment_time


  function get_current_time ( ) result(t)
  !! Function to get the current working precision time, \(t\).

    implicit none

    real(wp) :: t
    !! Returns \(t\).

    t = time

  end function get_current_time


  function get_current_dtime ( ) result(dt)
  !! Function to get the current \(\Delta t\)

    implicit none

    real(wp) :: dt
    !! Returns \(\Delta t\).

    dt = dtime

  end function get_current_dtime


  function get_current_qtime ( ) result(t)
  !! Function to get the current quad precision time, \(t\).

    implicit none

    real(qp) :: t
    !! Returns \(t\).

    t = qtime

  end function get_current_qtime

end module time_info