anchor.diff:    do n=1,nTimeSteps
   
       ! Time varying winds
  -    if (UseSinusoidWind .eqv. .TRUE.) then
  +    if (UseSinusoidWind .eqv. .true.) then
         wind_x = base_wind_x*(wind_alpha +  &
             wind_beta*sin(((2d0*pi*n*dt)/wind_period) - wind_t_offset))
         wind_y = base_wind_y*(wind_alpha +  &
             wind_beta*sin(((2d0*pi*n*dt)/wind_period) - wind_t_offset))
  -    else if (UseStochWind .eqv. .TRUE.) then
  +    else if (UseStochWind .eqv. .true.) then
         if (mod(n-1,n_stoch_wind).eq.0) then
           ! Gives a pseudorandom number in range 0 <= x < 1
           call random_number(stoch_wind_mag)
  
positive.code:   if (UseSinusoidWind .and. UseStochWind)  then
      ! Can't use both sinusiodal and stochastic wind variation.
      ! Write a file saying so
      OPEN(UNIT=99, FILE='errors.txt', ACTION="write", STATUS="replace", &
          FORM="formatted")
      write(99,*) "Can't have both stochastic and sinusoidally varying &
          &wind forcings. Choose one."
      CLOSE(UNIT=99)
  
      ! Print it on the screen
      print *, "Can't have both stochastic and sinusoidally varying &
          &wind forcings. Choose one."
      ! Stop the program
      STOP
    endif
  
    ! Read in arrays from the input files
  
negative.code: 
    end do
  
    open(unit=10, file='run_finished.txt', action="write", status="unknown", &
        form="formatted", position = "append")
    write(10,1112) n
  1112 format( "run finished at time step ", 1i10.10)
    close(unit=10)
  
    print *, 'Execution ended normally'
  
    stop 0
  
  end program MIM
  
  
  ! ------------------------- Beginning of the subroutines ----------------------
  