forked from NCAR/ccpp-physics
-
Notifications
You must be signed in to change notification settings - Fork 34
/
sfcsub.F
8950 lines (8751 loc) · 307 KB
/
sfcsub.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!>\file sfcsub.F
!! This file contains gribcode for each parameter.
!>\defgroup mod_sfcsub GFS sfcsub Module
!!\ingroup mod_GFS_phys_time_vary
!> @{
!! This module contains grib code for each parameter-used in subroutines sfccycle()
!! and setrmsk().
module sfccyc_module
use machine , only : kind_io8,kind_io4
implicit none
save
!
! grib code for each parameter - used in subroutines sfccycle and setrmsk.
!
integer kpdtsf,kpdwet,kpdsno,kpdzor,kpdais,kpdtg3,kpdplr,kpdgla,
& kpdmxi,kpdscv,kpdsmc,kpdoro,kpdmsk,kpdstc,kpdacn,kpdveg,
& kpdvet,kpdsot,kpdsoc,
& kpdvmn,kpdvmx,kpdslp,kpdabs
&, kpdsnd, kpdabs_0, kpdabs_1, kpdalb(4)
parameter(kpdtsf=11, kpdwet=86, kpdsno=65, kpdzor=83,
! & kpdalb=84, kpdais=91, kpdtg3=11, kpdplr=224,
& kpdais=91, kpdtg3=11, kpdplr=224,
& kpdgla=238, kpdmxi=91, kpdscv=238, kpdsmc=144,
& kpdoro=8, kpdmsk=81, kpdstc=11, kpdacn=91, kpdveg=87,
!cbosu max snow albedo uses a grib id number of 159, not 255.
& kpdvmn=255, kpdvmx=255,kpdslp=236, kpdabs_0=255,
& kpdvet=225, kpdsot=224,kpdsoc=255,kpdabs_1=159,
& kpdsnd=66 )
!
integer, parameter :: kpdalb_0(4)=(/212,215,213,216/)
integer, parameter :: kpdalb_1(4)=(/189,190,191,192/)
integer, parameter :: kpdalf(2)=(/214,217/)
!
real (kind=kind_io8), parameter :: ten=10.0, one=1.0, zero=0.0
integer, parameter :: xdata=7200, ydata=3600, mdata=xdata*ydata
integer :: veg_type_landice
integer :: soil_type_landice
integer :: soil_color_landice
integer :: num_threads
!
!
contains
function message(prefix,index)
implicit none
character(len=*), intent(in) :: prefix
integer, intent(in) :: index
! Safety measure: prevent writing out of bounds, use a longer string than 8 characters
character(len=16) :: message
write(message,fmt='(a,a,i0)') trim(prefix), '-', index
end function message
end module sfccyc_module
!>\ingroup mod_GFS_phys_time_vary
!! This subroutine reads or interpolates surface climatology data in analysis
!! and forecast mode.
!!\param lugb the unit number used in this subprogram
!!\param len number of points on which sfccyc operates
!!\param lsoil number of soil layers
!!\param sig1t sigma level 1 temperature for dead start. it should be on gaussian
!! grid. If not dead start, no need for dimension but set to zero as
!! in the example below.
!!\param deltsfc = fhcyc, frequcy for surface data cycling in hours
!!\param iy,im,id,ih year, month, day, and hour of initial state
!!\param fh forecast hour
!!\param rla, rlo latitude and longitudes of the len points
!!\param slmsk
!!\param orog
!!\param orog_uf
!!\param use_ufo
!!\param nst_anl
!!
subroutine sfccycle(lugb,len,lsoil,sig1t,deltsfc &
&, iy,im,id,ih,fh,rla,rlo &
&, slmskl,slmskw,orog,orog_uf,use_ufo,nst_anl &
&, sihfcs,sicfcs,sitfcs &
&, swdfcs,slcfcs &
&, vmnfcs,vmxfcs,slpfcs,absfcs &
&, tsffcs,snofcs,zorfcs,albfcs,tg3fcs &
&, cnpfcs,smcfcs,stcfcs,slifcs,aisfcs &
&, vegfcs,vetfcs,sotfcs,socfcs,alffcs &
&, cvfcs,cvbfcs,cvtfcs,me,nthrds,nlunit &
&, sz_nml,input_nml_file &
&, min_ice &
&, ialb,isot,ivegsrc,tile_num_ch,i_index,j_index)
!
use machine , only : kind_io8,kind_io4
use sfccyc_module
implicit none
character(len=*), intent(in) :: tile_num_ch
integer, intent(in) :: i_index(len), j_index(len), &
& me, nthrds
logical, intent(in) :: use_ufo, nst_anl
real (kind=kind_io8), intent(in) :: min_ice(len)
real (kind=kind_io8) sllnd,slsea,aicice,aicsea,tgice,rlapse, &
& orolmx,orolmn,oroomx,oroomn,orosmx, &
& orosmn,oroimx,oroimn,orojmx,orojmn, &
& alblmx,alblmn,albomx,albomn,albsmx, &
& albsmn,albimx,albimn,albjmx,albjmn, &
& wetlmx,wetlmn,wetomx,wetomn,wetsmx, &
& wetsmn,wetimx,wetimn,wetjmx,wetjmn, &
& snolmx,snolmn,snoomx,snoomn,snosmx, &
& snosmn,snoimx,snoimn,snojmx,snojmn, &
& zorlmx,zorlmn,zoromx,zoromn,zorsmx, &
& zorsmn,zorimx,zorimn,zorjmx,zorjmn, &
& plrlmx,plrlmn,plromx,plromn,plrsmx, &
& plrsmn,plrimx,plrimn,plrjmx,plrjmn, &
& tsflmx,tsflmn,tsfomx,tsfomn,tsfsmx, &
& tsfsmn,tsfimx,tsfimn,tsfjmx,tsfjmn, &
& tg3lmx,tg3lmn,tg3omx,tg3omn,tg3smx, &
& tg3smn,tg3imx,tg3imn,tg3jmx,tg3jmn, &
& stclmx,stclmn,stcomx,stcomn,stcsmx, &
& stcsmn,stcimx,stcimn,stcjmx,stcjmn, &
& smclmx,smclmn,smcomx,smcomn,smcsmx, &
& smcsmn,smcimx,smcimn,smcjmx,smcjmn, &
& scvlmx,scvlmn,scvomx,scvomn,scvsmx, &
& scvsmn,scvimx,scvimn,scvjmx,scvjmn, &
& veglmx,veglmn,vegomx,vegomn,vegsmx, &
& vegsmn,vegimx,vegimn,vegjmx,vegjmn, &
& vetlmx,vetlmn,vetomx,vetomn,vetsmx, &
& vetsmn,vetimx,vetimn,vetjmx,vetjmn, &
& sotlmx,sotlmn,sotomx,sotomn,sotsmx, &
& sotsmn,sotimx,sotimn,sotjmx,sotjmn, &
& soclmx,soclmn,socomx,socomn,socsmx, &
& socsmn,socimx,socimn,socjmx,socjmn, &
& alslmx,alslmn,alsomx,alsomn,alssmx, &
& alssmn,alsimx,alsimn,alsjmx,alsjmn, &
& epstsf,epsalb,epssno,epswet,epszor, &
& epsplr,epsoro,epssmc,epsscv,eptsfc, &
& epstg3,epsais,epsacn,epsveg,epsvet, &
& epssot,epssoc,epsalf,qctsfs,qcsnos,qctsfi, &
& aislim,snwmin,snwmax,cplrl,cplrs, &
& cvegl,czors,csnol,csnos,czorl,csots, &
& csotl,csocs,csocl,cvwgs,cvetl,cvets,calfs, &
& fcalfl,fcalfs,ccvt,ccnp,ccv,ccvb, &
& calbl,calfl,calbs,ctsfs,grboro, &
& grbmsk,ctsfl,deltf,caisl,caiss, &
& fsalfl,fsalfs,flalfs,falbl,ftsfl, &
& ftsfs,fzorl,fzors,fplrl,fsnos,faisl, &
& faiss,fsnol,bltmsk,falbs,cvegs,percrit, &
& deltsfc,critp2,critp3,blnmsk,critp1, &
& fcplrl,fcplrs,fczors,fvets,fsotl,fsots, &
& fsocl,fsocs, &
& fvetl,fplrs,fvegl,fvegs,fcsnol,fcsnos, &
& fczorl,fcalbs,fctsfl,fctsfs,fcalbl, &
& falfs,falfl,fh,crit,zsca,ztsfc,tem1,tem2 &
&, fsihl,fsihs,fsicl,fsics, &
& csihl,csihs,csicl,csics,epssih,epssic &
&, fvmnl,fvmns,fvmxl,fvmxs,fslpl,fslps, &
& fabsl,fabss,cvmnl,cvmns,cvmxl,cvmxs, &
& cslpl,cslps,cabsl,cabss,epsvmn,epsvmx, &
& epsslp,epsabs &
&, sihlmx,sihlmn,sihomx,sihomn,sihsmx, &
& sihsmn,sihimx,sihimn,sihjmx,sihjmn, &
& siclmx,siclmn,sicomx,sicomn,sicsmx, &
& sicsmn,sicimx,sicimn,sicjmx,sicjmn &
&, glacir_hice &
&, vmnlmx,vmnlmn,vmnomx,vmnomn,vmnsmx, &
& vmnsmn,vmnimx,vmnimn,vmnjmx,vmnjmn, &
& vmxlmx,vmxlmn,vmxomx,vmxomn,vmxsmx, &
& vmxsmn,vmximx,vmximn,vmxjmx,vmxjmn, &
& slplmx,slplmn,slpomx,slpomn,slpsmx, &
& slpsmn,slpimx,slpimn,slpjmx,slpjmn, &
& abslmx,abslmn,absomx,absomn,abssmx, &
& abssmn,absimx,absimn,absjmx,absjmn &
&, sihnew
integer imsk,jmsk,ifp,irtscv,irtacn,irtais,irtsno,irtzor, &
& irtalb,irtsot,irtsoc,irtalf,j,irtvet,irtsmc,irtstc,irtveg,&
& irtwet,k,iprnt,kk,irttsf,iret,i,igrdbg,iy,im,id, &
& icalbl,icalbs,icalfl,ictsfs,lugb,len,lsoil,ih, &
& ictsfl,iczors,icplrl,icplrs,iczorl,icalfs,icsnol, &
& icsnos,irttg3,kqcm,nlunit,sz_nml,ialb &
&, irtvmn, irtvmx, irtslp, irtabs, isot, ivegsrc
logical gausm, deads, qcmsk, znlst, monclm, monanl, &
& monfcs, monmer, mondif, landice
character(len=*), intent(in) :: input_nml_file(sz_nml)
!
!> This is a limited point version of surface program.
!!
!! this program runs in two different modes:
!!
!! 1. analysis mode (fh=0.)
!!
!! this program merges climatology, analysis and forecast guess to create
!! new surface fields. if analysis file is given, the program
!! uses it if date of the analysis matches with iy,im,id,ih (see note
!! below).
!!
!! 2. forecast mode (fh.gt.0.)
!!
!! this program interpolates climatology to the date corresponding to the
!! forecast hour. if surface analysis file is given, for the corresponding
!! dates, the program will use it.
!!
!!\note if the date of the analysis does not match given iy,im,id,ih, (and fh),
!! the program searches an old analysis by going back 6 hours, then 12 hours,
!! then one day upto nrepmx days (parameter statement in the subrotine fixrd.
!! now defined as 8). this allows the user to provide non-daily analysis to
!! be used. if matching field is not found, the forecast guess will be used.
!!
!! use of a combined earlier surface analyses and current analysis is
!! not allowed (as was done in the old version for snow analysis in which
!! old snow analysis is used in combination with initial guess), except
!! for sea surface temperature. for sst anolmaly interpolation, you need to
!! set lanom=.true. and must provide sst analysis at initial time.
!!
!! if you want to do complex merging of past and present surface field analysis,
!! you need to create a separate file that contains daily surface field.
!!
!! for a dead start, do not supply fnbgsi or set fnbgsi=' '
!
!
! variable naming conventions:
!
! oro .. orography
! alb .. albedo
! wet .. soil wetness as defined for bucket model
! sno .. snow depth
! zor .. surface roughness length
! vet .. vegetation type
! plr .. plant evaporation resistance
! tsf .. surface skin temperature. sea surface temp. over ocean.
! tg3 .. deep soil temperature (at 500cm)
! stc .. soil temperature (lsoil layrs)
! smc .. soil moisture (lsoil layrs)
! scv .. snow cover (not snow depth)
! ais .. sea ice mask (0 or 1)
! acn .. sea ice concentration (fraction)
! gla .. glacier (permanent snow) mask (0 or 1)
! mxi .. maximum sea ice extent (0 or 1)
! msk .. land ocean mask (0=ocean 1=land)
! cnp .. canopy water content
! cv .. convective cloud cover
! cvb .. convective cloud base
! cvt .. convective cloud top
! sli .. land/sea/sea-ice mask. (1/0/2 respectively)
! veg .. vegetation cover
! sot .. soil type
! soc .. soil color
!cwu [+2l] add sih & sic
! sih .. sea ice thickness
! sic .. sea ice concentration
!clu [+6l] add swd,slc,vmn,vmx,slp,abs
! swd .. actual snow depth
! slc .. liquid soil moisture (lsoil layers)
! vmn .. vegetation cover minimum
! vmx .. vegetation cover maximum
! slp .. slope type
! abs .. maximum snow albedo
!
! definition of land/sea mask. sllnd for land and slsea for sea.
! definition of sea/ice mask. aicice for ice, aicsea for sea.
! tgice=max ice temperature
! rlapse=lapse rate for sst correction due to surface angulation
!
parameter(sllnd =1.0,slsea =0.0)
parameter(aicice=1.0,aicsea=0.0)
parameter(tgice=271.2)
parameter(rlapse=0.65e-2)
!
! max/min of fields for check and replace.
!
! ???lmx .. max over bare land
! ???lmn .. min over bare land
! ???omx .. max over open ocean
! ???omn .. min over open ocean
! ???smx .. max over snow surface (land and sea-ice)
! ???smn .. min over snow surface (land and sea-ice)
! ???imx .. max over bare sea ice
! ???imn .. min over bare sea ice
! ???jmx .. max over snow covered sea ice
! ???jmn .. min over snow covered sea ice
!
parameter(orolmx=8000.,orolmn=-1000.,oroomx=3000.,oroomn=-1000.,
& orosmx=8000.,orosmn=-1000.,oroimx=3000.,oroimn=-1000.,
& orojmx=3000.,orojmn=-1000.)
! parameter(alblmx=0.80,alblmn=0.06,albomx=0.06,albomn=0.06,
! & albsmx=0.80,albsmn=0.06,albimx=0.80,albimn=0.80,
! & albjmx=0.80,albjmn=0.80)
!cwu [-3l/+9l] change min/max for alb; add min/max for sih & sic
! parameter(alblmx=0.80,alblmn=0.01,albomx=0.01,albomn=0.01,
! & albsmx=0.80,albsmn=0.01,albimx=0.01,albimn=0.01,
! & albjmx=0.01,albjmn=0.01)
! note: the range values for bare land and snow covered land
! (alblmx, alblmn, albsmx, albsmn) are set below
! based on whether the old or new radiation is selected
parameter(albomx=0.06,albomn=0.06,
& albimx=0.80,albimn=0.06,
& albjmx=0.80,albjmn=0.06)
parameter(sihlmx=0.0,sihlmn=0.0,sihomx=5.0,sihomn=0.0,
& sihsmx=5.0,sihsmn=0.0,sihimx=5.0,sihimn=0.10,
& sihjmx=5.0,sihjmn=0.10,glacir_hice=3.0)
!cwu change sicimn & sicjmn Jan 2015
! parameter(siclmx=0.0,siclmn=0.0,sicomx=1.0,sicomn=0.0,
! & sicsmx=1.0,sicsmn=0.0,sicimx=1.0,sicimn=0.50,
! & sicjmx=1.0,sicjmn=0.50)
!
! parameter(sihlmx=0.0,sihlmn=0.0,sihomx=8.0,sihomn=0.0,
! & sihsmx=8.0,sihsmn=0.0,sihimx=8.0,sihimn=0.10,
! & sihjmx=8.0,sihjmn=0.10,glacir_hice=3.0)
parameter(siclmx=0.0,siclmn=0.0,sicomx=1.0,sicomn=0.0,
& sicsmx=1.0,sicsmn=0.0,sicimx=1.0,sicjmx=1.0)
! & sicsmx=1.0,sicsmn=0.0,sicimx=1.0,sicimn=0.15,
! & sicjmx=1.0,sicjmn=0.15)
parameter(wetlmx=0.15,wetlmn=0.00,wetomx=0.15,wetomn=0.15,
& wetsmx=0.15,wetsmn=0.15,wetimx=0.15,wetimn=0.15,
& wetjmx=0.15,wetjmn=0.15)
parameter(snolmx=0.0,snolmn=0.0,snoomx=0.0,snoomn=0.0,
& snosmx=55000.,snosmn=0.001,snoimx=0.,snoimn=0.0,
& snojmx=10000.,snojmn=0.01)
parameter(zorlmx=300.,zorlmn=1.0,zoromx=1.0,zoromn=1.e-05,
& zorsmx=300.,zorsmn=1.0,zorimx=1.0,zorimn=1.0,
& zorjmx=1.0,zorjmn=1.0)
parameter(plrlmx=1000.,plrlmn=0.0,plromx=1000.0,plromn=0.0,
& plrsmx=1000.,plrsmn=0.0,plrimx=1000.,plrimn=0.0,
& plrjmx=1000.,plrjmn=0.0)
!clu [-1l/+1l] relax tsfsmx
parameter(tsflmx=353.,tsflmn=173.0,tsfomx=313.0,tsfomn=271.2,
& tsfsmx=305.0,tsfsmn=173.0,tsfimx=271.2,tsfimn=173.0,
& tsfjmx=273.16,tsfjmn=173.0)
! parameter(tsflmx=353.,tsflmn=173.0,tsfomx=313.0,tsfomn=271.21,
!* & tsfsmx=273.16,tsfsmn=173.0,tsfimx=271.21,tsfimn=173.0,
! & tsfsmx=305.0,tsfsmn=173.0,tsfimx=271.21,tsfimn=173.0,
parameter(tg3lmx=310.,tg3lmn=200.0,tg3omx=310.0,tg3omn=200.0,
& tg3smx=310.,tg3smn=200.0,tg3imx=310.0,tg3imn=200.0,
& tg3jmx=310.,tg3jmn=200.0)
parameter(stclmx=353.,stclmn=173.0,stcomx=313.0,stcomn=200.0,
& stcsmx=310.,stcsmn=200.0,stcimx=310.0,stcimn=200.0,
& stcjmx=310.,stcjmn=200.0)
!landice mods force a flag value of soil moisture of 1.0
! at non-land points
parameter(smclmx=0.55,smclmn=0.0,smcomx=1.0,smcomn=1.0,
& smcsmx=0.55,smcsmn=0.0,smcimx=1.0,smcimn=1.0,
& smcjmx=1.0,smcjmn=1.0)
parameter(scvlmx=0.0,scvlmn=0.0,scvomx=0.0,scvomn=0.0,
& scvsmx=1.0,scvsmn=1.0,scvimx=0.0,scvimn=0.0,
& scvjmx=1.0,scvjmn=1.0)
parameter(veglmx=1.0,veglmn=0.0,vegomx=0.0,vegomn=0.0,
& vegsmx=1.0,vegsmn=0.0,vegimx=0.0,vegimn=0.0,
& vegjmx=0.0,vegjmn=0.0)
parameter(vmnlmx=1.0,vmnlmn=0.0,vmnomx=0.0,vmnomn=0.0,
& vmnsmx=1.0,vmnsmn=0.0,vmnimx=0.0,vmnimn=0.0,
& vmnjmx=0.0,vmnjmn=0.0)
parameter(vmxlmx=1.0,vmxlmn=0.0,vmxomx=0.0,vmxomn=0.0,
& vmxsmx=1.0,vmxsmn=0.0,vmximx=0.0,vmximn=0.0,
& vmxjmx=0.0,vmxjmn=0.0)
parameter(slplmx=9.0,slplmn=1.0,slpomx=0.0,slpomn=0.0,
& slpsmx=9.0,slpsmn=1.0,slpimx=0.,slpimn=0.,
& slpjmx=0.,slpjmn=0.)
! note: the range values for bare land and snow covered land
! (alblmx, alblmn, albsmx, albsmn) are set below
! based on whether the old or new radiation is selected
parameter(absomx=0.0,absomn=0.0,
& absimx=0.0,absimn=0.0,
& absjmx=0.0,absjmn=0.0)
! vegetation type
parameter(vetlmx=20.,vetlmn=1.0,vetomx=0.0,vetomn=0.0,
& vetsmx=20.,vetsmn=1.0,vetimx=0.,vetimn=0.,
& vetjmx=0.,vetjmn=0.)
! soil type
parameter(sotlmx=16.,sotlmn=1.0,sotomx=0.0,sotomn=0.0,
& sotsmx=16.,sotsmn=1.0,sotimx=0.,sotimn=0.,
& sotjmx=0.,sotjmn=0.)
! soil color
parameter(soclmx=20.,soclmn=1.0,socomx=0.0,socomn=0.0,
& socsmx=20.,socsmn=1.0,socimx=0.,socimn=0.,
& socjmx=0.,socjmn=0.)
! fraction of vegetation for strongly and weakly zeneith angle dependent
! albedo
parameter(alslmx=1.0,alslmn=0.0,alsomx=0.0,alsomn=0.0,
& alssmx=1.0,alssmn=0.0,alsimx=0.0,alsimn=0.0,
& alsjmx=0.0,alsjmn=0.0)
!
! criteria used for monitoring
!
parameter(epstsf=0.01,epsalb=0.001,epssno=0.01,
& epswet=0.01,epszor=0.0000001,epsplr=1.,epsoro=0.,
& epssmc=0.0001,epsscv=0.,eptsfc=0.01,epstg3=0.01,
& epsais=0.,epsacn=0.01,epsveg=0.01,
& epssih=0.001,epssic=0.001,
& epsvmn=0.01,epsvmx=0.01,epsabs=0.001,epsslp=0.01,
& epsvet=.01,epssot=.01,epssoc=0.01,epsalf=.001)
!
! quality control of analysis snow and sea ice
!
! qctsfs .. surface temperature above which no snow allowed
! qcsnos .. snow depth above which snow must exist
! qctsfi .. sst above which sea-ice is not allowed
!
!clu relax qctsfs (for noah lsm)
!* parameter(qctsfs=283.16,qcsnos=100.,qctsfi=280.16)
!* parameter(qctsfs=288.16,qcsnos=100.,qctsfi=280.16)
parameter(qctsfs=293.16,qcsnos=100.,qctsfi=280.16)
!
!cwu [-2l]
!* ice concentration for ice limit (55 percent)
!
!* parameter(aislim=0.55)
!
! parameters to obtain snow depth from snow cover and temperature
!
! parameter(snwmin=25.,snwmax=100.)
parameter(snwmin=5.0,snwmax=100.)
! real (kind=kind_io8), parameter :: ten=10.0, one=1.0, zero=0.0
!
! coefficients of blending forecast and interpolated clim
! (or analyzed) fields over sea or land(l) (not for clouds)
! 1.0 = use of forecast
! 0.0 = replace with interpolated analysis
!
! these values are set for analysis mode.
!
! variables land sea
! ---------------------------------------------------------
! surface temperature forecast analysis
! surface temperature forecast forecast (over sea ice)
! albedo forecast/analysis analysis
! sea-ice analysis analysis
! snow forecast/analysis forecast (over sea ice)
! roughness forecast/analysis forecast
! plant resistance analysis analysis
! soil wetness (layer) weighted average analysis
! soil temperature forecast analysis
! canopy waver content forecast forecast
! convective cloud cover forecast forecast
! convective cloud bottm forecast forecast
! convective cloud top forecast forecast
! vegetation cover analysis analysis
! vegetation type analysis analysis
! soil type analysis analysis
! soil color analysis analysis
! sea-ice thickness forecast forecast
! sea-ice concentration analysis analysis
! vegetation cover min analysis analysis
! vegetation cover max analysis analysis
! max snow albedo analysis analysis
! slope type analysis analysis
! liquid soil wetness analysis-weighted analysis
! actual snow depth forecast/analysis-weighted analysis
!
! note: if analysis file is not given, then time interpolated climatology
! is used. if analyiss file is given, it will be used as far as the
! date and time matches. if they do not match, it uses forecast.
!
! critical percentage value for aborting bad points when lgchek=.true.
!
logical lgchek
data lgchek/.true./
data critp1,critp2,critp3/80.,80.,25./
!
! integer kpdalb(4), kpdalf(2)
! data kpdalb/212,215,213,216/, kpdalf/214,217/
! save kpdalb, kpdalf
!
! mask orography and variance on gaussian grid
!
real (kind=kind_io8) slmskl(len), slmskw(len)
real (kind=kind_io8) orog(len), orog_uf(len), orogd(len)
real (kind=kind_io8) rla(len), rlo(len)
!
! permanent/extremes
!
character*500 fnglac,fnmxic
real (kind=kind_io8), allocatable :: glacir(:),amxice(:),tsfcl0(:)
!
! tsfcl0 is the climatological tsf at fh=0
!
! climatology surface fields (last character 'c' or 'clm' indicate climatology)
!
character*500 fntsfc,fnwetc,fnsnoc,fnzorc,fnalbc,fnaisc &
&, fnplrc,fntg3c,fnscvc,fnsmcc,fnstcc,fnacnc &
&, fnvegc,fnvetc,fnsotc,fnsocc &
&, fnvmnc,fnvmxc,fnslpc,fnabsc, fnalbc2
real (kind=kind_io8) tsfclm(len), wetclm(len), snoclm(len) &
&, zorclm(len), albclm(len,4), aisclm(len) &
&, tg3clm(len), acnclm(len), cnpclm(len) &
&, cvclm (len), cvbclm(len), cvtclm(len) &
&, scvclm(len), tsfcl2(len), vegclm(len) &
&, vetclm(len), sotclm(len), socclm(len),alfclm(len,2), sliclm(len)&
&, smcclm(len,lsoil), stcclm(len,lsoil) &
&, sihclm(len), sicclm(len) &
&, vmnclm(len), vmxclm(len), slpclm(len), absclm(len)
!
! analyzed surface fields (last character 'a' or 'anl' indicate analysis)
!
character*500 fntsfa,fnweta,fnsnoa,fnzora,fnalba,fnaisa &
&, fnplra,fntg3a,fnscva,fnsmca,fnstca,fnacna &
&, fnvega,fnveta,fnsota,fnsoca &
&, fnvmna,fnvmxa,fnslpa,fnabsa
!
real (kind=kind_io8) tsfanl(len), wetanl(len), snoanl(len) &
&, zoranl(len), albanl(len,4), aisanl(len) &
&, tg3anl(len), acnanl(len), cnpanl(len) &
&, cvanl (len), cvbanl(len), cvtanl(len) &
&, scvanl(len), tsfan2(len), veganl(len) &
&, vetanl(len), sotanl(len), socanl(len) &
&, alfanl(len,2), slianl(len) &
&, smcanl(len,lsoil), stcanl(len,lsoil) &
&, sihanl(len), sicanl(len) &
&, vmnanl(len), vmxanl(len), slpanl(len), absanl(len)
!
real (kind=kind_io8) tsfan0(len) ! sea surface temperature analysis at ft=0.
!
! predicted surface fields (last characters 'fcs' indicates forecast)
!
real (kind=kind_io8) tsffcs(len), wetfcs(len), snofcs(len) &
&, zorfcs(len), albfcs(len,4), aisfcs(len) &
&, tg3fcs(len), acnfcs(len), cnpfcs(len) &
&, cvfcs (len), cvbfcs(len), cvtfcs(len) &
&, slifcs(len), vegfcs(len) &
&, vetfcs(len), sotfcs(len), socfcs(len), alffcs(len,2) &
&, smcfcs(len,lsoil), stcfcs(len,lsoil) &
&, sihfcs(len), sicfcs(len), sitfcs(len) &
&, vmnfcs(len), vmxfcs(len), slpfcs(len), absfcs(len) &
&, swdfcs(len), slcfcs(len,lsoil)
!
! ratio of sigma level 1 wind and 10m wind (diagnozed by model and not touched
! in this program).
!
real (kind=kind_io8) f10m (len)
real (kind=kind_io8) fsmcl(25), fsmcs(25), fstcl(25), fstcs(25)
real (kind=kind_io8) fcsmcl(25),fcsmcs(25),fcstcl(25),fcstcs(25)
!clu [+1l] add swratio (soil moisture liquid-to-total ratio)
real (kind=kind_io8) swratio(len,lsoil)
!clu [+1l] add fixratio (option to adjust slc from smc)
logical fixratio(lsoil)
!
integer icsmcl(25), icsmcs(25), icstcl(25), icstcs(25)
!
real (kind=kind_io8) csmcl(25), csmcs(25)
real (kind=kind_io8) cstcl(25), cstcs(25)
!
real (kind=kind_io8) slmskh(mdata)
character*500 fnmskh
integer kpd7, kpd9
!
logical icefl1(len), icefl2(len)
!
real (kind=kind_io8), allocatable, dimension(:) :: &
& tsffcsd, snofcsd, tg3fcsd, zorfcsd, slifcsd, aisfcsd, &
& cnpfcsd, vegfcsd, vetfcsd, sotfcsd, socfcsd, sihfcsd, sicfcsd, &
& vmnfcsd, vmxfcsd, slpfcsd, absfcsd
real (kind=kind_io8), allocatable, dimension(:,:) :: &
& smcfcsd, stcfcsd, albfcsd
!
! input and output surface fields (bges) file names
!
!
! sigma level 1 temperature for dead start
!
real (kind=kind_io8) sig1t(len)
!
character*32 label
!
! = 1 ==> forecast is used
! = 0 ==> analysis (or climatology) is used
!
! output file ... primary surface file for radiation and forecast
!
! rec. 1 label
! rec. 2 date record
! rec. 3 tsf
! rec. 4 soilm(lsoil)
! rec. 5 snow
! rec. 6 soilt(lsoil)
! rec. 7 tg3
! rec. 8 zor
! rec. 9 cv
! rec. 10 cvb
! rec. 11 cvt
! rec. 12 albedo (four types)
! rec. 13 slimsk
! rec. 14 vegetation cover
! rec. 14 plantr -----> skip this record
! rec. 15 f10m -----> canopy
! rec. 16 canopy water content (cnpanl) -----> f10m
! rec. 17 vegetation type
! rec. 18 soil type
! rec. 18 soil color ? add later?
! rec. 19 zeneith angle dependent vegetation fraction (two types)
! rec. 20 uustar
! rec. 21 ffmm
! rec. 22 ffhh
!cwu add sih & sic
! rec. 23 sih(one category only)
! rec. 24 sic
!clu [+8l] add prcp, flag, swd, slc, vmn, vmx, slp, abs
! rec. 25 tprcp
! rec. 26 srflag
! rec. 27 swd
! rec. 28 slc (lsoil)
! rec. 29 vmn
! rec. 30 vmx
! rec. 31 slp
! rec. 32 abs
!
! debug only
! ldebug=.true. creates bges files for climatology and analysis
! lqcbgs=.true. quality controls input bges file before merging (should have been
! qced in the forecast program)
!
logical :: ldebug, lqcbgs, lprnt
!
! debug only
!
character*500 fndclm,fndanl
!
logical lanom
!
namelist/namsfc/fnglac,fnmxic,
& fntsfc,fnwetc,fnsnoc,fnzorc,fnalbc,fnaisc,
& fnplrc,fntg3c,fnscvc,fnsmcc,fnstcc,fnacnc,
& fnvegc,fnvetc,fnsotc,fnsocc,fnalbc2,
& fnvmnc,fnvmxc,fnslpc,fnabsc,
& fntsfa,fnweta,fnsnoa,fnzora,fnalba,fnaisa,
& fnplra,fntg3a,fnscva,fnsmca,fnstca,fnacna,
& fnvega,fnveta,fnsota,fnsoca,
& fnvmna,fnvmxa,fnslpa,fnabsa,
& fnmskh,
& ldebug,lgchek,lqcbgs,critp1,critp2,critp3,
& fndclm,fndanl,
& lanom,
& ftsfl,ftsfs,falbl,falbs,faisl,faiss,fsnol,fsnos,
& fzorl,fzors,fplrl,fplrs,fsmcl,fsmcs,
& fstcl,fstcs,fvegl,fvegs,fvetl,fvets,fsotl,fsots,
& fsocl,fsocs,
& fctsfl,fctsfs,fcalbl,fcalbs,fcsnol,fcsnos,
& fczorl,fczors,fcplrl,fcplrs,fcsmcl,fcsmcs,
& fcstcl,fcstcs,fsalfl,fsalfs,fcalfl,flalfs,
& fsihl,fsicl,fsihs,fsics,aislim,sihnew,
& fvmnl,fvmns,fvmxl,fvmxs,fslpl,fslps,
& fabsl,fabss,
& ictsfl,ictsfs,icalbl,icalbs,icsnol,icsnos,
& iczorl,iczors,icplrl,icplrs,icsmcl,icsmcs,
& icstcl,icstcs,icalfl,icalfs,
& gausm, deads, qcmsk, znlst,
& monclm, monanl, monfcs, monmer, mondif, igrdbg,
& blnmsk, bltmsk, landice
!
data gausm/.true./, deads/.false./, blnmsk/0.0/, bltmsk/90.0/
&, qcmsk/.false./, znlst/.false./, igrdbg/-1/
&, monclm/.false./, monanl/.false./, monfcs/.false./
&, monmer/.false./, mondif/.false./, landice/.true./
!
! defaults file names
!
data fnmskh/'global_slmask.t126.grb'/
data fnalbc/'global_albedo4.1x1.grb'/
data fnalbc2/'global_albedo4.1x1.grb'/
data fntsfc/'global_sstclim.2x2.grb'/
data fnsotc/'global_soiltype.1x1.grb'/
data fnsocc/''/
data fnvegc/'global_vegfrac.1x1.grb'/
data fnvetc/'global_vegtype.1x1.grb'/
data fnglac/'global_glacier.2x2.grb'/
data fnmxic/'global_maxice.2x2.grb'/
data fnsnoc/'global_snoclim.1.875.grb'/
data fnzorc/'global_zorclim.1x1.grb'/
data fnaisc/'global_iceclim.2x2.grb'/
data fntg3c/'global_tg3clim.2.6x1.5.grb'/
data fnsmcc/'global_soilmcpc.1x1.grb'/
!clu [+4l] add fn()c for vmn, vmx, abs, slp
data fnvmnc/'global_shdmin.0.144x0.144.grb'/
data fnvmxc/'global_shdmax.0.144x0.144.grb'/
data fnslpc/'global_slope.1x1.grb'/
data fnabsc/'global_snoalb.1x1.grb'/
!
data fnwetc/' '/
data fnplrc/' '/
data fnstcc/' '/
data fnscvc/' '/
data fnacnc/' '/
!
data fntsfa/' '/
data fnweta/' '/
data fnsnoa/' '/
data fnzora/' '/
data fnalba/' '/
data fnaisa/' '/
data fnplra/' '/
data fntg3a/' '/
data fnsmca/' '/
data fnstca/' '/
data fnscva/' '/
data fnacna/' '/
data fnvega/' '/
data fnveta/' '/
data fnsota/' '/
data fnsoca/' '/
!clu [+4l] add fn()a for vmn, vmx, abs, slp
data fnvmna/' '/
data fnvmxa/' '/
data fnslpa/' '/
data fnabsa/' '/
!
data ldebug/.false./, lqcbgs/.true./
data fndclm/' '/
data fndanl/' '/
data lanom/.false./
!
! default relaxation time in hours to analysis or climatology
data ftsfl/99999.0/, ftsfs/0.0/
data falbl/0.0/, falbs/0.0/
data falfl/0.0/, falfs/0.0/
data faisl/0.0/, faiss/0.0/
data fsnol/0.0/, fsnos/99999.0/
data fzorl/0.0/, fzors/99999.0/
data fplrl/0.0/, fplrs/0.0/
data fvetl/0.0/, fvets/99999.0/
data fsotl/0.0/, fsots/99999.0/
data fsocl/0.0/, fsocs/99999.0/
data fvegl/0.0/, fvegs/99999.0/
!cwu [+4l] add f()l and f()s for sih, sic and aislim, sihlim
data fsihl/99999.0/, fsihs/99999.0/
! data fsicl/99999.0/, fsics/99999.0/
data fsicl/0.0/, fsics/0.0/
! default ice concentration limit (50%), new ice thickness (20cm)
!cwu change ice concentration limit (15%) Jan 2015
! data aislim/0.50/, sihnew/0.2/
data aislim/0.15/, sihnew/0.2/
!clu [+4l] add f()l and f()s for vmn, vmx, abs, slp
data fvmnl/0.0/, fvmns/99999.0/
data fvmxl/0.0/, fvmxs/99999.0/
data fslpl/0.0/, fslps/99999.0/
data fabsl/0.0/, fabss/99999.0/
! default relaxation time in hours to climatology if analysis missing
data fctsfl/99999.0/, fctsfs/99999.0/
data fcalbl/99999.0/, fcalbs/99999.0/
data fcsnol/99999.0/, fcsnos/99999.0/
data fczorl/99999.0/, fczors/99999.0/
data fcplrl/99999.0/, fcplrs/99999.0/
! default flag to apply climatological annual cycle
data ictsfl/0/, ictsfs/1/
data icalbl/1/, icalbs/1/
data icalfl/1/, icalfs/1/
data icsnol/0/, icsnos/0/
data iczorl/1/, iczors/0/
data icplrl/1/, icplrs/0/
!
data ccnp/1.0/
data ccv/1.0/, ccvb/1.0/, ccvt/1.0/
!
data ifp/0/
!
save ifp,fnglac,fnmxic,
& fntsfc,fnwetc,fnsnoc,fnzorc,fnalbc,fnaisc,
& fnplrc,fntg3c,fnscvc,fnsmcc,fnstcc,fnacnc,fnvegc,
& fntsfa,fnweta,fnsnoa,fnzora,fnalba,fnaisa,
& fnplra,fntg3a,fnscva,fnsmca,fnstca,fnacna,fnvega,
& fnvetc,fnveta,
& fnsotc,fnsota,
& fnsocc,fnsoca,
!clu [+2l] add fn()c and fn()a for vmn, vmx, slp, abs
& fnvmnc,fnvmxc,fnabsc,fnslpc,
& fnvmna,fnvmxa,fnabsa,fnslpa,
& ldebug,lgchek,lqcbgs,critp1,critp2,critp3,
& fndclm,fndanl,
& lanom,
& ftsfl,ftsfs,falbl,falbs,faisl,faiss,fsnol,fsnos,
& fzorl,fzors,fplrl,fplrs,fsmcl,fsmcs,falfl,falfs,
& fstcl,fstcs,fvegl,fvegs,fvetl,fvets,fsotl,fsots,
& fsocl,fsocs,
& fctsfl,fctsfs,fcalbl,fcalbs,fcsnol,fcsnos,
& fczorl,fczors,fcplrl,fcplrs,fcsmcl,fcsmcs,
& fcstcl,fcstcs,fcalfl,fcalfs,
!cwu [+1l] add f()l and f()s for sih, sic and aislim, sihnew
& fsihl,fsihs,fsicl,fsics,aislim,sihnew,
!clu [+2l] add f()l and f()s for vmn, vmx, slp, abs
& fvmnl,fvmns,fvmxl,fvmxs,fslpl,fslps,
& fabsl,fabss,
& ictsfl,ictsfs,icalbl,icalbs,icsnol,icsnos,
& iczorl,iczors,icplrl,icplrs,icsmcl,icsmcs,
& icstcl,icstcs,icalfl,icalfs,
& gausm, deads, qcmsk,
& monclm, monanl, monfcs, monmer, mondif, igrdbg,
& grboro, grbmsk,
!
& ctsfl, ctsfs, calbl, calfl, calbs, calfs, csmcs,
& csnol, csnos, czorl, czors, cplrl, cplrs, cstcl,
& cstcs, cvegl, cvwgs, cvetl, cvets, csotl, csots,
& csocl, csocs,
& csmcl
!cwu [+1l] add c()l and c()s for sih, sic
&, csihl, csihs, csicl, csics
!clu [+2l] add c()l and c()s for vmn, vmx, slp, abs
&, cvmnl, cvmns, cvmxl, cvmxs, cslpl, cslps,
& cabsl, cabss
&, imsk, jmsk, slmskh, blnmsk, bltmsk
&, glacir, amxice, tsfcl0
&, caisl, caiss, cvegs
! Set number of threads num_threads in sfccyc_module for later use
! to the value received from the calling routine (nthrds)
num_threads = nthrds
!
lprnt = .false.
! do i=1,len
! if (ifp .eq. 0 .and. rla(i) .gt. 80.0) print *,' rla=',rla(i)
! *,' rlo=',rlo(i)
! tem1 = abs(rla(i) - 60.11)
! tem2 = abs(rlo(i) - 5.38)
! if(tem1 < 0.10 .and. tem2 < 0.10) then
! lprnt = .true.
! iprnt = i
! print *,' lprnt=',lprnt,' iprnt=',iprnt
! print *,' rla(i)=',rla(i),' rlo(i)=',rlo(i)
! endif
! enddo
if (ialb == 1) then
kpdabs = kpdabs_1
kpdalb = kpdalb_1
alblmx = .99
albsmx = .99
alblmn = .01
albsmn = .01
abslmx = 1.0
abssmx = 1.0
abssmn = .01
abslmn = .01
elseif (ialb ==2) then
kpdabs = kpdabs_1
kpdalb = kpdalb_1
alblmx = .99
albsmx = .99
alblmn = .01
albsmn = .01
abslmx = 1.0
abssmx = 1.0
abssmn = .01
abslmn = .01
else
kpdabs = kpdabs_0
kpdalb = kpdalb_0
alblmx = .80
albsmx = .80
alblmn = .06
albsmn = .06
abslmx = .80
abssmx = .80
abslmn = .01
abssmn = .01
endif
if (ifp == 0) then
ifp = 1
do k=1,lsoil
fsmcl(k) = 99999.
fsmcs(k) = 0.
fstcl(k) = 99999.
fstcs(k) = 0.
enddo
#ifdef INTERNAL_FILE_NML
read(input_nml_file, nml=namsfc)
#else
! print *,' in sfcsub nlunit=',nlunit,' me=',me,' ialb=',ialb
rewind(nlunit)
read (nlunit,namsfc)
#endif
! write(6,namsfc)
!
if (me == 0) then
print *,' ftsfl,falbl,faisl,fsnol,fzorl=', &
& ftsfl,falbl,faisl,fsnol,fzorl
print *,' fsmcl=',fsmcl(1:lsoil)
print *,' fstcl=',fstcl(1:lsoil)
print *,' ftsfs,falbs,faiss,fsnos,fzors=', &
& ftsfs,falbs,faiss,fsnos,fzors
print *,' fsmcs=',fsmcs(1:lsoil)
print *,' fstcs=',fstcs(1:lsoil)
print *,' aislim=',aislim,' sihnew=',sihnew
print *,' isot=', isot,' ivegsrc=',ivegsrc
print *,' fnsotc =', fnsotc
endif
if (ivegsrc == 2) then ! sib
veg_type_landice = 13
else
veg_type_landice = 15
endif
if (isot == 0) then
soil_type_landice = 9
else
soil_type_landice = 16
endif
soil_color_landice = 10 !does not matter, only one source
!
deltf = deltsfc / 24.0
!
ctsfl = 0. !... tsfc over land
if (ftsfl >= 99999.) ctsfl = 1.
if (ftsfl > 0. .and. ftsfl < 99999) ctsfl = exp(-deltf/ftsfl)
!
ctsfs=0. !... tsfc over sea
if (ftsfs >= 99999.) ctsfs=1.
if (ftsfs > 0. .and. ftsfs < 99999) ctsfs = exp(-deltf/ftsfs)
!
do k=1,lsoil
csmcl(k) = 0. !... soilm over land
if (fsmcl(k) >= 99999.) csmcl(k) = 1.
if (fsmcl(k) > 0. .and. fsmcl(k) < 99999)
& csmcl(k) = exp(-deltf/fsmcl(k))
csmcs(k)=0. !... soilm over sea
if (fsmcs(k) >= 99999.) csmcs(k) = 1.
if (fsmcs(k) > 0. .and. fsmcs(k) < 99999)
& csmcs(k) = exp(-deltf/fsmcs(k))
enddo
!
calbl = 0. !... albedo over land
if (ialb == 2) falbl=99999.
if (falbl >= 99999.) calbl = 1.
if (falbl > 0. .and. falbl < 99999) calbl = exp(-deltf/falbl)
!
calfl=0. !... fraction field for albedo over land
if (falfl >= 99999.) calfl = 1.
if (falfl > 0. .and. falfl < 99999) calfl = exp(-deltf/falfl)
!
calbs=0. !... albedo over sea
if (falbs >= 99999.) calbs = 1.
if (falbs > 0. .and. falbs < 99999) calbs = exp(-deltf/falbs)
!
calfs = 0. !... fraction field for albedo over sea
if (falfs >= 99999.) calfs = 1.
if (falfs > 0. .and. falfs < 99999) calfs = exp(-deltf/falfs)
!
caisl = 0. !... sea ice over land
if (faisl >= 99999.) caisl = 1.
if (faisl > 0. .and. faisl < 99999) caisl = 1.
!
caiss = 0. !... sea ice over sea
if (faiss >= 99999.) caiss = 1.
if (faiss > 0. .and. faiss < 99999) caiss = 1.
!
csnol = 0. !... snow over land
if (fsnol >= 99999.) csnol = 1.
if (fsnol > 0. .and. fsnol < 99999) csnol = exp(-deltf/fsnol)
! using the same way to bending snow as narr when fsnol is the negative value
! the magnitude of fsnol is the thread to determine the lower and upper bound
! of final swe
if (fsnol < 0.) csnol = fsnol
!
csnos = 0. !... snow over sea
if (fsnos >= 99999.) csnos = 1.
if (fsnos > 0 .and. fsnos < 99999) csnos = exp(-deltf/fsnos)
!
czorl = 0. !... roughness length over land
if (fzorl >= 99999.) czorl = 1.
if (fzorl > 0. .and. fzorl < 99999) czorl = exp(-deltf/fzorl)
!
czors = 0. !... roughness length over sea
if (fzors >= 99999.) czors = 1.
if (fzors > 0. .and. fzors < 99999) czors = exp(-deltf/fzors)
!
! cplrl = 0. !... plant resistance over land
! if (fplrl >= 99999.) cplrl = 1.
! if (fplrl > 0. .and. fplrl < 99999) cplrl=exp(-deltf/fplrl)
!
! cplrs = 0. !... plant resistance over sea
! if (fplrs >= 99999.) cplrs = 1.
! if (fplrs > 0. .and. fplrs < 99999) cplrs=exp(-deltf/fplrs)
!
do k=1,lsoil
cstcl(k) = 0. !... soilt over land
if (fstcl(k) >= 99999.) cstcl(k) = 1.
if (fstcl(k) > 0. .and. fstcl(k) < 99999) &
& cstcl(k) = exp(-deltf/fstcl(k))
cstcs(k) = 0. !... soilt over sea
if (fstcs(k) >= 99999.) cstcs(k) = 1.
if (fstcs(k) > 0. .and. fstcs(k) < 99999) &
& cstcs(k) = exp(-deltf/fstcs(k))
enddo
!
cvegl = 0. !... vegetation fraction over land
if (fvegl >= 99999.) cvegl = 1.
if (fvegl > 0. .and. fvegl < 99999) cvegl = exp(-deltf/fvegl)
!
cvegs = 0. !... vegetation fraction over sea
if (fvegs >= 99999.) cvegs = 1.
if (fvegs > 0. .and. fvegs < 99999) cvegs = exp(-deltf/fvegs)
!
cvetl = 0. !... vegetation type over land
if (fvetl >= 99999.) cvetl = 1.
if (fvetl > 0. .and. fvetl < 99999) cvetl = exp(-deltf/fvetl)
!
cvets = 0. !... vegetation type over sea
if (fvets >= 99999.) cvets = 1.
if (fvets > 0. .and. fvets < 99999) cvets = exp(-deltf/fvets)
!
csotl = 0. !... soil type over land
if (fsotl >= 99999.) csotl = 1.