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

Dev master candidate from NCAR - 2019 06 11 #935

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
fd4faf5
Converted local scalar Vort_mag into local 2d array
adcroft Dec 4, 2017
e5d4bdf
Consolidated Leith related calculations
adcroft Dec 4, 2017
273745c
Moved Leith vorticity magnitude calc into MOM_lateral_mixing_coeffs.F90
adcroft Dec 4, 2017
7dc2510
Added beta to Leith vorticity magnitude
adcroft Dec 4, 2017
c59f87e
Read Leith parameters in MOM_lateral_coeffs.F90
adcroft Dec 5, 2017
c546d3d
Replaced calc_vert_vort_mag() with calc_Leith_viscosity()
adcroft Dec 5, 2017
b39edff
Cleaned up left over arrays from moving Leith out of MOM_hor_visc.F90
adcroft Dec 5, 2017
f08592f
Added independent flag for beta-term in Leith
adcroft Dec 6, 2017
69f2c75
Added stretching term for QG Leith viscosity
adcroft Dec 6, 2017
2becf74
Merge branch 'qg-leith' into ncar_qg_leith
gustavo-marques Oct 10, 2018
7746539
Deletes unecessary code and adds Leith_Kh_*
gustavo-marques Oct 10, 2018
cda9edd
Deletes unneeded code
gustavo-marques Oct 11, 2018
84542af
QG Leith code refactoring
sdbachman Oct 15, 2018
da862b3
Change calc_Leith_viscosity to calc_QG_Leith_viscosity
gustavo-marques Oct 16, 2018
d02fd47
Adds option to diagnose div_xx_h and vort_xy_q
gustavo-marques Oct 16, 2018
92e2875
Bounds vort_xy_* in Leith.
gustavo-marques Oct 17, 2018
d069e51
Changed constraint on Leith viscosity.
sdbachman Oct 17, 2018
b9d69b7
Fix a bug in an if statement
gustavo-marques Oct 17, 2018
5c5533b
Rename variables to make names consistent; fix dimens. Biharm Smag
gustavo-marques Oct 25, 2018
f4256fb
Adding a limiter via planetary number
gustavo-marques Nov 1, 2018
3b43efe
Refactored the entire Leith section.
sdbachman Nov 1, 2018
e0baaea
Initialized new arrays for Leith, deleted deprecated ones
sdbachman Nov 1, 2018
52667e9
Changed use_QG_Leith to use_QG_Leith_visc. Removed commented lines fr…
sdbachman Nov 1, 2018
f913004
Preparing lateral_coeffs and thickness_diffuse for QG Leith calculati…
sdbachman Nov 1, 2018
d96a3fe
Defined KH arrays in VarMix to be passed to thickness_diffuse.
sdbachman Nov 2, 2018
c42b6a4
Add grad_vort_mag_h and grad_vort_mag_q
gustavo-marques Nov 26, 2018
81a5771
Compute QG Leith GM coefficient and add some diagnostics
gustavo-marques Nov 26, 2018
60d493a
Add option to use QG Leith viscosity as the GM coefficient
gustavo-marques Nov 26, 2018
ec68e41
Adds infrastructure to enable GME to access private arrays
gustavo-marques Jan 17, 2019
a38fc07
Add flags for GME and define necessary arrays
gustavo-marques Jan 17, 2019
d5f5d32
Adds GME and smoothing function
gustavo-marques Jan 18, 2019
019ee95
Merge branch 'dev/ncar' into ncar_GME_willy_merged
gustavo-marques Jan 22, 2019
d3aaa9d
Fix calls to find_eta and calc_Visbeck_coeffs
gustavo-marques Jan 22, 2019
e8a7386
Move thickness_diffuse_init before initialize_dyn_split_RK2
gustavo-marques Jan 24, 2019
bef613b
Add thickness_diffuse_CSp and Barotropic_CSp as arguments
gustavo-marques Jan 24, 2019
462dfd8
Change condition for applying Ah_Limit + axes for GME diag.
gustavo-marques Jan 24, 2019
581b30d
Move inv_PI3 outside of k loop
gustavo-marques Jan 24, 2019
de3a52c
Deleted KH_t_GME and allocate arrays via safe_alloc_ptr
gustavo-marques Jan 29, 2019
cc7f725
apply oda tracer increments only if da is active
alperaltuntas Jan 31, 2019
8228b64
Merge pull request #90 from alperaltuntas/fix_oda
gustavo-marques Jan 31, 2019
03b01c4
Merge pull request #89 from gustavo-marques/sync_dev_master_19Dec18
alperaltuntas Jan 31, 2019
38ac453
Fixed several issues for GME
gustavo-marques Feb 11, 2019
4b35452
Modified initialization of GME variables
gustavo-marques Feb 12, 2019
5360863
Changed hq to a 2D array
gustavo-marques Feb 12, 2019
b97a787
Fixed problem with updating hq -- hq is now a 2D array
gustavo-marques Feb 14, 2019
1241da8
Add new way of calculating latent heat
gustavo-marques Feb 20, 2019
72945e4
Comment lines with index_bounds
gustavo-marques Feb 20, 2019
a5fe8c0
Fix rotations in import and export subroutines
gustavo-marques Feb 21, 2019
2467749
Merge branch 'dev/ncar' into latent_heat_frozen_fluxes
gustavo-marques Feb 21, 2019
adfd67e
Fix line length
gustavo-marques Feb 21, 2019
12d8856
Merge branch 'latent_heat_frozen_fluxes' into fix_rotation
gustavo-marques Feb 21, 2019
e502a97
Fix another line length
gustavo-marques Feb 21, 2019
dddf151
Merge branch 'latent_heat_frozen_fluxes' into fix_rotation
gustavo-marques Feb 21, 2019
a160252
Change limiter in the GME_coeff to 1.0e5
gustavo-marques Feb 21, 2019
8f2080a
Merge pull request #91 from gustavo-marques/latent_heat_frozen_fluxes
alperaltuntas Feb 21, 2019
25ff7c8
Merge pull request #92 from gustavo-marques/fix_rotation
alperaltuntas Feb 21, 2019
bed3fbc
Change limiter in the GME_coeff to 1.0e4
gustavo-marques Feb 21, 2019
823d014
Merge branch 'dev/ncar' into GME_21Feb2019
gustavo-marques Feb 21, 2019
a271bb9
Changed QG Leith limiter to 2D vort. grad.
gustavo-marques Feb 28, 2019
a605c59
Added some pass_vector calls
gustavo-marques Mar 7, 2019
24790c2
Added some pass_vector and pass_var calls
gustavo-marques Mar 7, 2019
fda0334
Fixed QG Leith halo problem on k=nz level. Also added a tapering func…
sdbachman Mar 11, 2019
bd98d83
Increased GME limiter and number of times to pass through smoothing f…
sdbachman Mar 18, 2019
807072b
Refactored MOM_hor_visc. Moved GME out of loops where downgradient
sdbachman Apr 12, 2019
59aad4f
Added a loop to ensure MEKE is never less than 0. Added new variable…
sdbachman Apr 12, 2019
f5da24d
Allocated FrictWorkMax array (forgot last time).
sdbachman Apr 12, 2019
2260e70
Fixed some coding mistakes from the last commit.
sdbachman Apr 12, 2019
6542122
Added new variable FrictWork_diss to account for the energy dissipate…
sdbachman Apr 12, 2019
e5238f5
Merge branch 'dev/ncar' into add_nuopc_cap
gustavo-marques Apr 15, 2019
8df6efd
Added a new flag to MOM_lateral_mixing_coeffs called "USE_VISBECK", w…
sdbachman Apr 16, 2019
172ae02
Fixed problems with FrictWorkMax and FrictWorkDiss in MOM_hor_visc.F.…
sdbachman Apr 17, 2019
5868144
Merge pull request #93 from gustavo-marques/add_nuopc_cap
alperaltuntas Apr 17, 2019
d892664
Merge branch 'dev-master-candidate-2018-04-22' into merge-dev-master-…
gustavo-marques Apr 23, 2019
acb4d3f
Merge pull request #94 from gustavo-marques/merge-dev-master-candidat…
alperaltuntas Apr 23, 2019
379e9ee
make uppercase DEBUG lowercase
alperaltuntas Apr 24, 2019
d8b7825
fix uninitialized oneOrTwo
alperaltuntas Apr 24, 2019
03a5586
Merge branch 'dev/ncar' into fix_debug_mode
gustavo-marques Apr 24, 2019
42582a1
Merge pull request #95 from alperaltuntas/fix_debug_mode
gustavo-marques Apr 24, 2019
4727f20
Merge branch 'dev-master-candidate-2018-04-22' into add_missing_US_ar…
gustavo-marques Apr 24, 2019
ce5571f
Add CS%US argument lost during merge conflict
gustavo-marques Apr 24, 2019
36ba339
Merge pull request #96 from gustavo-marques/add_missing_US_arguments_…
alperaltuntas Apr 24, 2019
0fcc576
use ESMF operators
alperaltuntas Apr 24, 2019
3df6ff3
Merge pull request #97 from alperaltuntas/fix_nuopc_use_only
gustavo-marques Apr 24, 2019
c24bfb3
Added Jansen et al. (2015) version of MEKE dissipation. Added an alte…
sdbachman Apr 30, 2019
f6d1c65
Fixed if statement in MOM_MEKE.F90. Added option to use alternative
sdbachman Apr 30, 2019
3c91971
Added option to calculate MKE-to-MEKE energy conversion by GME.
sdbachman Apr 30, 2019
73e89ec
Cleaned up MOM_hor_visc.F90 a bit, especially parts having to do with
sdbachman Apr 30, 2019
6b32174
Added biharmonic option for MEKE viscosity.
sdbachman May 2, 2019
80c65c7
Added a GME sink term to the MEKE budget. Cleaned up MOM_hor_visc.F90.
sdbachman May 3, 2019
a6cd3fe
Commented out thickness diffusivity calls for GME, since it is not
sdbachman May 3, 2019
4d02387
Add seaice_melt and seaice_melt_heat
gustavo-marques May 3, 2019
4db5f4d
Merge branch 'add_missing_fluxes_nuopc' into gme_03may2019
gustavo-marques May 3, 2019
69c21ea
Add missing US entries and fix typos introduced during merge
gustavo-marques May 3, 2019
7671d31
get calendar from CESM
alperaltuntas May 3, 2019
4b6ef52
Revert "Added biharmonic option for MEKE viscosity."
sdbachman May 3, 2019
27bc6b3
Merge pull request #98 from NCAR/fix_nuopc_calendar
gustavo-marques May 3, 2019
434ff08
Willy was silly.
gustavo-marques May 3, 2019
ef0abe6
Merge branch 'dev/ncar' into gme_03may2019
gustavo-marques May 3, 2019
b503858
Merge pull request #99 from gustavo-marques/add_missing_fluxes_nuopc
alperaltuntas May 3, 2019
434ffe7
Working configuration of MEKE/GME. Has biharmonic MEKE viscosity and a
sdbachman May 6, 2019
4c15159
Added a "next-to_boundary" mask that should help with fixing abnormal…
sdbachman May 6, 2019
eda43c4
Merge branch 'guillermo_putao' into gme_06may2019
gustavo-marques May 6, 2019
d449d37
Set default of USE_NET_FW_ADJUSTMENT_SIGN_BUG to false in NUOPC cap
gustavo-marques May 10, 2019
b668abf
Merge pull request #100 from gustavo-marques/set_fw_bug_to_false
alperaltuntas May 10, 2019
eb301fe
skip first tstep and double second tstep
alperaltuntas May 14, 2019
0ae751e
apply ocean lag to cesm runs only
alperaltuntas May 14, 2019
8797615
Merge pull request #101 from NCAR/ocn_lag
gustavo-marques May 14, 2019
b2ff365
fix ocean lag logic for restart runs
alperaltuntas May 15, 2019
e0a8b9b
Merge pull request #102 from NCAR/ocn_lag
gustavo-marques May 15, 2019
e5a0b82
Merge branch 'GME_10may2019putao' into geometric_putao
sdbachman May 16, 2019
03386c0
Merge branch 'dev/ncar' into merge_GME
gustavo-marques May 17, 2019
59944eb
Added GEOMETRIC as an option for MEKE. Also added biharmonic MEKE vis…
sdbachman May 30, 2019
3594d53
Merge branch 'merge_GME_17May2019' into geometric_putao
gustavo-marques May 31, 2019
35eccc0
Ensures that MEKE%Kh_diff is only used when USE_KH_IN_MEKE = True
gustavo-marques Jun 3, 2019
3d997ee
Fixes doxygen syntax
gustavo-marques Jun 3, 2019
4dd50c1
Fixes additional doxygen syntax
gustavo-marques Jun 3, 2019
1388ce7
Removes trailing space
gustavo-marques Jun 3, 2019
b3c0b69
Fixes unregistered diagnostic id
gustavo-marques Jun 4, 2019
f52375b
Changes logic of an if statement in calc_slope_functions to avoid cha…
gustavo-marques Jun 6, 2019
f74be3f
Deletes code related to GME_Varmix
gustavo-marques Jun 6, 2019
25ea4dc
Changes in MEKE
gustavo-marques Jun 7, 2019
2d2f83f
Changes the way of counting the work
gustavo-marques Jun 7, 2019
a995acf
Reverts biharmonic constants to the origial definition
gustavo-marques Jun 10, 2019
22b6695
Remove trailing space
gustavo-marques Jun 11, 2019
91d0e26
Merge pull request #103 from gustavo-marques/gme_31May2019
alperaltuntas Jun 11, 2019
31dda12
Merge branch 'dev/master' into dev-master-candidate-2019-06-11
gustavo-marques Jun 11, 2019
2ada29a
Adds MEKE_VISCOSITY_COEFF_AU and MEKE_VISCOSITY_COEFF_KU into the MEK…
gustavo-marques Jun 21, 2019
062e3b0
Obsolete parameter MEKE_VISCOSITY_COEFF
gustavo-marques Jun 21, 2019
afb07fb
Add MEKE_GEOMETRIC_EPSILON
gustavo-marques Jun 21, 2019
89168bf
move OMP calls below GME and above the K-loop
gustavo-marques Jun 21, 2019
98373e8
Fix hint syntax in MOM_obsolete_param
gustavo-marques Jun 21, 2019
2a9d421
Set default AH_VEL_SCALE back to zero
gustavo-marques Jun 26, 2019
1a71a55
Remove thickness_diffuse_CS from horizontal_viscosity
gustavo-marques Jun 27, 2019
0d1fbff
Issue FATAL error if SPLIT=False and USE_GME=True
gustavo-marques Jun 27, 2019
31dfefd
Removes Barotropic and thickness_diffuse from MOM_dynamics_unsplit*
gustavo-marques Jun 27, 2019
47886e3
Changes Barotropic to BT in horizontal_viscosity
gustavo-marques Jun 27, 2019
8f96916
Passes optional arg. (BT=CS%barotropic_CSp) in calls to horizontal_vi…
gustavo-marques Jun 27, 2019
5c42192
Removes trailing space
gustavo-marques Jun 28, 2019
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
33 changes: 25 additions & 8 deletions config_src/mct_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, US, CS, &
type(forcing), intent(inout) :: fluxes !< A structure containing pointers to
!! all possible mass, heat or salt flux forcing fields.
!! Unused fields have NULL ptrs.

type(time_type), intent(in) :: Time !< The time of the fluxes, used for interpolating the
!! salinity to the right time, when it is being restored.
type(ocean_grid_type), intent(inout) :: G !< The ocean's grid structure
Expand Down Expand Up @@ -244,7 +243,6 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, US, CS, &

integer :: i, j, k, is, ie, js, je, Isq, Ieq, Jsq, Jeq, i0, j0
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, isr, ier, jsr, jer
integer :: isc_bnd, iec_bnd, jsc_bnd, jec_bnd

logical :: restore_salinity ! local copy of the argument restore_salt, if it
! is present, or false (no restoring) otherwise.
Expand Down Expand Up @@ -395,9 +393,8 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, US, CS, &
enddo; enddo
endif

!i0 = is - isc_bnd ; j0 = js - jsc_bnd ???
i0 = 0; j0 = 0 ! TODO: is this right?

! obtain fluxes from IOB
i0 = 0; j0 = 0
do j=js,je ; do i=is,ie
! liquid precipitation (rain)
if (associated(fluxes%lprec)) &
Expand Down Expand Up @@ -456,8 +453,27 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, Time, G, US, CS, &
fluxes%seaice_melt(i,j) = G%mask2dT(i,j) * IOB%seaice_melt(i-i0,j-j0)

! latent heat flux (W/m^2)
if (associated(fluxes%latent)) &
fluxes%latent(i,j) = G%mask2dT(i,j) * IOB%latent_flux(i-i0,j-j0)
! old method, latent = IOB%q_flux(i-i0,j-j0)*CS%latent_heat_vapor
!if (associated(fluxes%latent)) &
! fluxes%latent(i,j) = G%mask2dT(i,j) * IOB%latent_flux(i-i0,j-j0)
! new method
fluxes%latent(i,j) = 0.0
! contribution from frozen ppt
if (associated(fluxes%fprec)) then
fluxes%latent(i,j) = fluxes%latent(i,j) + IOB%fprec(i-i0,j-j0)*CS%latent_heat_fusion
fluxes%latent_fprec_diag(i,j) = G%mask2dT(i,j) * IOB%fprec(i-i0,j-j0)*CS%latent_heat_fusion
endif
! contribution from frozen runoff
if (associated(fluxes%frunoff)) then
fluxes%latent(i,j) = fluxes%latent(i,j) + IOB%rofi_flux(i-i0,j-j0)*CS%latent_heat_fusion
fluxes%latent_frunoff_diag(i,j) = G%mask2dT(i,j) * IOB%rofi_flux(i-i0,j-j0)*CS%latent_heat_fusion
endif
! contribution from evaporation
if (associated(IOB%q_flux)) then
fluxes%latent(i,j) = fluxes%latent(i,j) + IOB%q_flux(i-i0,j-j0)*CS%latent_heat_vapor
fluxes%latent_evap_diag(i,j) = G%mask2dT(i,j) * IOB%q_flux(i-i0,j-j0)*CS%latent_heat_vapor
endif
fluxes%latent(i,j) = G%mask2dT(i,j) * fluxes%latent(i,j)

if (associated(IOB%sw_flux_vis_dir)) &
fluxes%sw_vis_dir(i,j) = G%mask2dT(i,j) * IOB%sw_flux_vis_dir(i-i0,j-j0)
Expand Down Expand Up @@ -580,8 +596,9 @@ subroutine convert_IOB_to_forces(IOB, forces, index_bounds, Time, G, US, CS)

!isc_bnd = index_bounds(1) ; iec_bnd = index_bounds(2)
!jsc_bnd = index_bounds(3) ; jec_bnd = index_bounds(4)
!if (is_root_pe()) write(*,*)'isc_bnd, jsc_bnd, iec_bnd, jec_bnd',isc_bnd, jsc_bnd, iec_bnd, jec_bnd
!i0 = is - isc_bnd ; j0 = js - jsc_bnd
i0 = 0; j0 = 0 ! TODO: is this right?
i0 = 0; j0 = 0 ! TODO: is this right?

Irho0 = 1.0/CS%Rho0

Expand Down
12 changes: 6 additions & 6 deletions config_src/mct_driver/ocn_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ subroutine ocn_import(x2o, ind, grid, ice_ocean_boundary, ocean_public, logunit,
! rotate taux and tauy from true zonal/meridional to local coordinates
! taux
ice_ocean_boundary%u_flux(i,j) = GRID%cos_rot(i,j) * x2o(ind%x2o_Foxx_taux,k) &
+ GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_tauy,k)
- GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_tauy,k)

! tauy
ice_ocean_boundary%v_flux(i,j) = GRID%cos_rot(i,j) * x2o(ind%x2o_Foxx_tauy,k) &
- GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_taux,k)
+ GRID%sin_rot(i,j) * x2o(ind%x2o_Foxx_taux,k)

! liquid precipitation (rain)
ice_ocean_boundary%lprec(i,j) = x2o(ind%x2o_Faxa_rain,k)
Expand Down Expand Up @@ -188,9 +188,9 @@ subroutine ocn_export(ind, ocn_public, grid, o2x, dt_int, ncouple_per_day)
o2x(ind%o2x_So_t, n) = ocn_public%t_surf(ig,jg) * grid%mask2dT(i,j)
o2x(ind%o2x_So_s, n) = ocn_public%s_surf(ig,jg) * grid%mask2dT(i,j)
! rotate ocn current from local tripolar grid to true zonal/meridional (inverse transformation)
o2x(ind%o2x_So_u, n) = (grid%cos_rot(i,j) * ocn_public%u_surf(ig,jg) - &
o2x(ind%o2x_So_u, n) = (grid%cos_rot(i,j) * ocn_public%u_surf(ig,jg) + &
grid%sin_rot(i,j) * ocn_public%v_surf(ig,jg)) * grid%mask2dT(i,j)
o2x(ind%o2x_So_v, n) = (grid%cos_rot(i,j) * ocn_public%v_surf(ig,jg) + &
o2x(ind%o2x_So_v, n) = (grid%cos_rot(i,j) * ocn_public%v_surf(ig,jg) - &
grid%sin_rot(i,j) * ocn_public%u_surf(ig,jg)) * grid%mask2dT(i,j)

! boundary layer depth (m)
Expand Down Expand Up @@ -270,8 +270,8 @@ subroutine ocn_export(ind, ocn_public, grid, o2x, dt_int, ncouple_per_day)
n = 0
do j=grid%jsc, grid%jec ; do i=grid%isc,grid%iec
n = n+1
o2x(ind%o2x_So_dhdx, n) = grid%cos_rot(i,j) * sshx(i,j) - grid%sin_rot(i,j) * sshy(i,j)
o2x(ind%o2x_So_dhdy, n) = grid%cos_rot(i,j) * sshy(i,j) + grid%sin_rot(i,j) * sshx(i,j)
o2x(ind%o2x_So_dhdx, n) = grid%cos_rot(i,j) * sshx(i,j) + grid%sin_rot(i,j) * sshy(i,j)
o2x(ind%o2x_So_dhdy, n) = grid%cos_rot(i,j) * sshy(i,j) - grid%sin_rot(i,j) * sshx(i,j)
enddo; enddo

end subroutine ocn_export
Expand Down
27 changes: 13 additions & 14 deletions config_src/nuopc_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ module MOM_surface_forcing
real, pointer, dimension(:,:) :: q_flux =>NULL() !< specific humidity flux [kg/m2/s]
real, pointer, dimension(:,:) :: salt_flux =>NULL() !< salt flux [kg/m2/s]
real, pointer, dimension(:,:) :: seaice_melt_heat =>NULL() !< sea ice and snow melt heat flux [W/m2]
real, pointer, dimension(:,:) :: seaice_melt_water =>NULL() !< water flux due to sea ice and snow melting [kg/m2/s]
real, pointer, dimension(:,:) :: seaice_melt =>NULL() !< water flux due to sea ice and snow melting [kg/m2/s]
real, pointer, dimension(:,:) :: lw_flux =>NULL() !< long wave radiation [W/m2]
real, pointer, dimension(:,:) :: sw_flux_vis_dir =>NULL() !< direct visible sw radiation [W/m2]
real, pointer, dimension(:,:) :: sw_flux_vis_dif =>NULL() !< diffuse visible sw radiation [W/m2]
Expand Down Expand Up @@ -457,18 +457,18 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, &
fluxes%heat_content_frunoff(i,j) = IOB%calving_hflx(i-i0,j-j0) * G%mask2dT(i,j)

if (associated(IOB%lw_flux)) &
fluxes%LW(i,j) = IOB%lw_flux(i-i0,j-j0) * G%mask2dT(i,j)
fluxes%LW(i,j) = IOB%lw_flux(i-i0,j-j0) * G%mask2dT(i,j)

if (associated(IOB%t_flux)) &
fluxes%sens(i,j) = IOB%t_flux(i-i0,j-j0) * G%mask2dT(i,j)
fluxes%sens(i,j) = IOB%t_flux(i-i0,j-j0) * G%mask2dT(i,j)

! ! sea ice and snow melt heat flux [W/m2]
! if (associated(fluxes%seaice_melt_heat)) &
! fluxes%seaice_melt_heat(i,j) = G%mask2dT(i,j) * IOB%seaice_melt_heat(i-i0,j-j0)
! sea ice and snow melt heat flux [W/m2]
if (associated(IOB%seaice_melt_heat)) &
fluxes%seaice_melt_heat(i,j) = G%mask2dT(i,j) * IOB%seaice_melt_heat(i-i0,j-j0)

! ! water flux due to sea ice and snow melt [kg/m2/s]
! if (associated(fluxes%seaice_melt)) &
! fluxes%seaice_melt(i,j) = G%mask2dT(i,j) * IOB%seaice_melt_water(i-i0,j-j0)
! water flux due to sea ice and snow melt [kg/m2/s]
if (associated(IOB%seaice_melt)) &
fluxes%seaice_melt(i,j) = G%mask2dT(i,j) * IOB%seaice_melt(i-i0,j-j0)

fluxes%latent(i,j) = 0.0
if (associated(IOB%fprec)) then
Expand Down Expand Up @@ -540,10 +540,9 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, G, US, CS, &
sign_for_net_FW_bug = 1.
if (CS%use_net_FW_adjustment_sign_bug) sign_for_net_FW_bug = -1.
do j=js,je ; do i=is,ie
net_FW(i,j) = (((fluxes%lprec(i,j) + fluxes%fprec(i,j)) + &
net_FW(i,j) = (((fluxes%lprec(i,j) + fluxes%fprec(i,j) + fluxes%seaice_melt(i,j)) + &
(fluxes%lrunoff(i,j) + fluxes%frunoff(i,j))) + &
(fluxes%evap(i,j) + fluxes%vprec(i,j)) ) * G%areaT(i,j)
! net_FW(i,j) = netFW(i,j) + fluxes%seaice_melt(i,j) * G%areaT(i,j)

! The following contribution appears to be calculating the volume flux of sea-ice
! melt. This calculation is clearly WRONG if either sea-ice has variable
Expand Down Expand Up @@ -1087,7 +1086,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
call get_param(param_file, mdl, "USE_NET_FW_ADJUSTMENT_SIGN_BUG", &
CS%use_net_FW_adjustment_sign_bug, &
"If true, use the wrong sign for the adjustment to\n"//&
"the net fresh-water.", default=.true.)
"the net fresh-water.", default=.false.)
call get_param(param_file, mdl, "ADJUST_NET_FRESH_WATER_BY_SCALING", &
CS%adjust_net_fresh_water_by_scaling, &
"If true, adjustments to net fresh water to achieve zero net are\n"//&
Expand Down Expand Up @@ -1368,8 +1367,8 @@ subroutine ice_ocn_bnd_type_chksum(id, timestep, iobt)
write(outunit,100) 'iobt%t_flux ' , mpp_chksum( iobt%t_flux )
write(outunit,100) 'iobt%q_flux ' , mpp_chksum( iobt%q_flux )
write(outunit,100) 'iobt%salt_flux ' , mpp_chksum( iobt%salt_flux )
!write(outunit,100) 'iobt%seaice_melt_heat' , mpp_chksum( iobt%seaice_melt_heat)
!write(outunit,100) 'iobt%seaice_melt_water' , mpp_chksum( iobt%seaice_melt_water)
write(outunit,100) 'iobt%seaice_melt_heat' , mpp_chksum( iobt%seaice_melt_heat)
write(outunit,100) 'iobt%seaice_melt ' , mpp_chksum( iobt%seaice_melt )
write(outunit,100) 'iobt%lw_flux ' , mpp_chksum( iobt%lw_flux )
write(outunit,100) 'iobt%sw_flux_vis_dir' , mpp_chksum( iobt%sw_flux_vis_dir)
write(outunit,100) 'iobt%sw_flux_vis_dif' , mpp_chksum( iobt%sw_flux_vis_dif)
Expand Down
88 changes: 83 additions & 5 deletions config_src/nuopc_driver/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@
!! --------------------------|------------|-----------------|---------------------------------------|-------------------
!! inst_pres_height_surface | Pa | p | pressure of overlying sea ice and atmosphere
!! mass_of_overlying_sea_ice | kg | mi | mass of overlying sea ice | |
!! seaice_melt_heat | W m-2 | seaice_melt_heat| sea ice and snow melt heat flux | |
!! seaice_melt | kg m-2 s-1 | seaice_melt | water flux due to sea ice and snow melting | |
!! mean_calving_heat_flx | W m-2 | calving_hflx | heat flux, relative to 0C, of frozen land water into ocean
!! mean_calving_rate | kg m-2 s-1 | calving | mass flux of frozen runoff | |
!! mean_evap_rate | kg m-2 s-1 | q_flux | specific humidity flux |
Expand Down Expand Up @@ -377,6 +379,7 @@ module mom_cap_mod
use ESMF, only: ESMF_COORDSYS_SPH_DEG, ESMF_GridCreate, ESMF_INDEX_DELOCAL
use ESMF, only: ESMF_MESHLOC_ELEMENT, ESMF_RC_VAL_OUTOFRANGE, ESMF_StateGet
use ESMF, only: ESMF_TimePrint, ESMF_AlarmSet, ESMF_FieldGet
use ESMF, only: operator(==), operator(/=), operator(+), operator(-)

! TODO ESMF_GridCompGetInternalState does not have an explicit Fortran interface.
!! Model does not compile with "use ESMF, only: ESMF_GridCompGetInternalState"
Expand Down Expand Up @@ -753,6 +756,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer :: userRc
character(len=512) :: restartfile ! Path/Name of restart file
character(len=*), parameter :: subname='(mom_cap:InitializeAdvertise)'
character(len=32) :: calendar
!--------------------------------

rc = ESMF_SUCCESS
Expand Down Expand Up @@ -804,7 +808,35 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call fms_init(mpi_comm_mom)
call constants_init
call field_manager_init
call set_calendar_type (JULIAN)

! determine the calendar
if (cesm_coupled) then
call NUOPC_CompAttributeGet(gcomp, name="calendar", value=cvalue, &
isPresent=isPresent, isSet=isSet, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
if (isPresent .and. isSet) then
read(cvalue,*) calendar
select case (trim(calendar))
case ("NO_LEAP")
call set_calendar_type (NOLEAP)
case ("GREGORIAN")
call set_calendar_type (GREGORIAN)
case default
call ESMF_LogSetError(ESMF_RC_ARG_BAD, &
msg=subname//": Calendar not supported in MOM6: "//trim(calendar), &
line=__LINE__, file=__FILE__, rcToReturn=rc)
end select
else
call set_calendar_type (NOLEAP)
endif

else
call set_calendar_type (JULIAN)
endif

call diag_manager_init

! this ocean connector will be driven at set interval
Expand Down Expand Up @@ -960,6 +992,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
Ice_ocean_boundary% sw_flux_nir_dif (isc:iec,jsc:jec), &
Ice_ocean_boundary% lprec (isc:iec,jsc:jec), &
Ice_ocean_boundary% fprec (isc:iec,jsc:jec), &
Ice_ocean_boundary% seaice_melt_heat (isc:iec,jsc:jec),&
Ice_ocean_boundary% seaice_melt (isc:iec,jsc:jec), &
Ice_ocean_boundary% mi (isc:iec,jsc:jec), &
Ice_ocean_boundary% p (isc:iec,jsc:jec), &
Ice_ocean_boundary% runoff (isc:iec,jsc:jec), &
Expand All @@ -981,6 +1015,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
Ice_ocean_boundary%sw_flux_nir_dif = 0.0
Ice_ocean_boundary%lprec = 0.0
Ice_ocean_boundary%fprec = 0.0
Ice_ocean_boundary%seaice_melt = 0.0
Ice_ocean_boundary%seaice_melt_heat= 0.0
Ice_ocean_boundary%mi = 0.0
Ice_ocean_boundary%p = 0.0
Ice_ocean_boundary%runoff = 0.0
Expand Down Expand Up @@ -1030,8 +1066,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call fld_list_add(fldsToOcn_num, fldsToOcn, "inst_pres_height_surface" , "will provide")
call fld_list_add(fldsToOcn_num, fldsToOcn, "Foxx_rofl" , "will provide") !-> liquid runoff
call fld_list_add(fldsToOcn_num, fldsToOcn, "Foxx_rofi" , "will provide") !-> ice runoff
!call fld_list_add(fldsToOcn_num, fldsToOcn, "seaice_melt_water" , "will provide")
!call fld_list_add(fldsToOcn_num, fldsToOcn, "seaice_melt_heat" , "will provide")
call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_fresh_water_to_ocean_rate", "will provide")
call fld_list_add(fldsToOcn_num, fldsToOcn, "net_heat_flx_to_ocn" , "will provide")

!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_runoff_rate" , "will provide")
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_calving_rate" , "will provide")
Expand Down Expand Up @@ -1728,6 +1764,7 @@ subroutine ModelAdvance(gcomp, rc)
! local variables
integer :: userRc
logical :: existflag, isPresent, isSet
logical :: do_advance = .true.
type(ESMF_Clock) :: clock!< ESMF Clock class definition
type(ESMF_Alarm) :: alarm
type(ESMF_State) :: importState, exportState
Expand Down Expand Up @@ -1810,8 +1847,47 @@ subroutine ModelAdvance(gcomp, rc)
file=__FILE__)) &
return ! bail out

Time = esmf2fms_time(currTime)
Time_step_coupled = esmf2fms_time(timeStep)
Time = esmf2fms_time(currTime)

!---------------
! Apply ocean lag for startup runs:
!---------------

if (cesm_coupled) then
if (trim(runtype) == "initial") then

! Do not call MOM6 timestepping routine if the first cpl tstep of a startup run
if (currTime == startTime) then
call ESMF_LogWrite("MOM6 - Skipping the first coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
do_advance = .false.
else
do_advance = .true.
endif

! If the second cpl tstep of a startup run, step back a cpl tstep and advance for two cpl tsteps
if (currTime == startTime + timeStep) then
call ESMF_LogWrite("MOM6 - Stepping back one coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
Time = esmf2fms_time(currTime-timeStep) ! i.e., startTime

call ESMF_LogWrite("MOM6 - doubling the coupling timestep", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out
Time_step_coupled = 2 * esmf2fms_time(timeStep)
endif
endif
endif


!---------------
! Write diagnostics for import
Expand Down Expand Up @@ -1854,7 +1930,9 @@ subroutine ModelAdvance(gcomp, rc)
!---------------

if(profile_memory) call ESMF_VMLogMemInfo("Entering MOM update_ocean_model: ")
call update_ocean_model(Ice_ocean_boundary, ocean_state, ocean_public, Time, Time_step_coupled)
if (do_advance) then
call update_ocean_model(Ice_ocean_boundary, ocean_state, ocean_public, Time, Time_step_coupled)
endif
if(profile_memory) call ESMF_VMLogMemInfo("Leaving MOM update_ocean_model: ")

!---------------
Expand Down
Loading