From b4f52640527cf12945015567f3508fe3d58974e9 Mon Sep 17 00:00:00 2001 From: Marshall Ward Date: Tue, 8 Oct 2019 13:58:18 -0400 Subject: [PATCH 1/4] ALE: Float ID inequality replaced with integer A diagnostic ID was compared to floating point 0. to test if it had been set. This patch replaces this with an integer inequality test. This resolves GitHub Issue #1016. Thanks to Stephen Griffies for reporting. --- src/ALE/MOM_ALE.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ALE/MOM_ALE.F90 b/src/ALE/MOM_ALE.F90 index 8eed4aa925..898861c914 100644 --- a/src/ALE/MOM_ALE.F90 +++ b/src/ALE/MOM_ALE.F90 @@ -799,12 +799,12 @@ subroutine remap_all_state_vars(CS_remapping, CS_ALE, G, GV, h_old, h_new, Reg, ! Intermediate steps for tendency of tracer concentration and tracer content. if (present(dt)) then - if (Tr%id_remap_conc>0) then + if (Tr%id_remap_conc > 0) then do k=1,GV%ke - work_conc(i,j,k) = (u_column(k) - Tr%t(i,j,k) ) * Idt + work_conc(i,j,k) = (u_column(k) - Tr%t(i,j,k)) * Idt enddo endif - if (Tr%id_remap_cont>0. .or. Tr%id_remap_cont_2d>0) then + if (Tr%id_remap_cont > 0 .or. Tr%id_remap_cont_2d > 0) then do k=1,GV%ke work_cont(i,j,k) = (u_column(k)*h2(k) - Tr%t(i,j,k)*h1(k)) * Idt enddo From defb0c59dd4d54ab0a9b2c069f5550dd737a5181 Mon Sep 17 00:00:00 2001 From: Matthew Harrison Date: Thu, 24 Oct 2019 21:15:09 -0400 Subject: [PATCH 2/4] Verify ENABLE_THERMODYNAMICS is True before posting C_p diagnostic --- src/diagnostics/MOM_diagnostics.F90 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/diagnostics/MOM_diagnostics.F90 b/src/diagnostics/MOM_diagnostics.F90 index 7344a5e677..5a05a9a453 100644 --- a/src/diagnostics/MOM_diagnostics.F90 +++ b/src/diagnostics/MOM_diagnostics.F90 @@ -1859,7 +1859,8 @@ subroutine write_static_fields(G, GV, US, tv, diag) ! Local variables integer :: id - + logical :: use_temperature + id = register_static_field('ocean_model', 'geolat', diag%axesT1, & 'Latitude of tracer (T) points', 'degrees_north') if (id > 0) call post_data(id, G%geoLatT, diag, .true.) @@ -2011,12 +2012,15 @@ subroutine write_static_fields(G, GV, US, tv, diag) cmor_long_name='reference sea water density for boussinesq approximation') if (id > 0) call post_data(id, GV%Rho0, diag, .true.) - id = register_static_field('ocean_model','C_p', diag%axesNull, & - 'heat capacity of sea water', 'J kg-1 K-1', cmor_field_name='cpocean', & - cmor_standard_name='specific_heat_capacity_of_sea_water', & - cmor_long_name='specific_heat_capacity_of_sea_water') - if (id > 0) call post_data(id, tv%C_p, diag, .true.) - + use_temperature = associated(tv%T) + if (use_temperature) then + id = register_static_field('ocean_model','C_p', diag%axesNull, & + 'heat capacity of sea water', 'J kg-1 K-1', cmor_field_name='cpocean', & + cmor_standard_name='specific_heat_capacity_of_sea_water', & + cmor_long_name='specific_heat_capacity_of_sea_water') + if (id > 0) call post_data(id, tv%C_p, diag, .true.) + endif + end subroutine write_static_fields From 3c0d52ac8a93465f0ff3d29fb72587eb75d9a35e Mon Sep 17 00:00:00 2001 From: Matthew Harrison Date: Fri, 25 Oct 2019 10:47:30 -0400 Subject: [PATCH 3/4] Make tc4 faster --- .testing/tc4/MOM_input | 9 +++++++-- .testing/tc4/build_data.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.testing/tc4/MOM_input b/.testing/tc4/MOM_input index 456783af88..deb496315a 100644 --- a/.testing/tc4/MOM_input +++ b/.testing/tc4/MOM_input @@ -7,10 +7,15 @@ USE_REGRIDDING = True ! [Boolean] default = False ! If True, use the ALE algorithm (regridding/remapping). If False, use the ! layered isopycnal algorithm. -DT = 300.0 ! [s] +DT = 1200.0 ! [s] ! The (baroclinic) dynamics time step. The time-step that is actually used will ! be an integer fraction of the forcing time-step (DT_FORCING in ocean-only mode ! or the coupling timestep in coupled mode.) +DT_THERM = 3600.0 ! [s] default = 300.0 + ! The thermodynamic and tracer advection time step. Ideally DT_THERM should be + ! an integer multiple of DT and less than the forcing or coupling time-step, + ! unless THERMO_SPANS_COUPLING is true, in which case DT_THERM can be an integer + ! multiple of the coupling timestep. By default DT_THERM is set to DT. C_P = 3925.0 ! [J kg-1 K-1] default = 3991.86795711963 ! The heat capacity of sea water, approximated as a constant. This is only used ! if ENABLE_THERMODYNAMICS is true. The default value is from the TEOS-10 @@ -377,7 +382,7 @@ WIND_CONFIG = "zero" ! ! === module MOM_restart === ! === module MOM_main (MOM_driver) === -DAYMAX = 1.0 ! [days] +DAYMAX = 0.25 ! [days] ! The final time of the whole simulation, in units of TIMEUNIT seconds. This ! also sets the potential end time of the present run segment if the end time is ! not set via ocean_solo_nml in input.nml. diff --git a/.testing/tc4/build_data.py b/.testing/tc4/build_data.py index 50f45ce9f1..e060d05cb1 100644 --- a/.testing/tc4/build_data.py +++ b/.testing/tc4/build_data.py @@ -30,7 +30,7 @@ def t_fc(x, y, z, radius=5.0, tmag=1.0): ny, nx = x.shape -nz = 10 +nz = 3 z = (np.arange(nz) * zbot0) / nz temp = t_fc(x, y, z) From 817bdde76ccd24490786e5dd2554077b0b79f7e9 Mon Sep 17 00:00:00 2001 From: Matthew Harrison Date: Fri, 25 Oct 2019 10:54:12 -0400 Subject: [PATCH 4/4] remove trailing whitespace --- src/diagnostics/MOM_diagnostics.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/diagnostics/MOM_diagnostics.F90 b/src/diagnostics/MOM_diagnostics.F90 index 5a05a9a453..b8696969df 100644 --- a/src/diagnostics/MOM_diagnostics.F90 +++ b/src/diagnostics/MOM_diagnostics.F90 @@ -1860,7 +1860,7 @@ subroutine write_static_fields(G, GV, US, tv, diag) ! Local variables integer :: id logical :: use_temperature - + id = register_static_field('ocean_model', 'geolat', diag%axesT1, & 'Latitude of tracer (T) points', 'degrees_north') if (id > 0) call post_data(id, G%geoLatT, diag, .true.) @@ -2012,7 +2012,7 @@ subroutine write_static_fields(G, GV, US, tv, diag) cmor_long_name='reference sea water density for boussinesq approximation') if (id > 0) call post_data(id, GV%Rho0, diag, .true.) - use_temperature = associated(tv%T) + use_temperature = associated(tv%T) if (use_temperature) then id = register_static_field('ocean_model','C_p', diag%axesNull, & 'heat capacity of sea water', 'J kg-1 K-1', cmor_field_name='cpocean', & @@ -2020,7 +2020,7 @@ subroutine write_static_fields(G, GV, US, tv, diag) cmor_long_name='specific_heat_capacity_of_sea_water') if (id > 0) call post_data(id, tv%C_p, diag, .true.) endif - + end subroutine write_static_fields