72 st_input , sm_input , landmask, sst, &
74 st_levels_input , sm_levels_input , &
75 num_soil_layers , num_st_levels_input , num_sm_levels_input , &
76 num_st_levels_alloc , num_sm_levels_alloc , &
77 flag_sst , flag_soil_layers , flag_soil_levels , &
78 ids , ide , jds , jde , kds , kde , &
79 ims , ime , jms , jme , kms , kme , &
80 its , ite , jts , jte , kts , kte )
82 INTEGER ,
INTENT(IN) :: num_soil_layers , &
83 num_st_levels_input , num_sm_levels_input , &
84 num_st_levels_alloc , num_sm_levels_alloc , &
85 ids , ide , jds , jde , kds , kde , &
86 ims , ime , jms , jme , kms , kme , &
87 its , ite , jts , jte , kts , kte
89 INTEGER ,
INTENT(IN) :: flag_sst, flag_soil_layers, flag_soil_levels
91 INTEGER ,
DIMENSION(1:num_st_levels_input) ,
INTENT(INOUT) :: st_levels_input
92 INTEGER ,
DIMENSION(1:num_sm_levels_input) ,
INTENT(INOUT) :: sm_levels_input
94 REAL ,
DIMENSION(ims:ime,1:num_st_levels_alloc,jms:jme) ,
INTENT(INOUT) :: st_input
95 REAL ,
DIMENSION(ims:ime,1:num_sm_levels_alloc,jms:jme) ,
INTENT(INOUT) :: sm_input
96 REAL ,
DIMENSION(ims:ime,jms:jme) ,
INTENT(IN) :: landmask , sst
98 REAL ,
DIMENSION(ims:ime,jms:jme) ,
INTENT(IN) :: tmn
99 REAL ,
DIMENSION(ims:ime,jms:jme) ,
INTENT(INOUT) :: tsk
100 REAL ,
DIMENSION(num_soil_layers) :: zs , dzs
102 REAL ,
DIMENSION(ims:ime,num_soil_layers,jms:jme) ,
INTENT(OUT) :: tslb , smois
104 REAL ,
ALLOCATABLE ,
DIMENSION(:) :: zhave
106 logical :: debug_print = .false.
107 INTEGER :: i , j , l , lout , lin , lwant , lhave, k
112 IF ( ( num_st_levels_input .LE. 0 ) .OR. &
113 ( num_sm_levels_input .LE. 0 ) )
THEN
114 write (0, fmt=
'(A)')&
115'No input soil level data (either temperature or moisture, or both are missing). Required for RUC LSM.'
117 IF ( flag_soil_levels == 1 )
THEN
118 if (debug_print)
write(0, fmt=
'(A)')
' Assume RUC LSM input'
119 ALLOCATE ( zhave( max(num_st_levels_input,num_sm_levels_input) ) )
121 if (debug_print)
write(0, fmt=
'(A)')
' Assume non-RUC LSM input'
122 ALLOCATE ( zhave( max(num_st_levels_input,num_soil_layers) ) )
128 outert :
DO lout = 1 , num_st_levels_input-1
129 innert :
DO lin = lout+1 , num_st_levels_input
130 IF ( st_levels_input(lout) .GT. st_levels_input(lin) )
THEN
131 temp = st_levels_input(lout)
132 st_levels_input(lout) = st_levels_input(lin)
133 st_levels_input(lin) = nint(temp)
136 temp = st_input(i,lout,j)
137 st_input(i,lout,j) = st_input(i,lin,j)
138 st_input(i,lin,j) = temp
145 IF ( flag_soil_layers == 1 )
THEN
148 st_input(i,1,j) = tsk(i,j)
149 st_input(i,num_st_levels_input+2,j) = tmn(i,j)
156 outerm:
DO lout = 1 , num_sm_levels_input-1
157 innerm :
DO lin = lout+1 , num_sm_levels_input
158 IF ( sm_levels_input(lout) .GT. sm_levels_input(lin) )
THEN
159 temp = sm_levels_input(lout)
160 sm_levels_input(lout) = sm_levels_input(lin)
161 sm_levels_input(lin) = nint(temp)
164 temp = sm_input(i,lout,j)
165 sm_input(i,lout,j) = sm_input(i,lin,j)
166 sm_input(i,lin,j) = temp
173 IF ( flag_soil_layers == 1 )
THEN
176 sm_input(i,1,j) = (sm_input(i,2,j)-sm_input(i,3,j))/ &
177 (st_levels_input(2)-st_levels_input(1))*st_levels_input(1)+ &
180 sm_input(i,num_sm_levels_input+2,j) = sm_input(i,num_sm_levels_input+1,j)
187 IF ( flag_soil_levels == 1 )
THEN
188 DO l = 1 , num_st_levels_input
189 zhave(l) = st_levels_input(l) / 100.
196 z_wantt :
DO lwant = 1 , num_soil_layers
197 z_havet :
DO lhave = 1 , num_st_levels_input -1
198 IF ( ( zs(lwant) .GE. zhave(lhave ) ) .AND. &
199 ( zs(lwant) .LE. zhave(lhave+1) ) )
THEN
202 tslb(i,lwant,j)= ( st_input(i,lhave,j ) * ( zhave(lhave+1) - zs(lwant) ) + &
203 st_input(i,lhave+1,j) * ( zs(lwant ) - zhave(lhave) ) ) / &
204 ( zhave(lhave+1) - zhave(lhave) )
215 DO l = 1 , num_st_levels_input
216 zhave(l+1) = st_levels_input(l) / 100.
218 zhave(num_st_levels_input+2) = 300. / 100.
223 z_wantt_2 :
DO lwant = 1 , num_soil_layers
224 z_havet_2 :
DO lhave = 1 , num_st_levels_input +2
225 IF ( ( zs(lwant) .GE. zhave(lhave ) ) .AND. &
226 ( zs(lwant) .LE. zhave(lhave+1) ) )
THEN
229 tslb(i,lwant,j)= ( st_input(i,lhave,j ) * ( zhave(lhave+1) - zs(lwant) ) + &
230 st_input(i,lhave+1,j) * ( zs(lwant ) - zhave(lhave) ) ) / &
231 ( zhave(lhave+1) - zhave(lhave) )
243 IF ( flag_soil_levels .EQ. 1 )
THEN
244 DO l = 1 , num_sm_levels_input
245 zhave(l) = sm_levels_input(l) / 100.
251 z_wantm :
DO lwant = 1 , num_soil_layers
252 z_havem :
DO lhave = 1 , num_sm_levels_input -1
253 IF ( ( zs(lwant) .GE. zhave(lhave ) ) .AND. &
254 ( zs(lwant) .LE. zhave(lhave+1) ) )
THEN
257 smois(i,lwant,j)= ( sm_input(i,lhave,j ) * ( zhave(lhave+1) - zs(lwant) ) + &
258 sm_input(i,lhave+1,j) * ( zs(lwant ) - zhave(lhave) ) ) / &
259 ( zhave(lhave+1) - zhave(lhave) )
270 DO l = 1 , num_sm_levels_input
271 zhave(l+1) = sm_levels_input(l) / 100.
273 zhave(num_sm_levels_input+2) = 300. / 100.
275 z_wantm_2 :
DO lwant = 1 , num_soil_layers
276 z_havem_2 :
DO lhave = 1 , num_sm_levels_input +2
277 IF ( ( zs(lwant) .GE. zhave(lhave ) ) .AND. &
278 ( zs(lwant) .LE. zhave(lhave+1) ) )
THEN
281 smois(i,lwant,j)= ( sm_input(i,lhave,j ) * ( zhave(lhave+1) - zs(lwant) ) + &
282 sm_input(i,lhave+1,j) * ( zs(lwant ) - zhave(lhave) ) ) / &
283 ( zhave(lhave+1) - zhave(lhave) )
295 IF ( flag_sst .EQ. 1 )
THEN
298 IF ( landmask(i,j) .LT. 0.5 )
THEN
299 DO l = 1 , num_soil_layers
300 tslb(i,l,j) = sst(i,j)
310 IF ( landmask(i,j) .LT. 0.5 )
THEN
311 DO l = 1 , num_soil_layers
312 tslb(i,l,j)= tsk(i,j)
subroutine, public init_soil_3_real(tsk, tmn, smois, tslb, st_input, sm_input, landmask, sst, zs, dzs, st_levels_input, sm_levels_input, num_soil_layers, num_st_levels_input, num_sm_levels_input, num_st_levels_alloc, num_sm_levels_alloc, flag_sst, flag_soil_layers, flag_soil_levels, ids, ide, jds, jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte, kts, kte)
This subroutine initializes soil moisture and temperature at RUC vertical levels from the Noah layers...