forked from NCAR/ccpp-physics
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathmodule_sf_noahmp_glacier.F90
3498 lines (2910 loc) · 162 KB
/
module_sf_noahmp_glacier.F90
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
#define CCPP
!> \file module_sf_noahmp_glacier.F90
!! This file contains the NoahMP Glacier scheme.
!>\ingroup NoahMP_LSM
module noahmp_glacier_globals
use machine , only : kind_phys
use sfc_diff, only : stability
use module_sf_noahmplsm, only : sfcdif4
implicit none
! ==================================================================================================
!------------------------------------------------------------------------------------------!
! physical constants: !
!------------------------------------------------------------------------------------------!
real (kind=kind_phys), parameter :: grav = 9.80616 !< acceleration due to gravity (m/s2)
real (kind=kind_phys), parameter :: sb = 5.67e-08 !< stefan-boltzmann constant (w/m2/k4)
real (kind=kind_phys), parameter :: vkc = 0.40 !< von karman constant
real (kind=kind_phys), parameter :: tfrz = 273.16 !< freezing/melting point (k)
real (kind=kind_phys), parameter :: hsub = 2.8440e06 !< latent heat of sublimation (j/kg)
real (kind=kind_phys), parameter :: hvap = 2.5104e06 !< latent heat of vaporization (j/kg)
real (kind=kind_phys), parameter :: hfus = 0.3336e06 !< latent heat of fusion (j/kg)
real (kind=kind_phys), parameter :: cwat = 4.188e06 !< specific heat capacity of water (j/m3/k)
real (kind=kind_phys), parameter :: cice = 2.094e06 !< specific heat capacity of ice (j/m3/k)
real (kind=kind_phys), parameter :: cpair = 1004.64 !< heat capacity dry air at const pres (j/kg/k)
real (kind=kind_phys), parameter :: tkwat = 0.6 !< thermal conductivity of water (w/m/k)
real (kind=kind_phys), parameter :: tkice = 2.2 !< thermal conductivity of ice (w/m/k)
real (kind=kind_phys), parameter :: tkair = 0.023 !< thermal conductivity of air (w/m/k)
real (kind=kind_phys), parameter :: rair = 287.04 !< gas constant for dry air (j/kg/k)
real (kind=kind_phys), parameter :: rw = 461.269 !< gas constant for water vapor (j/kg/k)
real (kind=kind_phys), parameter :: denh2o = 1000. !< density of water (kg/m3)
real (kind=kind_phys), parameter :: denice = 917. !< density of ice (kg/m3)
! =====================================options for different schemes================================
!> options for ground snow surface albedo
!! 1-> BATS; 2 -> CLASS
INTEGER :: OPT_ALB != 2 !(suggested 2)
!> options for partitioning precipitation into rainfall & snowfall
!! 1 -> Jordan (1991); 2 -> BATS: when SFCTMP<TFRZ+2.2 ; 3-> SFCTMP<TFRZ
INTEGER :: OPT_SNF != 1 !(suggested 1)
!> options for lower boundary condition of soil temperature
!! 1 -> zero heat flux from bottom (ZBOT and TBOT not used)
!! 2 -> TBOT at ZBOT (8m) read from a file (original Noah)
INTEGER :: OPT_TBOT != 2 !(suggested 2)
!> options for snow/soil temperature time scheme (only layer 1)
!! 1 -> semi-implicit; 2 -> full implicit (original Noah)
INTEGER :: OPT_STC != 1 !(suggested 1)
!> options for glacier treatment
!! 1 -> include phase change of ice; 2 -> ice treatment more like original Noah
INTEGER :: OPT_GLA != 1 !(suggested 1)
INTEGER :: OPT_SFC != 1 !(suggested 1)
INTEGER :: OPT_TRS != 1 !(suggested 2)
! adjustable parameters for snow processes
REAL, PARAMETER :: Z0SNO = 0.002 !< snow surface roughness length (m) (0.002)
REAL, PARAMETER :: SSI = 0.03 !< liquid water holding capacity for snowpack (m3/m3) (0.03)
REAL, PARAMETER :: SWEMX = 1.00 !< new snow mass to fully cover old snow (mm)
!< equivalent to 10mm depth (density = 100 kg/m3)
!------------------------------------------------------------------------------------------!
end module noahmp_glacier_globals
!------------------------------------------------------------------------------------------!
!>\ingroup NoahMP_LSM
module noahmp_glacier_routines
use noahmp_glacier_globals
#ifndef CCPP
use module_wrf_utl
#endif
implicit none
public :: noahmp_options_glacier
public :: noahmp_glacier
private :: atm_glacier
private :: energy_glacier
private :: thermoprop_glacier
private :: csnow_glacier
private :: radiation_glacier
private :: snow_age_glacier
private :: snowalb_bats_glacier
private :: snowalb_class_glacier
private :: glacier_flux
private :: sfcdif1_glacier
private :: tsnosoi_glacier
private :: hrt_glacier
private :: hstep_glacier
private :: rosr12_glacier
private :: phasechange_glacier
private :: water_glacier
private :: snowwater_glacier
private :: snowfall_glacier
private :: combine_glacier
private :: divide_glacier
private :: combo_glacier
private :: compact_glacier
private :: snowh2o_glacier
private :: error_glacier
contains
!
! ==================================================================================================
!>\ingroup NoahMP_LSM
subroutine noahmp_glacier (&
iloc ,jloc ,cosz ,nsnow ,nsoil ,dt , & ! in : time/space/model-related
sfctmp ,sfcprs ,uu ,vv ,q2 ,soldn , & ! in : forcing
prcp ,lwdn ,tbot ,zlvl ,ficeold ,zsoil , & ! in : forcing
thsfc_loc ,prslkix ,prsik1x ,prslk1x , &
psfc ,pblhx ,iz0tlnd ,itime , &
sigmaf1 ,garea1 ,psi_opt , & ! in :
ep_1 ,ep_2 ,epsm1 ,cp , &
qsnow ,sneqvo ,albold ,cm ,ch ,isnow , & ! in/out :
sneqv ,smc ,zsnso ,snowh ,snice ,snliq , & ! in/out :
tg ,stc ,sh2o ,tauss ,qsfc , & ! in/out :
fsa ,fsr ,fira ,fsh ,fgev ,ssoil , & ! out :
trad ,edir ,runsrf ,runsub ,sag ,albedo , & ! out :
qsnbot ,ponding ,ponding1 ,ponding2 ,t2m,q2e ,z0h_total , & ! out :
#ifdef CCPP
emissi ,fpice ,ch2b , esnow , albsnd , albsni , &
errmsg ,errflg)
#else
emissi ,fpice ,ch2b , esnow. , albsnd , albsni)
#endif
! --------------------------------------------------------------------------------------------------
! initial code: guo-yue niu, oct. 2007
! modified to glacier: michael barlage, june 2012
! --------------------------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------------------------
! input
integer , intent(in) :: iloc !< grid index
integer , intent(in) :: jloc !< grid index
real (kind=kind_phys) , intent(in) :: cosz !< cosine solar zenith angle [0-1]
integer , intent(in) :: nsnow !< maximum no. of snow layers
integer , intent(in) :: nsoil !< no. of soil layers
integer , intent(in) :: psi_opt
real (kind=kind_phys) , intent(in) :: dt !< time step [sec]
real (kind=kind_phys) , intent(in) :: sfctmp !< surface air temperature [k]
real (kind=kind_phys) , intent(in) :: sfcprs !< pressure (pa)
real (kind=kind_phys) , intent(in) :: uu !< wind speed in eastward dir (m/s)
real (kind=kind_phys) , intent(in) :: vv !< wind speed in northward dir (m/s)
real (kind=kind_phys) , intent(in) :: q2 !< mixing ratio (kg/kg) lowest model layer
real (kind=kind_phys) , intent(in) :: soldn !< downward shortwave radiation (w/m2)
real (kind=kind_phys) , intent(in) :: prcp !< precipitation rate (kg m-2 s-1)
real (kind=kind_phys) , intent(in) :: lwdn !< downward longwave radiation (w/m2)
real (kind=kind_phys) , intent(in) :: tbot !< bottom condition for soil temp. [k]
real (kind=kind_phys) , intent(in) :: zlvl !< reference height (m)
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(in) :: ficeold!< ice fraction at last timestep
real (kind=kind_phys), dimension( 1:nsoil), intent(in) :: zsoil !< layer-bottom depth from soil surf (m)
logical , intent(in) :: thsfc_loc
real (kind=kind_phys) , intent(in) :: prslkix !< pressure (pa)
real (kind=kind_phys) , intent(in) :: prsik1x !< pressure (pa)
real (kind=kind_phys) , intent(in) :: prslk1x !< pressure (pa)
real (kind=kind_phys) , intent(in) :: psfc ! surface pressure
real (kind=kind_phys) , intent(in) :: pblhx ! pbl height
real (kind=kind_phys) , intent(in) :: ep_1
real (kind=kind_phys) , intent(in) :: ep_2
real (kind=kind_phys) , intent(in) :: epsm1
real (kind=kind_phys) , intent(in) :: cp
integer , intent(in) :: iz0tlnd !
integer , intent(in) :: itime !< timestep
real (kind=kind_phys) , intent(in) :: sigmaf1 !< areal fractional cover of green vegetation
real (kind=kind_phys) , intent(in) :: garea1 !< area of the grid cell
! input/output : need arbitary intial values
real (kind=kind_phys) , intent(inout) :: qsnow !< snowfall [mm/s]
real (kind=kind_phys) , intent(inout) :: sneqvo !< snow mass at last time step (mm)
real (kind=kind_phys) , intent(inout) :: albold !< snow albedo at last time step (class type)
real (kind=kind_phys) , intent(inout) :: cm !< momentum drag coefficient
real (kind=kind_phys) , intent(inout) :: ch !< sensible heat exchange coefficient
! prognostic variables
integer , intent(inout) :: isnow !< actual no. of snow layers [-]
real (kind=kind_phys) , intent(inout) :: sneqv !< snow water eqv. [mm]
real (kind=kind_phys), dimension( 1:nsoil), intent(inout) :: smc !< soil moisture (ice + liq.) [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(inout) :: zsnso !< layer-bottom depth from snow surf [m]
real (kind=kind_phys) , intent(inout) :: snowh !< snow height [m]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(inout) :: snice !< snow layer ice [mm]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(inout) :: snliq !< snow layer liquid water [mm]
real (kind=kind_phys) , intent(inout) :: tg !< ground temperature (k)
real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(inout) :: stc !< snow/soil temperature [k]
real (kind=kind_phys), dimension( 1:nsoil), intent(inout) :: sh2o !< liquid soil moisture [m3/m3]
real (kind=kind_phys) , intent(inout) :: tauss !< non-dimensional snow age
real (kind=kind_phys) , intent(inout) :: qsfc !< mixing ratio at lowest model layer
! output
real (kind=kind_phys) , intent(out) :: fsa !< total absorbed solar radiation (w/m2)
real (kind=kind_phys) , intent(out) :: fsr !< total reflected solar radiation (w/m2)
real (kind=kind_phys) , intent(out) :: fira !< total net lw rad (w/m2) [+ to atm]
real (kind=kind_phys) , intent(out) :: fsh !< total sensible heat (w/m2) [+ to atm]
real (kind=kind_phys) , intent(out) :: fgev !< ground evap heat (w/m2) [+ to atm]
real (kind=kind_phys) , intent(out) :: ssoil !< ground heat flux (w/m2) [+ to soil]
real (kind=kind_phys) , intent(out) :: trad !< surface radiative temperature (k)
real (kind=kind_phys) , intent(out) :: edir !< soil surface evaporation rate (mm/s]
real (kind=kind_phys) , intent(out) :: runsrf !< surface runoff [mm/s]
real (kind=kind_phys) , intent(out) :: runsub !< baseflow (saturation excess) [mm/s]
real (kind=kind_phys) , intent(out) :: sag !< solar rad absorbed by ground (w/m2)
real (kind=kind_phys) , intent(out) :: albedo !< surface albedo [-]
real (kind=kind_phys) , intent(out) :: qsnbot !< snowmelt [mm/s]
real (kind=kind_phys) , intent(out) :: ponding!< surface ponding [mm]
real (kind=kind_phys) , intent(out) :: ponding1!< surface ponding [mm]
real (kind=kind_phys) , intent(out) :: ponding2!< surface ponding [mm]
real (kind=kind_phys) , intent(out) :: t2m !< 2-m air temperature over bare ground part [k]
real (kind=kind_phys) , intent(out) :: q2e
real (kind=kind_phys) , intent(out) :: z0h_total !< roughness length for heat
real (kind=kind_phys) , intent(out) :: emissi
real (kind=kind_phys) , intent(out) :: fpice
real (kind=kind_phys) , intent(out) :: ch2b
real (kind=kind_phys) , intent(out) :: esnow
real (kind=kind_phys), dimension(1:2) , intent(out) :: albsnd !< snow albedo (direct)
real (kind=kind_phys), dimension(1:2) , intent(out) :: albsni !< snow albedo (diffuse)
#ifdef CCPP
character(len=*), intent(inout) :: errmsg
integer, intent(inout) :: errflg
#endif
! local
integer :: iz !< do-loop index
integer, dimension(-nsnow+1:nsoil) :: imelt !< phase change index [1-melt; 2-freeze]
real (kind=kind_phys) :: rhoair !< density air (kg/m3)
real (kind=kind_phys), dimension(-nsnow+1:nsoil) :: dzsnso !< snow/soil layer thickness [m]
real (kind=kind_phys) :: thair !< potential temperature (k)
real (kind=kind_phys) :: qair !< specific humidity (kg/kg) (q2/(1+q2))
real (kind=kind_phys) :: eair !< vapor pressure air (pa)
real (kind=kind_phys), dimension( 1: 2) :: solad !< incoming direct solar rad (w/m2)
real (kind=kind_phys), dimension( 1: 2) :: solai !< incoming diffuse solar rad (w/m2)
real (kind=kind_phys), dimension( 1:nsoil) :: sice !< soil ice content (m3/m3)
real (kind=kind_phys), dimension(-nsnow+1: 0) :: snicev !< partial volume ice of snow [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1: 0) :: snliqv !< partial volume liq of snow [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1: 0) :: epore !< effective porosity [m3/m3]
real (kind=kind_phys) :: qdew !< ground surface dew rate [mm/s]
real (kind=kind_phys) :: qvap !< ground surface evap. rate [mm/s]
real (kind=kind_phys) :: lathea !< latent heat [j/kg]
real (kind=kind_phys) :: qmelt !< internal pack melt
real (kind=kind_phys) :: swdown !< downward solar [w/m2]
real (kind=kind_phys) :: beg_wb !< beginning water for error check
real (kind=kind_phys) :: zbot = -8.0
character*256 message
! --------------------------------------------------------------------------------------------------
! re-process atmospheric forcing
call atm_glacier (ep_2, epsm1,sfcprs ,sfctmp ,q2 ,soldn ,cosz ,thair , &
qair ,eair ,rhoair ,solad ,solai ,swdown )
beg_wb = sneqv
! snow/soil layer thickness (m); interface depth: zsnso < 0; layer thickness dzsnso > 0
do iz = isnow+1, nsoil
if(iz == isnow+1) then
dzsnso(iz) = - zsnso(iz)
else
dzsnso(iz) = zsnso(iz-1) - zsnso(iz)
end if
end do
! compute energy budget (momentum & energy fluxes and phase changes)
call energy_glacier (nsnow ,nsoil ,isnow ,dt ,qsnow ,rhoair , & !in
eair ,sfcprs ,qair ,sfctmp ,lwdn ,uu , & !in
vv ,solad ,solai ,cosz ,zlvl , & !in
tbot ,zbot ,zsnso ,dzsnso ,sigmaf1 ,garea1 , & !in
thsfc_loc ,prslkix ,prsik1x ,prslk1x , & !in
psfc ,pblhx ,iz0tlnd ,itime ,psi_opt , &
ep_1, ep_2, epsm1, cp, &
tg ,stc ,snowh ,sneqv ,sneqvo ,sh2o , & !inout
smc ,snice ,snliq ,albold ,cm ,ch , & !inout
#ifdef CCPP
tauss ,qsfc ,errmsg ,errflg , & !inout
#else
tauss ,qsfc , & !inout
#endif
imelt ,snicev ,snliqv ,epore ,qmelt ,ponding , & !out
sag ,fsa ,fsr ,fira ,fsh ,fgev , & !out
trad ,t2m ,ssoil ,lathea ,q2e ,emissi , & !out
ch2b ,albsnd ,albsni ,z0h_total) !out
#ifdef CCPP
if (errflg /= 0) return
#endif
sice = max(0.0, smc - sh2o)
sneqvo = sneqv
qvap = max( fgev/lathea, 0.) ! positive part of fgev [mm/s] > 0
qdew = abs( min(fgev/lathea, 0.)) ! negative part of fgev [mm/s] > 0
edir = qvap - qdew
! compute water budgets (water storages, et components, and runoff)
call water_glacier (nsnow ,nsoil ,imelt ,dt ,prcp ,sfctmp , & !in
qvap ,qdew ,ficeold ,zsoil , & !in
isnow ,snowh ,sneqv ,snice ,snliq ,stc , & !inout
dzsnso ,sh2o ,sice ,ponding ,zsnso ,fsh , & !inout
runsrf ,runsub ,qsnow ,ponding1 ,ponding2 ,qsnbot , & !out
fpice ,esnow) !out
if(opt_gla == 2) then
edir = qvap - qdew
fgev = edir * lathea
end if
! if(maxval(sice) < 0.0001) then
! write(message,*) "glacier has melted at:",iloc,jloc," are you sure this should be a glacier point?"
! call wrf_debug(10,trim(message))
! end if
! water and energy balance check
call error_glacier (iloc ,jloc ,swdown ,fsa ,fsr ,fira , &
fsh ,fgev ,ssoil ,sag ,prcp ,edir , &
#ifdef CCPP
runsrf ,runsub ,sneqv ,dt ,beg_wb ,errmsg , errflg )
#else
runsrf ,runsub ,sneqv ,dt ,beg_wb )
#endif
#ifdef CCPP
if (errflg /= 0) return
#endif
if(snowh <= 1.e-6 .or. sneqv <= 1.e-3) then
snowh = 0.0
sneqv = 0.0
end if
if(swdown.ne.0.) then
albedo = fsr / swdown
else
albedo = -999.9
end if
end subroutine noahmp_glacier
! ==================================================================================================
!>\ingroup NoahMP_LSM
!! re-process atmospheric forcing
subroutine atm_glacier (ep_2, epsm1, sfcprs ,sfctmp ,q2 ,soldn ,cosz ,thair , &
qair ,eair ,rhoair ,solad ,solai , &
swdown )
! --------------------------------------------------------------------------------------------------
! re-process atmospheric forcing
! --------------------------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------------------------
! inputs
real (kind=kind_phys) , intent(in) :: ep_2
real (kind=kind_phys) , intent(in) :: epsm1
real (kind=kind_phys) , intent(in) :: sfcprs !< pressure (pa)
real (kind=kind_phys) , intent(in) :: sfctmp !< surface air temperature [k]
real (kind=kind_phys) , intent(in) :: q2 !< mixing ratio (kg/kg)
real (kind=kind_phys) , intent(in) :: soldn !< downward shortwave radiation (w/m2)
real (kind=kind_phys) , intent(in) :: cosz !< cosine solar zenith angle [0-1]
! outputs
real (kind=kind_phys) , intent(out) :: thair !< potential temperature (k)
real (kind=kind_phys) , intent(out) :: qair !< specific humidity (kg/kg) (q2/(1+q2))
real (kind=kind_phys) , intent(out) :: eair !< vapor pressure air (pa)
real (kind=kind_phys), dimension( 1: 2), intent(out) :: solad !< incoming direct solar radiation (w/m2)
real (kind=kind_phys), dimension( 1: 2), intent(out) :: solai !< incoming diffuse solar radiation (w/m2)
real (kind=kind_phys) , intent(out) :: rhoair !< density air (kg/m3)
real (kind=kind_phys) , intent(out) :: swdown !< downward solar filtered by sun angle [w/m2]
!locals
real (kind=kind_phys) :: pair !< atm bottom level pressure (pa)
! --------------------------------------------------------------------------------------------------
pair = sfcprs ! atm bottom level pressure (pa)
thair = sfctmp * (sfcprs/pair)**(rair/cpair)
! qair = q2 / (1.0+q2) ! mixing ratio to specific humidity [kg/kg]
qair = q2 ! in wrf, driver converts to specific humidity
eair = qair*sfcprs / (ep_2-epsm1*qair)
rhoair = (sfcprs+epsm1*eair) / (rair*sfctmp)
if(cosz <= 0.) then
swdown = 0.
else
swdown = soldn
end if
solad(1) = swdown*0.7*0.5 ! direct vis
solad(2) = swdown*0.7*0.5 ! direct nir
solai(1) = swdown*0.3*0.5 ! diffuse vis
solai(2) = swdown*0.3*0.5 ! diffuse nir
end subroutine atm_glacier
! ==================================================================================================
! --------------------------------------------------------------------------------------------------
!>\ingroup NoahMP_LSM
!! Compute energy budget (momentum & energy fluxes and phase changes).
subroutine energy_glacier (nsnow ,nsoil ,isnow ,dt ,qsnow ,rhoair , & !in
eair ,sfcprs ,qair ,sfctmp ,lwdn ,uu , & !in
vv ,solad ,solai ,cosz ,zref , & !in
tbot ,zbot ,zsnso ,dzsnso ,sigmaf1 ,garea1 , & !in
thsfc_loc ,prslkix ,prsik1x ,prslk1x , & !in
psfc ,pblhx ,iz0tlnd ,itime ,psi_opt , &
ep_1, ep_2, epsm1, cp, &
tg ,stc ,snowh ,sneqv ,sneqvo ,sh2o , & !inout
smc ,snice ,snliq ,albold ,cm ,ch , & !inout
#ifdef CCPP
tauss ,qsfc ,errmsg ,errflg , & !inout
#else
tauss ,qsfc , & !inout
#endif
imelt ,snicev ,snliqv ,epore ,qmelt ,ponding , & !out
sag ,fsa ,fsr ,fira ,fsh ,fgev , & !out
trad ,t2m ,ssoil ,lathea ,q2e ,emissi , & !out
ch2b ,albsnd ,albsni ,z0h_total) !out
! --------------------------------------------------------------------------------------------------
! --------------------------------------------------------------------------------------------------
! use noahmp_veg_parameters
! use noahmp_rad_parameters
! --------------------------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------------------------
! inputs
integer , intent(in) :: nsnow !< maximum no. of snow layers
integer , intent(in) :: nsoil !< number of soil layers
integer , intent(in) :: psi_opt
integer , intent(in) :: isnow !< actual no. of snow layers
real (kind=kind_phys) , intent(in) :: dt !< time step [sec]
real (kind=kind_phys) , intent(in) :: qsnow !< snowfall on the ground (mm/s)
real (kind=kind_phys) , intent(in) :: rhoair !< density air (kg/m3)
real (kind=kind_phys) , intent(in) :: eair !< vapor pressure air (pa)
real (kind=kind_phys) , intent(in) :: sfcprs !< pressure (pa)
real (kind=kind_phys) , intent(in) :: qair !< specific humidity (kg/kg)
real (kind=kind_phys) , intent(in) :: sfctmp !< air temperature (k)
real (kind=kind_phys) , intent(in) :: lwdn !< downward longwave radiation (w/m2)
real (kind=kind_phys) , intent(in) :: uu !< wind speed in e-w dir (m/s)
real (kind=kind_phys) , intent(in) :: vv !< wind speed in n-s dir (m/s)
real (kind=kind_phys) , dimension( 1: 2), intent(in) :: solad !< incoming direct solar rad. (w/m2)
real (kind=kind_phys) , dimension( 1: 2), intent(in) :: solai !< incoming diffuse solar rad. (w/m2)
real (kind=kind_phys) , intent(in) :: cosz !< cosine solar zenith angle (0-1)
real (kind=kind_phys) , intent(in) :: zref !< reference height (m)
real (kind=kind_phys) , intent(in) :: tbot !< bottom condition for soil temp. (k)
real (kind=kind_phys) , intent(in) :: zbot !< depth for tbot [m]
real (kind=kind_phys) , dimension(-nsnow+1:nsoil), intent(in) :: zsnso !< layer-bottom depth from snow surf [m]
real (kind=kind_phys) , dimension(-nsnow+1:nsoil), intent(in) :: dzsnso !< depth of snow & soil layer-bottom [m]
logical , intent(in) :: thsfc_loc
real (kind=kind_phys) , intent(in) :: prslkix ! in exner function
real (kind=kind_phys) , intent(in) :: prsik1x ! in exner function
real (kind=kind_phys) , intent(in) :: prslk1x ! in exner function
real (kind=kind_phys) , intent(in) :: pblhx !< PBL height (m)
real (kind=kind_phys) , intent(in) :: psfc !< surface pressure
real (kind=kind_phys) , intent(in) :: ep_1
real (kind=kind_phys) , intent(in) :: ep_2
real (kind=kind_phys) , intent(in) :: epsm1
real (kind=kind_phys) , intent(in) :: cp
integer , intent(in) :: iz0tlnd !< z0t option
integer , intent(in) :: itime !< integration time
real (kind=kind_phys) , intent(in) :: sigmaf1 !< areal fractional cover of green vegetation
real (kind=kind_phys) , intent(in) :: garea1 !< area of the grid cell
! input & output
real (kind=kind_phys) , intent(inout) :: tg !< ground temperature (k)
real (kind=kind_phys) , dimension(-nsnow+1:nsoil), intent(inout) :: stc !< snow/soil temperature [k]
real (kind=kind_phys) , intent(inout) :: snowh !< snow height [m]
real (kind=kind_phys) , intent(inout) :: sneqv !< snow mass (mm)
real (kind=kind_phys) , intent(inout) :: sneqvo !< snow mass at last time step (mm)
real (kind=kind_phys) , dimension( 1:nsoil), intent(inout) :: sh2o !< liquid soil moisture [m3/m3]
real (kind=kind_phys) , dimension( 1:nsoil), intent(inout) :: smc !< soil moisture (ice + liq.) [m3/m3]
real (kind=kind_phys) , dimension(-nsnow+1: 0), intent(inout) :: snice !< snow ice mass (kg/m2)
real (kind=kind_phys) , dimension(-nsnow+1: 0), intent(inout) :: snliq !< snow liq mass (kg/m2)
real (kind=kind_phys) , intent(inout) :: albold !< snow albedo at last time step(class type)
real (kind=kind_phys) , intent(inout) :: cm !< momentum drag coefficient
real (kind=kind_phys) , intent(inout) :: ch !< sensible heat exchange coefficient
real (kind=kind_phys) , intent(inout) :: tauss !< snow aging factor
real (kind=kind_phys) , intent(inout) :: qsfc !< mixing ratio at lowest model layer
#ifdef CCPP
character(len=*) , intent(inout) :: errmsg
integer , intent(inout) :: errflg
#endif
! outputs
integer, dimension(-nsnow+1:nsoil) , intent(out) :: imelt !< phase change index [1-melt; 2-freeze]
real (kind=kind_phys) , dimension(-nsnow+1: 0), intent(out) :: snicev !< partial volume ice [m3/m3]
real (kind=kind_phys) , dimension(-nsnow+1: 0), intent(out) :: snliqv !< partial volume liq. water [m3/m3]
real (kind=kind_phys) , dimension(-nsnow+1: 0), intent(out) :: epore !< effective porosity [m3/m3]
real (kind=kind_phys) , intent(out) :: qmelt !< snowmelt [mm/s]
real (kind=kind_phys) , intent(out) :: ponding!< pounding at ground [mm]
real (kind=kind_phys) , intent(out) :: sag !< solar rad. absorbed by ground (w/m2)
real (kind=kind_phys) , intent(out) :: fsa !< tot. absorbed solar radiation (w/m2)
real (kind=kind_phys) , intent(out) :: fsr !< tot. reflected solar radiation (w/m2)
real (kind=kind_phys) , intent(out) :: fira !< total net lw. rad (w/m2) [+ to atm]
real (kind=kind_phys) , intent(out) :: fsh !< total sensible heat (w/m2) [+ to atm]
real (kind=kind_phys) , intent(out) :: fgev !< ground evaporation (w/m2) [+ to atm]
real (kind=kind_phys) , intent(out) :: trad !< radiative temperature (k)
real (kind=kind_phys) , intent(out) :: t2m !< 2 m height air temperature (k)
real (kind=kind_phys) , intent(out) :: ssoil !< ground heat flux (w/m2) [+ to soil]
real (kind=kind_phys) , intent(out) :: lathea !< latent heat vap./sublimation (j/kg)
real (kind=kind_phys) , intent(out) :: q2e
real (kind=kind_phys) , intent(out) :: emissi
real (kind=kind_phys) , intent(out) :: ch2b !< sensible heat conductance, canopy air to zlvl air (m/s)
real (kind=kind_phys), dimension(1:2) , intent(out) :: albsnd !< snow albedo (direct)
real (kind=kind_phys), dimension(1:2) , intent(out) :: albsni !< snow albedo (diffuse)
real (kind=kind_phys) , intent(out) :: z0h_total !< roughness length for heat
! local
real (kind=kind_phys) :: ur !< wind speed at height zlvl (m/s)
real (kind=kind_phys) :: zlvl !< reference height (m)
real (kind=kind_phys) :: rsurf !< ground surface resistance (s/m)
real (kind=kind_phys) :: zpd !< zero plane displacement (m)
real (kind=kind_phys) :: z0mg !< z0 momentum, ground (m)
real (kind=kind_phys) :: emg !< ground emissivity
real (kind=kind_phys) :: fire !< emitted ir (w/m2)
real (kind=kind_phys), dimension(-nsnow+1:nsoil) :: fact !< temporary used in phase change
real (kind=kind_phys), dimension(-nsnow+1:nsoil) :: df !< thermal conductivity [w/m/k]
real (kind=kind_phys), dimension(-nsnow+1:nsoil) :: hcpct !< heat capacity [j/m3/k]
real (kind=kind_phys) :: gamma !< psychrometric constant (pa/k)
real (kind=kind_phys) :: rhsur !< raltive humidity in surface soil/snow air space (-)
! ---------------------------------------------------------------------------------------------------
! wind speed at reference height: ur >= 1
ur = max( sqrt(uu**2.+vv**2.), 1. )
! roughness length and displacement height
z0mg = z0sno
zpd = snowh
zlvl = zpd + zref
! thermal properties of soil, snow, lake, and frozen soil
call thermoprop_glacier (nsoil ,nsnow ,isnow ,dzsnso , & !in
dt ,snowh ,snice ,snliq , & !in
df ,hcpct ,snicev ,snliqv ,epore , & !out
fact ) !out
! solar radiation: absorbed & reflected by the ground
call radiation_glacier (dt ,tg ,sneqvo ,sneqv ,cosz , & !in
qsnow ,solad ,solai , & !in
albold ,tauss , & !inout
sag ,fsr ,fsa ,albsnd ,albsni) !out
! vegetation and ground emissivity
emg = 0.98
! soil surface resistance for ground evap.
rhsur = 1.0
rsurf = 1.0
! set psychrometric constant
lathea = hsub
gamma = cpair*sfcprs/(ep_2*lathea)
! surface temperatures of the ground and energy fluxes
call glacier_flux (nsoil ,nsnow ,emg ,isnow ,df ,dzsnso ,z0mg , & !in
zlvl ,zpd ,qair ,sfctmp ,rhoair ,sfcprs , & !in
ur ,gamma ,rsurf ,lwdn ,rhsur ,smc , & !in
eair ,stc ,sag ,snowh ,lathea ,sh2o , & !in
thsfc_loc ,prslkix ,prsik1x ,prslk1x , &
psfc ,pblhx ,iz0tlnd ,itime ,uu ,vv , &
sigmaf1 ,garea1 ,psi_opt ,ep_1, ep_2, epsm1, cp, & !in
#ifdef CCPP
cm ,ch ,tg ,qsfc ,errmsg ,errflg , & !inout
#else
cm ,ch ,tg ,qsfc , & !inout
#endif
fira ,fsh ,fgev ,ssoil , & !out
t2m ,q2e ,ch2b ,z0h_total) !out
!energy balance at surface: sag=(irb+shb+evb+ghb)
fire = lwdn + fira
if(fire <=0.) then
#ifdef CCPP
errflg = 1
errmsg = "stop in noah-mp: emitted longwave <0"
return
#else
call wrf_error_fatal("stop in noah-mp: emitted longwave <0")
#endif
end if
! compute a net emissivity
emissi = emg
! when we're computing a trad, subtract from the emitted ir the
! reflected portion of the incoming lwdn, so we're just
! considering the ir originating in the canopy/ground system.
trad = ( ( fire - (1-emissi)*lwdn ) / (emissi*sb) ) ** 0.25
! 3l snow & 4l soil temperatures
call tsnosoi_glacier (nsoil ,nsnow ,isnow ,dt ,tbot , & !in
ssoil ,snowh ,zbot ,zsnso ,df , & !in
hcpct , & !in
stc ) !inout
! adjusting snow surface temperature
if(opt_stc == 2) then
if (snowh > 0.05 .and. tg > tfrz) tg = tfrz
end if
! energy released or consumed by snow & ice
call phasechange_glacier (nsnow ,nsoil ,isnow ,dt ,fact , & !in
dzsnso , & !in
stc ,snice ,snliq ,sneqv ,snowh , & !inout
smc ,sh2o , & !inout
qmelt ,imelt ,ponding ) !out
end subroutine energy_glacier
! ==================================================================================================
!>\ingroup NoahMP_LSM
!! calculate thermal properties of soil, snow, lake, and frozen soil.
subroutine thermoprop_glacier (nsoil ,nsnow ,isnow ,dzsnso , & !in
dt ,snowh ,snice ,snliq , & !in
df ,hcpct ,snicev ,snliqv ,epore , & !out
fact ) !out
! -------------------------------------------------------------------------------------------------
! -------------------------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------------------------
! inputs
integer , intent(in) :: nsoil !< number of soil layers
integer , intent(in) :: nsnow !< maximum no. of snow layers
integer , intent(in) :: isnow !< actual no. of snow layers
real (kind=kind_phys) , intent(in) :: dt !< time step [s]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(in) :: snice !< snow ice mass (kg/m2)
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(in) :: snliq !< snow liq mass (kg/m2)
real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(in) :: dzsnso !< thickness of snow/soil layers [m]
real (kind=kind_phys) , intent(in) :: snowh !< snow height [m]
! outputs
real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(out) :: df !< thermal conductivity [w/m/k]
real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(out) :: hcpct !< heat capacity [j/m3/k]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: snicev !< partial volume of ice [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: snliqv !< partial volume of liquid water [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: epore !< effective porosity [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(out) :: fact !< computing energy for phase change
! --------------------------------------------------------------------------------------------------
! locals
integer :: iz, iz2
real (kind=kind_phys), dimension(-nsnow+1: 0) :: cvsno !< volumetric specific heat (j/m3/k)
real (kind=kind_phys), dimension(-nsnow+1: 0) :: tksno !< snow thermal conductivity (j/m3/k)
real (kind=kind_phys) :: zmid !< mid-point soil depth
! --------------------------------------------------------------------------------------------------
! compute snow thermal conductivity and heat capacity
call csnow_glacier (isnow ,nsnow ,nsoil ,snice ,snliq ,dzsnso , & !in
tksno ,cvsno ,snicev ,snliqv ,epore ) !out
do iz = isnow+1, 0
df (iz) = tksno(iz)
hcpct(iz) = cvsno(iz)
end do
! compute soil thermal properties (using noah glacial ice approximations)
do iz = 1, nsoil
zmid = 0.5 * (dzsnso(iz))
do iz2 = 1, iz-1
zmid = zmid + dzsnso(iz2)
end do
hcpct(iz) = 1.e6 * ( 0.8194 + 0.1309*zmid )
df(iz) = 0.32333 + ( 0.10073 * zmid )
end do
! combine a temporary variable used for melting/freezing of snow and frozen soil
do iz = isnow+1,nsoil
fact(iz) = dt/(hcpct(iz)*dzsnso(iz))
end do
! snow/soil interface
if(isnow == 0) then
df(1) = (df(1)*dzsnso(1)+0.35*snowh) / (snowh +dzsnso(1))
else
df(1) = (df(1)*dzsnso(1)+df(0)*dzsnso(0)) / (dzsnso(0)+dzsnso(1))
end if
end subroutine thermoprop_glacier
! ==================================================================================================
! --------------------------------------------------------------------------------------------------
!>\ingroup NoahMP_LSM
!! snow bulk density, volumetric capacity, and thermal conductivity
subroutine csnow_glacier (isnow ,nsnow ,nsoil ,snice ,snliq ,dzsnso , & !in
tksno ,cvsno ,snicev ,snliqv ,epore ) !out
! --------------------------------------------------------------------------------------------------
! snow bulk density,volumetric capacity, and thermal conductivity
!---------------------------------------------------------------------------------------------------
implicit none
!---------------------------------------------------------------------------------------------------
! inputs
integer, intent(in) :: isnow !< number of snow layers (-)
integer , intent(in) :: nsnow !< maximum no. of snow layers
integer , intent(in) :: nsoil !< number of soil layers
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(in) :: snice !< snow ice mass (kg/m2)
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(in) :: snliq !< snow liq mass (kg/m2)
real (kind=kind_phys), dimension(-nsnow+1:nsoil), intent(in) :: dzsnso !< snow/soil layer thickness [m]
! outputs
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: cvsno !< volumetric specific heat (j/m3/k)
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: tksno !< thermal conductivity (w/m/k)
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: snicev !< partial volume of ice [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: snliqv !< partial volume of liquid water [m3/m3]
real (kind=kind_phys), dimension(-nsnow+1: 0), intent(out) :: epore !< effective porosity [m3/m3]
! locals
integer :: iz
real (kind=kind_phys), dimension(-nsnow+1: 0) :: bdsnoi !< bulk density of snow(kg/m3)
!---------------------------------------------------------------------------------------------------
! thermal capacity of snow
do iz = isnow+1, 0
snicev(iz) = min(1., snice(iz)/(dzsnso(iz)*denice) )
epore(iz) = 1. - snicev(iz)
snliqv(iz) = min(epore(iz),snliq(iz)/(dzsnso(iz)*denh2o))
enddo
do iz = isnow+1, 0
bdsnoi(iz) = (snice(iz)+snliq(iz))/dzsnso(iz)
cvsno(iz) = cice*snicev(iz)+cwat*snliqv(iz)
! cvsno(iz) = 0.525e06 ! constant
enddo
! thermal conductivity of snow
do iz = isnow+1, 0
! tksno(iz) = 3.2217e-6*bdsnoi(iz)**2. ! stieglitz(yen,1965)
! tksno(iz) = 2e-2+2.5e-6*bdsnoi(iz)*bdsnoi(iz) ! anderson, 1976
! tksno(iz) = 0.35 ! constant
tksno(iz) = 2.576e-6*bdsnoi(iz)**2. + 0.074 ! verseghy (1991)
! tksno(iz) = 2.22*(bdsnoi(iz)/1000.)**1.88 ! douvill(yen, 1981)
enddo
end subroutine csnow_glacier
!===================================================================================================
!>\ingroup NoahMP_LSM
!! Compute solar radiation: absorbed & reflected by the ground.
subroutine radiation_glacier (dt ,tg ,sneqvo ,sneqv ,cosz , & !in
qsnow ,solad ,solai , & !in
albold ,tauss , & !inout
sag ,fsr ,fsa ,albsnd ,albsni) !out
! --------------------------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------------------------
! input
real (kind=kind_phys), intent(in) :: dt !< time step [s]
real (kind=kind_phys), intent(in) :: tg !< ground temperature (k)
real (kind=kind_phys), intent(in) :: sneqvo !< snow mass at last time step(mm)
real (kind=kind_phys), intent(in) :: sneqv !< snow mass (mm)
real (kind=kind_phys), intent(in) :: cosz !< cosine solar zenith angle (0-1)
real (kind=kind_phys), intent(in) :: qsnow !< snowfall (mm/s)
real (kind=kind_phys), dimension(1:2) , intent(in) :: solad !< incoming direct solar radiation (w/m2)
real (kind=kind_phys), dimension(1:2) , intent(in) :: solai !< incoming diffuse solar radiation (w/m2)
! inout
real (kind=kind_phys), intent(inout) :: albold !< snow albedo at last time step (class type)
real (kind=kind_phys), intent(inout) :: tauss !< non-dimensional snow age
real (kind=kind_phys), dimension(1:2) :: albsnd !< snow albedo (direct)
real (kind=kind_phys), dimension(1:2) :: albsni !< snow albedo (diffuse)
! output
real (kind=kind_phys), intent(out) :: sag !< solar radiation absorbed by ground (w/m2)
real (kind=kind_phys), intent(out) :: fsr !< total reflected solar radiation (w/m2)
real (kind=kind_phys), intent(out) :: fsa !< total absorbed solar radiation (w/m2)
! local
integer :: ib !< number of radiation bands
integer :: nband !< number of radiation bands
real (kind=kind_phys) :: fage !< snow age function (0 - new snow)
real (kind=kind_phys) :: alb !< current class albedo
real (kind=kind_phys) :: abs !< temporary absorbed rad
real (kind=kind_phys) :: ref !< temporary reflected rad
real (kind=kind_phys) :: fsno !< snow-cover fraction, = 1 if any snow
real (kind=kind_phys), dimension(1:2) :: albice !< albedo land ice: 1=vis, 2=nir
real (kind=kind_phys),parameter :: mpe = 1.e-6
! --------------------------------------------------------------------------------------------------
nband = 2
albsnd = 0.0
albsni = 0.0
albice(1) = 0.80 !albedo land ice: 1=vis, 2=nir
albice(2) = 0.55
! snow age
call snow_age_glacier (dt,tg,sneqvo,sneqv,tauss,fage)
! snow albedos: age even when sun is not present
if(opt_alb == 1) &
call snowalb_bats_glacier (nband,cosz,fage,albsnd,albsni)
if(opt_alb == 2) then
call snowalb_class_glacier(nband,qsnow,dt,alb,albold,albsnd,albsni)
albold = alb
end if
! zero summed solar fluxes
sag = 0.
fsa = 0.
fsr = 0.
fsno = 0.0
if(sneqv > 0.0) fsno = 1.0
! loop over nband wavebands
do ib = 1, nband
albsnd(ib) = albice(ib)*(1.-fsno) + albsnd(ib)*fsno
albsni(ib) = albice(ib)*(1.-fsno) + albsni(ib)*fsno
! solar radiation absorbed by ground surface
abs = solad(ib)*(1.-albsnd(ib)) + solai(ib)*(1.-albsni(ib))
sag = sag + abs
fsa = fsa + abs
ref = solad(ib)*albsnd(ib) + solai(ib)*albsni(ib)
fsr = fsr + ref
end do
end subroutine radiation_glacier
! ==================================================================================================
!>\ingroup NoahMP_LSM
subroutine snow_age_glacier (dt,tg,sneqvo,sneqv,tauss,fage)
! --------------------------------------------------------------------------------------------------
implicit none
! ------------------------ code history ------------------------------------------------------------
! from bats
! ------------------------ input/output variables --------------------------------------------------
!input
real (kind=kind_phys), intent(in) :: dt !< main time step (s)
real (kind=kind_phys), intent(in) :: tg !< ground temperature (k)
real (kind=kind_phys), intent(in) :: sneqvo !< snow mass at last time step(mm)
real (kind=kind_phys), intent(in) :: sneqv !< snow water per unit ground area (mm)
! inout
real (kind=kind_phys), intent(inout) :: tauss !< non-dimensional snow age
!output
real (kind=kind_phys), intent(out) :: fage !< snow age
!local
real (kind=kind_phys) :: tage !< total aging effects
real (kind=kind_phys) :: age1 !< effects of grain growth due to vapor diffusion
real (kind=kind_phys) :: age2 !< effects of grain growth at freezing of melt water
real (kind=kind_phys) :: age3 !< effects of soot
real (kind=kind_phys) :: dela !< temporary variable
real (kind=kind_phys) :: sge !< temporary variable
real (kind=kind_phys) :: dels !< temporary variable
real (kind=kind_phys) :: dela0 !< temporary variable
real (kind=kind_phys) :: arg !< temporary variable
! see yang et al. (1997) j.of climate for detail.
!---------------------------------------------------------------------------------------------------
if(sneqv.le.0.0) then
tauss = 0.
else if (sneqv.gt.800.) then
tauss = 0.
else
! tauss = 0.
dela0 = 1.e-6*dt
arg = 5.e3*(1./tfrz-1./tg)
age1 = exp(arg)
age2 = exp(amin1(0.,10.*arg))
age3 = 0.3
tage = age1+age2+age3
dela = dela0*tage
dels = amax1(0.0,sneqv-sneqvo) / swemx
sge = (tauss+dela)*(1.0-dels)
tauss = amax1(0.,sge)
endif
fage= tauss/(tauss+1.)
end subroutine snow_age_glacier
! ==================================================================================================
! --------------------------------------------------------------------------------------------------
!>\ingroup NoahMP_LSM
subroutine snowalb_bats_glacier (nband,cosz,fage,albsnd,albsni)
! --------------------------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------------------------
! input
integer,intent(in) :: nband !< number of waveband classes
real (kind=kind_phys),intent(in) :: cosz !< cosine solar zenith angle
real (kind=kind_phys),intent(in) :: fage !< snow age correction
! output
real (kind=kind_phys), dimension(1:2),intent(out) :: albsnd !< snow albedo for direct(1=vis, 2=nir)
real (kind=kind_phys), dimension(1:2),intent(out) :: albsni !< snow albedo for diffuse
! ---------------------------------------------------------------------------------------------
real (kind=kind_phys) :: fzen !< zenith angle correction
real (kind=kind_phys) :: cf1 !< temperary variable
real (kind=kind_phys) :: sl2 !< 2.*sl
real (kind=kind_phys) :: sl1 !< 1/sl
real (kind=kind_phys) :: sl !< adjustable parameter
real (kind=kind_phys), parameter :: c1 = 0.2 !< default in bats
real (kind=kind_phys), parameter :: c2 = 0.5 !< default in bats
! real (kind=kind_phys), parameter :: c1 = 0.2 * 2. !< double the default to match sleepers river's
! real (kind=kind_phys), parameter :: c2 = 0.5 * 2. !< snow surface albedo (double aging effects)
! ---------------------------------------------------------------------------------------------
! zero albedos for all points
albsnd(1: nband) = 0.
albsni(1: nband) = 0.
! when cosz > 0
sl=2.0
sl1=1./sl
sl2=2.*sl
cf1=((1.+sl1)/(1.+sl2*cosz)-sl1)
fzen=amax1(cf1,0.)
albsni(1)=0.95*(1.-c1*fage)
albsni(2)=0.65*(1.-c2*fage)
albsnd(1)=albsni(1)+0.4*fzen*(1.-albsni(1)) ! vis direct
albsnd(2)=albsni(2)+0.4*fzen*(1.-albsni(2)) ! nir direct
end subroutine snowalb_bats_glacier
! ==================================================================================================
! --------------------------------------------------------------------------------------------------
!>\ingroup NoahMP_LSM
subroutine snowalb_class_glacier (nband,qsnow,dt,alb,albold,albsnd,albsni)
! --------------------------------------------------------------------------------------------------
implicit none
! --------------------------------------------------------------------------------------------------
! input
integer,intent(in) :: nband !< number of waveband classes
real (kind=kind_phys),intent(in) :: qsnow !< snowfall (mm/s)
real (kind=kind_phys),intent(in) :: dt !< time step (sec)
real (kind=kind_phys),intent(in) :: albold !< snow albedo at last time step
! in & out