1
1
! >\file calpreciptype.f90
2
2
! ! This file contains the subroutines that calculates dominant precipitation type.
3
3
4
+ module calpreciptype_mod
5
+ contains
4
6
! >\ingroup gfs_calpreciptype
5
7
! ! Foure algorithms are called to calculate dominant precipitation type, and the
6
8
! !tallies are sumed in calwxt_dominant().
@@ -26,17 +28,18 @@ subroutine calpreciptype(kdt,nrcm,im,ix,lm,lp1,randomno, &
26
28
! --------------------------------------------------------------------
27
29
use funcphys, only : fpvs,ftdp,fpkap,ftlcl,stma,fthe
28
30
use physcons
31
+ use machine , only : kind_phys
29
32
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30
33
implicit none
31
34
!
32
- real , parameter :: pthresh = 0.0 , oneog = 1.0 / con_g
35
+ real (kind = kind_phys) , parameter :: pthresh = 0.0 , oneog = 1.0 / con_g
33
36
integer ,parameter :: nalg = 5
34
37
!
35
38
! declare variables.
36
39
!
37
40
integer ,intent (in ) :: kdt,nrcm,im,ix,lm,lp1
38
- real ,intent (in ) :: xlat(im),xlon(im)
39
- real ,intent (in ) :: randomno(ix,nrcm)
41
+ real (kind = kind_phys) ,intent (in ) :: xlat(im),xlon(im)
42
+ real (kind = kind_phys) ,intent (in ) :: randomno(ix,nrcm)
40
43
real (kind= kind_phys),dimension (im), intent (in ) :: prec,tskin
41
44
real (kind= kind_phys),dimension (ix,lm), intent (in ) :: gt0,gq0,prsl
42
45
real (kind= kind_phys),dimension (ix,lp1),intent (in ) :: prsi,phii
@@ -220,8 +223,9 @@ subroutine calpreciptype(kdt,nrcm,im,ix,lm,lp1,randomno, &
220
223
! ! This subroutine computes precipitation type using a decision tree approach that uses
221
224
! ! variables such as integrated wet bulb temperatue below freezing and lowest layer
222
225
! ! temperature (Baldwin et al. 1994 \cite baldwin_et_al_1994)
223
- subroutine calwxt (lm ,lp1 ,t ,q ,pmid ,pint , &
224
- d608 ,rog ,epsq ,zint ,iwx ,twet )
226
+ subroutine calwxt (lm ,lp1 ,t ,q ,pmid ,pint , &
227
+ d608 ,rog ,epsq ,zint ,iwx ,twet )
228
+ use machine , only : kind_phys
225
229
!
226
230
! file: calwxt.f
227
231
! written: 11 november 1993, michael baldwin
@@ -247,10 +251,10 @@ subroutine calwxt(lm,lp1,t,q,pmid,pint, &
247
251
! t,q,pmid,htm,lmh,zint
248
252
!
249
253
integer ,intent (in ) :: lm,lp1
250
- real ,dimension (lm),intent (in ) :: t,q,pmid,twet
251
- real ,dimension (lp1),intent (in ) :: zint,pint
254
+ real (kind = kind_phys) ,dimension (lm),intent (in ) :: t,q,pmid,twet
255
+ real (kind = kind_phys) ,dimension (lp1),intent (in ) :: zint,pint
252
256
integer ,intent (out ) :: iwx
253
- real ,intent (in ) :: d608,rog,epsq
257
+ real (kind = kind_phys) ,intent (in ) :: d608,rog,epsq
254
258
255
259
256
260
! output:
@@ -264,10 +268,10 @@ subroutine calwxt(lm,lp1,t,q,pmid,pint, &
264
268
!
265
269
! internal:
266
270
!
267
- ! real, allocatable :: twet(:)
268
- real , parameter :: d00= 0.0
271
+ ! real(kind=kind_phys) , allocatable :: twet(:)
272
+ real (kind = kind_phys) , parameter :: d00= 0.0
269
273
integer karr,licee
270
- real tcold,twarm
274
+ real (kind = kind_phys) tcold,twarm
271
275
272
276
! subroutines called:
273
277
! wetbulb
@@ -282,7 +286,7 @@ subroutine calwxt(lm,lp1,t,q,pmid,pint, &
282
286
!
283
287
284
288
integer l,lice,iwrml,ifrzl
285
- real psfck,tdchk,a,tdkl,tdpre,tlmhk,twrmk,areas8,areap4, &
289
+ real (kind = kind_phys) psfck,tdchk,a,tdkl,tdpre,tlmhk,twrmk,areas8,areap4, &
286
290
surfw,surfc,dzkl,area1,pintk1,pintk2,pm150,pkl,tkl,qkl
287
291
288
292
! allocate ( twet(lm) )
@@ -486,27 +490,28 @@ subroutine calwxt_ramer(lm,lp1,t,q,pmid,rh,td,pint,ptyp)
486
490
! use params_mod
487
491
! use ctlblk_mod
488
492
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
493
+ use machine , only : kind_phys
489
494
implicit none
490
495
!
491
- real ,parameter :: twice= 266.55 ,rhprcp= 0.80 ,deltag= 1.02 , &
496
+ real (kind = kind_phys) ,parameter :: twice= 266.55 ,rhprcp= 0.80 ,deltag= 1.02 , &
492
497
& emelt= 0.045 ,rlim= 0.04 ,slim= 0.85
493
- real ,parameter :: twmelt= 273.15 ,tz= 273.15 ,efac= 1.0 ! specify in params now
498
+ real (kind = kind_phys) ,parameter :: twmelt= 273.15 ,tz= 273.15 ,efac= 1.0 ! specify in params now
494
499
!
495
500
integer * 4 i, k1, lll, k2, toodry
496
501
!
497
- real xxx ,mye, icefrac
502
+ real (kind = kind_phys) xxx ,mye, icefrac
498
503
integer , intent (in ) :: lm,lp1
499
- real ,dimension (lm), intent (in ) :: t,q,pmid,rh,td
500
- real ,dimension (lp1),intent (in ) :: pint
504
+ real (kind = kind_phys) ,dimension (lm), intent (in ) :: t,q,pmid,rh,td
505
+ real (kind = kind_phys) ,dimension (lp1),intent (in ) :: pint
501
506
integer , intent (out ) :: ptyp
502
507
!
503
- real ,dimension (lm) :: tq,pq,rhq,twq
508
+ real (kind = kind_phys) ,dimension (lm) :: tq,pq,rhq,twq
504
509
!
505
510
integer j,l,lev,ii
506
- real rhmax,twmax,ptop,dpdrh,twtop,rhtop,wgt1,wgt2, &
511
+ real (kind = kind_phys) rhmax,twmax,ptop,dpdrh,twtop,rhtop,wgt1,wgt2, &
507
512
rhavg,dtavg,dpk,ptw,pbot
508
- ! real b,qtmp,rate,qc
509
- real , external :: xmytw
513
+ ! real(kind=kind_phys) b,qtmp,rate,qc
514
+ !
510
515
!
511
516
! initialize.
512
517
icefrac = - 9999 .
@@ -521,7 +526,7 @@ subroutine calwxt_ramer(lm,lp1,t,q,pmid,rh,td,pint,ptyp)
521
526
! causing problems later in this subroutine
522
527
! qtmp=max(h1m12,q(l))
523
528
! rhqtmp(lev)=qtmp/qc
524
- rhq(lev) = rh(l)
529
+ rhq(lev) = rh(l)
525
530
pq(lev) = pmid(l) * 0.01
526
531
tq(lev) = t(l)
527
532
enddo
@@ -753,10 +758,11 @@ subroutine calwxt_ramer(lm,lp1,t,q,pmid,rh,td,pint,ptyp)
753
758
!- -------------------------------------------------------------------------
754
759
function xmytw (t ,td ,p )
755
760
!
761
+ use machine , only : kind_phys
756
762
implicit none
757
763
!
758
764
integer * 4 cflag, l
759
- real f, c0, c1, c2, k, kd, kw, ew, t, td, p, ed, fp, s, &
765
+ real (kind = kind_phys) f, c0, c1, c2, k, kd, kw, ew, t, td, p, ed, fp, s, &
760
766
& de, xmytw
761
767
data f, c0, c1, c2 / 0.0006355 , 26.66082 , 0.0091379024 , 6106.3960 /
762
768
!
@@ -877,19 +883,20 @@ function xmytw(t,td,p)
877
883
! ! \cite bourgouin_2000.
878
884
! of aes (canada) 1992
879
885
subroutine calwxt_bourg (lm ,lp1 ,rn ,g ,t ,q ,pmid ,pint ,zint ,ptype )
886
+ use machine , only : kind_phys
880
887
implicit none
881
888
!
882
889
! input:
883
890
integer ,intent (in ) :: lm,lp1
884
- real ,intent (in ) :: g,rn(2 )
885
- real ,intent (in ), dimension (lm) :: t, q, pmid
886
- real ,intent (in ), dimension (lp1) :: pint, zint
891
+ real (kind = kind_phys) ,intent (in ) :: g,rn(2 )
892
+ real (kind = kind_phys) ,intent (in ), dimension (lm) :: t, q, pmid
893
+ real (kind = kind_phys) ,intent (in ), dimension (lp1) :: pint, zint
887
894
!
888
895
! output:
889
896
integer , intent (out ) :: ptype
890
897
!
891
898
integer ifrzl,iwrml,l,lhiwrm
892
- real pintk1,areane,tlmhk,areape,pintk2,surfw,area1,dzkl,psfck,r1,r2
899
+ real (kind = kind_phys) pintk1,areane,tlmhk,areape,pintk2,surfw,area1,dzkl,psfck,r1,r2
893
900
!
894
901
! initialize weather type array to zero (ie, off).
895
902
! we do this since we want ptype to represent the
@@ -1076,6 +1083,7 @@ subroutine calwxt_revised(lm,lp1,t,q,pmid,pint, &
1076
1083
! use params_mod
1077
1084
! use ctlblk_mod
1078
1085
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1086
+ use machine , only : kind_phys
1079
1087
implicit none
1080
1088
!
1081
1089
! list of variables needed
@@ -1087,9 +1095,9 @@ subroutine calwxt_revised(lm,lp1,t,q,pmid,pint, &
1087
1095
! t,q,pmid,htm,lmh,zint
1088
1096
1089
1097
integer ,intent (in ) :: lm,lp1
1090
- real ,dimension (lm),intent (in ) :: t,q,pmid,twet
1091
- real ,dimension (lp1),intent (in ) :: pint,zint
1092
- real ,intent (in ) :: d608,rog,epsq
1098
+ real (kind = kind_phys) ,dimension (lm),intent (in ) :: t,q,pmid,twet
1099
+ real (kind = kind_phys) ,dimension (lp1),intent (in ) :: pint,zint
1100
+ real (kind = kind_phys) ,intent (in ) :: d608,rog,epsq
1093
1101
! output:
1094
1102
! iwx - instantaneous weather type.
1095
1103
! acts like a 4 bit binary
@@ -1101,12 +1109,12 @@ subroutine calwxt_revised(lm,lp1,t,q,pmid,pint, &
1101
1109
integer , intent (out ) :: iwx
1102
1110
! internal:
1103
1111
!
1104
- real , parameter :: d00= 0.0
1112
+ real (kind = kind_phys) , parameter :: d00= 0.0
1105
1113
integer karr,licee
1106
- real tcold,twarm
1114
+ real (kind = kind_phys) tcold,twarm
1107
1115
!
1108
1116
integer l,lmhk,lice,iwrml,ifrzl
1109
- real psfck,tdchk,a,tdkl,tdpre,tlmhk,twrmk,areas8,areap4,area1, &
1117
+ real (kind = kind_phys) psfck,tdchk,a,tdkl,tdpre,tlmhk,twrmk,areas8,areap4,area1, &
1110
1118
surfw,surfc,dzkl,pintk1,pintk2,pm150,qkl,tkl,pkl,area0,areap0
1111
1119
1112
1120
! subroutines called:
@@ -1316,14 +1324,15 @@ subroutine calwxt_dominant(nalg,rain,freezr,sleet,snow, &
1316
1324
! algorithms and sums them up to give a dominant type
1317
1325
!
1318
1326
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1327
+ use machine , only : kind_phys
1319
1328
implicit none
1320
1329
!
1321
1330
! input:
1322
1331
integer ,intent (in ) :: nalg
1323
- real ,intent (out ) :: doms,domr,domzr,domip
1332
+ real (kind = kind_phys) ,intent (out ) :: doms,domr,domzr,domip
1324
1333
integer ,dimension (nalg),intent (in ) :: rain,snow,sleet,freezr
1325
1334
integer l
1326
- real totsn,totip,totr,totzr
1335
+ real (kind = kind_phys) totsn,totip,totr,totzr
1327
1336
!- -------------------------------------------------------------------------
1328
1337
! print* , 'into dominant'
1329
1338
domr = 0 .
@@ -1377,3 +1386,4 @@ subroutine calwxt_dominant(nalg,rain,freezr,sleet,snow, &
1377
1386
return
1378
1387
end
1379
1388
! ! @}
1389
+ end module calpreciptype_mod
0 commit comments