42 real(RP),
private :: LAND_DYN_BUCKET_T_frz
44 logical,
private :: LAND_DYN_BUCKET_update_bottom_temp = .false.
45 logical,
private :: LAND_DYN_BUCKET_update_bottom_water = .false.
47 logical,
private :: LAND_DYN_BUCKET_nudging = .false.
48 real(DP),
private :: LAND_DYN_BUCKET_nudging_tau = 0.0_dp
49 character(len=H_SHORT),
private :: LAND_DYN_BUCKET_nudging_tau_unit =
"SEC"
50 character(len=H_LONG),
private :: LAND_DYN_BUCKET_nudging_basename =
''
51 logical,
private :: LAND_DYN_BUCKET_nudging_basename_add_num = .false.
52 integer,
private :: LAND_DYN_BUCKET_nudging_number_of_files = 1
53 logical,
private :: LAND_DYN_BUCKET_nudging_enable_periodic_year = .false.
54 logical,
private :: LAND_DYN_BUCKET_nudging_enable_periodic_month = .false.
55 logical,
private :: LAND_DYN_BUCKET_nudging_enable_periodic_day = .false.
56 integer,
private :: LAND_DYN_BUCKET_nudging_step_fixed = 0
57 real(RP),
private :: LAND_DYN_BUCKET_nudging_defval
58 logical,
private :: LAND_DYN_BUCKET_nudging_check_coordinates = .true.
59 integer,
private :: LAND_DYN_BUCKET_nudging_step_limit = 0
61 real(RP),
private :: WATER_DENSCS
62 real(RP),
private :: ICE_DENSCS
63 real(DP),
private :: LAND_DYN_BUCKET_nudging_tausec
65 logical,
private :: replace = .false.
82 file_external_input_regist
88 namelist / param_land_dyn_bucket / &
89 land_dyn_bucket_t_frz, &
90 land_dyn_bucket_nudging, &
91 land_dyn_bucket_nudging_tau, &
92 land_dyn_bucket_nudging_tau_unit, &
93 land_dyn_bucket_nudging_basename, &
94 land_dyn_bucket_nudging_basename_add_num, &
95 land_dyn_bucket_nudging_number_of_files, &
96 land_dyn_bucket_nudging_enable_periodic_year, &
97 land_dyn_bucket_nudging_enable_periodic_month, &
98 land_dyn_bucket_nudging_enable_periodic_day, &
99 land_dyn_bucket_nudging_step_fixed, &
100 land_dyn_bucket_nudging_defval, &
101 land_dyn_bucket_nudging_check_coordinates, &
102 land_dyn_bucket_nudging_step_limit, &
103 land_dyn_bucket_update_bottom_temp, &
104 land_dyn_bucket_update_bottom_water
110 log_info(
"LAND_DYN_BUCKET_setup",*)
'Setup'
112 land_dyn_bucket_nudging_defval = undef
113 land_dyn_bucket_t_frz = tem00
117 read(
io_fid_conf,nml=param_land_dyn_bucket,iostat=ierr)
119 log_info(
"LAND_DYN_BUCKET_setup",*)
'Not found namelist. Default used.'
120 elseif( ierr > 0 )
then
121 log_error(
"LAND_DYN_BUCKET_setup",*)
'Not appropriate names in namelist PARAM_LAND_DYN_BUCKET. Check!'
124 log_nml(param_land_dyn_bucket)
126 if ( land_dyn_bucket_nudging )
then
127 call calendar_unit2sec( land_dyn_bucket_nudging_tausec, land_dyn_bucket_nudging_tau, land_dyn_bucket_nudging_tau_unit )
129 log_info(
"LAND_DYN_BUCKET_setup",*)
'Use nudging for LAND physics : ON'
130 log_info(
"LAND_DYN_BUCKET_setup",*)
'Relaxation time Tau [sec] : ', land_dyn_bucket_nudging_tausec
132 if ( land_dyn_bucket_nudging_tausec <= 0.0_rp )
then
133 log_info(
"LAND_DYN_BUCKET_setup",*)
'Tau<=0 means that LST is completely replaced by the external data.'
137 if ( land_dyn_bucket_nudging_basename ==
'' )
then
138 log_error(
"LAND_DYN_BUCKET_setup",*)
'LAND_DYN_BUCKET_nudging_basename is necessary !!'
142 call file_external_input_regist( land_dyn_bucket_nudging_basename, &
143 land_dyn_bucket_nudging_basename_add_num, &
144 land_dyn_bucket_nudging_number_of_files, &
147 land_dyn_bucket_nudging_enable_periodic_year, &
148 land_dyn_bucket_nudging_enable_periodic_month, &
149 land_dyn_bucket_nudging_enable_periodic_day, &
150 land_dyn_bucket_nudging_step_fixed, &
151 land_dyn_bucket_nudging_defval, &
152 check_coordinates = land_dyn_bucket_nudging_check_coordinates, &
153 step_limit = land_dyn_bucket_nudging_step_limit, &
154 allow_missing = (.not. replace) )
156 call file_external_input_regist( land_dyn_bucket_nudging_basename, &
157 land_dyn_bucket_nudging_basename_add_num, &
158 land_dyn_bucket_nudging_number_of_files, &
161 land_dyn_bucket_nudging_enable_periodic_year, &
162 land_dyn_bucket_nudging_enable_periodic_month, &
163 land_dyn_bucket_nudging_enable_periodic_day, &
164 land_dyn_bucket_nudging_step_fixed, &
165 land_dyn_bucket_nudging_defval, &
166 check_coordinates = land_dyn_bucket_nudging_check_coordinates, &
167 step_limit = land_dyn_bucket_nudging_step_limit, &
168 allow_missing = (.not. replace) )
170 log_info(
"LAND_DYN_BUCKET_setup",*)
'Use nudging for Land physics: ON'
172 log_info(
"LAND_DYN_BUCKET_setup",*)
'Use nudging for Land physics: OFF'
176 ice_denscs = dice *
cv_ice
179 log_info(
"LAND_DYN_BUCKET_setup",*)
'Update soil temperature of bottom layer? : ', land_dyn_bucket_update_bottom_temp
180 log_info(
"LAND_DYN_BUCKET_setup",*)
'Update soil moisture of bottom layer? : ', land_dyn_bucket_update_bottom_water
188 LKMAX, LKS, LKE, LIA, LIS, LIE, LJA, LJS, LJE, &
189 TEMP_t, WATER_t, ICE_t, &
194 SFLX_GH, SFLX_water, &
199 RUNOFF, RUNOFF_ENGI )
208 file_external_input_update
210 matrix_solver_tridiagonal, &
217 integer,
intent(in) :: lkmax, lks, lke
218 integer,
intent(in) :: lia, lis, lie
219 integer,
intent(in) :: lja, ljs, lje
221 real(rp),
intent(in) :: temp_t (lkmax,lia,lja)
222 real(rp),
intent(in) :: water_t (lkmax,lia,lja)
223 real(rp),
intent(in) :: ice_t (lkmax,lia,lja)
224 real(rp),
intent(in) :: waterlimit (lia,lja)
225 real(rp),
intent(in) :: thermalcond (lia,lja)
226 real(rp),
intent(in) :: heatcapacity(lia,lja)
227 real(rp),
intent(in) :: waterdiff (lia,lja)
228 real(rp),
intent(in) :: sflx_gh (lia,lja)
229 real(rp),
intent(in) :: sflx_water (lia,lja)
230 real(rp),
intent(in) :: sflx_rhoe (lia,lja)
231 logical,
intent(in) :: exists_land (lia,lja)
232 real(rp),
intent(in) :: cdz (lkmax)
233 real(dp),
intent(in) :: dt
234 real(dp),
intent(in) :: nowdaysec
236 real(rp),
intent(inout) :: temp (lkmax,lia,lja)
237 real(rp),
intent(inout) :: water(lkmax,lia,lja)
238 real(rp),
intent(inout) :: ice (lkmax,lia,lja)
240 real(rp),
intent(out) :: runoff (lia,lja)
241 real(rp),
intent(out) :: runoff_engi(lia,lja)
245 real(rp) :: temp1 (lkmax,lia,lja)
246 real(rp) :: water1(lkmax,lia,lja)
248 real(rp) :: kappa (lkmax,lsize)
250 real(rp) :: f1(lkmax,lsize)
251 real(rp) :: f2(lkmax,lsize)
252 real(rp) :: f3(lkmax,lsize)
253 real(rp) :: v(lkmax,lsize)
254 real(rp) :: temp2(lkmax,lsize)
255 real(rp) :: water2(lkmax,lsize)
256 real(rp) :: ice2 (lkmax,lsize)
259 real(rp) :: work(lkmax,4)
262 real(rp) :: ndg_temp (lkmax,lia,lja)
263 real(rp) :: ndg_water(lkmax,lia,lja)
265 real(rp) :: mass_total(lkmax)
266 real(rp) :: mass_water(lkmax)
267 real(rp) :: mass_ice(lkmax)
269 real(rp) :: engi(lkmax,lsize)
273 real(rp) :: flux(lks-1:lke,lsize)
275 real(rp) :: ro, rw, ri
276 real(rp) :: ro_sum, roe_sum
282 integer,
parameter :: l = 1
287 integer :: land_iindx_list(lie-lis+1,ljs:lje)
288 integer :: land_iindx_list_epos(ljs:lje)
292 log_progress(*)
'land / dynamics / bucket'
300 if ( land_dyn_bucket_nudging )
then
302 call file_external_input_update( &
308 log_error(
"LAND_DYN_BUCKET",*)
'Requested data is not found!'
312 call file_external_input_update( &
318 log_error(
"LAND_DYN_BUCKET",*)
'Requested data is not found!'
323 if ( land_dyn_bucket_nudging )
then
324 if ( .not. replace )
then
332 if ( temp1(k,i,j) == undef )
then
333 ndg_temp(k,i,j) = 0.0_rp
335 ndg_temp(k,i,j) = ( temp1(k,i,j) - temp(k,i,j) ) / land_dyn_bucket_nudging_tausec * dt
347 if ( water1(k,i,j) == undef )
then
348 ndg_water(k,i,j) = 0.0_rp
350 ndg_water(k,i,j) = ( water1(k,i,j) - ( water(k,i,j) + ice(k,i,j) ) ) / land_dyn_bucket_nudging_tausec * dt
359 if ( .not. land_dyn_bucket_update_bottom_water )
then
364 ndg_water(lke,i,j) = 0.0_rp
370 if ( .not. land_dyn_bucket_update_bottom_temp )
then
375 ndg_temp(lke,i,j) = 0.0_rp
389 ndg_temp(k,i,j) = 0.0_rp
390 ndg_water(k,i,j) = 0.0_rp
398 if ( .not. replace )
then
406 if ( exists_land(i,j) )
then
408 land_iindx_list(l,j) = i
411 land_iindx_list_epos(j) = l
429 if ( exists_land(i,j) )
then
431 do ii = 1, land_iindx_list_epos(j), lsize
432 len = min(ii+lsize,land_iindx_list_epos(j)+1) - ii
439 i = land_iindx_list(ii+l-1,j)
442 mass_total(k) = dwatr * water(k,i,j) + dice * ice(k,i,j)
444 mass_total(lks) = mass_total(lks) + dt * sflx_water(i,j) / cdz(lks)
446 cs = ( 1.0_rp - waterlimit(i,j) ) * heatcapacity(i,j)
448 engi(k,l) = ( cs + water_denscs * water(k,i,j) + ice_denscs * ice(k,i,j) ) * temp(k,i,j) -
lhf * dice * ice(k,i,j)
450 engi(lks,l) = engi(lks,l) + dt * ( sflx_gh(i,j) + sflx_rhoe(i,j) ) / cdz(lks)
454 mass_ice(k) = min( mass_total(k), max( 0.0_rp, &
455 ( engi(k,l) - ( cs +
cv_water * mass_total(k) ) * land_dyn_bucket_t_frz ) &
458 mass_water(k) = mass_total(k) - mass_ice(k)
459 v(k,l) = mass_water(k) / dwatr
460 ice2(k,l) = mass_ice(k) / dice
461 temp2(k,l) = ( engi(k,l) +
lhf * mass_ice(k) ) &
468 f1(lks,l) = -2.0_rp * waterdiff(i,j) / ( cdz(lks) * ( cdz(lks) + cdz(lks+1) ) ) * dt
469 f2(lks,l) = 1.0_rp - f3(lks,l) - f1(lks,l)
471 if ( land_dyn_bucket_update_bottom_water )
then
472 f3(lke,l) = -2.0_rp * waterdiff(i,j) / ( cdz(lke) * ( cdz(lke) + cdz(lke-1) ) ) * dt
478 f2(lke,l) = 1.0_rp - f3(lke,l) - f1(lke,l)
481 f3(k,l) = -2.0_rp * waterdiff(i,j) / ( cdz(k) * ( cdz(k) + cdz(k-1) ) ) * dt
482 f1(k,l) = -2.0_rp * waterdiff(i,j) / ( cdz(k) * ( cdz(k) + cdz(k+1) ) ) * dt
483 f2(k,l) = 1.0_rp - f3(k,l) - f1(k,l)
491 f1(:,1), f2(:,1), f3(:,1), v(:,1), &
504 call matrix_solver_tridiagonal( lkmax, 1, lkmax, &
505 f1(:,:), f2(:,:), f3(:,:), v(:,:), &
509 i = land_iindx_list(ii+l-1,j)
514 flux(lks-1,l) = 0.0_rp
517 cs = ( 1.0_rp - waterlimit(i,j) ) * heatcapacity(i,j)
519 kappa(k,l) = thermalcond(i,j) + 0.5_rp * water2(k,l)**(1.0_rp/3.0_rp)
523 flux(k,l) = - 2.0_rp * dwatr * waterdiff(i,j) * ( water2(k+1,l) - water2(k,l) ) / ( cdz(k+1) + cdz(k) )
524 sw = 0.5_rp - sign( 0.5_rp, flux(k,l) )
525 flux(k,l) = flux(k,l) *
cv_water * ( temp2(k+1,l) * sw + temp2(k,l) * ( 1.0_rp - sw ) )
527 if ( .not. land_dyn_bucket_update_bottom_temp )
then
528 flux(lke,l) = flux(lke-1,l)
532 v(k,l) = engi(k,l) +
lhf * dice * ice2(k,l) &
533 - dt * ( flux(k,l) - flux(k-1,l) ) / cdz(k)
536 cl = cs + water_denscs * water2(lks,l) + ice_denscs * ice2(lks,l)
538 f1(lks,l) = - ( kappa(lks,l) + kappa(lks+1,l) ) / ( cdz(lks) * ( cdz(lks) + cdz(lks+1) ) ) * dt
539 f2(lks,l) = cl - f3(lks,l) - f1(lks,l)
541 cl = cs + water_denscs * water2(lke,l) + ice_denscs * ice2(lke,l)
542 if ( land_dyn_bucket_update_bottom_water )
then
543 f3(lke,l) = - ( kappa(lke,l) + kappa(lke-1,l) ) / ( cdz(lke) * ( cdz(lke) + cdz(lke-1) ) ) * dt
548 f2(lke,l) = cl - f3(lke,l) - f1(lke,l)
551 cl = cs + water_denscs * water2(k,l) + ice_denscs * ice2(k,l)
552 f3(k,l) = - ( kappa(k,l) + kappa(k-1,l) ) / ( cdz(k) * ( cdz(k) + cdz(k-1) ) ) * dt
553 f1(k,l) = - ( kappa(k,l) + kappa(k+1,l) ) / ( cdz(k) * ( cdz(k) + cdz(k+1) ) ) * dt
554 f2(k,l) = cl - f3(k,l) - f1(k,l)
563 f1(:,1), f2(:,1), f3(:,1), v(:,1), &
568 call matrix_solver_tridiagonal( lkmax, 1, lkmax, &
569 f1(:,:), f2(:,:), f3(:,:), v(:,:), &
573 i = land_iindx_list(ii+l-1,j)
577 temp2(k,l) = temp2(k,l) + ndg_temp(k,i,j)
579 if ( temp2(k,l) >= land_dyn_bucket_t_frz )
then
580 water2(k,l) = water2(k,l) + ndg_water(k,i,j)
582 ice2(k,l) = ice2(k,l) + ndg_water(k,i,j)
591 ro = max( water2(k,l) + ice2(k,l) - waterlimit(i,j), 0.0_rp )
592 rw = min( ro, water2(k,l) )
594 water2(k,l) = water2(k,l) - rw
595 ice2(k,l) = ice2(k,l) - ri
598 ro_sum = ro_sum + ( rw + ri ) * cdz(k)
603 runoff_engi(i,j) = roe_sum
606 if ( .not. land_dyn_bucket_update_bottom_water )
then
607 water2(lke,l) = water(lke,i,j)
608 ice2(lke,l) = ice(lke,i,j)
610 if ( .not. land_dyn_bucket_update_bottom_temp )
then
611 temp2(lke,l) = temp(lke,i,j)
615 temp(k,i,j) = temp2(k,l)
616 water(k,i,j) = water2(k,l)
617 ice(k,i,j) = ice2(k,l)
636 temp(k,i,j) = temp1(k,i,j)
637 water(k,i,j) = water1(k,i,j)