*IF DEF,A04_3B ADM0F405.157
C *****************************COPYRIGHT****************************** LSPCON3A.3
C (c) CROWN COPYRIGHT 1997, METEOROLOGICAL OFFICE, All Rights Reserved. LSPCON3A.4
C LSPCON3A.5
C Use, duplication or disclosure of this code is subject to the LSPCON3A.6
C restrictions as set forth in the contract. LSPCON3A.7
C LSPCON3A.8
C Meteorological Office LSPCON3A.9
C London Road LSPCON3A.10
C BRACKNELL LSPCON3A.11
C Berkshire UK LSPCON3A.12
C RG12 2SZ LSPCON3A.13
C LSPCON3A.14
C If no contract has been raised with this copy of the code, the use, LSPCON3A.15
C duplication or disclosure of it is strictly prohibited. Permission LSPCON3A.16
C to do so must first be obtained in writing from the Head of Numerical LSPCON3A.17
C Modelling at the above address. LSPCON3A.18
C ******************************COPYRIGHT****************************** LSPCON3A.19
! SUBROUTINE LSPCON----------------------------------------- LSPCON3A.20
! PURPOSE: CALCULATES CONSTANTS USED IN PRECIP LSPCON3A.21
! LSPCON3A.22
! Modification History from Version 4.4 LSPCON3A.23
! Version Date LSPCON3A.24
! 4.4 Sept 97 New Deck Damian Wilson LSPCON3A.25
! Sue Ballard LSPCON3A.26
! ---------------------------------------------------------------- LSPCON3A.27
SUBROUTINE LSPCON(CX,CONSTP) 1,10LSPCON3A.28
IMPLICIT NONE LSPCON3A.29
! LSPCON3A.30
! LOCAL VARIABLES LSPCON3A.31
INTEGER I LSPCON3A.32
! Counter to print out the contents of CX and CONSTP LSPCON3A.33
REAL TEMP LSPCON3A.34
! Forms input to the GAMMAF routine which calculates gamma functions. LSPCON3A.35
&, GBD1,GB1,GD3,GD52,GDR3,GDR4,GDR52,G1,G2,G3 LSPCON3A.36
! Represents the gamma function of BI+DI+1 etc. LSPCON3A.37
! LSPCON3A.38
! PROCEDURE CALL LSPCON3A.39
EXTERNAL GAMMAF LSPCON3A.40
! LSPCON3A.41
*CALL C_LSPDRP
LSPCON3A.42
! Obtain the size of CONSTP and CX LSPCON3A.43
*CALL C_LSPSIZ
LSPCON3A.44
! OUTPUT VARIABLES LSPCON3A.45
! LSPCON3A.46
CX(1)=NINT(1000.*(2.+X4I-X2I)/(BI+1-X2I+X4I))/1000. LSPCON3A.47
! Used in deposition, evaporation of snow and melting calculations. LSPCON3A.48
! LSPCON3A.49
CX(2)=NINT(1000.*(5.+DI-2.*X2I+2.*X4I)/ LSPCON3A.50
& (2.*(BI+1.-X2I+X4I)))/1000. LSPCON3A.51
! Used in deposition, evaporation of snow and melting calculations. LSPCON3A.52
! LSPCON3A.53
CX(3)=NINT(1000.*DI/(BI+1-X2I+X4I))/1000. LSPCON3A.54
! Used in fall speed and capture calculations. LSPCON3A.55
! LSPCON3A.56
CX(4)=NINT(1000.*(3.+DI-X2I+X4I)/(BI+1.-X2I+X4I))/1000. LSPCON3A.57
! Used in riming calculations. LSPCON3A.58
! LSPCON3A.59
CX(5)=NINT(1000.*DR/(4.+DR-X2R))/1000. LSPCON3A.60
! Used in capture calculations. LSPCON3A.61
! LSPCON3A.62
CX(6)=NINT(1000./(X2I-X4I-1.-BI))/1000. LSPCON3A.63
! Used in capture calculations. LSPCON3A.64
! LSPCON3A.65
CX(7)=NINT(1000.*(3.0+DR-X2R)/(4.0+DR-X2R))/1000. LSPCON3A.66
! Used in accretion calculations. LSPCON3A.67
! LSPCON3A.68
CX(8)=NINT(1000.*X2I)/1000. LSPCON3A.69
! Used in capture calculations. LSPCON3A.70
! LSPCON3A.71
CX(9)=NINT(1000.*X2R)/1000. LSPCON3A.72
! Used in capture calculations. LSPCON3A.73
! LSPCON3A.74
CX(10)=NINT(1000./(4.0+DR-X2R))/1000. LSPCON3A.75
! Used in capture and evaporation of rain calculations. LSPCON3A.76
! LSPCON3A.77
CX(11)=NINT(1000.*((DR+5.0)/2.0-X2R))/1000. LSPCON3A.78
! Used in evaporation of rain calculations. LSPCON3A.79
! LSPCON3A.80
CX(12)=NINT(1000.*(2.0-X2R))/1000. LSPCON3A.81
! Used in evaporation of rain calculations. LSPCON3A.82
! LSPCON3A.83
CX(13)=X3I LSPCON3A.84
! Used to define temperature dependence of ice particle distribution. LSPCON3A.85
! LSPCON3A.86
CX(14)=3.+X4I LSPCON3A.87
! Used in capture calculations. LSPCON3A.88
! LSPCON3A.89
CX(15)=2.+X4I LSPCON3A.90
! Used in capture calculations. LSPCON3A.91
! LSPCON3A.92
CX(16)=1.+X4I LSPCON3A.93
! Used in capture calculations. LSPCON3A.94
! LSPCON3A.95
! Define values of GBD1 etc. LSPCON3A.96
TEMP=BI+DI+1.+X4I LSPCON3A.97
CALL GAMMAF
(TEMP,GBD1) LSPCON3A.98
TEMP=BI+1.+X4I LSPCON3A.99
CALL GAMMAF
(TEMP,GB1) LSPCON3A.100
TEMP=3.+DI+X4I LSPCON3A.101
CALL GAMMAF
(TEMP,GD3) LSPCON3A.102
TEMP=2.5+DI/2.+X4I LSPCON3A.103
CALL GAMMAF
(TEMP,GD52) LSPCON3A.104
TEMP=4.+DR LSPCON3A.105
CALL GAMMAF
(TEMP,GDR4) LSPCON3A.106
TEMP=3.+DR LSPCON3A.107
CALL GAMMAF
(TEMP,GDR3) LSPCON3A.108
TEMP=2.5+DR/2. LSPCON3A.109
CALL GAMMAF
(TEMP,GDR52) LSPCON3A.110
TEMP=1.+X4I LSPCON3A.111
CALL GAMMAF
(TEMP,G1) LSPCON3A.112
TEMP=2.+X4I LSPCON3A.113
CALL GAMMAF
(TEMP,G2) LSPCON3A.114
TEMP=3.+X4I LSPCON3A.115
CALL GAMMAF
(TEMP,G3) LSPCON3A.116
! LSPCON3A.117
! Define values of CONSTP LSPCON3A.118
! LSPCON3A.119
CONSTP(1)=1.0/(AI*X1I*GB1) LSPCON3A.120
! Used in fallspeed, deposition, riming, capture, evap of snow and LSPCON3A.121
! melting of snow calculations. LSPCON3A.122
! LSPCON3A.123
CONSTP(2)=6.2832*X1R LSPCON3A.124
! 6.2832 = 2 * pi LSPCON3A.125
! Used in evaporation of rain calculations. LSPCON3A.126
! LSPCON3A.127
CONSTP(3)=CI*GBD1/GB1 LSPCON3A.128
! Used in fallspeed and capture calculations. LSPCON3A.129
! LSPCON3A.130
CONSTP(4)=0.7854*X1I*CI*GD3 LSPCON3A.131
! 0.7854 = pi / 4 LSPCON3A.132
! Used in riming calculations. LSPCON3A.133
! LSPCON3A.134
! LSPCON3A.135
CONSTP(5)=1.0*6.2832*X1I ADM2F405.1
! 6.2832 = 2 pi 1.0 represents the relative capacitance of spheres. ADM2F405.2
! Used in deposition and evaporation of snow calculations. LSPCON3A.137
! LSPCON3A.138
CONSTP(6)=89.48*SQRT(CI)*GD52 LSPCON3A.139
! 89.48 = 0.44Sc**0.333 /dyn viscosity**0.5 LSPCON3A.140
! Used in deposition, evaporation of snow and melting calculations. LSPCON3A.141
! LSPCON3A.142
CONSTP(7)=4.57E-7*X1I LSPCON3A.143
! 4.57E-7 = 2 pi ka / Lf LSPCON3A.144
! Used in melting of snow calculations. LSPCON3A.145
! LSPCON3A.146
CONSTP(8)=523.6*X1R*GDR4*CR LSPCON3A.147
! 523.6 = pi rho(water)/ 6 LSPCON3A.148
! Used in capture, evap of rain and melting of snow calculations. LSPCON3A.149
! LSPCON3A.150
CONSTP(9)=9869.6*X1I*X1R LSPCON3A.151
! 9869.6 = pi**2 rho(water) LSPCON3A.152
! Used in capture calculations. LSPCON3A.153
! LSPCON3A.154
CONSTP(10)=0.7854*X1R*CR*GDR3 LSPCON3A.155
! 0.7854 = pi / 4 LSPCON3A.156
! Used in accretion calculations. LSPCON3A.157
! LSPCON3A.158
CONSTP(11)=CR*GDR4 LSPCON3A.159
! Used in capture calculations. LSPCON3A.160
! LSPCON3A.161
CONSTP(12)=63.100*GDR52*SQRT(CR) LSPCON3A.162
! 63.1 = 0.31Sc**0.333/dyn viscosity**0.5 LSPCON3A.163
! Used in evaporation of rain calculations. LSPCON3A.164
! LSPCON3A.165
CONSTP(13)=G2 LSPCON3A.166
! Used in deposition, evap of snow and melting of snow calculations. LSPCON3A.167
! LSPCON3A.168
CONSTP(14)=G3*0.25 LSPCON3A.169
! Used in capture calulations. LSPCON3A.170
! LSPCON3A.171
CONSTP(15)=G2*2. LSPCON3A.172
! Used in capture calulations. LSPCON3A.173
! LSPCON3A.174
CONSTP(16)=G1*5. LSPCON3A.175
! Used in capture calulations. LSPCON3A.176
! LSPCON3A.177
! End the subroutine LSPCON3A.178
RETURN LSPCON3A.179
END LSPCON3A.180
! LSPCON3A.181
! SUBROUTINE GAMMAF------------------------------------------- LSPCON3A.182
! PURPOSE: CALCULATES COMPLETE GAMMAF FUNCTION BY LSPCON3A.183
! A POLYNOMIAL APPROXIMATION LSPCON3A.184
! ---------------------------------------------------------------- LSPCON3A.185
SUBROUTINE GAMMAF(Y,GAM) 10LSPCON3A.186
IMPLICIT NONE LSPCON3A.187
REAL !, INTENT(IN) LSPCON3A.188
& Y LSPCON3A.189
REAL !, INTENT(OUT) LSPCON3A.190
& GAM LSPCON3A.191
! Gamma function of Y LSPCON3A.192
! LSPCON3A.193
! LOCAL VARIABLE LSPCON3A.194
INTEGER I,M LSPCON3A.195
REAL GG,G,PARE,X LSPCON3A.196
! -------------------------------------------------------------------- LSPCON3A.197
GG=1. LSPCON3A.198
M=Y LSPCON3A.199
X=Y-M LSPCON3A.200
IF (M.NE.1) THEN LSPCON3A.201
DO I=1,M-1 LSPCON3A.202
G=Y-I LSPCON3A.203
GG=GG*G LSPCON3A.204
END DO LSPCON3A.205
END IF LSPCON3A.206
PARE=-0.5748646*X+0.9512363*X*X-0.6998588*X*X*X LSPCON3A.207
& +0.4245549*X*X*X*X-0.1010678*X*X*X*X*X+1. LSPCON3A.208
GAM=PARE*GG LSPCON3A.209
RETURN LSPCON3A.210
END LSPCON3A.211
! LSPCON3A.212
*ENDIF LSPCON3A.213