7 use data_override_mod,
only : data_override_init, data_override
12 use mom_error_handler,
only : calltree_enter, calltree_leave, mom_error, fatal, warning, is_root_pe
17 use astronomy_mod,
only : orbital_time, diurnal_solar, daily_mean_solar
24 implicit none ;
private 26 public update_offline_from_files
27 public update_offline_from_arrays
28 public update_h_horizontal_flux
29 public update_h_vertical_flux
30 public limit_mass_flux_3d
31 public distribute_residual_uh_barotropic
32 public distribute_residual_vh_barotropic
33 public distribute_residual_uh_upwards
34 public distribute_residual_vh_upwards
35 public next_modulo_time
36 public offline_add_diurnal_sw
38 #include "MOM_memory.h" 39 #include "version_variable.h" 45 subroutine update_h_horizontal_flux(G, GV, uhtr, vhtr, h_pre, h_new)
48 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
50 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
52 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
54 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
55 intent(inout) :: h_new
58 integer :: i, j, k, m, is, ie, js, je, nz
60 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
63 do i=is-1,ie+1 ;
do j=js-1,je+1
65 h_new(i,j,k) = max(0.0, g%US%L_to_m**2*g%areaT(i,j)*h_pre(i,j,k) + &
66 ((uhtr(i-1,j,k) - uhtr(i,j,k)) + (vhtr(i,j-1,k) - vhtr(i,j,k))))
71 h_new(i,j,k) = h_new(i,j,k) + &
72 max(gv%Angstrom_H, 1.0e-13*h_new(i,j,k) - g%US%L_to_m**2*g%areaT(i,j)*h_pre(i,j,k))
75 h_new(i,j,k) = h_new(i,j,k) / (g%US%L_to_m**2*g%areaT(i,j))
79 end subroutine update_h_horizontal_flux
83 subroutine update_h_vertical_flux(G, GV, ea, eb, h_pre, h_new)
86 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
89 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
92 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
95 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
96 intent(inout) :: h_new
99 integer :: i, j, k, m, is, ie, js, je, nz
101 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
108 h_new(i,j,1) = max(0.0, h_pre(i,j,1) + (eb(i,j,1) - ea(i,j,2) + ea(i,j,1) ))
109 h_new(i,j,1) = h_new(i,j,1) + &
110 max(0.0, 1.0e-13*h_new(i,j,1) - h_pre(i,j,1))
114 h_new(i,j,nz) = max(0.0, h_pre(i,j,nz) + (ea(i,j,nz) - eb(i,j,nz-1)+eb(i,j,nz)))
115 h_new(i,j,nz) = h_new(i,j,nz) + &
116 max(0.0, 1.0e-13*h_new(i,j,nz) - h_pre(i,j,nz))
121 do k=2,nz-1 ;
do i=is-1,ie+1
123 h_new(i,j,k) = max(0.0, h_pre(i,j,k) + ((ea(i,j,k) - eb(i,j,k-1)) + &
124 (eb(i,j,k) - ea(i,j,k+1))))
125 h_new(i,j,k) = h_new(i,j,k) + &
126 max(0.0, 1.0e-13*h_new(i,j,k) - h_pre(i,j,k))
132 end subroutine update_h_vertical_flux
136 subroutine limit_mass_flux_3d(G, GV, uh, vh, ea, eb, h_pre)
139 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
141 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
143 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
146 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
149 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
154 integer :: i, j, k, m, is, ie, js, je, nz
155 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)) :: top_flux, bottom_flux
156 real :: pos_flux, hvol, h_neglect, scale_factor, max_off_cfl
165 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
170 do j=js-1,je+1 ;
do i=is-1,ie+1
171 top_flux(i,j,k) = -ea(i,j,k)
172 bottom_flux(i,j,k) = -(eb(i,j,k)-ea(i,j,k+1))
175 do k=2, nz-1 ;
do j=js-1,je+1 ;
do i=is-1,ie+1
176 top_flux(i,j,k) = -(ea(i,j,k)-eb(i,j,k-1))
177 bottom_flux(i,j,k) = -(eb(i,j,k)-ea(i,j,k+1))
178 enddo ;
enddo ;
enddo 181 do j=js-1,je+1 ;
do i=is-1,ie+1
182 top_flux(i,j,k) = -(ea(i,j,k)-eb(i,j,k-1))
183 bottom_flux(i,j,k) = -eb(i,j,k)
189 do k = 1, nz ;
do j=js-1,je+1 ;
do i=is-1,ie+1
191 hvol = h_pre(i,j,k)*g%US%L_to_m**2*g%areaT(i,j)
192 pos_flux = max(0.0,-uh(i-1,j,k)) + max(0.0, -vh(i,j-1,k)) + &
193 max(0.0, uh(i,j,k)) + max(0.0, vh(i,j,k)) + &
194 max(0.0, top_flux(i,j,k)*g%US%L_to_m**2*g%areaT(i,j)) + max(0.0, bottom_flux(i,j,k)*g%US%L_to_m**2*g%areaT(i,j))
196 if (pos_flux>hvol .and. pos_flux>0.0)
then 197 scale_factor = ( hvol )/pos_flux*max_off_cfl
203 if (-uh(i-1,j,k)>0) uh(i-1,j,k) = uh(i-1,j,k)*scale_factor
204 if (uh(i,j,k)>0) uh(i,j,k) = uh(i,j,k)*scale_factor
205 if (-vh(i,j-1,k)>0) vh(i,j-1,k) = vh(i,j-1,k)*scale_factor
206 if (vh(i,j,k)>0) vh(i,j,k) = vh(i,j,k)*scale_factor
208 if (k>1 .and. k<nz)
then 210 if (top_flux(i,j,k)>0.0)
then 211 ea(i,j,k) = ea(i,j,k)*scale_factor
212 eb(i,j,k-1) = eb(i,j,k-1)*scale_factor
214 if (bottom_flux(i,j,k)>0.0)
then 215 eb(i,j,k) = eb(i,j,k)*scale_factor
216 ea(i,j,k+1) = ea(i,j,k+1)*scale_factor
220 if (top_flux(i,j,k)>0.0) ea(i,j,k) = ea(i,j,k)*scale_factor
221 if (bottom_flux(i,j,k)>0.0)
then 222 eb(i,j,k) = eb(i,j,k)*scale_factor
223 ea(i,j,k+1) = ea(i,j,k+1)*scale_factor
227 if (top_flux(i,j,k)>0.0)
then 228 ea(i,j,k) = ea(i,j,k)*scale_factor
229 eb(i,j,k-1) = eb(i,j,k-1)*scale_factor
231 if (bottom_flux(i,j,k)>0.0) eb(i,j,k)=eb(i,j,k)*scale_factor
233 enddo ;
enddo ;
enddo 235 end subroutine limit_mass_flux_3d
239 subroutine distribute_residual_uh_barotropic(G, GV, hvol, uh)
242 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
245 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
248 real,
dimension(SZIB_(G),SZK_(G)) :: uh2d
249 real,
dimension(SZIB_(G)) :: uh2d_sum
250 real,
dimension(SZI_(G),SZK_(G)) :: h2d
251 real,
dimension(SZI_(G)) :: h2d_sum
253 integer :: i, j, k, m, is, ie, js, je, nz
257 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
262 do k=1,nz ;
do i=is-1,ie
263 uh2d(i,k) = uh(i,j,k)
264 uh2d_sum(i) = uh2d_sum(i) + uh2d(i,k)
269 do k=1,nz ;
do i=is-1,ie+1
270 h2d(i,k) = hvol(i,j,k)
271 if (hvol(i,j,k)>0.)
then 272 h2d_sum(i) = h2d_sum(i) + h2d(i,k)
274 h2d(i,k) = gv%H_subroundoff
281 if ( uh2d_sum(i)>0.0 )
then 283 uh2d(i,k) = uh2d_sum(i)*(h2d(i,k)/h2d_sum(i))
285 elseif (uh2d_sum(i)<0.0)
then 287 uh2d(i,k) = uh2d_sum(i)*(h2d(i+1,k)/h2d_sum(i+1))
296 uh_neglect = gv%Angstrom_H*g%US%L_to_m**2 * min(g%areaT(i,j), g%areaT(i+1,j))
297 if ( abs(sum(uh2d(i,:))-uh2d_sum(i)) > uh_neglect) &
298 call mom_error(warning,
"Column integral of uh does not match after "//&
299 "barotropic redistribution")
302 do k=1,nz ;
do i=is-1,ie
303 uh(i,j,k) = uh2d(i,k)
307 end subroutine distribute_residual_uh_barotropic
310 subroutine distribute_residual_vh_barotropic(G, GV, hvol, vh)
313 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
316 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
319 real,
dimension(SZJB_(G),SZK_(G)) :: vh2d
320 real,
dimension(SZJB_(G)) :: vh2d_sum
321 real,
dimension(SZJ_(G),SZK_(G)) :: h2d
322 real,
dimension(SZJ_(G)) :: h2d_sum
324 integer :: i, j, k, m, is, ie, js, je, nz
328 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
333 do k=1,nz ;
do j=js-1,je
334 vh2d(j,k) = vh(i,j,k)
335 vh2d_sum(j) = vh2d_sum(j) + vh2d(j,k)
340 do k=1,nz ;
do j=js-1,je+1
341 h2d(j,k) = hvol(i,j,k)
342 if (hvol(i,j,k)>0.)
then 343 h2d_sum(j) = h2d_sum(j) + h2d(j,k)
345 h2d(j,k) = gv%H_subroundoff
351 if ( vh2d_sum(j)>0.0 )
then 353 vh2d(j,k) = vh2d_sum(j)*(h2d(j,k)/h2d_sum(j))
355 elseif (vh2d_sum(j)<0.0)
then 357 vh2d(j,k) = vh2d_sum(j)*(h2d(j+1,k)/h2d_sum(j+1))
366 vh_neglect = gv%Angstrom_H*g%US%L_to_m**2 * min(g%areaT(i,j), g%areaT(i,j+1))
367 if ( abs(sum(vh2d(j,:))-vh2d_sum(j)) > vh_neglect)
then 368 call mom_error(warning,
"Column integral of vh does not match after "//&
369 "barotropic redistribution")
374 do k=1,nz ;
do j=js-1,je
375 vh(i,j,k) = vh2d(j,k)
379 end subroutine distribute_residual_vh_barotropic
383 subroutine distribute_residual_uh_upwards(G, GV, hvol, uh)
386 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
389 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
392 real,
dimension(SZIB_(G),SZK_(G)) :: uh2d
393 real,
dimension(SZI_(G),SZK_(G)) :: h2d
395 real :: uh_neglect, uh_remain, uh_add, uh_sum, uh_col, uh_max
396 real :: hup, hdown, hlos, min_h
397 integer :: i, j, k, m, is, ie, js, je, nz, k_rev
400 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
402 min_h = gv%Angstrom_H*0.1
406 do k=1,nz ;
do i=is-2,ie+1
407 uh2d(i,k) = uh(i,j,k)
409 do k=1,nz ;
do i=is-1,ie+1
411 h2d(i,k) = hvol(i,j,k)-min_h*g%US%L_to_m**2*g%areaT(i,j)
415 uh_col = sum(uh2d(i,:))
417 uh_remain = uh2d(i,k)
419 if (abs(uh_remain)>0.0)
then 421 uh_sum = uh_remain + uh2d(i,k_rev)
424 hlos = max(0.0,uh2d(i+1,k_rev))
425 if ((((hup - hlos) + uh_sum) < 0.0) .and. &
426 ((0.5*hup + uh_sum) < 0.0))
then 427 uh2d(i,k_rev) = min(-0.5*hup,-hup+hlos,0.0)
428 uh_remain = uh_sum - uh2d(i,k_rev)
430 uh2d(i,k_rev) = uh_sum
436 hlos = max(0.0,-uh2d(i-1,k_rev))
437 if ((((hup - hlos) - uh_sum) < 0.0) .and. &
438 ((0.5*hup - uh_sum) < 0.0))
then 439 uh2d(i,k_rev) = max(0.5*hup,hup-hlos,0.0)
440 uh_remain = uh_sum - uh2d(i,k_rev)
442 uh2d(i,k_rev) = uh_sum
450 if (abs(uh_remain)>0.0)
then 452 uh2d(i,k+1) = uh2d(i,k+1) + uh_remain
454 uh2d(i,k) = uh2d(i,k) + uh_remain
455 call mom_error(warning,
"Water column cannot accommodate UH redistribution. Tracer may not be conserved")
462 uh_neglect = gv%Angstrom_H*g%US%L_to_m**2 * min(g%areaT(i,j), g%areaT(i+1,j))
463 if (abs(uh_col - sum(uh2d(i,:)))>uh_neglect)
then 464 call mom_error(warning,
"Column integral of uh does not match after "//&
465 "upwards redistribution")
470 do k=1,nz ;
do i=is-1,ie
471 uh(i,j,k) = uh2d(i,k)
475 end subroutine distribute_residual_uh_upwards
479 subroutine distribute_residual_vh_upwards(G, GV, hvol, vh)
482 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
485 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
488 real,
dimension(SZJB_(G),SZK_(G)) :: vh2d
489 real,
dimension(SZJB_(G)) :: vh2d_sum
490 real,
dimension(SZJ_(G),SZK_(G)) :: h2d
491 real,
dimension(SZJ_(G)) :: h2d_sum
493 real :: vh_neglect, vh_remain, vh_col, vh_sum
494 real :: hup, hlos, min_h
495 integer :: i, j, k, m, is, ie, js, je, nz, k_rev
498 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
500 min_h = 0.1*gv%Angstrom_H
504 do k=1,nz ;
do j=js-2,je+1
505 vh2d(j,k) = vh(i,j,k)
507 do k=1,nz ;
do j=js-1,je+1
508 h2d(j,k) = hvol(i,j,k)-min_h*g%US%L_to_m**2*g%areaT(i,j)
512 vh_col = sum(vh2d(j,:))
514 vh_remain = vh2d(j,k)
516 if (abs(vh_remain)>0.0)
then 518 vh_sum = vh_remain + vh2d(j,k_rev)
521 hlos = max(0.0,vh2d(j+1,k_rev))
522 if ((((hup - hlos) + vh_sum) < 0.0) .and. &
523 ((0.5*hup + vh_sum) < 0.0))
then 524 vh2d(j,k_rev) = min(-0.5*hup,-hup+hlos,0.0)
525 vh_remain = vh_sum - vh2d(j,k_rev)
527 vh2d(j,k_rev) = vh_sum
533 hlos = max(0.0,-vh2d(j-1,k_rev))
534 if ((((hup - hlos) - vh_sum) < 0.0) .and. &
535 ((0.5*hup - vh_sum) < 0.0))
then 536 vh2d(j,k_rev) = max(0.5*hup,hup-hlos,0.0)
537 vh_remain = vh_sum - vh2d(j,k_rev)
539 vh2d(j,k_rev) = vh_sum
548 if (abs(vh_remain)>0.0)
then 550 vh2d(j,k+1) = vh2d(j,k+1) + vh_remain
552 vh2d(j,k) = vh2d(j,k) + vh_remain
553 call mom_error(warning,
"Water column cannot accommodate VH redistribution. Tracer will not be conserved")
560 vh_neglect = gv%Angstrom_H*g%US%L_to_m**2 * min(g%areaT(i,j), g%areaT(i,j+1))
561 if ( abs(vh_col-sum(vh2d(j,:))) > vh_neglect)
then 562 call mom_error(warning,
"Column integral of vh does not match after "//&
563 "upwards redistribution")
567 do k=1,nz ;
do j=js-1,je
568 vh(i,j,k) = vh2d(j,k)
572 end subroutine distribute_residual_vh_upwards
576 subroutine offline_add_diurnal_sw(fluxes, G, Time_start, Time_end)
579 type(time_type),
intent(in) :: time_start
580 type(time_type),
intent(in) :: time_end
582 real :: diurnal_factor, time_since_ae, rad
583 real :: fracday_dt, fracday_day
584 real :: cosz_day, cosz_dt, rrsun_day, rrsun_dt
585 type(time_type) :: dt_here
587 integer :: i, j, k, i2, j2, isc, iec, jsc, jec, i_off, j_off
589 isc = g%isc ; iec = g%iec ; jsc = g%jsc ; jec = g%jec
590 i_off = lbound(fluxes%sens,1) - g%isc ; j_off = lbound(fluxes%sens,2) - g%jsc
594 time_since_ae = orbital_time(time_start)
595 dt_here = time_end - time_start
602 do j=jsc,jec ;
do i=isc,iec
609 call diurnal_solar(g%geoLatT(i,j)*rad, g%geoLonT(i,j)*rad, time_start, cosz=cosz_dt, &
610 fracday=fracday_dt, rrsun=rrsun_dt, dt_time=dt_here)
611 call daily_mean_solar(g%geoLatT(i,j)*rad, time_since_ae, cosz_day, fracday_day, rrsun_day)
612 diurnal_factor = cosz_dt*fracday_dt*rrsun_dt / &
613 max(1e-30, cosz_day*fracday_day*rrsun_day)
615 i2 = i+i_off ; j2 = j+j_off
616 fluxes%sw(i2,j2) = fluxes%sw(i2,j2) * diurnal_factor
617 fluxes%sw_vis_dir(i2,j2) = fluxes%sw_vis_dir(i2,j2) * diurnal_factor
618 fluxes%sw_vis_dif(i2,j2) = fluxes%sw_vis_dif(i2,j2) * diurnal_factor
619 fluxes%sw_nir_dir(i2,j2) = fluxes%sw_nir_dir(i2,j2) * diurnal_factor
620 fluxes%sw_nir_dif(i2,j2) = fluxes%sw_nir_dif(i2,j2) * diurnal_factor
623 end subroutine offline_add_diurnal_sw
627 subroutine update_offline_from_files(G, GV, nk_input, mean_file, sum_file, snap_file, surf_file, h_end, &
628 uhtr, vhtr, temp_mean, salt_mean, mld, Kd, fluxes, ridx_sum, ridx_snap, read_mld, read_sw, &
629 read_ts_uvh, do_ale_in)
633 integer,
intent(in ) :: nk_input
634 character(len=*),
intent(in ) :: mean_file
635 character(len=*),
intent(in ) :: sum_file
636 character(len=*),
intent(in ) :: snap_file
637 character(len=*),
intent(in ) :: surf_file
638 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
639 intent(inout) :: uhtr
640 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
641 intent(inout) :: vhtr
642 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
643 intent(inout) :: h_end
644 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
645 intent(inout) :: temp_mean
646 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
647 intent(inout) :: salt_mean
648 real,
dimension(SZI_(G),SZJ_(G)), &
650 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)+1), &
652 type(
forcing),
intent(inout) :: fluxes
653 integer,
intent(in ) :: ridx_sum
654 integer,
intent(in ) :: ridx_snap
655 logical,
intent(in ) :: read_mld
656 logical,
intent(in ) :: read_sw
657 logical,
intent(in ) :: read_ts_uvh
658 logical,
optional,
intent(in ) :: do_ale_in
661 integer :: i, j, k, is, ie, js, je, nz
665 if (
present(do_ale_in) ) do_ale = do_ale_in
667 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
670 if (read_ts_uvh)
then 672 temp_mean(:,:,:) = 0.0
673 salt_mean(:,:,:) = 0.0
677 call mom_read_vector(sum_file,
'uhtr_sum',
'vhtr_sum', uhtr(:,:,1:nk_input), &
678 vhtr(:,:,1:nk_input), g%Domain, timelevel=ridx_sum)
679 call mom_read_data(snap_file,
'h_end', h_end(:,:,1:nk_input), g%Domain, &
680 timelevel=ridx_snap,position=center)
681 call mom_read_data(mean_file,
'temp', temp_mean(:,:,1:nk_input), g%Domain, &
682 timelevel=ridx_sum,position=center)
683 call mom_read_data(mean_file,
'salt', salt_mean(:,:,1:nk_input), g%Domain, &
684 timelevel=ridx_sum,position=center)
687 do j=js,je ;
do i=is,ie
688 if (g%mask2dT(i,j)>0.)
then 689 temp_mean(:,:,nk_input:nz) = temp_mean(i,j,nk_input)
690 salt_mean(:,:,nk_input:nz) = salt_mean(i,j,nk_input)
695 call mom_read_data( mean_file,
'Kd_interface', kd(:,:,1:nk_input+1), g%Domain, &
696 timelevel=ridx_sum,position=center)
701 if (.not.
associated(fluxes%netMassOut))
then 702 allocate(fluxes%netMassOut(g%isd:g%ied,g%jsd:g%jed))
703 fluxes%netMassOut(:,:) = 0.0
705 if (.not.
associated(fluxes%netMassIn))
then 706 allocate(fluxes%netMassIn(g%isd:g%ied,g%jsd:g%jed))
707 fluxes%netMassIn(:,:) = 0.0
710 fluxes%netMassOut(:,:) = 0.0
711 fluxes%netMassIn(:,:) = 0.0
712 call mom_read_data(surf_file,
'massout_flux_sum',fluxes%netMassOut, g%Domain, &
714 call mom_read_data(surf_file,
'massin_flux_sum', fluxes%netMassIn, g%Domain, &
717 do j=js,je ;
do i=is,ie
718 if (g%mask2dT(i,j)<1.0)
then 719 fluxes%netMassOut(i,j) = 0.0
720 fluxes%netMassIn(i,j) = 0.0
727 call mom_read_data(surf_file,
'ePBL_h_ML', mld, g%Domain, timelevel=ridx_sum)
735 call mom_read_data(mean_file,
'sw_vis', fluxes%sw_vis_dir, g%Domain, &
736 timelevel=ridx_sum, scale=g%US%W_m2_to_QRZ_T)
737 call mom_read_data(mean_file,
'sw_nir', fluxes%sw_nir_dir, g%Domain, &
738 timelevel=ridx_sum, scale=g%US%W_m2_to_QRZ_T)
739 fluxes%sw_vis_dir(:,:) = fluxes%sw_vis_dir(:,:)*0.5
740 fluxes%sw_vis_dif(:,:) = fluxes%sw_vis_dir(:,:)
741 fluxes%sw_nir_dir(:,:) = fluxes%sw_nir_dir(:,:)*0.5
742 fluxes%sw_nir_dif(:,:) = fluxes%sw_nir_dir(:,:)
743 fluxes%sw = (fluxes%sw_vis_dir + fluxes%sw_vis_dif) + (fluxes%sw_nir_dir + fluxes%sw_nir_dif)
744 do j=js,je ;
do i=is,ie
745 if (g%mask2dT(i,j)<1.0)
then 747 fluxes%sw_vis_dir(i,j) = 0.0
748 fluxes%sw_nir_dir(i,j) = 0.0
749 fluxes%sw_vis_dif(i,j) = 0.0
750 fluxes%sw_nir_dif(i,j) = 0.0
754 call pass_var(fluxes%sw_vis_dir,g%Domain)
755 call pass_var(fluxes%sw_vis_dif,g%Domain)
756 call pass_var(fluxes%sw_nir_dir,g%Domain)
757 call pass_var(fluxes%sw_nir_dif,g%Domain)
760 end subroutine update_offline_from_files
763 subroutine update_offline_from_arrays(G, GV, nk_input, ridx_sum, mean_file, sum_file, snap_file, uhtr, vhtr, &
764 hend, uhtr_all, vhtr_all, hend_all, temp, salt, temp_all, salt_all )
767 integer,
intent(in ) :: nk_input
768 integer,
intent(in ) :: ridx_sum
769 character(len=200),
intent(in ) :: mean_file
770 character(len=200),
intent(in ) :: sum_file
771 character(len=200),
intent(in ) :: snap_file
772 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)),
intent(inout) :: uhtr
773 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)),
intent(inout) :: vhtr
774 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(inout) :: hend
775 real,
dimension(:,:,:,:),
allocatable,
intent(inout) :: uhtr_all
776 real,
dimension(:,:,:,:),
allocatable,
intent(inout) :: vhtr_all
777 real,
dimension(:,:,:,:),
allocatable,
intent(inout) :: hend_all
778 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(inout) :: temp
779 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(inout) :: salt
780 real,
dimension(:,:,:,:),
allocatable,
intent(inout) :: temp_all
781 real,
dimension(:,:,:,:),
allocatable,
intent(inout) :: salt_all
783 integer :: i, j, k, is, ie, js, je, nz
784 real,
parameter :: fill_value = 0.
785 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
788 if (.not.
allocated(uhtr_all)) &
789 call mom_error(fatal,
"uhtr_all not allocated before call to update_transport_from_arrays")
790 if (.not.
allocated(vhtr_all)) &
791 call mom_error(fatal,
"vhtr_all not allocated before call to update_transport_from_arrays")
792 if (.not.
allocated(hend_all)) &
793 call mom_error(fatal,
"hend_all not allocated before call to update_transport_from_arrays")
794 if (.not.
allocated(temp_all)) &
795 call mom_error(fatal,
"temp_all not allocated before call to update_transport_from_arrays")
796 if (.not.
allocated(salt_all)) &
797 call mom_error(fatal,
"salt_all not allocated before call to update_transport_from_arrays")
800 do k=1,nk_input ;
do j=js,je ;
do i=is,ie
801 uhtr(i,j,k) = uhtr_all(i,j,k,ridx_sum)
802 vhtr(i,j,k) = vhtr_all(i,j,k,ridx_sum)
803 hend(i,j,k) = hend_all(i,j,k,ridx_sum)
804 temp(i,j,k) = temp_all(i,j,k,ridx_sum)
805 salt(i,j,k) = salt_all(i,j,k,ridx_sum)
806 enddo ;
enddo ;
enddo 809 do k=nk_input+1,nz ;
do j=js,je ;
do i=is,ie
810 uhtr(i,j,k) = fill_value
811 vhtr(i,j,k) = fill_value
812 hend(i,j,k) = fill_value
813 temp(i,j,k) = fill_value
814 salt(i,j,k) = fill_value
815 enddo ;
enddo ;
enddo 817 end subroutine update_offline_from_arrays
821 function next_modulo_time(inidx, numtime)
826 integer :: read_index
829 integer :: next_modulo_time
831 read_index = mod(inidx+1,numtime)
832 if (read_index < 0) read_index = inidx-read_index
833 if (read_index == 0) read_index = numtime
835 next_modulo_time = read_index
837 end function next_modulo_time
Provides kernels for single-column interpolation, re-integration (re-mapping of integrated quantities...
Wraps the FMS time manager functions.
This module implements boundary forcing for MOM6.
Ocean grid type. See mom_grid for details.
Contains routines related to offline transport of tracers. These routines are likely to be called fro...
A structure that can be parsed to read and document run-time parameters.
Provides the ocean grid type.
Vertical viscosities, drag coefficients, and related fields.
This module contains I/O framework code.
The MOM6 facility to parse input files for runtime parameters.
Do a halo update on a pair of arrays representing the two components of a vector. ...
Read a pair of data fields representing the two components of a vector from a file.
Make a diagnostic available for averaging or output.
Routines used to calculate the opacity of the ocean.
Describes the decomposed MOM domain and has routines for communications across PEs.
Routines for error handling and I/O management.
Structure that contains pointers to the boundary forcing used to drive the liquid ocean simulated by ...
An overloaded interface to log version information about modules.
Describes the vertical ocean grid, including unit conversion factors.
This type is used to store information about ocean optical properties.
Provides a transparent vertical ocean grid type and supporting routines.
Provides transparent structures with groups of MOM6 variables and supporting routines.
Do a halo update on an array.
Read a data field from a file.
An overloaded interface to read and log the values of various types of parameters.
Provides checksumming functions for debugging.