@@ -2,28 +2,6 @@ module MOM_set_diffusivity
2
2
3
3
! This file is part of MOM6. See LICENSE.md for the license.
4
4
5
- ! ********+*********+*********+*********+*********+*********+*********+**
6
- ! * *
7
- ! * By Robert Hallberg, September 1997 - June 2007 *
8
- ! * *
9
- ! * This file contains the subroutines that sets the diapycnal *
10
- ! * diffusivity, perhaps adding up pieces that are calculated in other *
11
- ! * files and passed in via the vertvisc type argument. *
12
- ! * *
13
- ! * A small fragment of the grid is shown below: *
14
- ! * *
15
- ! * j+1 x ^ x ^ x At x: q *
16
- ! * j+1 > o > o > At ^: v *
17
- ! * j x ^ x ^ x At >: u *
18
- ! * j > o > o > At o: h, buoy, ustar, T, S, Kd, ea, eb, etc. *
19
- ! * j-1 x ^ x ^ x *
20
- ! * i-1 i i+1 At x & ^: *
21
- ! * i i+1 At > & o: *
22
- ! * *
23
- ! * The boundaries always run through q grid points (x). *
24
- ! * *
25
- ! ********+*********+*********+*********+*********+*********+*********+**
26
-
27
5
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
28
6
use MOM_cpu_clock, only : CLOCK_MODULE_DRIVER, CLOCK_MODULE, CLOCK_ROUTINE
29
7
use MOM_diag_mediator, only : diag_ctrl, time_type
@@ -41,12 +19,11 @@ module MOM_set_diffusivity
41
19
use MOM_intrinsic_functions, only : invcosh
42
20
use MOM_io, only : slasher, vardesc, var_desc, MOM_read_data
43
21
use MOM_kappa_shear, only : calculate_kappa_shear, kappa_shear_init, Kappa_shear_CS
44
- use MOM_cvmix_shear, only : calculate_cvmix_shear, cvmix_shear_init, cvmix_shear_CS
22
+ use MOM_cvmix_shear, only : calculate_cvmix_shear, cvmix_shear_init, cvmix_shear_cs
45
23
use MOM_string_functions, only : uppercase
46
24
use MOM_thickness_diffuse, only : vert_fill_TS
47
25
use MOM_variables, only : thermo_var_ptrs, vertvisc_type, p3d
48
- use MOM_verticalGrid, only : verticalGrid_type
49
-
26
+ use MOM_verticalGrid, only : verticalGrid_type
50
27
use user_change_diffusivity, only : user_change_diff, user_change_diff_init
51
28
use user_change_diffusivity, only : user_change_diff_end, user_change_diff_CS
52
29
@@ -244,11 +221,9 @@ module MOM_set_diffusivity
244
221
logical :: user_change_diff ! If true, call user-defined code to change diffusivity.
245
222
logical :: useKappaShear ! If true, use the kappa_shear module to find the
246
223
! shear-driven diapycnal diffusivity.
247
-
248
- logical :: useCVmix ! If true, use one of the CVMix modules to find
224
+ logical :: use_cvmix_shear ! If true, use one of the CVMix modules to find
249
225
! shear-driven diapycnal diffusivity.
250
-
251
- logical :: double_diffusion ! If true, enable double-diffusive mixing.
226
+ logical :: double_diffusion ! If true, enable double-diffusive mixing.
252
227
logical :: simple_TKE_to_Kd ! If true, uses a simple estimate of Kd/TKE that
253
228
! does not rely on a layer-formulation.
254
229
real :: Max_Rrho_salt_fingers ! max density ratio for salt fingering
@@ -266,7 +241,7 @@ module MOM_set_diffusivity
266
241
type (user_change_diff_CS), pointer :: user_change_diff_CSp = > NULL ()
267
242
type (diag_to_Z_CS), pointer :: diag_to_Z_CSp = > NULL ()
268
243
type (Kappa_shear_CS), pointer :: kappaShear_CSp = > NULL ()
269
- type (CVMix_shear_CS ), pointer :: CVMix_Shear_CSp = > NULL ()
244
+ type (cvmix_shear_cs ), pointer :: cvmix_shear_csp = > NULL ()
270
245
type (int_tide_CS), pointer :: int_tide_CSp = > NULL ()
271
246
272
247
integer :: id_TKE_itidal = - 1
@@ -380,22 +355,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
380
355
optional , intent (out ) :: Kd_int ! < Diapycnal diffusivity at each interface
381
356
! ! (m2/sec).
382
357
383
- ! Arguments:
384
- ! (in) u - zonal velocity (m/s)
385
- ! (in) v - meridional velocity (m/s)
386
- ! (in) h - Layer thickness (m or kg/m2)
387
- ! (in) tv - structure with pointers to thermodynamic fields
388
- ! (in) fluxes - structure of surface fluxes that may be used
389
- ! (in) visc - structure containing vertical viscosities, bottom boundary
390
- ! layer properies, and related fields
391
- ! (in) dt - time increment (sec)
392
- ! (in) G - ocean grid structure
393
- ! (in) GV - The ocean's vertical grid structure.
394
- ! (in) CS - module control structure
395
- ! (in) j - meridional index upon which to work
396
- ! (out) Kd - diapycnal diffusivity of each layer (m2/sec)
397
- ! (out,opt) Kd_int - diapycnal diffusivity at each interface (m2/sec)
398
-
358
+ ! local variables
399
359
real , dimension (SZI_(G)) :: &
400
360
depth, & ! distance from surface of an interface (meter)
401
361
N2_bot ! bottom squared buoyancy frequency (1/s2)
@@ -580,9 +540,9 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
580
540
call hchksum(visc% TKE_turb, " after calc_KS visc%TKE_turb" ,G% HI)
581
541
endif
582
542
if (showCallTree) call callTree_waypoint(" done with calculate_kappa_shear (set_diffusivity)" )
583
- elseif (CS% useCVMix ) then
543
+ elseif (CS% use_cvmix_shear ) then
584
544
! NOTE{BGR}: this needs to be cleaned up. It works in 1D case, but has not been tested outside.
585
- call calculate_cvmix_shear(u_h, v_h, h, tv, visc% Kd_turb, visc% Kv_turb,G,GV,CS% CVMix_shear_CSp )
545
+ call calculate_cvmix_shear(u_h, v_h, h, tv, visc% Kd_turb, visc% Kv_turb,G,GV,CS% cvmix_shear_csp )
586
546
elseif (associated (visc% Kv_turb)) then
587
547
visc% Kv_turb(:,:,:) = 0 . ! needed if calculate_kappa_shear is not enabled
588
548
endif
@@ -674,6 +634,10 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
674
634
Kd(i,j,k) = max (CS% Kd_min, Kd_sfc(i,j) * &
675
635
((abs_sin * invcosh(N_2Omega/ abs_sin)) * I_x30)* N02_N2)
676
636
enddo ; enddo
637
+ ! GMM, CVMix "internal" bg mixing can go here
638
+ ! elseif (CS%use_cvmix_internal??) then
639
+
640
+
677
641
else
678
642
do k= 1 ,nz ; do i= is,ie
679
643
Kd(i,j,k) = Kd_sfc(i,j)
@@ -708,7 +672,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
708
672
endif
709
673
710
674
! Add the input turbulent diffusivity.
711
- if (CS% useKappaShear .or. CS% useCVMix ) then
675
+ if (CS% useKappaShear .or. CS% use_cvmix_shear ) then
712
676
if (present (Kd_int)) then
713
677
do K= 2 ,nz ; do i= is,ie
714
678
Kd_int(i,j,K) = visc% Kd_turb(i,j,K) + 0.5 * (Kd(i,j,k-1 ) + Kd(i,j,k))
@@ -834,6 +798,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt, &
834
798
T_f, S_f, dd% Kd_user)
835
799
endif
836
800
801
+ ! GMM, post diags...
837
802
if (CS% id_Kd_layer > 0 ) call post_data(CS% id_Kd_layer, Kd, CS% diag)
838
803
839
804
num_z_diags = 0
@@ -2533,6 +2498,7 @@ subroutine set_density_ratios(h, tv, kb, G, GV, CS, j, ds_dsp1, rho_0)
2533
2498
2534
2499
end subroutine set_density_ratios
2535
2500
2501
+ ! > Initialized the set_diffusivity module
2536
2502
subroutine set_diffusivity_init (Time , G , GV , param_file , diag , CS , diag_to_Z_CSp , int_tide_CSp )
2537
2503
type (time_type), intent (in ) :: Time
2538
2504
type (ocean_grid_type), intent (inout ) :: G ! < The ocean's grid structure.
@@ -2547,21 +2513,14 @@ subroutine set_diffusivity_init(Time, G, GV, param_file, diag, CS, diag_to_Z_CSp
2547
2513
type (int_tide_CS), pointer :: int_tide_CSp ! < pointer to the internal tides control
2548
2514
! ! structure (BDM)
2549
2515
2550
- ! Arguments:
2551
- ! (in) Time - current model time
2552
- ! (in) G - ocean grid structure
2553
- ! (in) GV - The ocean's vertical grid structure.
2554
- ! (in) param_file - structure indicating open file to parse for params
2555
- ! (in) diag - structure used to regulate diagnostic output
2556
- ! (in/out) CS - pointer set to point to the module control structure
2557
- ! (in) diag_to_Z_CSp - pointer to the Z-diagnostics control structure
2558
- ! (in) int_tide_CSp - pointer to the internal tides control structure (BDM)
2559
-
2516
+ ! local variables
2560
2517
real :: decay_length, utide, zbot, hamp
2561
2518
type (vardesc) :: vd
2562
2519
logical :: read_tideamp, ML_use_omega
2520
+
2563
2521
! This include declares and sets the variable "version".
2564
2522
#include " version_variable.h"
2523
+
2565
2524
character (len= 40 ) :: mdl = " MOM_set_diffusivity" ! This module's name.
2566
2525
character (len= 20 ) :: tmpstr
2567
2526
character (len= 200 ) :: filename, tideamp_file, h2_file, Niku_TKE_input_file
@@ -3131,6 +3090,8 @@ subroutine set_diffusivity_init(Time, G, GV, param_file, diag, CS, diag_to_Z_CSp
3131
3090
endif
3132
3091
endif
3133
3092
3093
+
3094
+ ! GMM, the following should be moved to the DD module
3134
3095
call get_param(param_file, mdl, " DOUBLE_DIFFUSION" , CS% double_diffusion, &
3135
3096
" If true, increase diffusivitives for temperature or salt \n" // &
3136
3097
" based on double-diffusive paramaterization from MOM4/KPP." , &
@@ -3181,9 +3142,9 @@ subroutine set_diffusivity_init(Time, G, GV, param_file, diag, CS, diag_to_Z_CSp
3181
3142
CS% useKappaShear = kappa_shear_init(Time, G, GV, param_file, CS% diag, CS% kappaShear_CSp)
3182
3143
if (CS% useKappaShear) &
3183
3144
id_clock_kappaShear = cpu_clock_id(' (Ocean kappa_shear)' , grain= CLOCK_MODULE)
3184
- CS% useCVMix = CVMix_shear_init(Time, G, GV, param_file, CS% diag, CS% CVMix_shear_CSp)
3185
-
3186
3145
3146
+ ! CVMix shear-driven mixing
3147
+ CS% use_cvmix_shear = cvmix_shear_init(Time, G, GV, param_file, CS% diag, CS% cvmix_shear_csp)
3187
3148
3188
3149
end subroutine set_diffusivity_init
3189
3150
0 commit comments