*IF DEF,SCMA S_DPCAL.2 C *****************************COPYRIGHT****************************** S_DPCAL.3 C (c) CROWN COPYRIGHT 1998, METEOROLOGICAL OFFICE, All Rights Reserved. S_DPCAL.4 C S_DPCAL.5 C Use, duplication or disclosure of this code is subject to the S_DPCAL.6 C restrictions as set forth in the contract. S_DPCAL.7 C S_DPCAL.8 C Meteorological Office S_DPCAL.9 C London Road S_DPCAL.10 C BRACKNELL S_DPCAL.11 C Berkshire UK S_DPCAL.12 C RG12 2SZ S_DPCAL.13 C S_DPCAL.14 C If no contract has been raised with this copy of the code, the use, S_DPCAL.15 C duplication or disclosure of it is strictly prohibited. Permission S_DPCAL.16 C to do so must first be obtained in writing from the Head of Numerical S_DPCAL.17 C Modelling at the above address. S_DPCAL.18 C ******************************COPYRIGHT****************************** S_DPCAL.19 C S_DPCAL.20 C Purpose: Calculates the daily dump from the timestep dump. S_DPCAL.21 C (code was previously in the main calling routine S_DPCAL.22 C SCMMAIN) S_DPCAL.23 C S_DPCAL.24 C Code Description: S_DPCAL.25 C Language - FORTRAN 77 S_DPCAL.26 C Author: C.Bunton S_DPCAL.27 C S_DPCAL.28 C Modification History: S_DPCAL.29 C Version Date S_DPCAL.30 C 4.5 07/98 SCM integrated as a standard UM configuration S_DPCAL.31 C JC Thil. S_DPCAL.32 C S_DPCAL.33 C Documentation: Single Column Model Guide J. Lean S_DPCAL.34 C S_DPCAL.35 C--------------------------------------------------------------------- S_DPCAL.36Subroutine CALC_DUMPDAY( 1S_DPCAL.37 C ! IN dump description. S_DPCAL.38 & points, nvars, ndump, cloud_count , tcount, qcount S_DPCAL.39 & ,T1p5m_maxcount ,T1p5m_mincount S_DPCAL.40 & ,dump, dumpmean_day) S_DPCAL.41 C S_DPCAL.42 Implicit none S_DPCAL.43 C S_DPCAL.44 C ! IN Dimensions of dump array : S_DPCAL.45 Integer S_DPCAL.46 & points ! IN No of points S_DPCAL.47 & ,nvars ! nvars is no. variables in dump and S_DPCAL.48 ! is equal to nprimvars + X S_DPCAL.49 ! where X is any no. of variables S_DPCAL.50 ! (default 71) S_DPCAL.51 & ,ndump ! Number of dumps per day S_DPCAL.52 & ,cloud_count ! Counter which points to S_DPCAL.53 ! position of mean cloud base S_DPCAL.54 ! in dump S_DPCAL.55 & ,qcount ! Points to position of q S_DPCAL.56 ! averaged throughout atmos. S_DPCAL.57 & ,tcount ! Points to position of T S_DPCAL.58 ! averaged throughout atmos. S_DPCAL.59 ! column in dump S_DPCAL.60 & ,T1p5m_maxcount ! pointer to T1p5m_max in dump S_DPCAL.61 & ,T1p5m_mincount ! pointer to T1p5m_min in dump S_DPCAL.62 S_DPCAL.63 C S_DPCAL.64 Real S_DPCAL.65 & dump(points,nvars,ndump) ! IN S_DPCAL.66 C S_DPCAL.67 Real S_DPCAL.68 & dumpmean_day(points,nvars) ! OUT S_DPCAL.69 C S_DPCAL.70 C--------------------------------------------------------------------- S_DPCAL.71 C Local Variables, S_DPCAL.72 C--------------------------------------------------------------------- S_DPCAL.73 C S_DPCAL.74 Integer S_DPCAL.75 & i, j, k ! Loop counters S_DPCAL.76 C S_DPCAL.77 Do k = 1, points S_DPCAL.78 Do i = 1, nvars S_DPCAL.79 If (i .ne. T1p5m_maxcount .and. i .ne. T1p5m_mincount) then S_DPCAL.80 Do j = 1,ndump S_DPCAL.81 dumpmean_day(k,i) = dumpmean_day(k,i) + dump(k,i,j) S_DPCAL.82 enddo S_DPCAL.83 else S_DPCAL.84 dumpmean_day(k,t1p5m_maxcount) = dump(k,t1p5m_maxcount,1) S_DPCAL.85 dumpmean_day(k,t1p5m_mincount) = dump(k,t1p5m_mincount,1) S_DPCAL.86 C S_DPCAL.87 Do j = 2, ndump S_DPCAL.88 If (dump(k,T1p5m_maxcount,j) .gt. S_DPCAL.89 & dumpmean_day(k,T1p5m_maxcount)) S_DPCAL.90 & dumpmean_day(k,T1p5m_maxcount) = S_DPCAL.91 & dump(k,T1p5m_maxcount,j) S_DPCAL.92 If (dump(k,T1p5m_mincount,j) .lt. S_DPCAL.93 & dumpmean_day(k,T1p5m_mincount)) S_DPCAL.94 & dumpmean_day(k,T1p5m_mincount) = S_DPCAL.95 & dump(k,T1p5m_mincount,j) S_DPCAL.96 enddo S_DPCAL.97 endif S_DPCAL.98 enddo S_DPCAL.99 Do i = 1,nvars S_DPCAL.100 If (i .ne. T1p5m_maxcount .and. i .ne. T1p5m_mincount) then S_DPCAL.101 dumpmean_day(k,i) = dumpmean_day(k,i) / real(ndump) S_DPCAL.102 endif S_DPCAL.103 enddo S_DPCAL.104 C S_DPCAL.105 C Calculate average T and q throughout atmospheric column S_DPCAL.106 C S_DPCAL.107 Do i = 1, nvars S_DPCAL.108 If (i .eq. tcount) then S_DPCAL.109 dumpmean_day(k,i) = dumpmean_day(k,i-1) S_DPCAL.110 & / dumpmean_day(k,i-2) S_DPCAL.111 endif S_DPCAL.112 If (i .eq. qcount) then S_DPCAL.113 dumpmean_day(k,i) = dumpmean_day(k,i-1) S_DPCAL.114 & / dumpmean_day(k,tcount-2) S_DPCAL.115 endif S_DPCAL.116 C S_DPCAL.117 C Calculate mean of cloud base and top in Pa rather than S_DPCAL.118 C levels S_DPCAL.119 C S_DPCAL.120 If (i .eq. (cloud_count)) then S_DPCAL.121 C S_DPCAL.122 S_DPCAL.123 C Check that sum of CCA is non-zero so that you don't S_DPCAL.124 C divide by zero S_DPCAL.125 C S_DPCAL.126 If (dumpmean_day(k,cloud_count-3) .ne. 0.0) S_DPCAL.127 & dumpmean_day(k,i) = dumpmean_day(k,i-2) S_DPCAL.128 & / dumpmean_day(k,i-3) S_DPCAL.129 elseif (i .eq. (cloud_count+1)) then S_DPCAL.130 C S_DPCAL.131 C Check that sum of CCA is non-zero so that you don't S_DPCAL.132 C divide by zero S_DPCAL.133 C S_DPCAL.134 If (dumpmean_day(k, i-4) .ne. 0.0) S_DPCAL.135 & dumpmean_day(k, i) = dumpmean_day(k, i-2) S_DPCAL.136 & / dumpmean_day(k, i-4) S_DPCAL.137 endif S_DPCAL.138 enddo ! i S_DPCAL.139 enddo ! k S_DPCAL.140 Return S_DPCAL.141 End S_DPCAL.142 C&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& S_DPCAL.143 C$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ S_DPCAL.144
Subroutine CALC_DUMPDAYS( 1S_DPCAL.145 ! IN dimension of dump array. S_DPCAL.146 & points, nvars, cloud_count , tcount, qcount S_DPCAL.147 & ,DUMPMEAN_DAY, DUMP_DAYS, J S_DPCAL.148 & ,DUMPMEAN_DAYS) S_DPCAL.149 C S_DPCAL.150 Implicit none S_DPCAL.151 C Arguments S_DPCAL.152 Integer S_DPCAL.153 & points ! IN No of points S_DPCAL.154 & ,nvars ! IN no. variables in dump and S_DPCAL.155 ! equal to NPRIMVARS + X S_DPCAL.156 ! where X is any no. of variables S_DPCAL.157 ! (default 71) S_DPCAL.158 & ,cloud_count ! Counter which points to S_DPCAL.159 ! position of mean cloud base S_DPCAL.160 ! in DUMP S_DPCAL.161 & ,qcount ! IN Points to position of q S_DPCAL.162 ! averaged throughout atmos. S_DPCAL.163 & ,tcount ! IN Points to position of T S_DPCAL.164 ! averaged throughout atmos. S_DPCAL.165 ! column in DUMP S_DPCAL.166 & ,dump_days(4) ! IN S_DPCAL.167 & ,j ! IN loop counter for periodic dump S_DPCAL.168 C S_DPCAL.169 Real S_DPCAL.170 & dumpmean_day(points,nvars) ! IN S_DPCAL.171 & ,dumpmean_days(points,nvars,4) ! OUT S_DPCAL.172 C S_DPCAL.173 C--------------------------------------------------------------------- S_DPCAL.174 C Local Variables, S_DPCAL.175 C--------------------------------------------------------------------- S_DPCAL.176 C S_DPCAL.177 Integer S_DPCAL.178 & i,k ! Loop counters S_DPCAL.179 S_DPCAL.180 C S_DPCAL.181 Do k = 1 , points S_DPCAL.182 Do i = 1, nvars S_DPCAL.183 dumpmean_days(k,i,j) = dumpmean_days(k,i,j) S_DPCAL.184 & / real(dump_days(j)) S_DPCAL.185 enddo S_DPCAL.186 S_DPCAL.187 Do i = 1, nvars S_DPCAL.188 C S_DPCAL.189 C Calculate average T and q throughout atmospheric column S_DPCAL.190 C S_DPCAL.191 If (i .eq. tcount) then S_DPCAL.192 dumpmean_days(k,i,j) = dumpmean_days(k,i-1,j) S_DPCAL.193 & / dumpmean_days(k,i-2,j) S_DPCAL.194 endif S_DPCAL.195 If (i .eq. qcount) then S_DPCAL.196 dumpmean_days(k,i,j) = dumpmean_days(k,i-1,j) S_DPCAL.197 & / dumpmean_days(k,tcount-2,j) S_DPCAL.198 endif S_DPCAL.199 C S_DPCAL.200 C Calculate mean of cloud base and top in Pa rather than S_DPCAL.201 C levels S_DPCAL.202 C S_DPCAL.203 If (i .eq. (cloud_count)) then S_DPCAL.204 C S_DPCAL.205 C Check that sum of CCA is non-zero so that you don't S_DPCAL.206 C divide by zero S_DPCAL.207 C S_DPCAL.208 If (dumpmean_days(k,cloud_count-3,j) .ne. 0.0) S_DPCAL.209 & dumpmean_days(k,i,j) = dumpmean_days(k,i-2,j) S_DPCAL.210 & / dumpmean_days(k,i-3,j) S_DPCAL.211 S_DPCAL.212 elseif (i .eq. (cloud_count+1)) then S_DPCAL.213 C S_DPCAL.214 C Check that sum of CCA is non-zero so that you don't S_DPCAL.215 C divide by zero S_DPCAL.216 C S_DPCAL.217 If (dumpmean_days(k,i-4,j) .ne. 0.0) S_DPCAL.218 & dumpmean_days(k,i,j) = dumpmean_days(k,i-2,j) S_DPCAL.219 & / dumpmean_days(k,i-4,j) S_DPCAL.220 endif S_DPCAL.221 enddo S_DPCAL.222 enddo S_DPCAL.223 Return S_DPCAL.224 End S_DPCAL.225 *ENDIF S_DPCAL.226