1 !WRF:MODEL_LAYER:PHYSICS
5 !---SPECIFY CONSTANTS AND LAYERS FOR SOIL MODEL
6 !---SOIL DIFFUSION CONSTANT SET (M^2/S)
8 REAL, PARAMETER :: DIFSL=5.e-7
10 !---FACTOR TO MAKE SOIL STEP MORE CONSERVATIVE
12 REAL , PARAMETER :: SOILFAC=1.25
16 !----------------------------------------------------------------
17 SUBROUTINE SLAB(T3D,QV3D,P3D,FLHC,FLQC, &
18 PSFC,XLAND,TMN,HFX,QFX,LH,TSK,QSFC,CHKLOWQ, &
19 GSW,GLW,CAPG,THC,SNOWC,EMISS,MAVAIL, &
20 DELTSM,ROVCP,XLV,DTMIN,IFSNOW, &
21 SVP1,SVP2,SVP3,SVPT0,EP2, &
22 KARMAN,EOMEG,STBOLT, &
23 TSLB,ZS,DZS,num_soil_layers,radiation, &
25 ids,ide, jds,jde, kds,kde, &
26 ims,ime, jms,jme, kms,kme, &
27 its,ite, jts,jte, kts,kte )
28 !----------------------------------------------------------------
30 !----------------------------------------------------------------
32 ! SUBROUTINE SLAB CALCULATES THE GROUND TEMPERATURE TENDENCY
33 ! ACCORDING TO THE RESIDUAL OF THE SURFACE ENERGY BUDGET
37 ! FOR SOIL SUB-TIMESTEPS UPDATE SURFACE HFX AND QFX AS TG
38 ! CHANGES TO PREVENT POSSIBLE INSTABILITY FOR LONG MODEL
39 ! STEPS (DT > ~200 SEC).
41 ! PUT SNOW COVER CHECK ON SOIL SUB-TIMESTEPS
43 ! MAKE UPPER LIMIT ON SOIL SUB-STEP LENGTH MORE CONSERVATIVE
45 !----------------------------------------------------------------
46 !-- T3D temperature (K)
47 !-- QV3D 3D water vapor mixing ratio (Kg/Kg)
48 !-- P3D 3D pressure (Pa)
49 !-- FLHC exchange coefficient for heat (m/s)
50 !-- FLQC exchange coefficient for moisture (m/s)
51 !-- PSFC surface pressure (Pa)
52 !-- XLAND land mask (1 for land, 2 for water)
53 !-- TMN soil temperature at lower boundary (K)
54 !-- HFX upward heat flux at the surface (W/m^2)
55 !-- QFX upward moisture flux at the surface (kg/m^2/s)
56 !-- LH latent heat flux at the surface (W/m^2)
57 !-- TSK surface temperature (K)
58 !-- GSW downward short wave flux at ground surface (W/m^2)
59 !-- GLW downward long wave flux at ground surface (W/m^2)
60 !-- CAPG heat capacity for soil (J/K/m^3)
61 !-- THC thermal inertia (Cal/cm/K/s^0.5)
62 !-- SNOWC flag indicating snow coverage (1 for snow cover)
63 !-- EMISS surface emissivity (between 0 and 1)
64 !-- DELTSM time step (second)
66 !-- XLV latent heat of melting (J/kg)
67 !-- DTMIN time step (minute)
68 !-- IFSNOW ifsnow=1 for snow-cover effects
69 !-- SVP1 constant for saturation vapor pressure (kPa)
70 !-- SVP2 constant for saturation vapor pressure (dimensionless)
71 !-- SVP3 constant for saturation vapor pressure (K)
72 !-- SVPT0 constant for saturation vapor pressure (K)
73 !-- EP1 constant for virtual temperature (R_v/R_d - 1) (dimensionless)
74 !-- EP2 constant for specific humidity calculation
75 ! (R_d/R_v) (dimensionless)
76 !-- KARMAN Von Karman constant
77 !-- EOMEG angular velocity of earth's rotation (rad/s)
78 !-- STBOLT Stefan-Boltzmann constant (W/m^2/K^4)
79 !-- TSLB soil temperature in 5-layer model
80 !-- ZS depths of centers of soil layers
81 !-- DZS thicknesses of soil layers
82 !-- num_soil_layers the number of soil layers
83 !-- ids start index for i in domain
84 !-- ide end index for i in domain
85 !-- jds start index for j in domain
86 !-- jde end index for j in domain
87 !-- kds start index for k in domain
88 !-- kde end index for k in domain
89 !-- ims start index for i in memory
90 !-- ime end index for i in memory
91 !-- jms start index for j in memory
92 !-- jme end index for j in memory
93 !-- kms start index for k in memory
94 !-- kme end index for k in memory
95 !-- its start index for i in tile
96 !-- ite end index for i in tile
97 !-- jts start index for j in tile
98 !-- jte end index for j in tile
99 !-- kts start index for k in tile
100 !-- kte end index for k in tile
101 !----------------------------------------------------------------
102 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde, &
103 ims,ime, jms,jme, kms,kme, &
104 its,ite, jts,jte, kts,kte
106 INTEGER, INTENT(IN) :: num_soil_layers
107 LOGICAL, INTENT(IN) :: radiation
109 INTEGER, INTENT(IN ) :: IFSNOW
112 REAL, INTENT(IN ) :: DTMIN,XLV,ROVCP,DELTSM
114 REAL, INTENT(IN ) :: SVP1,SVP2,SVP3,SVPT0
115 REAL, INTENT(IN ) :: EP2,KARMAN,EOMEG,STBOLT
116 REAL, INTENT(IN ) :: P1000mb
118 REAL, DIMENSION( ims:ime , 1:num_soil_layers, jms:jme ), &
119 INTENT(INOUT) :: TSLB
121 REAL, DIMENSION(1:num_soil_layers), INTENT(IN)::ZS,DZS
123 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ) , &
124 INTENT(IN ) :: QV3D, &
128 REAL, DIMENSION( ims:ime, jms:jme ) , &
129 INTENT(IN ) :: SNOWC, &
138 !CHKLOWQ is declared as memory size
140 REAL, DIMENSION( ims:ime, jms:jme ) , &
141 INTENT(INOUT) :: HFX, &
149 REAL, DIMENSION( ims:ime, jms:jme ) , &
152 REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: &
158 REAL, DIMENSION( its:ite ) :: QV1D, &
171 ! the indices to the PSFC argument in the following call look
172 ! wrong; however, it is correct to call with its (and not ims)
173 ! because of the way PSFC is defined in SLAB1D. Whether *that*
174 ! is a good idea or not, this commenter cannot comment. JM
176 CALL SLAB1D(J,T1D,QV1D,P1D,FLHC(ims,j),FLQC(ims,j), &
177 PSFC(its,j),XLAND(ims,j),TMN(ims,j),HFX(ims,j), &
178 QFX(ims,j),TSK(ims,j),QSFC(ims,j),CHKLOWQ(ims,j), &
179 LH(ims,j),GSW(ims,j),GLW(ims,j), &
180 CAPG(ims,j),THC(ims,j),SNOWC(ims,j),EMISS(ims,j), &
181 MAVAIL(ims,j),DELTSM,ROVCP,XLV,DTMIN,IFSNOW, &
182 SVP1,SVP2,SVP3,SVPT0,EP2,KARMAN,EOMEG,STBOLT, &
183 TSLB(ims,1,j),ZS,DZS,num_soil_layers,radiation, &
185 ids,ide, jds,jde, kds,kde, &
186 ims,ime, jms,jme, kms,kme, &
187 its,ite, jts,jte, kts,kte )
193 !----------------------------------------------------------------
194 SUBROUTINE SLAB1D(J,T1D,QV1D,P1D,FLHC,FLQC, &
195 PSFCPA,XLAND,TMN,HFX,QFX,TSK,QSFC,CHKLOWQ, &
196 LH,GSW,GLW,CAPG,THC,SNOWC,EMISS,MAVAIL, &
197 DELTSM,ROVCP,XLV,DTMIN,IFSNOW, &
198 SVP1,SVP2,SVP3,SVPT0,EP2, &
199 KARMAN,EOMEG,STBOLT, &
200 TSLB2D,ZS,DZS,num_soil_layers,radiation, &
202 ids,ide, jds,jde, kds,kde, &
203 ims,ime, jms,jme, kms,kme, &
204 its,ite, jts,jte, kts,kte )
205 !----------------------------------------------------------------
207 !----------------------------------------------------------------
209 ! SUBROUTINE SLAB CALCULATES THE GROUND TEMPERATURE TENDENCY
210 ! ACCORDING TO THE RESIDUAL OF THE SURFACE ENERGY BUDGET
211 ! (BLACKADAR, 1978B).
214 ! FOR SOIL SUB-TIMESTEPS UPDATE SURFACE HFX AND QFX AS TG
215 ! CHANGES TO PREVENT POSSIBLE INSTABILITY FOR LONG MODEL
216 ! STEPS (DT > ~200 SEC).
218 ! PUT SNOW COVER CHECK ON SOIL SUB-TIMESTEPS
220 ! MAKE UPPER LIMIT ON SOIL SUB-STEP LENGTH MORE CONSERVATIVE
222 !----------------------------------------------------------------
224 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde, &
225 ims,ime, jms,jme, kms,kme, &
226 its,ite, jts,jte, kts,kte,J
228 INTEGER , INTENT(IN) :: num_soil_layers
229 LOGICAL, INTENT(IN ) :: radiation
231 INTEGER, INTENT(IN ) :: IFSNOW
233 REAL, INTENT(IN ) :: DTMIN,XLV,ROVCP,DELTSM
235 REAL, INTENT(IN ) :: SVP1,SVP2,SVP3,SVPT0
236 REAL, INTENT(IN ) :: EP2,KARMAN,EOMEG,STBOLT
237 REAL, INTENT(IN ) :: P1000mb
239 REAL, DIMENSION( ims:ime , 1:num_soil_layers ), &
240 INTENT(INOUT) :: TSLB2D
242 REAL, DIMENSION(1:num_soil_layers), INTENT(IN)::ZS,DZS
245 REAL, DIMENSION( ims:ime ) , &
246 INTENT(INOUT) :: HFX, &
254 REAL, DIMENSION( ims:ime ) , &
255 INTENT(IN ) :: SNOWC, &
264 REAL, DIMENSION( its:ite ) , &
265 INTENT(IN ) :: QV1D, &
269 REAL, DIMENSION( its:ite ) , &
270 INTENT(IN ) :: PSFCPA
273 REAL, DIMENSION( ims:ime ), INTENT(INOUT) :: &
278 REAL, DIMENSION( its:ite ) :: PSFC
280 REAL, DIMENSION( its:ite ) :: &
285 REAL, DIMENSION( its:ite ) :: DTHGDT, &
298 REAL, DIMENSION( its:ite, num_soil_layers ) :: FLUX
300 INTEGER :: I,K,NSOIL,ITSOIL,L,NK,RADSWTCH
301 REAL :: PS,PS1,XLDCOL,TSKX,RNSOIL,RHOG1,RHOG2,RHOG3,LAMDAG
302 REAL :: THG,ESG,QSG,HFXT,QFXT,CS,CSW,LAMG(4),THCON,PL
304 !----------------------------------------------------------------------
305 !-----DETERMINE IF ANY POINTS IN COLUMN ARE LAND (RATHER THAN OCEAN)
306 ! POINTS. IF NOT, SKIP DOWN TO THE PRINT STATEMENTS SINCE OCEAN
307 ! SURFACE TEMPERATURES ARE NOT ALLOWED TO CHANGE.
310 !----------------------------------------------------------------------
312 DATA LAMG/1.407E-8, -1.455E-5, 6.290E-3, 0.16857/
316 PSFC(I)=PSFCPA(I)/1000.
324 ! THCON=(100./PL)**ROVCP
325 THCON=(P1000mb*0.001/PL)**ROVCP
330 ! IF(IDRY.EQ.1) GOTO 81
337 !-----THE SLAB THERMAL CAPACITY CAPG(I) ARE DEPENDENT ON:
338 ! THC(I) - SOIL THERMAL INERTIAL, ONLY.
341 CAPG(I)=3.298E6*THC(I)
342 IF(num_soil_layers .gt. 1)THEN
344 ! CAPG REPRESENTS SOIL HEAT CAPACITY (J/K/M^3) WHEN DIFSL=5.E-7 (M^2/S)
345 ! TO GIVE A CORRECT THERMAL INERTIA (=CAPG*DIFSL^0.5)
347 CAPG(I)=5.9114E7*THC(I)
353 XLDCOL=AMIN1(XLDCOL,XLAND(I))
356 IF(XLDCOL.GT.1.5)GOTO 90
359 !-----CONVERT SLAB TEMPERATURE TO POTENTIAL TEMPERATURE AND
360 ! SET XLD1(I) = 0. FOR OCEAN POINTS:
364 IF((XLAND(I)-1.5).GE.0)THEN
371 !-----CONVERT 'TSK(THETAG)' TO 'TG' FOR 'IUP' CALCULATION ....
372 ! IF WE ARE USING THE BLACKADAR MULTI-LEVEL (HIGH-RESOLUTION)
376 IF(XLD1(I).LT.0.5)GOTO 50
381 ! TSK is Temperature at gound sfc
382 ! TG0(I)=TSK(I)*(PS*0.01)**ROVCP
386 !-----COMPUTE THE SURFACE ENERGY BUDGET:
388 ! IF(ISOIL.EQ.1)NSOIL=1
389 IF(num_soil_layers .gt. 1)NSOIL=1
399 IF(XLD1(I).LT.0.5)GOTO 70
400 ! OLTG(I)=TSK(I)*(100./PSFC(I))**ROVCP
401 OLTG(I)=TSK(I)*(P1000mb*0.001/PSFC(I))**ROVCP
402 UPFLUX(I)=RADSWTCH*STBOLT*TG0(I)**4
403 XINET(I)=EMISS(I)*(GLW(I)-UPFLUX(I))
404 RNET(I)=GSW(I)+XINET(I)
405 HM(I)=1.18*EOMEG*(TG0(I)-TMN(I))
406 ! MOISTURE FLUX CALCULATED HERE (OVERWRITES SFC LAYER VALUE FOR LAND)
407 ESG=SVP1*EXP(SVP2*(TG0(I)-SVPT0)/(TG0(I)-SVP3))
408 QSG=EP2*ESG/(PSFC(I)-ESG)
409 THG=TSK(I)*(100./PSFC(I))**ROVCP
410 HFX(I)=FLHC(I)*(THG-THX(I))
411 QFX(I)=FLQC(I)*(QSG-QX(I))
413 QS(I)=HFX(I)+QFX(I)*XLV
415 IF(num_soil_layers .EQ. 1)THEN
416 DTHGDT(I)=(RNET(I)-QS(I))/CAPG(I)-HM(I)
422 IF(num_soil_layers .gt. 1)THEN
423 NSOIL=1+IFIX(SOILFAC*4*DIFSL/DZS(1)*DELTSM/DZS(1))
424 RNSOIL=1./FLOAT(NSOIL)
430 DO L=1,num_soil_layers-1
431 IF(XLD1(I).LT.0.5)GOTO 75
432 IF(L.EQ.1.AND.ITSOIL.GT.1)THEN
433 ! PS1=(PSFC(I)*0.01)**ROVCP
434 PS1=(PSFCPA(I)/P1000mb)**ROVCP
436 ! for rk scheme A and B are the same
439 ESG=SVP1*EXP(SVP2*(TSLB2D(I,1)-SVPT0)/(TSLB2D(I,1) &
442 ! UPDATE FLUXES FOR NEW GROUND TEMPERATURE
443 HFXT=FLHC(I)*(THG-THX(I))
444 QFXT=FLQC(I)*(QSG-QX(I))
446 ! SUM HFX AND QFX OVER SOIL TIMESTEPS
450 FLUX(I,1)=RNET(I)-QS(I)
451 FLUX(I,L+1)=-DIFSL*CAPG(I)*(TSLB2D(I,L+1)-TSLB2D(I,L))/( &
453 DTSDT(I)=-(FLUX(I,L+1)-FLUX(I,L))/(DZS(L)*CAPG(I))
454 TSLB2D(I,L)=TSLB2D(I,L)+DTSDT(I)*DELTSM*RNSOIL
455 IF(IFSNOW.EQ.1.AND.L.EQ.1)THEN
456 IF((SNOWC(I).GT.0..AND.TSLB2D(I,1).GT.273.16))THEN
460 IF(L.EQ.1)DTHGDT(I)=DTHGDT(I)+RNSOIL*DTSDT(I)
461 IF(ITSOIL.EQ.NSOIL.AND.L.EQ.1)THEN
462 ! AVERAGE HFX AND QFX OVER SOIL TIMESTEPS FOR OUTPUT TO PBL
474 IF(XLD1(I).LT.0.5) GOTO 80
475 TSKX=TG0(I)+DELTSM*DTHGDT(I)
478 ! TSK(I)=TSKX*(100./PS1)**ROVCP
483 !-----MODIFY THE THE GROUND TEMPERATURE IF THE SNOW COVER EFFECTS ARE
484 ! CONSIDERED: LIMIT THE GROUND TEMPERATURE UNDER 0 C.
486 IF(IFSNOW.EQ.0)GOTO 90
488 IF(XLD1(I).LT.0.5)GOTO 85
489 ! PS1=(PSFC(I)*0.01)**ROVCP
490 ! TSCVN(I)=TSK(I)*PS1
492 IF((SNOWC(I).GT.0..AND.TSCVN(I).GT.273.16))THEN
497 ! TSK(I)=TSCVN(I)/PS1
503 ! QSFC and CHKLOWQ needed by Eta PBL
504 ! WA added check for flqc = 0 to accomodate TEMF (and others?)
505 if ( FLQC(I) .ne. 0.) then
506 QSFC(I)=QX(I)+QFX(I)/FLQC(I)
515 END SUBROUTINE SLAB1D
517 !================================================================
518 SUBROUTINE slabinit(TSK,TMN, &
519 TSLB,ZS,DZS,num_soil_layers, &
520 allowed_to_read, start_of_simulation, &
521 ids,ide, jds,jde, kds,kde, &
522 ims,ime, jms,jme, kms,kme, &
523 its,ite, jts,jte, kts,kte )
524 !----------------------------------------------------------------
526 !----------------------------------------------------------------
527 LOGICAL , INTENT(IN) :: allowed_to_read
528 LOGICAL , INTENT(IN) :: start_of_simulation
529 INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde, &
530 ims,ime, jms,jme, kms,kme, &
531 its,ite, jts,jte, kts,kte
533 INTEGER, INTENT(IN ) :: num_soil_layers
535 REAL, DIMENSION( ims:ime , 1:num_soil_layers , jms:jme ), INTENT(INOUT) :: TSLB
537 REAL, DIMENSION(1:num_soil_layers), INTENT(IN) :: ZS,DZS
539 REAL, DIMENSION( ims:ime, jms:jme ) , &
545 INTEGER :: L,J,I,itf,jtf
546 CHARACTER*1024 message
548 !----------------------------------------------------------------
553 END SUBROUTINE slabinit
554 !-------------------------------------------------------------------
556 END MODULE module_sf_slab