Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:41:40 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
e0a2f8aec4 Jean*0001 #include "LAND_OPTIONS.h"
                0002 
                0003 CBOP
                0004 C     !ROUTINE: LAND_INI_VARS
                0005 C     !INTERFACE:
                0006       SUBROUTINE LAND_INI_VARS( myThid )
                0007 
                0008 C     !DESCRIPTION: \bv
                0009 C     *==========================================================*
                0010 C     | S/R LAND_INI_VARS
                0011 C     | o Initialize Land package variables
                0012 C     *==========================================================*
                0013 C     | for now, used only for a restart
                0014 C     *==========================================================*
                0015 C     \ev
1720e28536 Jean*0016 
e0a2f8aec4 Jean*0017 C     !USES:
                0018       IMPLICIT NONE
                0019 
                0020 C     == Global variables ===
                0021 
                0022 C-- size for MITgcm & Land package :
                0023 #include "LAND_SIZE.h"
                0024 
                0025 #include "EEPARAMS.h"
                0026 #include "PARAMS.h"
                0027 #include "LAND_PARAMS.h"
a8844d79c5 Jean*0028 #include "LAND_VARS.h"
e0a2f8aec4 Jean*0029 
                0030 C     !INPUT/OUTPUT PARAMETERS:
1720e28536 Jean*0031 C     == Routine Arguments ==
e0a2f8aec4 Jean*0032 C     myThid -  Number of this instance
                0033       INTEGER myThid
                0034 CEOP
                0035 
                0036 #ifdef ALLOW_LAND
                0037 
1720e28536 Jean*0038 C     == Local Variables ==
e0a2f8aec4 Jean*0039 C     msgBuf      - Informational/error meesage buffer
89992793c5 Jean*0040 C     i,j,k,bi,bj :: loop indices
                0041 C     grd_HeatCp   :: Heat capacity of the ground (J/m3/K)
                0042 C     mWater       :: water content of the ground (kg/m3)
                0043 C     temp_af      :: ground temperature if above freezing
                0044 C     temp_bf      :: ground temperature if below freezing
e0a2f8aec4 Jean*0045 c     CHARACTER*(MAX_LEN_MBUF) msgBuf
89992793c5 Jean*0046       INTEGER i,j,k,bi,bj
                0047       _RL grd_HeatCp, mWater
                0048       _RL temp_af, temp_bf
e0a2f8aec4 Jean*0049 
                0050 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0051 
89992793c5 Jean*0052 C--   Initialize Land package variables
                0053 
                0054 C-    Over all tiles
                0055       DO bj = myByLo(myThid), myByHi(myThid)
                0056        DO bi = myBxLo(myThid), myBxHi(myThid)
                0057 
                0058 C-      3D arrays
                0059         DO k=1,land_nLev
                0060          DO J=1-Oly,sNy+Oly
                0061           DO I=1-Olx,sNx+Olx
                0062            land_groundT(i,j,k,bi,bj) = 0. _d 0
                0063            land_enthalp(i,j,k,bi,bj) = 0. _d 0
                0064            land_groundW(i,j,k,bi,bj) = 0. _d 0
                0065           ENDDO
                0066          ENDDO
                0067         ENDDO
                0068 
                0069 C-      2D arrays
                0070         DO J=1-Oly,sNy+Oly
                0071          DO I=1-Olx,sNx+Olx
                0072            land_skinT  (i,j,bi,bj) = 0. _d 0
                0073            land_hSnow  (i,j,bi,bj) = 0. _d 0
                0074            land_snowAge(i,j,bi,bj) = 0. _d 0
                0075            land_runOff (i,j,bi,bj) = 0. _d 0
                0076            land_enRnOf (i,j,bi,bj) = 0. _d 0
                0077            land_HeatFLx(i,j,bi,bj) = 0. _d 0
                0078            land_Pr_m_Ev(i,j,bi,bj) = 0. _d 0
                0079            land_EnWFlux(i,j,bi,bj) = 0. _d 0
                0080          ENDDO
                0081         ENDDO
                0082 
                0083 C-     end bi,bj loops
                0084        ENDDO
                0085       ENDDO
                0086 
                0087 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
a8844d79c5 Jean*0088 
1720e28536 Jean*0089 C-    Need to synchronize here before doing master-thread IO
                0090       _BARRIER
                0091 
adf557b193 Jean*0092       IF ( startTime.EQ.baseTime .AND. nIter0.EQ.0 ) THEN
e0a2f8aec4 Jean*0093 
a8844d79c5 Jean*0094 C--   Define the initial state : read from file
                0095        IF ( land_grT_iniFile .NE. ' ' ) THEN
e024b9fa7f Jean*0096         CALL READ_REC_3D_RL( land_grT_iniFile, readBinaryPrec,
                0097      &            land_nLev, land_groundT, 1, nIter0, myThid )
a8844d79c5 Jean*0098        ENDIF
                0099        IF ( land_grW_iniFile .NE. ' ' ) THEN
e024b9fa7f Jean*0100         CALL READ_REC_3D_RL( land_grW_iniFile, readBinaryPrec,
                0101      &            land_nLev, land_groundW, 1, nIter0, myThid )
a8844d79c5 Jean*0102        ENDIF
89992793c5 Jean*0103        IF ( land_snow_iniFile .NE. ' ' ) THEN
e024b9fa7f Jean*0104         CALL READ_FLD_XY_RL( land_snow_iniFile, ' ',
                0105      &                       land_hSnow, nIter0, myThid )
89992793c5 Jean*0106        ENDIF
e0a2f8aec4 Jean*0107 
                0108       ELSEIF ( land_calc_grT .OR. land_calc_grW ) THEN
                0109 
                0110 C--   Read Land package state variables from pickup file
                0111         CALL LAND_READ_PICKUP( nIter0, myThid )
                0112 
a8844d79c5 Jean*0113 c     ELSE
                0114 C-    a trick to allow to start without a land pickup:
                0115 C        load grT & grW from AIM surf. BC in S/R aim_land2aim
e0a2f8aec4 Jean*0116       ENDIF
                0117 
1720e28536 Jean*0118 C-    Every one else must wait until loading is done.
                0119       _BARRIER
                0120 
                0121 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0122 
89992793c5 Jean*0123       DO bj=myByLo(myThid),myByHi(myThid)
                0124        DO bi=myBxLo(myThid),myBxHi(myThid)
                0125 
41e18af02d Jean*0126 C-     to have a consistent initial state: set surface Temp & enthalpy
                0127 C       assuming all the water in 1 phase only (solid or liquid):
adf557b193 Jean*0128         IF ( ( startTime.EQ.baseTime .AND. nIter0.EQ.0 ) .OR.
89992793c5 Jean*0129      &   .NOT.( land_calc_grT .OR. land_calc_grW ) .OR.
                0130      &       land_oldPickup ) THEN
                0131          DO j=1,sNy
                0132           DO i=1,sNx
                0133 c          IF ( land_frc(i,j,bi,bj).GT.0. ) THEN
                0134             DO k=1,land_nLev
                0135              mWater = land_rhoLiqW*land_waterCap
                0136      &               *land_groundW(i,j,k,bi,bj)
                0137              grd_HeatCp = land_heatCs + land_CpWater*mWater
1720e28536 Jean*0138              land_enthalp(i,j,k,bi,bj) =
89992793c5 Jean*0139      &                     grd_HeatCp*land_groundT(i,j,k,bi,bj)
1720e28536 Jean*0140              IF (land_groundT(i,j,k,bi,bj).LT. 0. _d 0)
89992793c5 Jean*0141      &       land_enthalp(i,j,k,bi,bj) = land_enthalp(i,j,k,bi,bj)
                0142      &                                 - land_Lfreez*mWater
                0143             ENDDO
                0144              land_skinT(i,j,bi,bj) = land_groundT(i,j,1,bi,bj)
                0145 c          ENDIF
                0146           ENDDO
                0147          ENDDO
1720e28536 Jean*0148         ELSE
89992793c5 Jean*0149          DO j=1,sNy
                0150           DO i=1,sNx
                0151             DO k=1,land_nLev
                0152              mWater = land_rhoLiqW*land_waterCap
                0153      &               *land_groundW(i,j,k,bi,bj)
                0154              grd_HeatCp = land_heatCs + land_CpWater*mWater
                0155 C         temperature if below freezing:
                0156              temp_bf = (land_enthalp(i,j,k,bi,bj)+land_Lfreez*mWater)
                0157      &                                            / grd_HeatCp
                0158 C         temperature if above freezing:
                0159              temp_af =  land_enthalp(i,j,k,bi,bj) / grd_HeatCp
                0160              land_groundT(i,j,k,bi,bj) =
                0161      &               MIN( temp_bf, MAX(temp_af, 0. _d 0) )
                0162             ENDDO
                0163           ENDDO
                0164          ENDDO
                0165         ENDIF
                0166 
                0167 C-     end bi,bj loops
                0168        ENDDO
                0169       ENDDO
                0170 
e0a2f8aec4 Jean*0171 #endif /* ALLOW_LAND */
                0172 
                0173       RETURN
                0174       END