*IF DEF,SCMA S_STATDY.2
C *****************************COPYRIGHT****************************** S_STATDY.3
C (c) CROWN COPYRIGHT 1998, METEOROLOGICAL OFFICE, All Rights Reserved. S_STATDY.4
C S_STATDY.5
C Use, duplication or disclosure of this code is subject to the S_STATDY.6
C restrictions as set forth in the contract. S_STATDY.7
C S_STATDY.8
C Meteorological Office S_STATDY.9
C London Road S_STATDY.10
C BRACKNELL S_STATDY.11
C Berkshire UK S_STATDY.12
C RG12 2SZ S_STATDY.13
C S_STATDY.14
C If no contract has been raised with this copy of the code, the use, S_STATDY.15
C duplication or disclosure of it is strictly prohibited. Permission S_STATDY.16
C to do so must first be obtained in writing from the Head of Numerical S_STATDY.17
C Modelling at the above address. S_STATDY.18
C ******************************COPYRIGHT****************************** S_STATDY.19
S_STATDY.20
C Subroutine statday S_STATDY.21
C Purpose:- To calculate statistical forcing required each S_STATDY.22
C CLIM_CHANGE days S_STATDY.23
C Programmer:- J. LEAN - modified code from original SCM to S_STATDY.24
C meet UM standards S_STATDY.25
C Modification History: S_STATDY.26
C Version Date S_STATDY.27
C 4.5 07/98 SCM integrated as a standard UM configuration S_STATDY.28
C Introduce multicolumn SCM S_STATDY.29
C JC Thil. S_STATDY.30
C===================================================================== S_STATDY.31
C S_STATDY.32
Subroutine STATDAY( 1,17S_STATDY.33
C ! IN leading dimensions of arrays S_STATDY.34
& points, nlevs, nwet, ntrop, S_STATDY.35
C ! S_STATDY.36
& atime, btime, dayno, deltan, daycount, S_STATDY.37
& tbara, tbarb, tsda, tsdb, dbara, dbarb, vnbara, vnbarb, S_STATDY.38
& vnsda, vnsdb, vpbara, vpbarb, wbara, wbarb, wsda, wsdb, S_STATDY.39
& alfada, alfadb, pstara, pstarb, pstar, tgrada, tgradb, S_STATDY.40
& dgrada, dgradb, cort, cord, corvn, corw, tdash, ddash, S_STATDY.41
& ctbar, ctsd, at, cdbar, cdsd, ad, S_STATDY.42
& cvnbar, cvnsd, avn, cwbar, cwsd, aw, tbar, tsd, dbar, dsd, S_STATDY.43
& vnbar, vnsd, vpbar, wbar, wsd, press, rpress, ak, bk) S_STATDY.44
S_STATDY.45
Implicit none S_STATDY.46
C S_STATDY.47
C--------------------------------------------------------------------- S_STATDY.48
C Arguments S_STATDY.49
C--------------------------------------------------------------------- S_STATDY.50
C S_STATDY.51
Integer S_STATDY.52
& points ! IN number of model columns S_STATDY.53
& ,nlevs ! IN Number of levels of the model. S_STATDY.54
& ,nwet ! IN Number of humidity model levels S_STATDY.55
& ,ntrop ! IN Max number of levels in the S_STATDY.56
! troposphere S_STATDY.57
& ,dayno ! IN Dayno. relative to winter S_STATDY.58
! solstice S_STATDY.59
& ,daycount ! IN Daynumber (ie 1 is 1st january) S_STATDY.60
Real S_STATDY.61
& alfada(points) ! IN Amplitude and mean of seasonal S_STATDY.62
& ,alfadb(points) ! variation of tuning factor S_STATDY.63
& ,ak(nlevs) ! Coefficient defining hybrid S_STATDY.64
! vertical coordinate S_STATDY.65
& ,at(points,nlevs-1) ! OUT Variable a in eqn 2.22 S_STATDY.66
& ,ad(points,nwet-1) ! used to calculate mean of S_STATDY.67
! random variable for S_STATDY.68
! temp. and dew point depression S_STATDY.69
& ,atime,btime ! IN Constants for calculating S_STATDY.70
! annual cycle in eqn. 2.33 S_STATDY.71
& ,avn(points,nlevs-1) ! OUT Variable a in eqn 2.22 S_STATDY.72
& ,aw(points,ntrop-1) ! used to calculate mean of S_STATDY.73
! random variable for S_STATDY.74
! horiz. and vert velocity S_STATDY.75
& ,bk(nlevs) ! Coefficient defining hybrid S_STATDY.76
! vertical coordinate S_STATDY.77
& ,cord(points) ! IN vertical correlation S_STATDY.78
! coeff. for dew pt. depress(0.9) S_STATDY.79
& ,cort(points) ! IN vertical correlation S_STATDY.80
! coeff. for temp. (0.9) S_STATDY.81
& ,corvn(points) ! IN vertical correlation S_STATDY.82
! coeff. for velocity VN (0.5) S_STATDY.83
& ,corw(points) ! IN vertical correlation S_STATDY.84
! coeff. for velocity W (0.5) S_STATDY.85
& ,cdbar(points,nwet) ! OUT Mean and SD of random variable S_STATDY.86
& ,cdsd(points,nwet) ! for dew pt. depression (eqns S_STATDY.87
! 2.22 and 2.23) S_STATDY.88
& ,ctbar(points,nlevs) ! OUT Mean and SD of random S_STATDY.89
& ,ctsd(points,nlevs) ! variable for temp. (eqns 2.22 S_STATDY.90
! and 2.23) S_STATDY.91
& ,cvnbar(points,nlevs) ! OUT Mean and SD of random variable S_STATDY.92
& ,cvnsd(points,nlevs) ! for velocity VN (eqns 2.22 S_STATDY.93
! and 2.23) S_STATDY.94
& ,cwbar(points,ntrop) ! OUT Mean and SD of random variable S_STATDY.95
& ,cwsd(points,ntrop) ! for vertical velocity (eqns 2.22 S_STATDY.96
! and 2.23) S_STATDY.97
& ,dbar(points,nwet) ! OUT Mean and SD dewpoint S_STATDY.98
& ,dsd(points,nwet) ! depression at daynumber relative S_STATDY.99
! to winter solstice (K) S_STATDY.100
& ,dbara(points,nwet) ! IN Amplitude and mean of seasonal S_STATDY.101
& ,dbarb(points,nwet) ! variation of mean dew pt. S_STATDY.102
! depression (K) S_STATDY.103
& ,ddash(points,nwet) ! OUT Dew pt. corrections (K) S_STATDY.104
& ,deltan(points) ! IN Radius of area (m) S_STATDY.105
& ,dgrada(points,nwet) ! IN Amplitude and mean of seasonal S_STATDY.106
& ,dgradb(points,nwet) ! variation of dew pt. depression S_STATDY.107
! gradient (K km^-1) S_STATDY.108
& ,press(points,nlevs) ! OUT Pressure for sigma levels (Pa) S_STATDY.109
& ,pstara(points) ! IN Amplitude and mean of seasonal S_STATDY.110
& ,pstarb(points) ! variation of surface pressure (Pa S_STATDY.111
& ,pstar(points) ! OUT Surface pressure (Pa) S_STATDY.112
& ,rpress(points,nlevs) ! OUT Reciprocal pressure ((HPa)^-1) S_STATDY.113
& ,tdash(points,nlevs) ! Temp. correction (K) S_STATDY.114
& ,tbar(points,nlevs) ! OUT Mean and SD temperature at S_STATDY.115
& ,tsd(points,nlevs) ! daycount days from winter S_STATDY.116
! solstice (K) S_STATDY.117
& ,tbara(points,nlevs) ! IN Amplitude and mean of S_STATDY.118
& ,tbarb(points,nlevs) ! seasonal variation of temp. (K) S_STATDY.119
& ,tgrada(points,nlevs) ! IN Amplitude and mean of seasonal S_STATDY.120
& ,tgradb(points,nlevs) ! variation of temp. gradient S_STATDY.121
! (K km^-1) S_STATDY.122
& ,tsda(points,nlevs) ! IN Amplitude and mean of seasonal S_STATDY.123
& ,tsdb(points,nlevs) ! variation of SD of temp. (K) S_STATDY.124
& ,vnbar(points,nlevs) ! OUT Mean and SD velocity VN at S_STATDY.125
& ,vnsd(points,nlevs) ! daycount days from S_STATDY.126
! winter solstice (m s^-1) S_STATDY.127
& ,vpbar(points,nlevs) ! OUT Mean velocity VP at S_STATDY.128
! daycount days from S_STATDY.129
! winter solstice (m s^-1) S_STATDY.130
& ,vnbara(points,nlevs) ! IN Amplitude and mean of seasonal S_STATDY.131
& ,vnbarb(points,nlevs) ! variation of velocity VN S_STATDY.132
! (m s^-1) S_STATDY.133
& ,vnsda(points,nlevs) ! IN Amplitude and mean of seasonal S_STATDY.134
& ,vnsdb(points,nlevs) ! variation of SD of velocity VN S_STATDY.135
! (m s^-1) S_STATDY.136
& ,vpbara(points,nlevs) ! IN Amplitude and mean of seasonal S_STATDY.137
& ,vpbarb(points,nlevs) ! variation of velocity VP S_STATDY.138
! (m s^-1) S_STATDY.139
& ,wbar(points,ntrop) ! OUT Mean and SD vertical S_STATDY.140
& ,wsd(points,ntrop) ! velocity at daycount days S_STATDY.141
! from winter solstice (mb s^-1) S_STATDY.142
& ,wbara(points,ntrop) ! IN Amplitude and mean of seasonal S_STATDY.143
& ,wbarb(points,ntrop) ! variation of SD of vert. vel. S_STATDY.144
! (mb s^-1) S_STATDY.145
& ,wsda(points,ntrop) ! IN Amplitude and mean of seasonal S_STATDY.146
& ,wsdb(points,ntrop) ! variation of SD of vert. vel. S_STATDY.147
! (mb s^-1) S_STATDY.148
C S_STATDY.149
C--------------------------------------------------------------------- S_STATDY.150
C Local variables S_STATDY.151
C--------------------------------------------------------------------- S_STATDY.152
C S_STATDY.153
Real S_STATDY.154
& alfad(points) ! Tuning factor at daycount days S_STATDY.155
! from winter solstice S_STATDY.156
& ,daynew ! function to calculate SIN S_STATDY.157
! of argument (eqn 2.33) S_STATDY.158
& ,dgrad ! dew pt. depression gradient S_STATDY.159
& ,tgrad ! Temp. gradient S_STATDY.160
& ,xt ! Argument of SIN distribution S_STATDY.161
! (eqn. 2.33) S_STATDY.162
Integer S_STATDY.163
& i, k ! Loop counter S_STATDY.164
C S_STATDY.165
C Calculate argument of SIN (in eqn. 12) S_STATDY.166
C S_STATDY.167
If (daycount .eq. 1) then S_STATDY.168
xt = daynew
(atime, btime, dayno) S_STATDY.169
else S_STATDY.170
xt = daynew
(atime, btime, dayno+1) S_STATDY.171
endif S_STATDY.172
C S_STATDY.173
C Calculate sinusoidal distribution (eqn. 12) S_STATDY.174
C S_STATDY.175
Call xnew
(tbar, tbara, tbarb, points, nlevs, xt) S_STATDY.176
Call xnew
(tsd, tsda, tsdb, points, nlevs, xt) S_STATDY.177
Call xnew
(dbar, dbara, dbarb, points, nwet, xt) S_STATDY.178
Call xnew
(vnbar, vnbara, vnbarb, points, nlevs, xt) S_STATDY.179
Call xnew
(vnsd, vnsda, vnsdb, points, nlevs, xt) S_STATDY.180
Call xnew
(vpbar, vpbara, vpbarb, points, nlevs, xt) S_STATDY.181
Call xnew
(wbar, wbara, wbarb, points, ntrop, xt) S_STATDY.182
Call xnew
(wsd, wsda, wsdb, points, ntrop, xt) S_STATDY.183
Call xnew
(alfad, alfada, alfadb, points, 1, xt) S_STATDY.184
Call xnew
(pstar, pstara, pstarb, points, 1, xt) S_STATDY.185
Call pnew
(nlevs, press, rpress, points, nwet, pstar, ak, bk) S_STATDY.186
Do i = 1, points ! loop on model columns S_STATDY.187
Do k = 1, nlevs S_STATDY.188
tgrad = tgrada(i,k)*xt + tgradb(i,k) S_STATDY.189
If (vnbar(i,k) .gt. 0.) then S_STATDY.190
tgrad = -tgrad S_STATDY.191
endif S_STATDY.192
C S_STATDY.193
C Calculate corrections for temp. and dew pt. depression S_STATDY.194
C S_STATDY.195
tdash(i,k)=deltan(i)*tgrad/1000. S_STATDY.196
enddo S_STATDY.197
Do k = 1, nwet S_STATDY.198
dgrad = dgrada(i,k) * xt + dgradb(i,k) S_STATDY.199
dsd(i,k) = alfad(i) * tsd(i,k) S_STATDY.200
If (vnbar(i,k) .gt. 0.0) then S_STATDY.201
dgrad = -dgrad S_STATDY.202
endif S_STATDY.203
C S_STATDY.204
C Calculate corrections for temp. and dew pt. depression S_STATDY.205
C S_STATDY.206
ddash(i,k) = deltan(i) * dgrad/1000. S_STATDY.207
enddo S_STATDY.208
enddo ! points S_STATDY.209
C S_STATDY.210
C Calculate mean and SD of random variable (eqns. 6 and 7) S_STATDY.211
C S_STATDY.212
Call ACINIT
(tbar, tsd, at, ctbar, ctsd, cort, nlevs, points) S_STATDY.213
Call ACINIT
(dbar, dsd, ad, cdbar, cdsd, cord, nwet, points) S_STATDY.214
Call ACINIT
(vnbar, vnsd, avn, cvnbar, cvnsd, corvn, nlevs, S_STATDY.215
& points) S_STATDY.216
Call ACINIT
(wbar, wsd, aw, cwbar, cwsd, corw, ntrop, points) S_STATDY.217
Return S_STATDY.218
End ! Subroutine STATDAY S_STATDY.219
C S_STATDY.220
C S_STATDY.221
*ENDIF S_STATDY.222