*IF DEF,SEAICE                                                             ORH1F305.443    
C ******************************COPYRIGHT******************************    GTS2F400.3943   
C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.    GTS2F400.3944   
C                                                                          GTS2F400.3945   
C Use, duplication or disclosure of this code is subject to the            GTS2F400.3946   
C restrictions as set forth in the contract.                               GTS2F400.3947   
C                                                                          GTS2F400.3948   
C                Meteorological Office                                     GTS2F400.3949   
C                London Road                                               GTS2F400.3950   
C                BRACKNELL                                                 GTS2F400.3951   
C                Berkshire UK                                              GTS2F400.3952   
C                RG12 2SZ                                                  GTS2F400.3953   
C                                                                          GTS2F400.3954   
C If no contract has been raised with this copy of the code, the use,      GTS2F400.3955   
C duplication or disclosure of it is strictly prohibited.  Permission      GTS2F400.3956   
C to do so must first be obtained in writing from the Head of Numerical    GTS2F400.3957   
C Modelling at the above address.                                          GTS2F400.3958   
C ******************************COPYRIGHT******************************    GTS2F400.3959   
C                                                                          GTS2F400.3960   
C*LL                                                                       HNYCAL1.3      
CLL   Subroutine HNYCAL1                                                   HNYCAL1.4      
CLL   Can run on any FORTRAN 77 compiler with long lower case variables    HNYCAL1.5      
CLL                                                                        HNYCAL1.6      
CLL   The code must be pre-compiled by the UPDOC system.                   HNYCAL1.7      
CLL   Option V selects relaxation to climatological T & S..                HNYCAL1.8      
CLL   Option A indicates that the Unified Model version is to be used.     HNYCAL1.9      
CLL   The default is the COX standard code.                                HNYCAL1.10     
CLL                                                                        HNYCAL1.11     
CLL   Author: A B Keen                                                     HNYCAL1.12     
CLL   Date: 4 August 1992                                                  HNYCAL1.13     
CLL   Reviewer:                                                            HNYCAL1.14     
CLL   Review date:                                                         HNYCAL1.15     
CLL                                                                        HNYCAL1.16     
CLL   Programming standards use Cox naming convention for Cox variables    HNYCAL1.17     
CLL      with the addition that lower case variables are local to the      HNYCAL1.18     
CLL      routine.                                                          HNYCAL1.19     
CLL      Otherwise follows UM doc paper 4 version 1.                       HNYCAL1.20     
CLL                                                                        HNYCAL1.21     
CLL   This forms part of UM brick P4.                                      HNYCAL1.22     
CLL                                                                        HNYCAL1.23     
CLL   This routine is a special version of HNYCAL for the northernmost     HNYCAL1.24     
CLL   row, where the ocean model thinks there is land, the atmos           HNYCAL1.25     
CLL   model thinks there is sea, and the sea-ice model still operates!     HNYCAL1.26     
CLL                                                                        HNYCAL1.27     
CLL   Programming: Brick P4, paper 4, version number 1.                    HNYCAL1.28     
CLL                                                                        HNYCAL1.29     
CLL   Subroutine dependencies: NONE                                        HNYCAL1.30     
CLL                                                                        HNYCAL1.31     
CLLEND   ---------------------------------------------------------------   HNYCAL1.32     
C*                                                                         HNYCAL1.33     
C*L   -------------------------- Arguments ----------------------------    HNYCAL1.34     
C                                                                          HNYCAL1.35     

      SUBROUTINE HNYCAL1 ( IMT                                              1HNYCAL1.36     
     +,                    HANEY_SI                                        HNYCAL1.37     
     +,                    fluxiceh                                        HNYCAL1.38     
     +,                    HICE, HICE_REF                                  HNYCAL1.39     
     +,                    QFUSION                                         HNYCAL1.40     
     +,                    RHO,CP                                          HNYCAL1.41     
     +,                    DZ1                                             HNYCAL1.42     
     +                     )                                               HNYCAL1.43     
C                                                                          HNYCAL1.44     
      IMPLICIT NONE                                                        HNYCAL1.45     
C                                                                          HNYCAL1.46     
C     Define constants for array sizes                                     HNYCAL1.47     
C                                                                          HNYCAL1.48     
      INTEGER                                                              HNYCAL1.49     
     +   IMT               ! IN  Number of points in horizontal            HNYCAL1.50     
C                                                                          HNYCAL1.51     
C     Physical arguments                                                   HNYCAL1.52     
C                                                                          HNYCAL1.53     
      REAL                                                                 HNYCAL1.54     
     +   HANEY_SI          ! IN  Haney coeff (w m-2 K-1)                   HNYCAL1.55     
     +,  fluxiceh (IMT)    ! OUT Heating anomaly (W/m2)                    HNYCAL1.56     
     +,  HICE(IMT)         ! IN  Grid box mean ice depth                   HNYCAL1.57     
     +,  HICE_REF(IMT)     ! IN  Climatological ice depth                  HNYCAL1.58     
     +,  QFUSION           ! IN  Latent heat of fusion of ice              HNYCAL1.59     
     +,  RHO               ! IN  Density of sea-water (Kg m-3)             HNYCAL1.60     
     +,  CP                ! IN  Heat capacity of sea-water (J Kg-1 K-1)   HNYCAL1.61     
     +,  DZ1               ! IN  Top layer depth (cm)                      HNYCAL1.62     
C*                                                                         HNYCAL1.63     
C                                                                          HNYCAL1.64     
C     Locally defined variables                                            HNYCAL1.65     
C                                                                          HNYCAL1.66     
      INTEGER                                                              HNYCAL1.67     
     +   i              !  Horizontal loop index                           HNYCAL1.68     
      REAL                                                                 HNYCAL1.69     
     +   hcap1          !  Heat capacity of top layer (J m-2 K-1)          HNYCAL1.70     
     +,  const          !  Factor to convert ice depth to thermodynamic    HNYCAL1.71     
     +,  rhoice         !  Density of ice (Kg m-3)                         HNYCAL1.72     
     +,  rhocp          !  Vol. heat capacity of sea-water (J m-3 K-1)     HNYCAL1.73     
     +,  dz1z           !  Top layer depth (m)                             HNYCAL1.74     
     +,  tref           !  Reference thermodynamic temp                    HNYCAL1.75     
     +,  t1             !  Thermodynamic temp                              HNYCAL1.76     
     +,  HANEYI_SI      !  Haney coeff for sea-ice                         HNYCAL1.77     
C                                                                          HNYCAL1.78     
C                                                                          HNYCAL1.79     
      PARAMETER(rhoice=900.0)                                              HNYCAL1.80     
C                                                                          HNYCAL1.81     
      dz1z=DZ1*0.01                                                        HNYCAL1.82     
      rhocp=RHO*CP                                                         HNYCAL1.83     
      hcap1=rhocp*dz1z                                                     HNYCAL1.84     
      const=rhoice*QFUSION/hcap1                                           HNYCAL1.85     
      HANEYI_SI = HANEY_SI                                                 HNYCAL1.86     
C                                                                          HNYCAL1.87     
C                                                                          HNYCAL1.88     
CL    1.1   Calculate anomalous heat flux                                  HNYCAL1.89     
C                                                                          HNYCAL1.90     
      DO 2100, i = 1, IMT                                                  HNYCAL1.91     
C  Calculate 'thermodynamic' temperature, which allows for heat            HNYCAL1.92     
C  content of ice                                                          HNYCAL1.93     
         tref=-const*HICE_REF(i)                                           HNYCAL1.94     
         t1=-const*HICE(i)                                                 HNYCAL1.95     
C  Do Haney forcing on thermodynamic temperature                           HNYCAL1.96     
         fluxiceh(i) = HANEYI_SI*(tref - t1)                               HNYCAL1.97     
 2100 CONTINUE                                                             HNYCAL1.98     
C                                                                          HNYCAL1.99     
CL    Return from HNYCAL1                                                  HNYCAL1.100    
C                                                                          HNYCAL1.101    
      RETURN                                                               HNYCAL1.102    
      END                                                                  HNYCAL1.103    
*ENDIF                                                                     HNYCAL1.104