Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to gfdl 20200108 dev/master commit #14

Merged
merged 372 commits into from
Jan 21, 2020
Merged
Changes from 1 commit
Commits
Show all changes
372 commits
Select commit Hold shift + click to select a range
0abd134
Report negative zero min/max as positive
marshallward Sep 26, 2019
74cc9bb
+Add optional scale argument to calculate_density
Hallberg-NOAA Sep 26, 2019
d4c2dfb
+Rescale BML densities via calculate_density calls
Hallberg-NOAA Sep 26, 2019
535950c
Merge branch 'dev/gfdl' into density_rescale
Hallberg-NOAA Sep 26, 2019
5e8f287
Merge remote-tracking branch 'gfdl/dev/gfdl' into dev/esmg
kshedstrom Sep 26, 2019
4156851
Rescaled density units in MOM_entrain_diffusive
Hallberg-NOAA Sep 26, 2019
57794ad
+Changed units of GV%Rlay to [R]
Hallberg-NOAA Sep 27, 2019
bc378e3
+Move rescaling of Rlay into set_coord routines
Hallberg-NOAA Sep 27, 2019
ee6baaa
+Changed units of GV%Rho0 to [R]
Hallberg-NOAA Sep 27, 2019
59036c1
Remove extraneous 'debugging' statements
ashao Sep 27, 2019
f7b4b77
Rescaled density units in MOM_regularize_layers
Hallberg-NOAA Sep 28, 2019
297ffe5
Rescaled density units in MOM_set_viscosity
Hallberg-NOAA Sep 28, 2019
ac329db
Rescaled density units in MOM_set_diffusivity
Hallberg-NOAA Sep 28, 2019
7f8b55b
Rescaled density units in MOM_kappa_shear
Hallberg-NOAA Sep 28, 2019
af57dab
Rescaled density units in MOM_internal_tide_input
Hallberg-NOAA Sep 28, 2019
3fe1c7b
Rescaled density units in diagnoseMLDbyDensityDiff
Hallberg-NOAA Sep 28, 2019
87a2c4d
Rescaled density units in MOM_tidal_mixing
Hallberg-NOAA Sep 28, 2019
4808e3a
+Rescaled density units in MOM_geothermal
Hallberg-NOAA Sep 28, 2019
727199a
Corrected dimensions in comments
Hallberg-NOAA Sep 28, 2019
80b2d99
+Partially rescaled the units of TKE_itidal_input
Hallberg-NOAA Sep 28, 2019
68e322b
Rescaled density units in MOM_energetic_PBL
Hallberg-NOAA Sep 29, 2019
5122e33
+Rescaled density units of cTKE arguments
Hallberg-NOAA Sep 29, 2019
2d1f647
+Rescaled specific volume units of dSV_dT args
Hallberg-NOAA Sep 29, 2019
08231ca
Used GV%H_to_RZ to simplify rescalings
Hallberg-NOAA Sep 29, 2019
8e231df
+Pass mixed layer densities to sponges in [R]
Hallberg-NOAA Sep 29, 2019
e5ca06e
Rescaled units of dRhodT in applyBoundaryFluxesInOut
Hallberg-NOAA Sep 29, 2019
2e3f9c4
Rescaled density units in MOM_thickness_diffuse
Hallberg-NOAA Sep 30, 2019
3fb51fd
Rescaled units of FrictWork in MOM_hor_visc.F90
Hallberg-NOAA Sep 30, 2019
04901cd
Rescaled density units in MOM_mixed_layer_restrat
Hallberg-NOAA Sep 30, 2019
3567989
+Rescaled units of set_int_tide_input variables
Hallberg-NOAA Sep 30, 2019
ceae892
Fixing openmp compile
nikizadehgfdl Sep 30, 2019
ef1080b
+Rescaled energy units in MOM_internal_tides
Hallberg-NOAA Sep 30, 2019
1865f4f
(*)+Rescaled MEKE source element units in MEKE_type
Hallberg-NOAA Sep 30, 2019
b6dfa49
Use popcnt intrinsic for bitcount
marshallward Oct 1, 2019
401ea2b
Rescaled density units in MOM_MEKE.F90
Hallberg-NOAA Oct 1, 2019
58cb2d4
Removed a commented out statement
Hallberg-NOAA Oct 1, 2019
36fef34
Rescaled density units in initialize_temp_salt_fit
Hallberg-NOAA Oct 1, 2019
f03495f
+Rescaled density units in MOM_T_S_init_from_Z
Hallberg-NOAA Oct 1, 2019
235d3b6
Rescaled density units in calc_isoneutral_slopes
Hallberg-NOAA Oct 1, 2019
e4fea0a
(*)Simplified convert_thickness with no eqn of state
Hallberg-NOAA Oct 1, 2019
3418c1d
Merge pull request #1009 from marshallward/negzero_minmax_log
adcroft Oct 1, 2019
277ff1f
Fix -openmp compilation
nikizadehgfdl Oct 1, 2019
4d846ab
Fix openmp threads to reproduce non-openmp answers
nikizadehgfdl Oct 1, 2019
0d0ff90
Merge branch 'dev/gfdl' into fix_openmp_compile
nikizadehgfdl Oct 1, 2019
e62524b
Merge branch 'dev/gfdl' into popcnt
adcroft Oct 1, 2019
9ca5fb9
Merge pull request #1011 from marshallward/popcnt
adcroft Oct 1, 2019
729a497
Merge branch 'dev/gfdl' into fix_openmp_compile
marshallward Oct 1, 2019
d38c0dc
Merge pull request #1010 from nikizadehgfdl/fix_openmp_compile
marshallward Oct 2, 2019
3f8e704
OpenMP fix in MOM_hor_visc, and enabled testing
marshallward Oct 2, 2019
f697f13
Merge branch 'dev/gfdl' into omp_test
marshallward Oct 2, 2019
34f2c39
Rescaled density units in find_eta
Hallberg-NOAA Oct 2, 2019
7a65682
+Rescaled density units in MOM_PressureForce_Mont
Hallberg-NOAA Oct 2, 2019
fa02d85
Rescaled density units in MOM_PressureForce_AFV
Hallberg-NOAA Oct 2, 2019
27a9edd
Rescaled density units in adjust_ssh_for_p_atm
Hallberg-NOAA Oct 2, 2019
594300e
Rescaled density units in calc_diagnostic_fields
Hallberg-NOAA Oct 2, 2019
8efd5ae
Rescaled density units in MOM_wave_speed.F90
Hallberg-NOAA Oct 2, 2019
d072db2
Rescaled density units in wave_structure
Hallberg-NOAA Oct 2, 2019
45de704
Rescaled density units in MOM_tracer_hor_diff.F90
Hallberg-NOAA Oct 2, 2019
e137451
Rescaled density units in DOME_initialization.F90
Hallberg-NOAA Oct 2, 2019
a14bca0
Rescaled density units in ISOMIP_initialization.F90
Hallberg-NOAA Oct 2, 2019
fbed637
Rescaled density units in Rossby_front_2d_init.F90
Hallberg-NOAA Oct 2, 2019
ef491f7
Merge pull request #1012 from marshallward/omp_test
adcroft Oct 2, 2019
17fd654
Merge branch 'dev/gfdl' into rewrite_discontinuous_sort
adcroft Oct 2, 2019
0a8e67f
Rescaled density units in benchmark_init.F90
Hallberg-NOAA Oct 2, 2019
57e5165
Merge branch 'ashao-rewrite_discontinuous_sort' into dev/gfdl
adcroft Oct 2, 2019
15a5cb5
Rescaled density units in adjustment_init.F90
Hallberg-NOAA Oct 2, 2019
08980a7
Merge branch 'dev/gfdl' into density_rescale
Hallberg-NOAA Oct 2, 2019
e2e4bcb
+Rescaled taux_bot and tauy_bot
Hallberg-NOAA Oct 2, 2019
a669294
+Rescaled density units in coord_rho.F90
Hallberg-NOAA Oct 3, 2019
1cbf498
+Rescaled units of forces%taux to [R Z L T-2]
Hallberg-NOAA Oct 3, 2019
3be7bb5
Merge remote-tracking branch 'gfdl/dev/gfdl' into dev/esmg
kshedstrom Oct 3, 2019
3db79cd
MEKE diagnostic array fixes
marshallward Oct 3, 2019
cecc6e6
Merge branch 'dev/gfdl' into meke_diag_arrays
marshallward Oct 3, 2019
79d004b
Rescaled gustiness in MOM_surface_forcing files
Hallberg-NOAA Oct 3, 2019
fb47d7b
+Changed set_derived_forcing_fields Rho0 arg units
Hallberg-NOAA Oct 3, 2019
86216c6
Fixing up restart of tracer reservoirs.
kshedstrom Sep 5, 2019
ebd7d12
*Add OBC code to ALE regrid of u and v
kshedstrom Oct 4, 2019
dfd5278
+Changed units of fluxes%TKE_tidal to [R Z3 T-3]
Hallberg-NOAA Oct 4, 2019
ceaca56
Merge pull request #1014 from marshallward/meke_diag_arrays
adcroft Oct 4, 2019
d7f08f5
+Rescaled density units in coord_hycom.F90
Hallberg-NOAA Oct 4, 2019
e9b36cc
+Rescaled density units in coord_slight.F90
Hallberg-NOAA Oct 4, 2019
1175786
Rescaled density units in MOM_regridding.F90
Hallberg-NOAA Oct 4, 2019
3b4ea9c
+Turned heat budget pointers into arrays
Hallberg-NOAA Oct 4, 2019
2fc1b09
My understanding of OBC_RAD_VEL_WT was wrong.
kshedstrom Oct 4, 2019
fa35255
+Rescaled the units of taux_shelf and tauy_shelf
Hallberg-NOAA Oct 4, 2019
1f9144f
TC4 integration into test suite
marshallward Oct 4, 2019
34193e9
+Added scale arguments in MOM_spatial_means
Hallberg-NOAA Oct 4, 2019
dbad998
+Rescaled the units of surface mass fluxes
Hallberg-NOAA Oct 4, 2019
a5082d5
Travis python support; tc4 Makefile
marshallward Oct 5, 2019
76172d4
Simplified scaling factors in MOM_forcing_type
Hallberg-NOAA Oct 5, 2019
965c2c2
+Rescaled _rate variables from extractFluxes1d
Hallberg-NOAA Oct 5, 2019
37d5405
Combined scaling factors in MOM_forcing_type
Hallberg-NOAA Oct 5, 2019
be8e18c
+Rescaled the units of surface salt fluxes
Hallberg-NOAA Oct 5, 2019
cbe3996
Refactored solo_driver/MOM_surface_forcing.F90
Hallberg-NOAA Oct 5, 2019
8f3c126
Rescaled FLUXCONST to [Z T-1] in eight modules
Hallberg-NOAA Oct 6, 2019
3b6ccd8
Rescaled RHO0 to [R] in four modules
Hallberg-NOAA Oct 6, 2019
838bc41
Removed unused code in MOM_barotropic.F90
Hallberg-NOAA Oct 6, 2019
1d3e21e
Merge branch 'dev/gfdl' into density_rescale
Hallberg-NOAA Oct 6, 2019
35b884d
Fixed a recently added bug in insert_brine
Hallberg-NOAA Oct 6, 2019
5484ab0
+Pass timestep to insert_brine in units of [T]
Hallberg-NOAA Oct 7, 2019
3f69350
+Pass timestep to extractFluxes1d in units of [T]
Hallberg-NOAA Oct 7, 2019
ecf5813
+Pass timestep to thickness_diffuse in units of [T]
Hallberg-NOAA Oct 7, 2019
d5ee19a
Store timestep in [T} in sum_output_CS
Hallberg-NOAA Oct 7, 2019
a4da592
+Rescaled the units of fluxes%heat_content_... vars
Hallberg-NOAA Oct 8, 2019
b4f5264
ALE: Float ID inequality replaced with integer
marshallward Oct 8, 2019
5312d99
Cleaned up code in insert_brine
Hallberg-NOAA Oct 8, 2019
e55ad23
+Pass timestep to step_forward_MEKE in units of [T]
Hallberg-NOAA Oct 8, 2019
55a0484
Fixed a rescaling factor in entrainment_diffusive
Hallberg-NOAA Oct 8, 2019
59b18f0
+Pass timestep to btstep in units of [T]
Hallberg-NOAA Oct 8, 2019
f1b9c66
+Pass timestep to btstep in units of [T]
Hallberg-NOAA Oct 8, 2019
8ade6de
+Pass MLDdensityDifference in units of [R]
Hallberg-NOAA Oct 8, 2019
0d43bc3
Corrected units in parameterization code comments
Hallberg-NOAA Oct 8, 2019
d518449
Corrected units in MOM_hor_visc code comments
Hallberg-NOAA Oct 8, 2019
629416b
+Rescaled the units of tv%salt_deficit
Hallberg-NOAA Oct 8, 2019
4bcd442
Merge pull request #1018 from marshallward/ale_ineq_1016
Hallberg-NOAA Oct 9, 2019
12d3aac
T scaling and OpenMP fixes
marshallward Oct 10, 2019
b3e4b3c
Merge pull request #1 from marshallward/pr_1019_fix
Hallberg-NOAA Oct 10, 2019
28bc95e
Makefile: MPI flag test; REPRO flag; diff report
marshallward Oct 11, 2019
d243193
Merge branch 'dev/gfdl' of https://github.com/noaa-gfdl/mom6 into mk_…
marshallward Oct 11, 2019
79a8fe2
Ice shelf and barotropic rescale variable init
marshallward Oct 16, 2019
5f81b73
Fix the downsampled "summed" diagnostics
nikizadehgfdl Oct 18, 2019
defb0c5
Verify ENABLE_THERMODYNAMICS is True before posting C_p diagnostic
MJHarrison-GFDL Oct 25, 2019
9fdbe98
Merge branch 'tc4_fix' of github.com:marshallward/MOM6 into gcc_7_4_0…
Oct 25, 2019
3c0d52a
Make tc4 faster
MJHarrison-GFDL Oct 25, 2019
817bdde
remove trailing whitespace
MJHarrison-GFDL Oct 25, 2019
1b96028
Merge pull request #1 from MJHarrison-GFDL/gcc_7_4_0_patch
marshallward Oct 25, 2019
3367d0e
Merge branch 'density_rescale' of https://github.com/Hallberg-NOAA/MO…
Hallberg-NOAA Oct 25, 2019
231f120
add unit scaling
MJHarrison-GFDL Oct 29, 2019
c4606e1
fix restart fail for tc4 and some cleanup
MJHarrison-GFDL Oct 29, 2019
8a52f40
Merge branch 'gcc_7_4_0_patch' of github.com:MJHarrison-GFDL/MOM6 int…
MJHarrison-GFDL Oct 29, 2019
251b0d9
remove trailiny ws
MJHarrison-GFDL Oct 29, 2019
241f3ba
Renamed internal vars dt to dt_in_s in MOM_dynamics
Hallberg-NOAA Oct 31, 2019
0be3f0e
+Pass timesteps to sponge code in [T]
Hallberg-NOAA Oct 31, 2019
7e0e505
Renamed internal variables dt_in_T to dt
Hallberg-NOAA Oct 31, 2019
41c860a
+Rescaled advective and diffusive tracer diags
Hallberg-NOAA Oct 31, 2019
2cd8276
Clarified comments in MOM_tracer_diabatic
Hallberg-NOAA Oct 31, 2019
88fcb8a
+Rescaled timestep arguments to several routines
Hallberg-NOAA Oct 31, 2019
3c71c13
+Corrected restart registration for US%m_to_L
Hallberg-NOAA Oct 31, 2019
34e612f
Pass dt in [T] to tracer_vertdiff for temperature
Hallberg-NOAA Oct 31, 2019
ce4ed7d
Kh_max_x[xy], Ah_max_xy chksum and alloc fixes
marshallward Nov 1, 2019
77e7342
Merge pull request #2 from MJHarrison-GFDL/gcc_7_4_0_patch
marshallward Nov 1, 2019
ec851ed
Extend z_top and z_btm density calculation in diag
marshallward Nov 4, 2019
0eaeb81
Wave speed diag: explicit argument calcs
marshallward Nov 4, 2019
aec5eb4
opacity: netPen explicit summation
marshallward Nov 4, 2019
a016e3b
Neutral diffusion unit testing tolerance set
marshallward Nov 4, 2019
b2e2511
advect_x logical test split
marshallward Nov 4, 2019
2518c36
Initialize surface forcing adjustments to zero
marshallward Nov 4, 2019
fa97128
MOM_entrain_diffusive logical nesting
marshallward Nov 4, 2019
f607a45
MOM_set_viscosity logic split
marshallward Nov 5, 2019
8834b3b
Merge pull request #1020 from marshallward/mk_fixes
adcroft Nov 5, 2019
b2fb9cc
Merge branch 'dev/gfdl' into tc-reconfig
marshallward Nov 5, 2019
54fc734
Mixedlayer_restrat density update
marshallward Nov 5, 2019
2980893
Merge branch 'dev/gfdl' into nan_fixes
marshallward Nov 5, 2019
83d8297
Merge pull request #1004 from adcroft/tc-reconfig
marshallward Nov 5, 2019
eca876e
Merge branch 'dev/gfdl' into nan_fixes
marshallward Nov 5, 2019
daa4a3a
Merge branch 'dev/gfdl' into dev/esmg
marshallward Nov 5, 2019
edc5c17
Merge branch 'dev/master' into dev_merge
marshallward Nov 7, 2019
802f830
Merge pull request #1025 from marshallward/dev_merge
adcroft Nov 7, 2019
e60c546
Merge branch 'dev/gfdl' into variable_init_fixes
marshallward Nov 8, 2019
76425c9
Merge branch 'dev/gfdl' into visc_max_chksums
marshallward Nov 8, 2019
cafd3e8
Merge branch 'dev/gfdl' into fix_downsampled_transport_diags
adcroft Nov 8, 2019
9a44252
Merge pull request #1022 from nikizadehgfdl/fix_downsampled_transport…
adcroft Nov 8, 2019
afb932a
Merge branch 'dev/gfdl' into variable_init_fixes
adcroft Nov 8, 2019
c43ffaa
Merge pull request #1021 from marshallward/variable_init_fixes
adcroft Nov 8, 2019
2c604c0
Merge branch 'dev/esmg' of https://github.com/ESMG/MOM6 into ESMG-dev…
adcroft Nov 8, 2019
dd0e7d4
Merge branch 'ESMG-dev/esmg' into dev/gfdl
adcroft Nov 8, 2019
58e84e8
Merge branch 'dev/gfdl' into visc_max_chksums
marshallward Nov 8, 2019
b541527
Merge branch 'dev/gfdl' into visc_max_chksums
adcroft Nov 8, 2019
5af42c6
Merge branch 'dev/gfdl' into density_rescale
Hallberg-NOAA Nov 8, 2019
0949df6
Merge branch 'dev/gfdl' into nan_merge
marshallward Nov 9, 2019
1a4903e
Corrected the dimensional rescaling in MOM_MEKE.F90
Hallberg-NOAA Nov 9, 2019
1b5d722
+Added enable_averages
Hallberg-NOAA Nov 9, 2019
2da48dc
Use enable_averages in MOM_dynamics modules
Hallberg-NOAA Nov 9, 2019
8000b1c
Merge pull request #1023 from marshallward/visc_max_chksums
Hallberg-NOAA Nov 9, 2019
0fab529
Merge branch 'dev/gfdl' into density_rescale
Hallberg-NOAA Nov 9, 2019
148fcf2
Rescaled timesteps in MOM.F90
Hallberg-NOAA Nov 10, 2019
81f3a58
RK2 split pass_init clock timer initialization
marshallward Nov 12, 2019
02bb5d7
Merge branch 'dev/gfdl' into nan_merge
marshallward Nov 12, 2019
0c390a3
Merge pull request #1026 from marshallward/nan_merge
adcroft Nov 12, 2019
a919f23
+Fixed unit conversion factors for 7 diagnostics
Hallberg-NOAA Nov 12, 2019
e2815d2
Merge branch 'dev/gfdl' into density_rescale
Hallberg-NOAA Nov 12, 2019
186beda
+Pass timesteps to diagnostic routines in [T]
Hallberg-NOAA Nov 13, 2019
ef462a8
Removed the accidental 2 in a comment
Hallberg-NOAA Nov 13, 2019
096761e
Merge branch 'dev/gfdl' into tc4_fix
marshallward Nov 13, 2019
18e5894
Enable tc4.restart test
marshallward Nov 13, 2019
840881d
Merge pull request #1019 from Hallberg-NOAA/density_rescale
marshallward Nov 13, 2019
605d1bc
+Pass timeesteps to tracer diagnostics in [T]
Hallberg-NOAA Nov 13, 2019
08dbb59
+Rescaled tracer advective flux diagnostics
Hallberg-NOAA Nov 13, 2019
00da24e
+Pass timesteps to ALE_main in [T]
Hallberg-NOAA Nov 13, 2019
0281e21
+Pass timesteps to tracer column_physics in [T]
Hallberg-NOAA Nov 14, 2019
b80d82e
+Pass timesteps to applyTracerBoundaryFluxesInOut in [T]
Hallberg-NOAA Nov 14, 2019
a3b7adc
Simplified expressions in MOM_PointAccel
Hallberg-NOAA Nov 14, 2019
2b0fea2
Corrected dimensional epsilons in downscaling
Hallberg-NOAA Nov 14, 2019
b48b594
Simplified expressions in MOM_offline_aux
Hallberg-NOAA Nov 14, 2019
44cfd27
Revised wave_speed to return speed in [L T-1]
Hallberg-NOAA Nov 14, 2019
f8b7564
Travis: Move regression tests to separate build
marshallward Nov 15, 2019
558b5e0
Testing: Makefile typo
marshallward Nov 15, 2019
8791de3
Merge pull request #1030 from marshallward/travis_regression_fix
adcroft Nov 15, 2019
4053e7d
Merge branch 'dev/gfdl' into tc4_fix
marshallward Nov 15, 2019
05b136b
Rescaled internal variables in wave_speed
Hallberg-NOAA Nov 15, 2019
6e115b7
+Changed the units of minimum_forcing_depth to [H]
Hallberg-NOAA Nov 15, 2019
c741390
Correction of documented units in comments
Hallberg-NOAA Nov 15, 2019
8b7a692
Merge branch 'dev/gfdl' into rescale_cleanup
Hallberg-NOAA Nov 15, 2019
f8f106a
Adiabatic clock ID bugfix
marshallward Nov 19, 2019
2ae0a68
Corrected an OMP declaration
Hallberg-NOAA Nov 20, 2019
be50409
Merge pull request #1032 from Hallberg-NOAA/rescale_cleanup
adcroft Nov 22, 2019
4b241f6
Merge branch 'dev/gfdl' into adiabatic_clock_id_fix
adcroft Nov 22, 2019
686302e
Update MOM.F90
marshallward Nov 22, 2019
ba45244
Merge pull request #1034 from marshallward/adiabatic_clock_id_fix
adcroft Nov 22, 2019
aaa58ca
Dimensional rescaling in MOM_open_boundary.F90
Hallberg-NOAA Nov 25, 2019
98e1450
(*)Fixed invariance bugs in MOM_open_boundary.F90
Hallberg-NOAA Nov 26, 2019
279fd7b
Merge branch 'dev/gfdl' into tc4_fix
adcroft Nov 26, 2019
3ea8609
Merge pull request #1031 from marshallward/tc4_fix
adcroft Nov 27, 2019
1c17bc4
Merge branch 'dev/gfdl' into revise_OBCs
adcroft Nov 27, 2019
0e0f6e9
Merge pull request #1037 from Hallberg-NOAA/revise_OBCs
adcroft Nov 27, 2019
4edc165
(*)Fixed dimensional inconsistency in P3M_functions
Hallberg-NOAA Dec 1, 2019
e9ee86a
+Added REMAPPING_2018 runtime option
Hallberg-NOAA Dec 2, 2019
aac71f5
Fix units for terms used in advection of MEKE
adcroft Dec 2, 2019
b7b7fbc
Removed out-of-date commented code
adcroft Nov 27, 2019
9c4d22d
Updated/added comments for units of variables in MOM_MEKE.F90
adcroft Nov 27, 2019
7dca672
Corrected the formatting of a doxygen comment
Hallberg-NOAA Dec 2, 2019
285273a
Corrected/added converted MKS units in comments
adcroft Dec 2, 2019
7a404fe
Added more converted MKS units in comments
adcroft Dec 2, 2019
bfa303d
Merge pull request #1039 from adcroft/fix-units-for-meke-advection
Hallberg-NOAA Dec 2, 2019
4158a7e
Merge branch 'dev/gfdl' into ALE_remap_fix
adcroft Dec 3, 2019
c9a7f98
Merge branch 'Hallberg-NOAA-ALE_remap_fix' into dev/gfdl
adcroft Dec 3, 2019
bb3827e
Added conversion factors to forcing diagnostics
Hallberg-NOAA Dec 4, 2019
3d7456a
Added correct scaling factors to chksum calls
Hallberg-NOAA Dec 4, 2019
6ab1721
+Unscales area before taking global sum
Hallberg-NOAA Dec 4, 2019
babc30a
(*)Correct dimensionally inconsistent advective CFL
Hallberg-NOAA Dec 4, 2019
e0d7236
Unscale sea level before averaging
Hallberg-NOAA Dec 4, 2019
5a8f17e
+Added an optional tmp_scale arg to global_i_mean
Hallberg-NOAA Dec 4, 2019
274a613
Expand consistency testing with i-mean sponges
Hallberg-NOAA Dec 4, 2019
4d7a947
Merge pull request #1040 from Hallberg-NOAA/rescale_diag_fix
marshallward Dec 6, 2019
0a3faa7
+Simplified handling of time with forcing type
Hallberg-NOAA Dec 6, 2019
dacde02
Merge branch 'dev/gfdl' into simplify_forcing_time
Hallberg-NOAA Dec 6, 2019
ef86e87
+Added the new parameter KAPPA_SHEAR_ITER_BUG
Hallberg-NOAA Dec 6, 2019
5ad6a38
+(*)Add the new parameter VERT_FRICTION_2018_ANSWERS
Hallberg-NOAA Dec 10, 2019
0896225
Merge branch 'Hallberg-NOAA-kappa_shear_bugfix' into dev/gfdl
adcroft Dec 16, 2019
975c004
Merge branch 'revise_vert_friction' of https://github.com/Hallberg-NO…
adcroft Dec 16, 2019
711a16c
Merge branch 'Hallberg-NOAA-revise_vert_friction' into dev/gfdl
adcroft Dec 16, 2019
44efd50
Merge branch 'simplify_forcing_time' of https://github.com/Hallberg-N…
adcroft Dec 16, 2019
d23a1f9
Merge branch 'Hallberg-NOAA-simplify_forcing_time' into dev/gfdl
adcroft Dec 16, 2019
7951a84
fix divide by zero
DeniseWorthen Dec 31, 2019
ae51d44
fix to wave_interface for debugging; looked safe but gave error
DeniseWorthen Dec 31, 2019
40871c1
more better way of fixing divide by zero
DeniseWorthen Jan 1, 2020
9269820
Corrected arguments to mct coupler iceberg calls
Hallberg-NOAA Jan 6, 2020
9f31539
Merge branch 'dev-master-candidate-2019-12-17' into dev/master
adcroft Jan 8, 2020
d866315
solve conflict in mom_surface_forcing_nuopc.F90
jiandewang Jan 9, 2020
ca73ebb
Merge remote-tracking branch 'Denise/feature/debugMOM6' into update-t…
jiandewang Jan 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rescaled density units in MOM_set_viscosity
  Rescaled density units in MOM_set_viscosity for dimensional consistency
testing.  All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Sep 28, 2019
commit 297ffe5c3fd310dc0c9891573774c18d05d76c5b
94 changes: 47 additions & 47 deletions src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
@@ -135,15 +135,15 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
S_EOS, & ! The salinity used to calculate the partial derivatives
! of density with T and S [ppt].
dR_dT, & ! Partial derivative of the density in the bottom boundary
! layer with temperature [kg m-3 degC-1].
! layer with temperature [R degC-1 ~> kg m-3 degC-1].
dR_dS, & ! Partial derivative of the density in the bottom boundary
! layer with salinity [kg m-3 ppt-1].
! layer with salinity [R ppt-1 ~> kg m-3 ppt-1].
press ! The pressure at which dR_dT and dR_dS are evaluated [Pa].
real :: htot ! Sum of the layer thicknesses up to some point [H ~> m or kg m-2].
real :: htot_vel ! Sum of the layer thicknesses up to some point [H ~> m or kg m-2].

real :: Rhtot ! Running sum of thicknesses times the layer potential
! densities [H kg m-3 ~> kg m-2 or kg2 m-5].
! densities [H R ~> kg m-2 or kg2 m-5].
real, dimension(SZIB_(G),SZJ_(G)) :: &
D_u, & ! Bottom depth interpolated to u points [Z ~> m].
mask_u ! A mask that disables any contributions from u points that
@@ -163,21 +163,21 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
S_vel, & ! Arithmetic mean of the layer salinities adjacent to a
! velocity point [ppt].
Rml_vel ! Arithmetic mean of the layer coordinate densities adjacent
! to a velocity point [kg m-3].
! to a velocity point [R ~> kg m-3].

real :: h_vel_pos ! The arithmetic mean thickness at a velocity point
! plus H_neglect to avoid 0 values [H ~> m or kg m-2].
real :: ustarsq ! 400 times the square of ustar, times
! Rho0 divided by G_Earth and the conversion
! from m to thickness units [H kg m-3 ~> kg m-2 or kg2 m-5].
! from m to thickness units [H R ~> kg m-2 or kg2 m-5].
real :: cdrag_sqrt_Z ! Square root of the drag coefficient, times a unit conversion
! factor from lateral lengths to vertical depths [Z L-1 ~> 1].
real :: cdrag_sqrt ! Square root of the drag coefficient [nondim].
real :: oldfn ! The integrated energy required to
! entrain up to the bottom of the layer,
! divided by G_Earth [H kg m-3 ~> kg m-2 or kg2 m-5].
! divided by G_Earth [H R ~> kg m-2 or kg2 m-5].
real :: Dfn ! The increment in oldfn for entraining
! the layer [H kg m-3 ~> kg m-2 or kg2 m-5].
! the layer [H R ~> kg m-2 or kg2 m-5].
real :: Dh ! The increment in layer thickness from
! the present layer [H ~> m or kg m-2].
real :: bbl_thick ! The thickness of the bottom boundary layer [H ~> m or kg m-2].
@@ -198,10 +198,10 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
! of the bottom [H ~> m or kg m-2].
real :: v_at_u, u_at_v ! v at a u point or vice versa [L T-1 ~> m s-1].
real :: Rho0x400_G ! 400*Rho0/G_Earth, times unit conversion factors
! [kg T2 H m-3 Z-2 ~> kg s2 m-4 or kg2 s2 m-7].
! [R T2 H Z-2 ~> kg s2 m-4 or kg2 s2 m-7].
! The 400 is a constant proposed by Killworth and Edwards, 1999.
real, dimension(SZI_(G),SZJ_(G),max(GV%nk_rho_varies,1)) :: &
Rml ! The mixed layer coordinate density [kg m-3].
Rml ! The mixed layer coordinate density [R ~> kg m-3].
real :: p_ref(SZI_(G)) ! The pressure used to calculate the coordinate
! density [Pa] (usually set to 2e7 Pa = 2000 dbar).

@@ -269,7 +269,7 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
Isq = G%IscB ; Ieq = G%IecB ; Jsq = G%JscB ; Jeq = G%JecB
nkmb = GV%nk_rho_varies ; nkml = GV%nkml
h_neglect = GV%H_subroundoff
Rho0x400_G = 400.0*(US%R_to_kg_m3*GV%Rho0 / (US%L_to_Z**2 * GV%g_Earth)) * GV%Z_to_H
Rho0x400_G = 400.0*(GV%Rho0 / (US%L_to_Z**2 * GV%g_Earth)) * GV%Z_to_H
Vol_quit = 0.9*GV%Angstrom_H + h_neglect
C2pi_3 = 8.0*atan(1.0)/3.0

@@ -304,7 +304,7 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
!$OMP parallel do default(shared)
do j=Jsq,Jeq+1 ; do k=1,nkmb
call calculate_density(tv%T(:,j,k), tv%S(:,j,k), p_ref, &
Rml(:,j,k), Isq, Ieq-Isq+2, tv%eqn_of_state)
Rml(:,j,k), Isq, Ieq-Isq+2, tv%eqn_of_state, scale=US%kg_m3_to_R)
enddo ; enddo
endif

@@ -545,7 +545,7 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
press(i) = press(i) + GV%H_to_Pa * h_vel(i,k)
enddo ; enddo
call calculate_density_derivs(T_EOS, S_EOS, press, dR_dT, dR_dS, &
is-G%IsdB+1, ie-is+1, tv%eqn_of_state)
is-G%IsdB+1, ie-is+1, tv%eqn_of_state, scale=US%kg_m3_to_R)
endif

do i=is,ie ; if (do_i(i)) then
@@ -574,7 +574,7 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
if ((oldfn + Dfn) <= ustarsq) then
Dh = h_at_vel(i,k)
else
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn)/Dfn)
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn) / (Dfn))
endif

htot = htot + Dh
@@ -589,19 +589,19 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
else ! Use Rlay and/or the coordinate density as density variables.
Rhtot = 0.0
do k=nz,K2,-1
oldfn = Rhtot - US%R_to_kg_m3*GV%Rlay(k)*htot
Dfn = (US%R_to_kg_m3*GV%Rlay(k) - US%R_to_kg_m3*GV%Rlay(k-1))*(h_at_vel(i,k)+htot)
oldfn = Rhtot - GV%Rlay(k)*htot
Dfn = (GV%Rlay(k) - GV%Rlay(k-1))*(h_at_vel(i,k)+htot)

if (oldfn >= ustarsq) then
cycle
elseif ((oldfn + Dfn) <= ustarsq) then
Dh = h_at_vel(i,k)
else
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn)/Dfn)
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn) / (Dfn))
endif

htot = htot + Dh
Rhtot = Rhtot + US%R_to_kg_m3*GV%Rlay(k)*Dh
Rhtot = Rhtot + GV%Rlay(k)*Dh
enddo
if (nkml>0) then
do k=nkmb,2,-1
@@ -613,15 +613,15 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
elseif ((oldfn + Dfn) <= ustarsq) then
Dh = h_at_vel(i,k)
else
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn)/Dfn)
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn) / (Dfn))
endif

htot = htot + Dh
Rhtot = Rhtot + Rml_vel(i,k)*Dh
enddo
if (Rhtot - Rml_vel(i,1)*htot < ustarsq) htot = htot + h_at_vel(i,1)
else
if (Rhtot - US%R_to_kg_m3*GV%Rlay(1)*htot < ustarsq) htot = htot + h_at_vel(i,1)
if (Rhtot - GV%Rlay(1)*htot < ustarsq) htot = htot + h_at_vel(i,1)
endif
endif ! use_BBL_EOS

@@ -1034,15 +1034,15 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
Shtot, & ! The integrated salt of layers that are within the
! surface mixed layer [H ppt ~> m ppt or kg ppt m-2].
Rhtot, & ! The integrated density of layers that are within the surface mixed layer
! [H kg m-3 ~> kg m-2 or kg2 m-5]. Rhtot is only used if no
! [H R ~> kg m-2 or kg2 m-5]. Rhtot is only used if no
! equation of state is used.
uhtot, & ! The depth integrated zonal and meridional velocities within
vhtot, & ! the surface mixed layer [H L T-1 ~> m2 s-1 or kg m-1 s-1].
Idecay_len_TKE, & ! The inverse of a turbulence decay length scale [H-1 ~> m-1 or m2 kg-1].
dR_dT, & ! Partial derivative of the density at the base of layer nkml
! (roughly the base of the mixed layer) with temperature [kg m-3 degC-1].
! (roughly the base of the mixed layer) with temperature [R degC-1 ~> kg m-3 degC-1].
dR_dS, & ! Partial derivative of the density at the base of layer nkml
! (roughly the base of the mixed layer) with salinity [kg m-3 ppt-1].
! (roughly the base of the mixed layer) with salinity [R ppt-1 ~> kg m-3 ppt-1].
ustar, & ! The surface friction velocity under ice shelves [Z T-1 ~> m s-1].
press, & ! The pressure at which dR_dT and dR_dS are evaluated [Pa].
T_EOS, & ! The potential temperature at which dR_dT and dR_dS are evaluated [degC]
@@ -1076,8 +1076,8 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
real :: I_2hlay ! 1 / 2*hlay [H-1 ~> m-1 or m2 kg-1].
real :: T_lay ! The layer temperature at velocity points [degC].
real :: S_lay ! The layer salinity at velocity points [ppt].
real :: Rlay ! The layer potential density at velocity points [kg m-3].
real :: Rlb ! The potential density of the layer below [kg m-3].
real :: Rlay ! The layer potential density at velocity points [R ~> kg m-3].
real :: Rlb ! The potential density of the layer below [R ~> kg m-3].
real :: v_at_u ! The meridonal velocity at a zonal velocity point [L T-1 ~> m s-1].
real :: u_at_v ! The zonal velocity at a meridonal velocity point [L T-1 ~> m s-1].
real :: gHprime ! The mixed-layer internal gravity wave speed squared, based
@@ -1089,18 +1089,18 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
real :: dt_Rho0 ! The time step divided by the conversion from the layer
! thickness to layer mass [s H m2 kg-1 ~> s m3 kg-1 or s].
real :: g_H_Rho0 ! The gravitational acceleration times the conversion from H to m divided
! by the mean density [L2 m3 T-2 H-1 kg-1 ~> m4 s-2 kg-1 or m7 s-2 kg-2].
! by the mean density [L2 T-2 H-1 R-1 ~> m4 s-2 kg-1 or m7 s-2 kg-2].
real :: ustarsq ! 400 times the square of ustar, times
! Rho0 divided by G_Earth and the conversion
! from m to thickness units [H kg m-3 ~> kg m-2 or kg2 m-5].
! from m to thickness units [H R ~> kg m-2 or kg2 m-5].
real :: cdrag_sqrt_Z ! Square root of the drag coefficient, times a unit conversion
! factor from lateral lengths to vertical depths [Z L-1 ~> 1].
real :: cdrag_sqrt ! Square root of the drag coefficient [nondim].
real :: oldfn ! The integrated energy required to
! entrain up to the bottom of the layer,
! divided by G_Earth [H kg m-3 ~> kg m-2 or kg2 m-5].
! divided by G_Earth [H R ~> kg m-2 or kg2 m-5].
real :: Dfn ! The increment in oldfn for entraining
! the layer [H kg m-3 ~> kg m-2 or kg2 m-5].
! the layer [H R ~> kg m-2 or kg2 m-5].
real :: Dh ! The increment in layer thickness from
! the present layer [H ~> m or kg m-2].
real :: U_bg_sq ! The square of an assumed background velocity, for
@@ -1113,7 +1113,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
real :: h_neglect ! A thickness that is so small it is usually lost
! in roundoff and can be neglected [H ~> m or kg m-2].
real :: Rho0x400_G ! 400*Rho0/G_Earth, times unit conversion factors
! [kg T2 H m-3 Z-2 ~> kg s2 m-4 or kg2 s2 m-7].
! [R T2 H Z-2 ~> kg s2 m-4 or kg2 s2 m-7].
! The 400 is a constant proposed by Killworth and Edwards, 1999.
real :: ustar1 ! ustar [H T-1 ~> m s-1 or kg m-2 s-1]
real :: h2f2 ! (h*2*f)^2 [H2 T-2 ~> m2 s-2 or kg2 m-4 s-2]
@@ -1134,7 +1134,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
Jsq = js-1 ; Isq = is-1
endif ; endif

Rho0x400_G = 400.0*(US%R_to_kg_m3*GV%Rho0/(US%L_to_Z**2 * GV%g_Earth)) * GV%Z_to_H
Rho0x400_G = 400.0*(GV%Rho0/(US%L_to_Z**2 * GV%g_Earth)) * GV%Z_to_H
U_bg_sq = CS%drag_bg_vel * CS%drag_bg_vel
cdrag_sqrt = sqrt(CS%cdrag)
cdrag_sqrt_Z = US%L_to_Z * sqrt(CS%cdrag)
@@ -1144,7 +1144,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
dt_Rho0 = US%T_to_s*dt_in_T / GV%H_to_kg_m2
h_neglect = GV%H_subroundoff
h_tiny = 2.0*GV%Angstrom_H + h_neglect
g_H_Rho0 = (GV%g_Earth*GV%H_to_Z) / (US%R_to_kg_m3*GV%Rho0)
g_H_Rho0 = (GV%g_Earth*GV%H_to_Z) / (GV%Rho0)

if (associated(forces%frac_shelf_u) .neqv. associated(forces%frac_shelf_v)) &
call MOM_error(FATAL, "set_viscous_ML: one of forces%frac_shelf_u and "//&
@@ -1232,7 +1232,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
S_EOS(I) = (h(i,j,k2)*tv%S(i,j,k2) + h(i+1,j,k2)*tv%S(i+1,j,k2)) * I_2hlay
enddo
call calculate_density_derivs(T_EOS, S_EOS, press, dR_dT, dR_dS, &
Isq-G%IsdB+1, Ieq-Isq+1, tv%eqn_of_state)
Isq-G%IsdB+1, Ieq-Isq+1, tv%eqn_of_state, scale=US%kg_m3_to_R)
endif

do I=Isq,Ieq ; if (do_i(I)) then
@@ -1250,7 +1250,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
gHprime = g_H_Rho0 * (dR_dT(I) * (T_lay*htot(I) - Thtot(I)) + &
dR_dS(I) * (S_lay*htot(I) - Shtot(I)))
else
gHprime = g_H_Rho0 * (US%R_to_kg_m3*GV%Rlay(k)*htot(I) - Rhtot(I))
gHprime = g_H_Rho0 * (GV%Rlay(k)*htot(I) - Rhtot(I))
endif

if (gHprime > 0.0) then
@@ -1282,7 +1282,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
Thtot(I) = Thtot(I) + 0.5 * (h(i,j,k)*tv%T(i,j,k) + h(i+1,j,k)*tv%T(i+1,j,k))
Shtot(I) = Shtot(I) + 0.5 * (h(i,j,k)*tv%S(i,j,k) + h(i+1,j,k)*tv%S(i+1,j,k))
else
Rhtot(i) = Rhtot(i) + 0.5 * (h(i,j,k) + h(i+1,j,k)) * US%R_to_kg_m3*GV%Rlay(k)
Rhtot(i) = Rhtot(i) + 0.5 * (h(i,j,k) + h(i+1,j,k)) * GV%Rlay(k)
endif
endif ; enddo
enddo ; endif
@@ -1353,7 +1353,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym

if (use_EOS) then
call calculate_density_derivs(T_EOS, S_EOS, forces%p_surf(:,j), &
dR_dT, dR_dS, Isq-G%IsdB+1, Ieq-Isq+1, tv%eqn_of_state)
dR_dT, dR_dS, Isq-G%IsdB+1, Ieq-Isq+1, tv%eqn_of_state, scale=US%kg_m3_to_R)
endif

do I=Isq,Ieq ; if (do_i(I)) then
@@ -1376,7 +1376,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
if ((oldfn + Dfn) <= ustarsq) then
Dh = h_at_vel(i,k)
else
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn)/Dfn)
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn) / (Dfn))
endif

htot(i) = htot(i) + Dh
@@ -1392,7 +1392,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
else ! Use Rlay as the density variable.
Rhtot = 0.0
do k=1,nz-1
Rlay = US%R_to_kg_m3*GV%Rlay(k) ; Rlb = US%R_to_kg_m3*GV%Rlay(k+1)
Rlay = GV%Rlay(k) ; Rlb = GV%Rlay(k+1)

oldfn = Rlay*htot(i) - Rhtot(i)
if (oldfn >= ustarsq) exit
@@ -1401,13 +1401,13 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
if ((oldfn + Dfn) <= ustarsq) then
Dh = h_at_vel(i,k)
else
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn)/Dfn)
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn) / (Dfn))
endif

htot(i) = htot(i) + Dh
Rhtot(i) = Rhtot(i) + Rlay*Dh
enddo
if (US%R_to_kg_m3*GV%Rlay(nz)*htot(i) - Rhtot(i) < ustarsq) &
if (GV%Rlay(nz)*htot(i) - Rhtot(i) < ustarsq) &
htot(i) = htot(i) + h_at_vel(i,nz)
endif ! use_EOS

@@ -1469,7 +1469,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
S_EOS(i) = (h(i,j,k2)*tv%S(i,j,k2) + h(i,j+1,k2)*tv%S(i,j+1,k2)) * I_2hlay
enddo
call calculate_density_derivs(T_EOS, S_EOS, press, dR_dT, dR_dS, &
is-G%IsdB+1, ie-is+1, tv%eqn_of_state)
is-G%IsdB+1, ie-is+1, tv%eqn_of_state, scale=US%kg_m3_to_R)
endif

do i=is,ie ; if (do_i(i)) then
@@ -1487,7 +1487,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
gHprime = g_H_Rho0 * (dR_dT(i) * (T_lay*htot(i) - Thtot(i)) + &
dR_dS(i) * (S_lay*htot(i) - Shtot(i)))
else
gHprime = g_H_Rho0 * (US%R_to_kg_m3*GV%Rlay(k)*htot(i) - Rhtot(i))
gHprime = g_H_Rho0 * (GV%Rlay(k)*htot(i) - Rhtot(i))
endif

if (gHprime > 0.0) then
@@ -1519,7 +1519,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
Thtot(i) = Thtot(i) + 0.5 * (h(i,j,k)*tv%T(i,j,k) + h(i,j+1,k)*tv%T(i,j+1,k))
Shtot(i) = Shtot(i) + 0.5 * (h(i,j,k)*tv%S(i,j,k) + h(i,j+1,k)*tv%S(i,j+1,k))
else
Rhtot(i) = Rhtot(i) + 0.5 * (h(i,j,k) + h(i,j+1,k)) * US%R_to_kg_m3*GV%Rlay(k)
Rhtot(i) = Rhtot(i) + 0.5 * (h(i,j,k) + h(i,j+1,k)) * GV%Rlay(k)
endif
endif ; enddo
enddo ; endif
@@ -1590,7 +1590,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym

if (use_EOS) then
call calculate_density_derivs(T_EOS, S_EOS, forces%p_surf(:,j), &
dR_dT, dR_dS, is-G%IsdB+1, ie-is+1, tv%eqn_of_state)
dR_dT, dR_dS, is-G%IsdB+1, ie-is+1, tv%eqn_of_state, scale=US%kg_m3_to_R)
endif

do i=is,ie ; if (do_i(i)) then
@@ -1613,7 +1613,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
if ((oldfn + Dfn) <= ustarsq) then
Dh = h_at_vel(i,k)
else
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn)/Dfn)
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn) / (Dfn))
endif

htot(i) = htot(i) + Dh
@@ -1629,7 +1629,7 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
else ! Use Rlay as the density variable.
Rhtot = 0.0
do k=1,nz-1
Rlay = US%R_to_kg_m3*GV%Rlay(k) ; Rlb = US%R_to_kg_m3*GV%Rlay(k+1)
Rlay = GV%Rlay(k) ; Rlb = GV%Rlay(k+1)

oldfn = Rlay*htot(i) - Rhtot(i)
if (oldfn >= ustarsq) exit
@@ -1638,13 +1638,13 @@ subroutine set_viscous_ML(u, v, h, tv, forces, visc, dt_in_T, G, GV, US, CS, sym
if ((oldfn + Dfn) <= ustarsq) then
Dh = h_at_vel(i,k)
else
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn)/Dfn)
Dh = h_at_vel(i,k) * sqrt((ustarsq-oldfn) / (Dfn))
endif

htot(i) = htot(i) + Dh
Rhtot = Rhtot + Rlay*Dh
enddo
if (US%R_to_kg_m3*GV%Rlay(nz)*htot(i) - Rhtot(i) < ustarsq) &
if (GV%Rlay(nz)*htot(i) - Rhtot(i) < ustarsq) &
htot(i) = htot(i) + h_at_vel(i,nz)
endif ! use_EOS