anchor.diff:          real(dp) :: start_time = HUGE(1.0_dp), end_time = -HUGE(1.0_dp)
               !! Controls the time-interval over which the forcing is applied. Must have start_time >= end_time.
               !! The default values will throw an error if used in apply_forcing_patch
  +        procedure(forcing_time), pointer, nopass :: forcing_time_function => NULL()
  +            !! A user-specified non-decreasing function of x such that:
  +            !!     forcing_time_function(0.0) = 0.0
  +            !! and:
  +            !!     forcing_time_function(1.0) = 1.0
  +            !! The idea is that, supposing: 
  +            !!     start_time <= t <= end_time
  +            !! then:
  +            !!     forcing_time( (t-start_time)/(end_time-start_time) ) 
  +            !! gives the fraction of the forcing that has been applied by time t.
  +            !! If not specified then the identify function is used (i.e. constant 
  +            !! rate of forcing between start_time and end_time).
           contains
  -
           procedure:: setup => setup_forcing_patch
               !! Allocate forcing_patch%forcing_work and set start_time, end_time, and spatial indices
           procedure:: finalise => deallocate_forcing_patch
  
positive.code:             !! Update the domain for a time-step from (time-dt, time). Note "time" is the END of the timestep
          real(dp), intent(in) :: start_time, end_time
              !! Apply the entire forcing at a steady rate between start_time and end_time
  
          real(dp) :: update_fraction, local_dt
          integer(ip) :: i, j, k
  
          if( ((time - dt) <= end_time) .and. (time >= start_time)) then
              ! The forcing is only applied between start_time and end_time - so
              ! we need to make sure the current time-step overlapped that period.
              ! (Note we are at the end of the timestep, and time was already updated).
  
negative.code: 
          ! All seems well so apply the forcing.
          call add_forcing_work_to_U_over_time(domain%U(i0:i1, j0:j1, k0:k1), fp%forcing_work, domain%time, &
              dt, fp%start_time, fp%end_time, fp%forcing_time_function)
  
      end subroutine
  
  