65 implicit none ;
private 67 #include <MOM_memory.h> 77 real :: mono_n2_column_fraction = 0.
79 real :: mono_n2_depth = -1.
87 real,
pointer,
dimension(:,:,:) :: &
92 real,
pointer,
dimension(:,:,:) :: &
101 uhgm_rlay => null(), &
102 vhgm_rlay => null(), &
106 real,
pointer,
dimension(:,:) :: &
110 cfl_cg1_x => null(), &
115 real,
pointer,
dimension(:,:,:) :: &
118 pe_to_ke => null(), &
119 ke_coradv => null(), &
126 ke_horvisc => null(),&
131 integer :: id_e = -1, id_e_d = -1
132 integer :: id_du_dt = -1, id_dv_dt = -1
133 integer :: id_col_ht = -1, id_dh_dt = -1
134 integer :: id_ke = -1, id_dkedt = -1
135 integer :: id_pe_to_ke = -1, id_ke_coradv = -1
136 integer :: id_ke_adv = -1, id_ke_visc = -1
137 integer :: id_ke_horvisc = -1, id_ke_dia = -1
138 integer :: id_uh_rlay = -1, id_vh_rlay = -1
139 integer :: id_uhgm_rlay = -1, id_vhgm_rlay = -1
140 integer :: id_h_rlay = -1, id_rd1 = -1
141 integer :: id_rml = -1, id_rcv = -1
142 integer :: id_cg1 = -1, id_cfl_cg1 = -1
143 integer :: id_cfl_cg1_x = -1, id_cfl_cg1_y = -1
144 integer :: id_cg_ebt = -1, id_rd_ebt = -1
145 integer :: id_p_ebt = -1
146 integer :: id_temp_int = -1, id_salt_int = -1
147 integer :: id_mass_wt = -1, id_col_mass = -1
148 integer :: id_masscello = -1, id_masso = -1
149 integer :: id_thetaoga = -1, id_soga = -1
150 integer :: id_sosga = -1, id_tosga = -1
151 integer :: id_temp_layer_ave = -1, id_salt_layer_ave = -1
152 integer :: id_pbo = -1
153 integer :: id_thkcello = -1, id_rhoinsitu = -1
154 integer :: id_rhopot0 = -1, id_rhopot2 = -1
159 type(
p3d) :: var_ptr(max_fields_)
160 type(
p3d) :: deriv(max_fields_)
161 type(
p3d) :: prev_val(max_fields_)
162 integer :: nlay(max_fields_)
163 integer :: num_time_deriv = 0
166 type(group_pass_type) :: pass_ke_uv
173 dt, G, GV, CS, eta_bt)
177 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)),
intent(in) :: u
178 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)),
intent(in) :: v
180 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(in) :: h
182 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)),
intent(in) :: uh
185 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)),
intent(in) :: vh
196 type(
forcing),
intent(in) :: fluxes
198 real,
intent(in) :: dt
204 real,
dimension(SZI_(G),SZJ_(G)),
optional,
intent(in) :: eta_bt
230 integer i, j, k, is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz, nkmb
233 real :: Rcv(szi_(g),szj_(g),szk_(g))
236 real :: surface_field(szi_(g),szj_(g))
237 real :: pressure_1d(szi_(g))
248 real,
parameter :: absurdly_small_freq2 = 1e-34
252 real,
dimension(SZK_(G)) :: temp_layer_ave, salt_layer_ave
253 real :: thetaoga, soga, masso, tosga, sosga
255 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
256 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
257 nz = g%ke ; nkmb = gv%nk_rho_varies
265 if (nkmb==0) nkmb = nz
268 "calculate_diagnostic_fields: Module must be initialized before used.")
272 if (
ASSOCIATED(cs%e))
then 273 call find_eta(h, tv, gv%g_Earth, g, gv, cs%e, eta_bt)
274 if (cs%id_e > 0)
call post_data(cs%id_e, cs%e, cs%diag)
277 if (
ASSOCIATED(cs%e_D))
then 278 if (
ASSOCIATED(cs%e))
then 279 do k=1,nz+1 ;
do j=js,je ;
do i=is,ie
280 cs%e_D(i,j,k) = cs%e(i,j,k) + g%bathyT(i,j)
281 enddo ;
enddo ;
enddo 283 call find_eta(h, tv, gv%g_Earth, g, gv, cs%e_D, eta_bt)
284 do k=1,nz+1 ;
do j=js,je ;
do i=is,ie
285 cs%e_D(i,j,k) = cs%e_D(i,j,k) + g%bathyT(i,j)
286 enddo ;
enddo ;
enddo 289 if (cs%id_e_D > 0)
call post_data(cs%id_e_D, cs%e_D, cs%diag)
293 if (cs%id_masscello > 0)
then 294 do k=1,nz;
do j=js,je ;
do i=is,ie
295 cs%diag_tmp3d(i,j,k) = gv%H_to_kg_m2*h(i,j,k)
296 enddo ;
enddo ;
enddo 297 call post_data(cs%id_masscello, cs%diag_tmp3d, cs%diag)
301 if (cs%id_masso > 0)
then 302 do k=1,nz;
do j=js,je ;
do i=is,ie
303 cs%diag_tmp3d(i,j,k) = gv%H_to_kg_m2*h(i,j,k)*g%areaT(i,j)
304 enddo ;
enddo ;
enddo 306 call post_data(cs%id_masso, masso, cs%diag)
310 if (cs%id_thkcello > 0)
then 313 if (gv%Boussinesq)
then 314 call post_data(cs%id_thkcello, gv%H_to_m*h, cs%diag)
321 if(
ASSOCIATED(fluxes%p_surf))
then 323 pressure_1d(i) = fluxes%p_surf(i,j)
334 pressure_1d(i) = pressure_1d(i) + 0.5*(gv%g_Earth*gv%H_to_kg_m2)*h(i,j,k)
338 cs%diag_tmp3d(:,j,k), is, ie-is+1, tv%eqn_of_state)
341 cs%diag_tmp3d(i,j,k) = (gv%H_to_kg_m2*h(i,j,k))/cs%diag_tmp3d(i,j,k)
345 pressure_1d(i) = pressure_1d(i) + 0.5*(gv%g_Earth*gv%H_to_kg_m2)*h(i,j,k)
350 call post_data(cs%id_thkcello, cs%diag_tmp3d, cs%diag)
355 if (cs%id_thetaoga>0)
then 357 call post_data(cs%id_thetaoga, thetaoga, cs%diag)
361 if (cs%id_tosga > 0)
then 362 do j=js,je ;
do i=is,ie
363 surface_field(i,j) = tv%T(i,j,1)
366 call post_data(cs%id_tosga, tosga, cs%diag)
370 if (cs%id_soga>0)
then 372 call post_data(cs%id_soga, soga, cs%diag)
376 if (cs%id_sosga > 0)
then 377 do j=js,je ;
do i=is,ie
378 surface_field(i,j) = tv%S(i,j,1)
381 call post_data(cs%id_sosga, sosga, cs%diag)
385 if (cs%id_temp_layer_ave>0)
then 387 call post_data_1d_k(cs%id_temp_layer_ave, temp_layer_ave, cs%diag)
391 if (cs%id_salt_layer_ave>0)
then 393 call post_data_1d_k(cs%id_salt_layer_ave, salt_layer_ave, cs%diag)
398 if ((cs%id_Rml > 0) .or. (cs%id_Rcv > 0) .or.
ASSOCIATED(cs%h_Rlay) .or. &
399 ASSOCIATED(cs%uh_Rlay) .or.
ASSOCIATED(cs%vh_Rlay) .or. &
400 ASSOCIATED(cs%uhGM_Rlay) .or.
ASSOCIATED(cs%vhGM_Rlay))
then 402 if (
associated(tv%eqn_of_state))
then 403 pressure_1d(:) = tv%P_Ref
405 do k=1,nz ;
do j=js-1,je+1
407 rcv(:,j,k), is-1, ie-is+3, tv%eqn_of_state)
410 do k=1,nz ;
do j=js-1,je+1 ;
do i=is-1,ie+1
411 rcv(i,j,k) = gv%Rlay(k)
412 enddo ;
enddo ;
enddo 414 if (cs%id_Rml > 0)
call post_data(cs%id_Rml, rcv, cs%diag)
415 if (cs%id_Rcv > 0)
call post_data(cs%id_Rcv, rcv, cs%diag)
417 if (
ASSOCIATED(cs%h_Rlay))
then 422 do k=1,nkmb ;
do i=is,ie
423 cs%h_Rlay(i,j,k) = 0.0
425 do k=nkmb+1,nz ;
do i=is,ie
426 cs%h_Rlay(i,j,k) = h(i,j,k)
428 do k=1,nkmb ;
do i=is,ie
429 call find_weights(gv%Rlay, rcv(i,j,k), k_list, nz, wt, wt_p)
430 cs%h_Rlay(i,j,k_list) = cs%h_Rlay(i,j,k_list) + h(i,j,k)*wt
431 cs%h_Rlay(i,j,k_list+1) = cs%h_Rlay(i,j,k_list+1) + h(i,j,k)*wt_p
435 if (cs%id_h_Rlay > 0)
call post_data(cs%id_h_Rlay, cs%h_Rlay, cs%diag)
438 if (
ASSOCIATED(cs%uh_Rlay))
then 443 do k=1,nkmb ;
do i=isq,ieq
444 cs%uh_Rlay(i,j,k) = 0.0
446 do k=nkmb+1,nz ;
do i=isq,ieq
447 cs%uh_Rlay(i,j,k) = uh(i,j,k)
450 do k=1,nkmb ;
do i=isq,ieq
451 call find_weights(gv%Rlay, 0.5*(rcv(i,j,k)+rcv(i+1,j,k)), k_list, nz, wt, wt_p)
452 cs%uh_Rlay(i,j,k_list) = cs%uh_Rlay(i,j,k_list) + uh(i,j,k)*wt
453 cs%uh_Rlay(i,j,k_list+1) = cs%uh_Rlay(i,j,k_list+1) + uh(i,j,k)*wt_p
457 if (cs%id_uh_Rlay > 0)
call post_data(cs%id_uh_Rlay, cs%uh_Rlay, cs%diag)
460 if (
ASSOCIATED(cs%vh_Rlay))
then 465 do k=1,nkmb ;
do i=is,ie
466 cs%vh_Rlay(i,j,k) = 0.0
468 do k=nkmb+1,nz ;
do i=is,ie
469 cs%vh_Rlay(i,j,k) = vh(i,j,k)
471 do k=1,nkmb ;
do i=is,ie
472 call find_weights(gv%Rlay, 0.5*(rcv(i,j,k)+rcv(i,j+1,k)), k_list, nz, wt, wt_p)
473 cs%vh_Rlay(i,j,k_list) = cs%vh_Rlay(i,j,k_list) + vh(i,j,k)*wt
474 cs%vh_Rlay(i,j,k_list+1) = cs%vh_Rlay(i,j,k_list+1) + vh(i,j,k)*wt_p
478 if (cs%id_vh_Rlay > 0)
call post_data(cs%id_vh_Rlay, cs%vh_Rlay, cs%diag)
481 if (
ASSOCIATED(cs%uhGM_Rlay) .and.
ASSOCIATED(cdp%uhGM))
then 486 do k=1,nkmb ;
do i=isq,ieq
487 cs%uhGM_Rlay(i,j,k) = 0.0
489 do k=nkmb+1,nz ;
do i=isq,ieq
490 cs%uhGM_Rlay(i,j,k) = cdp%uhGM(i,j,k)
492 do k=1,nkmb ;
do i=isq,ieq
493 call find_weights(gv%Rlay, 0.5*(rcv(i,j,k)+rcv(i+1,j,k)), k_list, nz, wt, wt_p)
494 cs%uhGM_Rlay(i,j,k_list) = cs%uhGM_Rlay(i,j,k_list) + cdp%uhGM(i,j,k)*wt
495 cs%uhGM_Rlay(i,j,k_list+1) = cs%uhGM_Rlay(i,j,k_list+1) + cdp%uhGM(i,j,k)*wt_p
499 if (cs%id_uh_Rlay > 0)
call post_data(cs%id_uhGM_Rlay, cs%uhGM_Rlay, cs%diag)
502 if (
ASSOCIATED(cs%vhGM_Rlay) .and.
ASSOCIATED(cdp%vhGM))
then 507 do k=1,nkmb ;
do i=is,ie
508 cs%vhGM_Rlay(i,j,k) = 0.0
510 do k=nkmb+1,nz ;
do i=is,ie
511 cs%vhGM_Rlay(i,j,k) = cdp%vhGM(i,j,k)
513 do k=1,nkmb ;
do i=is,ie
514 call find_weights(gv%Rlay, 0.5*(rcv(i,j,k)+rcv(i,j+1,k)), k_list, nz, wt, wt_p)
515 cs%vhGM_Rlay(i,j,k_list) = cs%vhGM_Rlay(i,j,k_list) + cdp%vhGM(i,j,k)*wt
516 cs%vhGM_Rlay(i,j,k_list+1) = cs%vhGM_Rlay(i,j,k_list+1) + cdp%vhGM(i,j,k)*wt_p
520 if (cs%id_vhGM_Rlay > 0)
call post_data(cs%id_vhGM_Rlay, cs%vhGM_Rlay, cs%diag)
524 if (
associated(tv%eqn_of_state))
then 525 if (cs%id_rhopot0 > 0)
then 528 do k=1,nz ;
do j=js,je
530 rcv(:,j,k),is,ie-is+1, tv%eqn_of_state)
532 if (cs%id_rhopot0 > 0)
call post_data(cs%id_rhopot0, rcv, cs%diag)
534 if (cs%id_rhopot2 > 0)
then 535 pressure_1d(:) = 2.e7
537 do k=1,nz ;
do j=js,je
539 rcv(:,j,k),is,ie-is+1, tv%eqn_of_state)
541 if (cs%id_rhopot2 > 0)
call post_data(cs%id_rhopot2, rcv, cs%diag)
543 if (cs%id_rhoinsitu > 0)
then 548 pressure_1d(:) = pressure_1d(:) + 0.5 * h(:,j,k) * gv%H_to_Pa
550 rcv(:,j,k),is,ie-is+1, tv%eqn_of_state)
551 pressure_1d(:) = pressure_1d(:) + 0.5 * h(:,j,k) * gv%H_to_Pa
554 if (cs%id_rhoinsitu > 0)
call post_data(cs%id_rhoinsitu, rcv, cs%diag)
558 if ((cs%id_cg1>0) .or. (cs%id_Rd1>0) .or. (cs%id_cfl_cg1>0) .or. &
559 (cs%id_cfl_cg1_x>0) .or. (cs%id_cfl_cg1_y>0))
then 560 call wave_speed(h, tv, g, gv, cs%cg1, cs%wave_speed_CSp)
561 if (cs%id_cg1>0)
call post_data(cs%id_cg1, cs%cg1, cs%diag)
562 if (cs%id_Rd1>0)
then 565 do j=js,je ;
do i=is,ie
567 f2_h = absurdly_small_freq2 + 0.25 * &
568 ((g%CoriolisBu(i,j)**2 + g%CoriolisBu(i-1,j-1)**2) + &
569 (g%CoriolisBu(i-1,j)**2 + g%CoriolisBu(i,j-1)**2))
570 mag_beta = sqrt(0.5 * ( &
571 (((g%CoriolisBu(i,j)-g%CoriolisBu(i-1,j)) * g%IdxCv(i,j))**2 + &
572 ((g%CoriolisBu(i,j-1)-g%CoriolisBu(i-1,j-1)) * g%IdxCv(i,j-1))**2) + &
573 (((g%CoriolisBu(i,j)-g%CoriolisBu(i,j-1)) * g%IdyCu(i,j))**2 + &
574 ((g%CoriolisBu(i-1,j)-g%CoriolisBu(i-1,j-1)) * g%IdyCu(i-1,j))**2) ))
575 cs%Rd1(i,j) = cs%cg1(i,j) / sqrt(f2_h + cs%cg1(i,j) * mag_beta)
578 call post_data(cs%id_Rd1, cs%Rd1, cs%diag)
580 if (cs%id_cfl_cg1>0)
then 581 do j=js,je ;
do i=is,ie
582 cs%cfl_cg1(i,j) = (dt*cs%cg1(i,j)) * (g%IdxT(i,j) + g%IdyT(i,j))
584 call post_data(cs%id_cfl_cg1, cs%cfl_cg1, cs%diag)
586 if (cs%id_cfl_cg1_x>0)
then 587 do j=js,je ;
do i=is,ie
588 cs%cfl_cg1_x(i,j) = (dt*cs%cg1(i,j)) * g%IdxT(i,j)
590 call post_data(cs%id_cfl_cg1_x, cs%cfl_cg1_x, cs%diag)
592 if (cs%id_cfl_cg1_y>0)
then 593 do j=js,je ;
do i=is,ie
594 cs%cfl_cg1_y(i,j) = (dt*cs%cg1(i,j)) * g%IdyT(i,j)
596 call post_data(cs%id_cfl_cg1_y, cs%cfl_cg1_y, cs%diag)
599 if ((cs%id_cg_ebt>0) .or. (cs%id_Rd_ebt>0) .or. (cs%id_p_ebt>0))
then 600 if (cs%id_p_ebt>0)
then 601 call wave_speed(h, tv, g, gv, cs%cg1, cs%wave_speed_CSp, use_ebt_mode=.true., &
602 mono_n2_column_fraction=cs%mono_N2_column_fraction, &
603 mono_n2_depth=cs%mono_N2_depth, modal_structure=cs%p_ebt)
604 call post_data(cs%id_p_ebt, cs%p_ebt, cs%diag)
606 call wave_speed(h, tv, g, gv, cs%cg1, cs%wave_speed_CSp, use_ebt_mode=.true., &
607 mono_n2_column_fraction=cs%mono_N2_column_fraction, &
608 mono_n2_depth=cs%mono_N2_depth)
610 if (cs%id_cg_ebt>0)
call post_data(cs%id_cg_ebt, cs%cg1, cs%diag)
611 if (cs%id_Rd_ebt>0)
then 614 do j=js,je ;
do i=is,ie
616 f2_h = absurdly_small_freq2 + 0.25 * &
617 ((g%CoriolisBu(i,j)**2 + g%CoriolisBu(i-1,j-1)**2) + &
618 (g%CoriolisBu(i-1,j)**2 + g%CoriolisBu(i,j-1)**2))
619 mag_beta = sqrt(0.5 * ( &
620 (((g%CoriolisBu(i,j)-g%CoriolisBu(i-1,j)) * g%IdxCv(i,j))**2 + &
621 ((g%CoriolisBu(i,j-1)-g%CoriolisBu(i-1,j-1)) * g%IdxCv(i,j-1))**2) + &
622 (((g%CoriolisBu(i,j)-g%CoriolisBu(i,j-1)) * g%IdyCu(i,j))**2 + &
623 ((g%CoriolisBu(i-1,j)-g%CoriolisBu(i-1,j-1)) * g%IdyCu(i-1,j))**2) ))
624 cs%Rd1(i,j) = cs%cg1(i,j) / sqrt(f2_h + cs%cg1(i,j) * mag_beta)
627 call post_data(cs%id_Rd_ebt, cs%Rd1, cs%diag)
632 if (cs%id_du_dt>0)
call post_data(cs%id_du_dt, cs%du_dt, cs%diag)
634 if (cs%id_dv_dt>0)
call post_data(cs%id_dv_dt, cs%dv_dt, cs%diag)
636 if (cs%id_dh_dt>0)
call post_data(cs%id_dh_dt, cs%dh_dt, cs%diag)
648 real,
intent(in) :: Rlist(:), R_in
649 integer,
intent(inout) :: k
650 integer,
intent(in) :: nz
651 real,
intent(out) :: wt, wt_p
658 integer :: k_upper, k_lower, k_new, inc
661 if ((k < 1) .or. (k > nz)) k = nz/2
663 k_upper = k ; k_lower = k ; inc = 1
664 if (r_in < rlist(k))
then 666 k_lower = max(k_lower-inc, 1)
667 if ((k_lower == 1) .or. (r_in >= rlist(k_lower)))
exit 673 k_upper = min(k_upper+inc, nz)
674 if ((k_upper == nz) .or. (r_in < rlist(k_upper)))
exit 680 if ((k_lower == 1) .and. (r_in <= rlist(k_lower)))
then 681 k = 1 ; wt = 1.0 ; wt_p = 0.0
682 else if ((k_upper == nz) .and. (r_in >= rlist(k_upper)))
then 683 k = nz-1 ; wt = 0.0 ; wt_p = 1.0
686 if (k_upper <= k_lower+1)
exit 687 k_new = (k_upper + k_lower) / 2
688 if (r_in < rlist(k_new))
then 700 wt = (rlist(k_upper) - r_in) / (rlist(k_upper) - rlist(k_lower))
714 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(in) :: h
718 type(
forcing),
intent(in) :: fluxes
736 real,
dimension(SZI_(G), SZJ_(G)) :: &
752 integer :: i, j, k, is, ie, js, je, nz
753 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
755 if (cs%id_mass_wt > 0)
then 756 do j=js,je ;
do i=is,ie ; mass(i,j) = 0.0 ;
enddo ;
enddo 757 do k=1,nz ;
do j=js,je ;
do i=is,ie
758 mass(i,j) = mass(i,j) + gv%H_to_kg_m2*h(i,j,k)
759 enddo ;
enddo ;
enddo 760 call post_data(cs%id_mass_wt, mass, cs%diag)
763 if (cs%id_temp_int > 0)
then 764 do j=js,je ;
do i=is,ie ; tr_int(i,j) = 0.0 ;
enddo ;
enddo 765 do k=1,nz ;
do j=js,je ;
do i=is,ie
766 tr_int(i,j) = tr_int(i,j) + (gv%H_to_kg_m2*h(i,j,k))*tv%T(i,j,k)
767 enddo ;
enddo ;
enddo 768 call post_data(cs%id_temp_int, tr_int, cs%diag)
771 if (cs%id_salt_int > 0)
then 772 do j=js,je ;
do i=is,ie ; tr_int(i,j) = 0.0 ;
enddo ;
enddo 773 do k=1,nz ;
do j=js,je ;
do i=is,ie
774 tr_int(i,j) = tr_int(i,j) + (gv%H_to_kg_m2*h(i,j,k))*tv%S(i,j,k)
775 enddo ;
enddo ;
enddo 776 call post_data(cs%id_salt_int, tr_int, cs%diag)
779 if (cs%id_col_ht > 0)
then 780 call find_eta(h, tv, gv%g_Earth, g, gv, z_top)
781 do j=js,je ;
do i=is,ie
782 z_bot(i,j) = z_top(i,j) + g%bathyT(i,j)
784 call post_data(cs%id_col_ht, z_bot, cs%diag)
787 if (cs%id_col_mass > 0 .or. cs%id_pbo > 0)
then 788 do j=js,je ;
do i=is,ie ; mass(i,j) = 0.0 ;
enddo ;
enddo 789 if (gv%Boussinesq)
then 790 if (
associated(tv%eqn_of_state))
then 791 ig_earth = 1.0 / gv%g_Earth
793 do j=js,je ;
do i=is,ie ; z_bot(i,j) = 0.0 ;
enddo ;
enddo 795 do j=js,je ;
do i=is,ie
796 z_top(i,j) = z_bot(i,j)
797 z_bot(i,j) = z_top(i,j) - gv%H_to_m*h(i,j,k)
800 z_top, z_bot, 0.0, gv%H_to_kg_m2, gv%g_Earth, &
801 g%HI, g%HI, tv%eqn_of_state, dpress)
802 do j=js,je ;
do i=is,ie
803 mass(i,j) = mass(i,j) + dpress(i,j) * ig_earth
807 do k=1,nz ;
do j=js,je ;
do i=is,ie
808 mass(i,j) = mass(i,j) + (gv%H_to_m*gv%Rlay(k))*h(i,j,k)
809 enddo ;
enddo ;
enddo 812 do k=1,nz ;
do j=js,je ;
do i=is,ie
813 mass(i,j) = mass(i,j) + gv%H_to_kg_m2*h(i,j,k)
814 enddo ;
enddo ;
enddo 816 if (cs%id_col_mass > 0)
then 817 call post_data(cs%id_col_mass, mass, cs%diag)
819 if (cs%id_pbo > 0)
then 820 do j=js,je ;
do i=is,ie ; btm_pres(i,j) = 0.0 ;
enddo ;
enddo 825 do j=js,je ;
do i=is,ie
826 btm_pres(i,j) = mass(i,j) * gv%g_Earth
827 if (
ASSOCIATED(fluxes%p_surf))
then 828 btm_pres(i,j) = btm_pres(i,j) + fluxes%p_surf(i,j)
831 call post_data(cs%id_pbo, btm_pres, cs%diag)
840 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)),
intent(in) :: u
841 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)),
intent(in) :: v
843 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)),
intent(in) :: h
845 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)),
intent(in) :: uh
848 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)),
intent(in) :: vh
873 real :: KE_u(szib_(g),szj_(g))
874 real :: KE_v(szi_(g),szjb_(g))
875 real :: KE_h(szi_(g),szj_(g))
877 integer :: i, j, k, is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz
878 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
879 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
881 do j=js-1,je ;
do i=is-1,ie
882 ke_u(i,j) = 0.0 ; ke_v(i,j) = 0.0
885 if (
ASSOCIATED(cs%KE))
then 886 do k=1,nz ;
do j=js,je ;
do i=is,ie
887 cs%KE(i,j,k) = ((u(i,j,k)*u(i,j,k) + u(i-1,j,k)*u(i-1,j,k)) + &
888 (v(i,j,k)*v(i,j,k) + v(i,j-1,k)*v(i,j-1,k)))*0.25
892 enddo ;
enddo ;
enddo 893 if (cs%id_KE > 0)
call post_data(cs%id_KE, cs%KE, cs%diag)
896 if(.not.g%symmetric)
then 897 if(
ASSOCIATED(cs%dKE_dt) .OR.
ASSOCIATED(cs%PE_to_KE) .OR.
ASSOCIATED(cs%KE_CorAdv) .OR. &
898 ASSOCIATED(cs%KE_adv) .OR.
ASSOCIATED(cs%KE_visc) .OR.
ASSOCIATED(cs%KE_horvisc).OR. &
899 ASSOCIATED(cs%KE_dia) )
then 904 if (
ASSOCIATED(cs%dKE_dt))
then 906 do j=js,je ;
do i=isq,ieq
907 ke_u(i,j) = uh(i,j,k)*g%dxCu(i,j)*cs%du_dt(i,j,k)
909 do j=jsq,jeq ;
do i=is,ie
910 ke_v(i,j) = vh(i,j,k)*g%dyCv(i,j)*cs%dv_dt(i,j,k)
912 do j=js,je ;
do i=is,ie
913 ke_h(i,j) = cs%KE(i,j,k)*cs%dh_dt(i,j,k)
915 if (.not.g%symmetric) &
916 call do_group_pass(cs%pass_KE_uv, g%domain)
917 do j=js,je ;
do i=is,ie
918 cs%dKE_dt(i,j,k) = ke_h(i,j) + 0.5 * g%IareaT(i,j) * &
919 (ke_u(i,j) + ke_u(i-1,j) + ke_v(i,j) + ke_v(i,j-1))
922 if (cs%id_dKEdt > 0)
call post_data(cs%id_dKEdt, cs%dKE_dt, cs%diag)
925 if (
ASSOCIATED(cs%PE_to_KE))
then 927 do j=js,je ;
do i=isq,ieq
928 ke_u(i,j) = uh(i,j,k)*g%dxCu(i,j)*adp%PFu(i,j,k)
930 do j=jsq,jeq ;
do i=is,ie
931 ke_v(i,j) = vh(i,j,k)*g%dyCv(i,j)*adp%PFv(i,j,k)
933 if (.not.g%symmetric) &
934 call do_group_pass(cs%pass_KE_uv, g%domain)
935 do j=js,je ;
do i=is,ie
936 cs%PE_to_KE(i,j,k) = 0.5 * g%IareaT(i,j) * &
937 (ke_u(i,j) + ke_u(i-1,j) + ke_v(i,j) + ke_v(i,j-1))
940 if (cs%id_PE_to_KE > 0)
call post_data(cs%id_PE_to_KE, cs%PE_to_KE, cs%diag)
943 if (
ASSOCIATED(cs%KE_CorAdv))
then 945 do j=js,je ;
do i=isq,ieq
946 ke_u(i,j) = uh(i,j,k)*g%dxCu(i,j)*adp%CAu(i,j,k)
948 do j=jsq,jeq ;
do i=is,ie
949 ke_v(i,j) = vh(i,j,k)*g%dyCv(i,j)*adp%CAv(i,j,k)
951 do j=js,je ;
do i=is,ie
952 ke_h(i,j) = -cs%KE(i,j,k) * g%IareaT(i,j) * &
953 (uh(i,j,k) - uh(i-1,j,k) + vh(i,j,k) - vh(i,j-1,k))
955 if (.not.g%symmetric) &
956 call do_group_pass(cs%pass_KE_uv, g%domain)
957 do j=js,je ;
do i=is,ie
958 cs%KE_CorAdv(i,j,k) = ke_h(i,j) + 0.5 * g%IareaT(i,j) * &
959 (ke_u(i,j) + ke_u(i-1,j) + ke_v(i,j) + ke_v(i,j-1))
962 if (cs%id_KE_Coradv > 0)
call post_data(cs%id_KE_Coradv, cs%KE_Coradv, cs%diag)
965 if (
ASSOCIATED(cs%KE_adv))
then 967 do j=js,je ;
do i=isq,ieq
968 ke_u(i,j) = uh(i,j,k)*g%dxCu(i,j)*adp%gradKEu(i,j,k)
970 do j=jsq,jeq ;
do i=is,ie
971 ke_v(i,j) = vh(i,j,k)*g%dyCv(i,j)*adp%gradKEv(i,j,k)
973 do j=js,je ;
do i=is,ie
974 ke_h(i,j) = -cs%KE(i,j,k) * g%IareaT(i,j) * &
975 (uh(i,j,k) - uh(i-1,j,k) + vh(i,j,k) - vh(i,j-1,k))
977 if (.not.g%symmetric) &
978 call do_group_pass(cs%pass_KE_uv, g%domain)
979 do j=js,je ;
do i=is,ie
980 cs%KE_adv(i,j,k) = ke_h(i,j) + 0.5 * g%IareaT(i,j) * &
981 (ke_u(i,j) + ke_u(i-1,j) + ke_v(i,j) + ke_v(i,j-1))
984 if (cs%id_KE_adv > 0)
call post_data(cs%id_KE_adv, cs%KE_adv, cs%diag)
987 if (
ASSOCIATED(cs%KE_visc))
then 989 do j=js,je ;
do i=isq,ieq
990 ke_u(i,j) = uh(i,j,k)*g%dxCu(i,j)*adp%du_dt_visc(i,j,k)
992 do j=jsq,jeq ;
do i=is,ie
993 ke_v(i,j) = vh(i,j,k)*g%dyCv(i,j)*adp%dv_dt_visc(i,j,k)
995 if (.not.g%symmetric) &
996 call do_group_pass(cs%pass_KE_uv, g%domain)
997 do j=js,je ;
do i=is,ie
998 cs%KE_visc(i,j,k) = 0.5 * g%IareaT(i,j) * &
999 (ke_u(i,j) + ke_u(i-1,j) + ke_v(i,j) + ke_v(i,j-1))
1002 if (cs%id_KE_visc > 0)
call post_data(cs%id_KE_visc, cs%KE_visc, cs%diag)
1005 if (
ASSOCIATED(cs%KE_horvisc))
then 1007 do j=js,je ;
do i=isq,ieq
1008 ke_u(i,j) = uh(i,j,k)*g%dxCu(i,j)*adp%diffu(i,j,k)
1010 do j=jsq,jeq ;
do i=is,ie
1011 ke_v(i,j) = vh(i,j,k)*g%dyCv(i,j)*adp%diffv(i,j,k)
1013 if (.not.g%symmetric) &
1014 call do_group_pass(cs%pass_KE_uv, g%domain)
1015 do j=js,je ;
do i=is,ie
1016 cs%KE_horvisc(i,j,k) = 0.5 * g%IareaT(i,j) * &
1017 (ke_u(i,j) + ke_u(i-1,j) + ke_v(i,j) + ke_v(i,j-1))
1020 if (cs%id_KE_horvisc > 0)
call post_data(cs%id_KE_horvisc, cs%KE_horvisc, cs%diag)
1023 if (
ASSOCIATED(cs%KE_dia))
then 1025 do j=js,je ;
do i=isq,ieq
1026 ke_u(i,j) = uh(i,j,k)*g%dxCu(i,j)*adp%du_dt_dia(i,j,k)
1028 do j=jsq,jeq ;
do i=is,ie
1029 ke_v(i,j) = vh(i,j,k)*g%dyCv(i,j)*adp%dv_dt_dia(i,j,k)
1031 do j=js,je ;
do i=is,ie
1032 ke_h(i,j) = cs%KE(i,j,k) * &
1033 (cdp%diapyc_vel(i,j,k) - cdp%diapyc_vel(i,j,k+1))
1035 if (.not.g%symmetric) &
1036 call do_group_pass(cs%pass_KE_uv, g%domain)
1037 do j=js,je ;
do i=is,ie
1038 cs%KE_dia(i,j,k) = ke_h(i,j) + 0.5 * g%IareaT(i,j) * &
1039 (ke_u(i,j) + ke_u(i-1,j) + ke_v(i,j) + ke_v(i,j-1))
1042 if (cs%id_KE_dia > 0)
call post_data(cs%id_KE_dia, cs%KE_dia, cs%diag)
1049 real,
dimension(:,:,:),
target :: f_ptr
1050 real,
dimension(:,:,:),
target :: deriv_ptr
1064 if (.not.
associated(cs))
call mom_error(fatal, &
1065 "register_time_deriv: Module must be initialized before it is used.")
1067 if (cs%num_time_deriv >= max_fields_)
then 1068 call mom_error(warning,
"MOM_diagnostics: Attempted to register more than " // &
1069 "MAX_FIELDS_ diagnostic time derivatives via register_time_deriv.")
1073 m = cs%num_time_deriv+1 ; cs%num_time_deriv = m
1075 cs%nlay(m) =
size(f_ptr(:,:,:),3)
1076 cs%deriv(m)%p => deriv_ptr
1077 allocate(cs%prev_val(m)%p(
size(f_ptr(:,:,:),1),
size(f_ptr(:,:,:),2), cs%nlay(m)) )
1079 cs%var_ptr(m)%p => f_ptr
1080 cs%prev_val(m)%p(:,:,:) = f_ptr(:,:,:)
1086 real,
intent(in) :: dt
1101 if (dt > 0.0)
then ; idt = 1.0/dt
1102 else ;
return ;
endif 1104 do m=1,cs%num_time_deriv
1105 do k=1,cs%nlay(m) ;
do j=g%jsc,g%jec ;
do i=g%isc,g%iec
1106 cs%deriv(m)%p(i,j,k) = (cs%var_ptr(m)%p(i,j,k) - cs%prev_val(m)%p(i,j,k)) * idt
1107 cs%prev_val(m)%p(i,j,k) = cs%var_ptr(m)%p(i,j,k)
1108 enddo ;
enddo ;
enddo 1122 type(time_type),
intent(in) :: Time
1127 type(
diag_ctrl),
target,
intent(inout) :: diag
1146 #include "version_variable.h" 1148 character(len=40) :: mdl =
"MOM_diagnostics" 1149 real :: omega, f2_min
1150 character(len=48) :: thickness_units, flux_units
1151 integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, nz, nkml, nkbl
1152 integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, i, j
1154 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
1155 isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
1156 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed ; nz = g%ke
1157 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
1159 if (
associated(cs))
then 1160 call mom_error(warning,
"MOM_diagnostics_init called with an associated "// &
1161 "control structure.")
1170 call get_param(param_file, mdl,
"DIAG_EBT_MONO_N2_COLUMN_FRACTION", cs%mono_N2_column_fraction, &
1171 "The lower fraction of water column over which N2 is limited as monotonic\n"// &
1172 "for the purposes of calculating the equivalent barotropic wave speed.", &
1173 units=
'nondim', default=0.)
1174 call get_param(param_file, mdl,
"DIAG_EBT_MONO_N2_DEPTH", cs%mono_N2_depth, &
1175 "The depth below which N2 is limited as monotonic for the\n"// &
1176 "purposes of calculating the equivalent barotropic wave speed.", &
1177 units=
'm', default=-1.)
1179 if (gv%Boussinesq)
then 1180 thickness_units =
"meter" ; flux_units =
"meter3 second-1" 1182 thickness_units =
"kilogram meter-2" ; flux_units =
"kilogram second-1" 1185 cs%id_temp_layer_ave = register_diag_field(
'ocean_model',
'temp_layer_ave', diag%axesZL, time, &
1186 'Layer Average Ocean Temperature',
'Celsius')
1188 cs%id_salt_layer_ave = register_diag_field(
'ocean_model',
'salt_layer_ave', diag%axesZL, time, &
1189 'Layer Average Ocean Salinity',
'ppt')
1191 cs%id_masscello = register_diag_field(
'ocean_model',
'masscello', diag%axesTL,&
1192 time,
'Mass per unit area of liquid ocean grid cell',
'kg m-2', &
1193 standard_name=
'sea_water_mass_per_unit_area', v_extensive=.true.)
1195 cs%id_masso = register_scalar_field(
'ocean_model',
'masso', time, &
1196 diag,
'Mass of liquid ocean',
'kg', standard_name=
'sea_water_mass')
1198 cs%id_thkcello = register_diag_field(
'ocean_model',
'thkcello', diag%axesTL, time, &
1199 long_name =
'Cell Thickness', standard_name=
'cell_thickness', units=
'm', v_extensive=.true.)
1201 if (((cs%id_masscello>0) .or. (cs%id_masso>0) .or. (cs%id_thkcello>0.and..not.gv%Boussinesq)) &
1202 .and. .not.
ASSOCIATED(cs%diag_tmp3d))
then 1203 call safe_alloc_ptr(cs%diag_tmp3d,isd,ied,jsd,jed,nz)
1206 cs%id_thetaoga = register_scalar_field(
'ocean_model',
'thetaoga', &
1207 time, diag,
'Global Mean Ocean Potential Temperature',
'Celsius',&
1208 standard_name=
'sea_water_potential_temperature')
1210 cs%id_soga = register_scalar_field(
'ocean_model',
'soga', &
1211 time, diag,
'Global Mean Ocean Salinity',
'ppt', &
1212 standard_name=
'sea_water_salinity')
1214 cs%id_tosga = register_scalar_field(
'ocean_model',
'sst_global', time, diag,&
1215 long_name=
'Global Area Average Sea Surface Temperature', &
1216 units=
'degC', standard_name=
'sea_surface_temperature', &
1217 cmor_field_name=
'tosga', cmor_standard_name=
'sea_surface_temperature', &
1218 cmor_units=
'degC', cmor_long_name=
'Sea Surface Temperature')
1220 cs%id_sosga = register_scalar_field(
'ocean_model',
'sss_global', time, diag,&
1221 long_name=
'Global Area Average Sea Surface Salinity', &
1222 units=
'ppt', standard_name=
'sea_surface_salinity', &
1223 cmor_field_name=
'sosga', cmor_standard_name=
'sea_surface_salinity', &
1224 cmor_units=
'ppt', cmor_long_name=
'Sea Surface Salinity')
1226 cs%id_e = register_diag_field(
'ocean_model',
'e', diag%axesTi, time, &
1227 'Interface Height Relative to Mean Sea Level',
'meter')
1228 if (cs%id_e>0)
call safe_alloc_ptr(cs%e,isd,ied,jsd,jed,nz+1)
1230 cs%id_e_D = register_diag_field(
'ocean_model',
'e_D', diag%axesTi, time, &
1231 'Interface Height above the Seafloor',
'meter')
1232 if (cs%id_e_D>0)
call safe_alloc_ptr(cs%e_D,isd,ied,jsd,jed,nz+1)
1234 cs%id_Rml = register_diag_field(
'ocean_model',
'Rml', diag%axesTL, time, &
1235 'Mixed Layer Coordinate Potential Density',
'kg meter-3')
1237 cs%id_Rcv = register_diag_field(
'ocean_model',
'Rho_cv', diag%axesTL, time, &
1238 'Coordinate Potential Density',
'kg meter-3')
1240 cs%id_rhopot0 = register_diag_field(
'ocean_model',
'rhopot0', diag%axesTL, time, &
1241 'Potential density referenced to surface',
'kg meter-3')
1242 cs%id_rhopot2 = register_diag_field(
'ocean_model',
'rhopot2', diag%axesTL, time, &
1243 'Potential density referenced to 2000 dbar',
'kg meter-3')
1244 cs%id_rhoinsitu = register_diag_field(
'ocean_model',
'rhoinsitu', diag%axesTL, time, &
1245 'In situ density',
'kg meter-3')
1247 cs%id_du_dt = register_diag_field(
'ocean_model',
'dudt', diag%axesCuL, time, &
1248 'Zonal Acceleration',
'meter second-2')
1249 if ((cs%id_du_dt>0) .and. .not.
ASSOCIATED(cs%du_dt))
then 1250 call safe_alloc_ptr(cs%du_dt,isdb,iedb,jsd,jed,nz)
1254 cs%id_dv_dt = register_diag_field(
'ocean_model',
'dvdt', diag%axesCvL, time, &
1255 'Meridional Acceleration',
'meter second-2')
1256 if ((cs%id_dv_dt>0) .and. .not.
ASSOCIATED(cs%dv_dt))
then 1257 call safe_alloc_ptr(cs%dv_dt,isd,ied,jsdb,jedb,nz)
1261 cs%id_dh_dt = register_diag_field(
'ocean_model',
'dhdt', diag%axesTL, time, &
1262 'Thickness tendency', trim(thickness_units)//
" second-1")
1263 if ((cs%id_dh_dt>0) .and. .not.
ASSOCIATED(cs%dh_dt))
then 1264 call safe_alloc_ptr(cs%dh_dt,isd,ied,jsd,jed,nz)
1270 cs%id_h_Rlay = register_diag_field(
'ocean_model',
'h_rho', diag%axesTL, time, &
1271 'Layer thicknesses in pure potential density coordinates', thickness_units)
1272 if (cs%id_h_Rlay>0)
call safe_alloc_ptr(cs%h_Rlay,isd,ied,jsd,jed,nz)
1274 cs%id_uh_Rlay = register_diag_field(
'ocean_model',
'uh_rho', diag%axesCuL, time, &
1275 'Zonal volume transport in pure potential density coordinates', flux_units)
1276 if (cs%id_uh_Rlay>0)
call safe_alloc_ptr(cs%uh_Rlay,isdb,iedb,jsd,jed,nz)
1278 cs%id_vh_Rlay = register_diag_field(
'ocean_model',
'vh_rho', diag%axesCvL, time, &
1279 'Meridional volume transport in pure potential density coordinates', flux_units)
1280 if (cs%id_vh_Rlay>0)
call safe_alloc_ptr(cs%vh_Rlay,isd,ied,jsdb,jedb,nz)
1282 cs%id_uhGM_Rlay = register_diag_field(
'ocean_model',
'uhGM_rho', diag%axesCuL, time, &
1283 'Zonal volume transport due to interface height diffusion in pure potential & 1284 &density coordinates', flux_units)
1285 if (cs%id_uhGM_Rlay>0)
call safe_alloc_ptr(cs%uhGM_Rlay,isdb,iedb,jsd,jed,nz)
1287 cs%id_vhGM_Rlay = register_diag_field(
'ocean_model',
'vhGM_rho', diag%axesCvL, time, &
1288 'Meridional volume transport due to interface height diffusion in pure & 1289 &potential density coordinates', flux_units)
1290 if (cs%id_vhGM_Rlay>0)
call safe_alloc_ptr(cs%vhGM_Rlay,isd,ied,jsdb,jedb,nz)
1295 cs%id_KE = register_diag_field(
'ocean_model',
'KE', diag%axesTL, time, &
1296 'Layer kinetic energy per unit mass',
'meter2 second-2')
1297 if (cs%id_KE>0)
call safe_alloc_ptr(cs%KE,isd,ied,jsd,jed,nz)
1299 cs%id_dKEdt = register_diag_field(
'ocean_model',
'dKE_dt', diag%axesTL, time, &
1300 'Kinetic Energy Tendency of Layer',
'meter3 second-3')
1301 if (cs%id_dKEdt>0)
call safe_alloc_ptr(cs%dKE_dt,isd,ied,jsd,jed,nz)
1303 cs%id_PE_to_KE = register_diag_field(
'ocean_model',
'PE_to_KE', diag%axesTL, time, &
1304 'Potential to Kinetic Energy Conversion of Layer',
'meter3 second-3')
1305 if (cs%id_PE_to_KE>0)
call safe_alloc_ptr(cs%PE_to_KE,isd,ied,jsd,jed,nz)
1307 cs%id_KE_Coradv = register_diag_field(
'ocean_model',
'KE_Coradv', diag%axesTL, time, &
1308 'Kinetic Energy Source from Coriolis and Advection',
'meter3 second-3')
1309 if (cs%id_KE_Coradv>0)
call safe_alloc_ptr(cs%KE_Coradv,isd,ied,jsd,jed,nz)
1311 cs%id_KE_adv = register_diag_field(
'ocean_model',
'KE_adv', diag%axesTL, time, &
1312 'Kinetic Energy Source from Advection',
'meter3 second-3')
1313 if (cs%id_KE_adv>0)
call safe_alloc_ptr(cs%KE_adv,isd,ied,jsd,jed,nz)
1315 cs%id_KE_visc = register_diag_field(
'ocean_model',
'KE_visc', diag%axesTL, time, &
1316 'Kinetic Energy Source from Vertical Viscosity and Stresses',
'meter3 second-3')
1317 if (cs%id_KE_visc>0)
call safe_alloc_ptr(cs%KE_visc,isd,ied,jsd,jed,nz)
1319 cs%id_KE_horvisc = register_diag_field(
'ocean_model',
'KE_horvisc', diag%axesTL, time, &
1320 'Kinetic Energy Source from Horizontal Viscosity',
'meter3 second-3')
1321 if (cs%id_KE_horvisc>0)
call safe_alloc_ptr(cs%KE_horvisc,isd,ied,jsd,jed,nz)
1323 cs%id_KE_dia = register_diag_field(
'ocean_model',
'KE_dia', diag%axesTL, time, &
1324 'Kinetic Energy Source from Diapycnal Diffusion',
'meter3 second-3')
1325 if (cs%id_KE_dia>0)
call safe_alloc_ptr(cs%KE_dia,isd,ied,jsd,jed,nz)
1329 cs%id_cg1 = register_diag_field(
'ocean_model',
'cg1', diag%axesT1, time, &
1330 'First baroclinic gravity wave speed',
'meter second-1')
1331 cs%id_Rd1 = register_diag_field(
'ocean_model',
'Rd1', diag%axesT1, time, &
1332 'First baroclinic deformation radius',
'meter')
1333 cs%id_cfl_cg1 = register_diag_field(
'ocean_model',
'CFL_cg1', diag%axesT1, time, &
1334 'CFL of first baroclinic gravity wave = dt*cg1*(1/dx+1/dy)',
'nondim')
1335 cs%id_cfl_cg1_x = register_diag_field(
'ocean_model',
'CFL_cg1_x', diag%axesT1, time, &
1336 'i-component of CFL of first baroclinic gravity wave = dt*cg1*/dx',
'nondim')
1337 cs%id_cfl_cg1_y = register_diag_field(
'ocean_model',
'CFL_cg1_y', diag%axesT1, time, &
1338 'j-component of CFL of first baroclinic gravity wave = dt*cg1*/dy',
'nondim')
1339 cs%id_cg_ebt = register_diag_field(
'ocean_model',
'cg_ebt', diag%axesT1, time, &
1340 'Equivalent barotropic gravity wave speed',
'meter second-1')
1341 cs%id_Rd_ebt = register_diag_field(
'ocean_model',
'Rd_ebt', diag%axesT1, time, &
1342 'Equivalent barotropic deformation radius',
'meter')
1343 cs%id_p_ebt = register_diag_field(
'ocean_model',
'p_ebt', diag%axesTL, time, &
1344 'Equivalent barotropic modal strcuture',
'nondim')
1346 if ((cs%id_cg1>0) .or. (cs%id_Rd1>0) .or. (cs%id_cfl_cg1>0) .or. &
1347 (cs%id_cfl_cg1_x>0) .or. (cs%id_cfl_cg1_y>0) .or. &
1348 (cs%id_cg_ebt>0) .or. (cs%id_Rd_ebt>0) .or. (cs%id_p_ebt>0))
then 1350 call safe_alloc_ptr(cs%cg1,isd,ied,jsd,jed)
1351 if (cs%id_Rd1>0)
call safe_alloc_ptr(cs%Rd1,isd,ied,jsd,jed)
1352 if (cs%id_Rd_ebt>0)
call safe_alloc_ptr(cs%Rd1,isd,ied,jsd,jed)
1353 if (cs%id_cfl_cg1>0)
call safe_alloc_ptr(cs%cfl_cg1,isd,ied,jsd,jed)
1354 if (cs%id_cfl_cg1_x>0)
call safe_alloc_ptr(cs%cfl_cg1_x,isd,ied,jsd,jed)
1355 if (cs%id_cfl_cg1_y>0)
call safe_alloc_ptr(cs%cfl_cg1_y,isd,ied,jsd,jed)
1356 if (cs%id_p_ebt>0)
call safe_alloc_ptr(cs%p_ebt,isd,ied,jsd,jed,nz)
1359 cs%id_mass_wt = register_diag_field(
'ocean_model',
'mass_wt', diag%axesT1, time, &
1360 'The column mass for calculating mass-weighted average properties',
'kg m-2')
1362 cs%id_temp_int = register_diag_field(
'ocean_model',
'temp_int', diag%axesT1, time, &
1363 'Density weighted column integrated potential temperature',
'degC kg m-2', &
1364 cmor_field_name=
'opottempmint', &
1365 cmor_long_name=
'integral_wrt_depth_of_product_of_sea_water_density_and_potential_temperature',&
1366 cmor_units=
'degC kg m-2', cmor_standard_name=
'Depth integrated density times potential temperature')
1368 cs%id_salt_int = register_diag_field(
'ocean_model',
'salt_int', diag%axesT1, time, &
1369 'Density weighted column integrated salinity',
'ppt kg m-2', &
1370 cmor_field_name=
'somint', &
1371 cmor_long_name=
'integral_wrt_depth_of_product_of_sea_water_density_and_salinity',&
1372 cmor_units=
'ppt kg m-2', cmor_standard_name=
'Depth integrated density times salinity')
1374 cs%id_col_mass = register_diag_field(
'ocean_model',
'col_mass', diag%axesT1, time, &
1375 'The column integrated in situ density',
'kg m-2')
1377 cs%id_col_ht = register_diag_field(
'ocean_model',
'col_height', diag%axesT1, time, &
1378 'The height of the water column',
'm')
1379 cs%id_pbo = register_diag_field(
'ocean_model',
'pbo', diag%axesT1, time, &
1380 long_name=
'Sea Water Pressure at Sea Floor', standard_name=
'sea_water_pressure_at_sea_floor', &
1409 integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, nz
1410 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed ; nz = g%ke
1411 isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
1413 if (
ASSOCIATED(cs%dKE_dt) .or.
ASSOCIATED(cs%PE_to_KE) .or. &
1414 ASSOCIATED(cs%KE_CorAdv) .or.
ASSOCIATED(cs%KE_adv) .or. &
1415 ASSOCIATED(cs%KE_visc) .or.
ASSOCIATED(cs%KE_horvisc) .or. &
1416 ASSOCIATED(cs%KE_dia)) &
1417 call safe_alloc_ptr(cs%KE,isd,ied,jsd,jed,nz)
1419 if (
ASSOCIATED(cs%dKE_dt))
then 1420 if (.not.
ASSOCIATED(cs%du_dt))
then 1421 call safe_alloc_ptr(cs%du_dt,isdb,iedb,jsd,jed,nz)
1424 if (.not.
ASSOCIATED(cs%dv_dt))
then 1425 call safe_alloc_ptr(cs%dv_dt,isd,ied,jsdb,jedb,nz)
1428 if (.not.
ASSOCIATED(cs%dh_dt))
then 1429 call safe_alloc_ptr(cs%dh_dt,isd,ied,jsd,jed,nz)
1434 if (
ASSOCIATED(cs%KE_adv))
then 1435 call safe_alloc_ptr(adp%gradKEu,isdb,iedb,jsd,jed,nz)
1436 call safe_alloc_ptr(adp%gradKEv,isd,ied,jsdb,jedb,nz)
1439 if (
ASSOCIATED(cs%KE_visc))
then 1440 call safe_alloc_ptr(adp%du_dt_visc,isdb,iedb,jsd,jed,nz)
1441 call safe_alloc_ptr(adp%dv_dt_visc,isd,ied,jsdb,jedb,nz)
1444 if (
ASSOCIATED(cs%KE_dia))
then 1445 call safe_alloc_ptr(adp%du_dt_dia,isdb,iedb,jsd,jed,nz)
1446 call safe_alloc_ptr(adp%dv_dt_dia,isd,ied,jsdb,jedb,nz)
1449 if (
ASSOCIATED(cs%uhGM_Rlay))
call safe_alloc_ptr(cdp%uhGM,isdb,iedb,jsd,jed,nz)
1450 if (
ASSOCIATED(cs%vhGM_Rlay))
call safe_alloc_ptr(cdp%vhGM,isd,ied,jsdb,jedb,nz)
1460 if (
ASSOCIATED(cs%e))
deallocate(cs%e)
1461 if (
ASSOCIATED(cs%e_D))
deallocate(cs%e_D)
1462 if (
ASSOCIATED(cs%KE))
deallocate(cs%KE)
1463 if (
ASSOCIATED(cs%dKE_dt))
deallocate(cs%dKE_dt)
1464 if (
ASSOCIATED(cs%PE_to_KE))
deallocate(cs%PE_to_KE)
1465 if (
ASSOCIATED(cs%KE_Coradv))
deallocate(cs%KE_Coradv)
1466 if (
ASSOCIATED(cs%KE_adv))
deallocate(cs%KE_adv)
1467 if (
ASSOCIATED(cs%KE_visc))
deallocate(cs%KE_visc)
1468 if (
ASSOCIATED(cs%KE_horvisc))
deallocate(cs%KE_horvisc)
1469 if (
ASSOCIATED(cs%KE_dia))
deallocate(cs%KE_dia)
1470 if (
ASSOCIATED(cs%dv_dt))
deallocate(cs%dv_dt)
1471 if (
ASSOCIATED(cs%dh_dt))
deallocate(cs%dh_dt)
1472 if (
ASSOCIATED(cs%du_dt))
deallocate(cs%du_dt)
1473 if (
ASSOCIATED(cs%h_Rlay))
deallocate(cs%h_Rlay)
1474 if (
ASSOCIATED(cs%uh_Rlay))
deallocate(cs%uh_Rlay)
1475 if (
ASSOCIATED(cs%vh_Rlay))
deallocate(cs%vh_Rlay)
1476 if (
ASSOCIATED(cs%uhGM_Rlay))
deallocate(cs%uhGM_Rlay)
1477 if (
ASSOCIATED(cs%vhGM_Rlay))
deallocate(cs%vhGM_Rlay)
1478 if (
ASSOCIATED(cs%diag_tmp3d))
deallocate(cs%diag_tmp3d)
1480 if (
ASSOCIATED(adp%gradKEu))
deallocate(adp%gradKEu)
1481 if (
ASSOCIATED(adp%gradKEu))
deallocate(adp%gradKEu)
1482 if (
ASSOCIATED(adp%du_dt_visc))
deallocate(adp%du_dt_visc)
1483 if (
ASSOCIATED(adp%dv_dt_visc))
deallocate(adp%dv_dt_visc)
1484 if (
ASSOCIATED(adp%du_dt_dia))
deallocate(adp%du_dt_dia)
1485 if (
ASSOCIATED(adp%dv_dt_dia))
deallocate(adp%dv_dt_dia)
1486 if (
ASSOCIATED(adp%du_other))
deallocate(adp%du_other)
1487 if (
ASSOCIATED(adp%dv_other))
deallocate(adp%dv_other)
1489 do m=1,cs%num_time_deriv ;
deallocate(cs%prev_val(m)%p) ;
enddo
subroutine find_weights(Rlist, R_in, k, nz, wt, wt_p)
This subroutine finds location of R_in in an increasing ordered list, Rlist, returning as k the eleme...
subroutine, public calculate_diagnostic_fields(u, v, h, uh, vh, tv, ADp, CDp, fluxes, dt, G, GV, CS, eta_bt)
Diagnostics not more naturally calculated elsewhere are computed here.
Control structure for MOM_wave_speed.
subroutine, public wave_speed_init(CS, use_ebt_mode, mono_N2_column_fraction, mono_N2_depth)
Initialize control structure for MOM_wave_speed.
subroutine, public mom_diagnostics_init(MIS, ADp, CDp, Time, G, GV, param_file, diag, CS)
This module implements boundary forcing for MOM6.
subroutine calculate_energy_diagnostics(u, v, h, uh, vh, ADp, CDp, G, CS)
This subroutine calculates terms in the mechanical energy budget.
The module calculates interface heights, including free surface height.
Ocean grid type. See mom_grid for details.
Calculates density of sea water from T, S and P.
Provides the ocean grid type.
subroutine, public do_group_pass(group, MOM_dom)
Routines for calculating baroclinic wave speeds.
The accel_diag_ptrs structure contains pointers to arrays with accelerations, which can later be used...
subroutine set_dependent_diagnostics(MIS, ADp, CDp, G, CS)
This subroutine sets up diagnostics upon which other diagnostics depend.
real function, dimension(gv %ke), public global_layer_mean(var, h, G, GV)
subroutine, public mom_diagnostics_end(CS, ADp)
The cont_diag_ptrs structure contains pointers to arrays with transports, which can later be used for...
subroutine, public register_time_deriv(f_ptr, deriv_ptr, CS)
This subroutine registers fields to calculate a diagnostic time derivative.
The ocean_internal_state structure contains pointers to all of the prognostic variables allocated in ...
Structure that contains pointers to the boundary forcing used to drive the liquid ocean simulated by ...
Provides subroutines for quantities specific to the equation of state.
real function, public global_volume_mean(var, h, G, GV)
subroutine calculate_derivs(dt, G, CS)
This subroutine calculates all registered time derivatives.
The thermo_var_ptrs structure contains pointers to an assortment of thermodynamic fields that may be ...
subroutine, public wave_speed(h, tv, G, GV, cg1, CS, full_halos, use_ebt_mode, mono_N2_column_fraction, mono_N2_depth, modal_structure)
Calculates the wave speed of the first baroclinic mode.
real function, public global_area_mean(var, G)
subroutine, public mom_error(level, message, all_print)
subroutine, public int_density_dz(T, S, z_t, z_b, rho_ref, rho_0, G_e, HII, HIO, EOS, dpa, intz_dpa, intx_dpa, inty_dpa)
This subroutine calculates analytical and nearly-analytical integrals of pressure anomalies across la...
subroutine calculate_vertical_integrals(h, tv, fluxes, G, GV, CS)
Subroutine calculates vertical integrals of several tracers, along with the mass-weight of these trac...