| 1 |
jscott |
1.2 |
C $Header: /u/gcmpack/MITgcm_contrib/jscott/code_changed/thsice_step_temp.F,v 1.1 2006/08/11 19:29:23 jscott Exp $ |
| 2 |
jscott |
1.1 |
C $Name: $ |
| 3 |
|
|
|
| 4 |
|
|
#include "THSICE_OPTIONS.h" |
| 5 |
|
|
|
| 6 |
|
|
CBOP |
| 7 |
|
|
C !ROUTINE: THSICE_STEP_TEMP |
| 8 |
|
|
C !INTERFACE: |
| 9 |
|
|
SUBROUTINE THSICE_STEP_TEMP( |
| 10 |
|
|
I bi, bj, iMin, iMax, jMin, jMax, |
| 11 |
|
|
I myTime, myIter, myThid ) |
| 12 |
|
|
C !DESCRIPTION: \bv |
| 13 |
|
|
C *==========================================================* |
| 14 |
|
|
C | S/R THSICE_STEP_TEMP |
| 15 |
|
|
C | o Step Forward Surface and SeaIce Temperature. |
| 16 |
|
|
C *==========================================================* |
| 17 |
|
|
C \ev |
| 18 |
|
|
|
| 19 |
|
|
C !USES: |
| 20 |
|
|
IMPLICIT NONE |
| 21 |
|
|
|
| 22 |
|
|
C === Global variables === |
| 23 |
|
|
#include "SIZE.h" |
| 24 |
|
|
#include "EEPARAMS.h" |
| 25 |
|
|
#include "PARAMS.h" |
| 26 |
|
|
#include "FFIELDS.h" |
| 27 |
|
|
#include "THSICE_SIZE.h" |
| 28 |
|
|
#include "THSICE_PARAMS.h" |
| 29 |
|
|
#include "THSICE_VARS.h" |
| 30 |
|
|
#include "THSICE_TAVE.h" |
| 31 |
|
|
|
| 32 |
|
|
INTEGER siLo, siHi, sjLo, sjHi |
| 33 |
|
|
PARAMETER ( siLo = 1-OLx , siHi = sNx+OLx ) |
| 34 |
|
|
PARAMETER ( sjLo = 1-OLy , sjHi = sNy+OLy ) |
| 35 |
|
|
|
| 36 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
| 37 |
|
|
C === Routine arguments === |
| 38 |
|
|
C- input: |
| 39 |
|
|
C bi,bj :: tile indices |
| 40 |
|
|
C iMin,iMax :: computation domain: 1rst index range |
| 41 |
|
|
C jMin,jMax :: computation domain: 2nd index range |
| 42 |
|
|
C myTime :: time counter for this thread |
| 43 |
|
|
C myIter :: iteration counter for this thread |
| 44 |
|
|
C myThid :: thread number for this instance of the routine. |
| 45 |
|
|
C-- Modify fluxes hold in commom blocks |
| 46 |
|
|
C- input: |
| 47 |
|
|
C icFlxSW :: (Inp) short-wave heat flux (+=down): downward comp. only |
| 48 |
|
|
C- output |
| 49 |
|
|
C icFlxSW :: (Out) net SW flux into ocean (+=down) |
| 50 |
|
|
C icFlxAtm:: net flux of energy from the atmosphere [W/m2] (+=down) |
| 51 |
|
|
C icFrwAtm:: evaporation to the atmosphere (kg/m2/s) (>0 if evaporate) |
| 52 |
|
|
C-- |
| 53 |
|
|
INTEGER bi,bj |
| 54 |
|
|
INTEGER iMin, iMax |
| 55 |
|
|
INTEGER jMin, jMax |
| 56 |
|
|
_RL myTime |
| 57 |
|
|
INTEGER myIter |
| 58 |
|
|
INTEGER myThid |
| 59 |
|
|
CEOP |
| 60 |
|
|
|
| 61 |
|
|
#ifdef ALLOW_THSICE |
| 62 |
|
|
C !LOCAL VARIABLES: |
| 63 |
|
|
C === Local variables === |
| 64 |
|
|
C tFrzOce :: sea-water freezing temperature [oC] (function of S) |
| 65 |
|
|
C dTsrf :: surf. temp adjusment: Ts^n+1 - Ts^n |
| 66 |
|
|
INTEGER i,j |
| 67 |
|
|
_RL tFrzOce(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 68 |
|
|
c _RL dTsrf (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 69 |
|
|
#ifndef ALLOW_ATM2D |
| 70 |
|
|
_RL tmpflx(1:2), tmpdTs(1:2) |
| 71 |
|
|
#else |
| 72 |
|
|
_RL tmpflx(iMin:iMax,jMin:jMax,0:2) |
| 73 |
|
|
_RL tmpdTs(iMin:iMax,jMin:jMax) |
| 74 |
|
|
#endif |
| 75 |
|
|
#ifdef SHORTWAVE_HEATING |
| 76 |
|
|
_RL opFrac, icFrac |
| 77 |
|
|
#endif |
| 78 |
|
|
LOGICAL dBugFlag |
| 79 |
|
|
|
| 80 |
|
|
C- define grid-point location where to print debugging values |
| 81 |
|
|
#include "THSICE_DEBUG.h" |
| 82 |
|
|
|
| 83 |
|
|
1010 FORMAT(A,1P4E14.6) |
| 84 |
|
|
|
| 85 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 86 |
|
|
|
| 87 |
|
|
dBugFlag = debugLevel.GE.debLevB |
| 88 |
|
|
C- Initialise flxAtm,evpAtm |
| 89 |
|
|
#ifndef ALLOW_ATM2D |
| 90 |
|
|
DO j = 1-OLy, sNy+OLy |
| 91 |
|
|
DO i = 1-OLx, sNx+OLx |
| 92 |
|
|
icFlxAtm(i,j,bi,bj) = 0. |
| 93 |
|
|
icFrwAtm(i,j,bi,bj) = 0. |
| 94 |
|
|
ENDDO |
| 95 |
|
|
ENDDO |
| 96 |
|
|
#endif |
| 97 |
|
|
c IF ( fluidIsWater ) THEN |
| 98 |
|
|
CALL THSICE_ALBEDO( |
| 99 |
|
|
I bi, bj, siLo, siHi, sjLo, sjHi, |
| 100 |
|
|
I iMin,iMax, jMin,jMax, |
| 101 |
|
|
I iceMask(siLo,sjLo,bi,bj), iceHeight(siLo,sjLo,bi,bj), |
| 102 |
|
|
I snowHeight(siLo,sjLo,bi,bj), Tsrf(siLo,sjLo,bi,bj), |
| 103 |
|
|
I snowAge(siLo,sjLo,bi,bj), |
| 104 |
|
|
O siceAlb(siLo,sjLo,bi,bj), |
| 105 |
|
|
I myTime, myIter, myThid ) |
| 106 |
|
|
|
| 107 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 108 |
|
|
C part.1 : ice-covered fraction ; |
| 109 |
|
|
C Solve for surface and ice temperature (implicitly) ; compute surf. fluxes |
| 110 |
|
|
C------- |
| 111 |
|
|
DO j = jMin, jMax |
| 112 |
|
|
DO i = iMin, iMax |
| 113 |
|
|
IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN |
| 114 |
|
|
#ifdef ALLOW_DBUG_THSICE |
| 115 |
|
|
IF ( dBug(i,j,bi,bj) ) THEN |
| 116 |
|
|
WRITE(6,'(A,2I4,2I2)') 'ThSI_STEP_T: i,j=',i,j,bi,bj |
| 117 |
|
|
WRITE(6,1010) 'ThSI_STEP_T: iceMask, hIc, hSn, Tsf =', |
| 118 |
|
|
& iceMask(i,j,bi,bj), iceHeight(i,j,bi,bj), |
| 119 |
|
|
& snowHeight(i,j,bi,bj), Tsrf(i,j,bi,bj) |
| 120 |
|
|
ENDIF |
| 121 |
|
|
#endif |
| 122 |
|
|
C- surface net SW flux: |
| 123 |
|
|
icFlxSW(i,j,bi,bj) = icFlxSW(i,j,bi,bj) |
| 124 |
|
|
& *(1. _d 0 - siceAlb(i,j,bi,bj)) |
| 125 |
|
|
tFrzOce(i,j) = -mu_Tf*sOceMxL(i,j,bi,bj) |
| 126 |
|
|
#ifdef ALLOW_ATM2D |
| 127 |
|
|
tmpflx(i,j,0)= icFlxAtm(i,j,bi,bj) + |
| 128 |
|
|
& (Tmlt1-Tsrf(i,j,bi,bj))*dFdT(i,j,bi,bj) |
| 129 |
|
|
tmpflx(i,j,1)= icFlxAtm(i,j,bi,bj) |
| 130 |
|
|
tmpflx(i,j,2)= dFdT(i,j,bi,bj) |
| 131 |
|
|
C print *,'in thsice_step_temp at ',i,j |
| 132 |
|
|
C print *,'tmpflx:',tmpflx(i,j,0),tmpflx(i,j,1),tmpflx(i,j,2) |
| 133 |
|
|
C print *,'ice:',Tsrf(i,j,1,1),iceMask(i,j,1,1), |
| 134 |
|
|
C & iceHeight(i,j,1,1),snowHeight(i,j,1,1) |
| 135 |
|
|
#endif |
| 136 |
|
|
ELSE |
| 137 |
|
|
tFrzOce(i,j) = 0. _d 0 |
| 138 |
|
|
ENDIF |
| 139 |
|
|
ENDDO |
| 140 |
|
|
ENDDO |
| 141 |
|
|
|
| 142 |
|
|
CALL THSICE_SOLVE4TEMP( |
| 143 |
|
|
I bi, bj, siLo, siHi, sjLo, sjHi, |
| 144 |
|
|
I iMin,iMax, jMin,jMax, dBugFlag, |
| 145 |
|
|
I useBulkForce, useEXF, |
| 146 |
|
|
I iceMask(siLo,sjLo,bi,bj), iceHeight(siLo,sjLo,bi,bj), |
| 147 |
|
|
I snowHeight(siLo,sjLo,bi,bj), tFrzOce, tmpflx, |
| 148 |
|
|
U icFlxSW(siLo,sjLo,bi,bj), Tsrf(siLo,sjLo,bi,bj), |
| 149 |
|
|
U Qice1(siLo,sjLo,bi,bj), Qice2(siLo,sjLo,bi,bj), |
| 150 |
|
|
O Tice1(siLo,sjLo,bi,bj), Tice2(siLo,sjLo,bi,bj), tmpdTs, |
| 151 |
|
|
O sHeating(siLo,sjLo,bi,bj), flxCndBt(siLo,sjLo,bi,bj), |
| 152 |
|
|
O icFlxAtm(siLo,sjLo,bi,bj), icFrwAtm(siLo,sjLo,bi,bj), |
| 153 |
|
|
I myTime, myIter, myThid ) |
| 154 |
|
|
|
| 155 |
|
|
#ifdef SHORTWAVE_HEATING |
| 156 |
|
|
#ifndef ALLOW_ATM2D |
| 157 |
|
|
DO j = jMin, jMax |
| 158 |
|
|
DO i = iMin, iMax |
| 159 |
|
|
IF (iceMask(i,j,bi,bj).GT.0. _d 0) THEN |
| 160 |
|
|
icFrac = iceMask(i,j,bi,bj) |
| 161 |
|
|
opFrac = 1. _d 0 - icFrac |
| 162 |
|
|
C-- Update Fluxes : |
| 163 |
|
|
Qsw(i,j,bi,bj) = opFrac*Qsw(i,j,bi,bj) |
| 164 |
|
|
& - icFrac*icFlxSW(i,j,bi,bj) |
| 165 |
|
|
ENDIF |
| 166 |
|
|
ENDDO |
| 167 |
|
|
ENDDO |
| 168 |
|
|
#endif |
| 169 |
|
|
#endif /* SHORTWAVE_HEATING */ |
| 170 |
|
|
c ENDIF |
| 171 |
|
|
|
| 172 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
| 173 |
|
|
#endif /* ALLOW_THSICE */ |
| 174 |
|
|
|
| 175 |
|
|
RETURN |
| 176 |
|
|
END |