From 249317d246a858e686594449241d6be06c6f068e Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Mon, 19 May 2025 15:27:32 -0500 Subject: [PATCH 01/16] Add diagnostic variable for landIceDraft --- components/mpas-ocean/src/Registry.xml | 4 ++++ .../mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index f7ff1ea8293d..8c0959d81fd6 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3457,6 +3457,10 @@ packages="topographicWaveDragPKG" /> + Date: Thu, 13 Mar 2025 17:57:03 -0500 Subject: [PATCH 02/16] Add constant ocean density for floatation --- components/mpas-ocean/src/Registry.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 8c0959d81fd6..99d43ea1a437 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -1078,6 +1078,10 @@ description="The density of land ice." possible_values="Any positive real number" /> + Date: Wed, 7 May 2025 10:33:05 -0500 Subject: [PATCH 03/16] Make bld files consistent with Registry --- components/mpas-ocean/bld/build-namelist | 7 +++++++ components/mpas-ocean/bld/build-namelist-group-list | 1 + components/mpas-ocean/bld/build-namelist-section | 6 ++++++ .../bld/namelist_files/namelist_defaults_mpaso.xml | 3 +++ .../bld/namelist_files/namelist_definition_mpaso.xml | 11 +++++++++++ components/mpas-ocean/src/Registry.xml | 10 ++++++---- 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 14e95edfc014..585d8301d5d7 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -815,6 +815,12 @@ if ($OCN_ISMF eq 'coupled') { add_default($nl, 'config_frazil_under_land_ice'); } +############################ +# Namelist group: land_ice # +############################ + +add_default($nl, 'config_land_ice_rho_ocean'); + ################################### # Namelist group: land_ice_fluxes # ################################### @@ -1866,6 +1872,7 @@ my @groups = qw(run_modes self_attraction_loading tidal_potential_forcing frazil_ice + land_ice land_ice_fluxes advection bottom_drag diff --git a/components/mpas-ocean/bld/build-namelist-group-list b/components/mpas-ocean/bld/build-namelist-group-list index 2adb0b92288b..ec96ea010ce3 100644 --- a/components/mpas-ocean/bld/build-namelist-group-list +++ b/components/mpas-ocean/bld/build-namelist-group-list @@ -20,6 +20,7 @@ my @groups = qw(run_modes self_attraction_loading tidal_potential_forcing frazil_ice + land_ice land_ice_fluxes advection bottom_drag diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 23ad36a868e0..edd1294ed9b0 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -305,6 +305,12 @@ add_default($nl, 'config_frazil_sea_ice_reference_salinity'); add_default($nl, 'config_frazil_maximum_freezing_temperature'); add_default($nl, 'config_frazil_use_surface_pressure'); +############################ +# Namelist group: land_ice # +############################ + +add_default($nl, 'config_land_ice_rho_ocean'); + ################################### # Namelist group: land_ice_fluxes # ################################### diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 2a8ed57abc18..1afd3781e5fa 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -428,6 +428,9 @@ 0.0 .false. + +1028 + 'off' 'pressure_only' diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 23130f5947d2..adc5eb1b3dbc 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1644,6 +1644,17 @@ Default: Defined in namelist_defaults.xml + + + +ocean density used to calculate landIceDraft at floatation (assumed constant and uniform). Should be consistent with MALI's config_ocean_density when used to determine grounding line location. This is an alternative to the coupler variable effectiveDensityInLandIce which is not currently used. + +Valid values: Any positive real number +Default: Defined in namelist_defaults.xml + + + + + + - Date: Thu, 13 Mar 2025 17:36:41 -0500 Subject: [PATCH 04/16] Compute landIceDraft in diagnostics --- .../src/shared/mpas_ocn_diagnostics.F | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 691bfe70b589..d2a2c2cad6f9 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -78,6 +78,7 @@ module ocn_diagnostics integer :: ke_cell_flag, ke_vertex_flag real (kind=RKIND) :: fCoef real (kind=RKIND) :: landIceTopDragCoeff + real (kind=RKIND) :: rho_floatation real (kind=RKIND), pointer :: coef_3rd_order ! Methods for computing thickness at edges for flux calculations @@ -141,7 +142,7 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe logical :: full_compute = .true. real (kind=RKIND), dimension(:), pointer :: & - frazilSurfacePressure, landIcePressure, landIceDraft, landIceFraction + frazilSurfacePressure, landIcePressure, landIceFraction integer, dimension(:), pointer :: & landIceFloatingMask @@ -179,7 +180,6 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe if (landIcePressureOn) then call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) - call mpas_pool_get_array(forcingPool, 'landIceDraft', landIceDraft) call mpas_pool_get_array(forcingPool, 'landIceFloatingMask', landIceFloatingMask) call mpas_pool_get_array(forcingPool, 'landIceFraction', landIceFraction) if (nCellsAll.gt.0 .AND. landIceFloatingMask(1) == -1) then @@ -468,11 +468,12 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe ! ! compute fields needed to compute land-ice fluxes, either in the ocean model or in the coupler ! - ! inputs: layerThickness, normalVelocity, landIceFraction, landIceFloatingMask + ! inputs: layerThickness, normalVelocity, landIcePressure, landIceFraction, landIceFloatingMask ! outputs: if (landIcePressureOn) then call ocn_compute_land_ice_flux_input_fields(layerThickness, normalVelocity, activeTracers, & - landIceFraction, landIceFloatingMask, timeLevel, indexTemperature, indexSalinity) + landIcePressure, landIceDraft, landIceFraction, landIceFloatingMask, timeLevel, & + indexTemperature, indexSalinity) end if if ( full_compute ) then @@ -3641,7 +3642,7 @@ end subroutine ocn_compute_mixing_input_fields!}}} !----------------------------------------------------------------------- subroutine ocn_compute_land_ice_flux_input_fields(layerThickness, normalVelocity, & - activeTracers, landIceFraction, landIceFloatingMask, & + activeTracers, landIcePressure, landIceDraft, landIceFraction, landIceFloatingMask, & timeLevel, indexTval, indexSval)!{{{ !----------------------------------------------------------------- @@ -3656,7 +3657,7 @@ subroutine ocn_compute_land_ice_flux_input_fields(layerThickness, normalVelocity layerThickness, normalVelocity real (kind=RKIND), dimension(:), intent(in) :: & - landIceFraction + landIcePressure, landIceDraft, landIceFraction real (kind=RKIND), dimension(:,:,:), intent(in) :: & activeTracers @@ -3690,11 +3691,23 @@ subroutine ocn_compute_land_ice_flux_input_fields(layerThickness, normalVelocity !----------------------------------------------------------------- - if (( trim(config_land_ice_flux_mode) == "off" ) .or. & - ( trim(config_land_ice_flux_mode) == "pressure_only")) then - ! nothing to do here - return - end if + if ( trim(config_land_ice_flux_mode) == "off" ) return + +#ifdef MPAS_OPENACC + !$acc parallel loop present(landIceDraft, landIcePressure) +#else + !$omp parallel + !$omp do schedule(runtime) +#endif + do iCell = 1, nCellsAll + landIceDraft(iCell) = -landIcePressure(iCell) / (rho_floatation * gravity) + end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + + if ( trim(config_land_ice_flux_mode) == "pressure_only") return call mpas_timer_start("land_ice_diagnostic_fields", .false.) @@ -4697,6 +4710,8 @@ subroutine ocn_diagnostics_init(domain, err)!{{{ landIceTopDragCoeff = config_land_ice_flux_explicit_topDragCoeff endif + rho_floatation = config_land_ice_rho_ocean + if (trim(config_thickness_drag_type) == 'centered') then thickEdgeDragChoice = thickEdgeDragCenter elseif (trim(config_thickness_drag_type) == 'harmonic-mean') then From 2a77acfdcfcd3ea478ad2b494e8eb7eea1e70969 Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Mon, 19 May 2025 15:36:13 -0500 Subject: [PATCH 05/16] Use landIceDraftForSsh to compute gradSSH --- components/mpas-ocean/src/Registry.xml | 6 ++- .../src/shared/mpas_ocn_diagnostics.F | 38 +++++++++++-------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 8d86d467f367..81b297a2672b 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -1046,6 +1046,10 @@ /> + Date: Mon, 19 May 2025 15:39:24 -0500 Subject: [PATCH 06/16] Use landIceDraftForSsh for eddy parameterization MLD --- .../mpas_ocn_mixed_layer_depths.F | 16 ++++++++-------- .../mpas_ocn_eddy_parameterization_helpers.F | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F index 41f2d7d6d0a4..3439202af587 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F @@ -174,7 +174,7 @@ subroutine ocn_compute_mixed_layer_depths(domain, timeLevel, err)!{{{ ! real (kind=RKIND), dimension(:), pointer :: areaCell real (kind=RKIND), dimension(:,:), allocatable :: pressureAdjustedForLandIce - real (kind=RKIND), dimension(:), pointer :: tThreshMLD, tGradientMLD, landIceDraft + real (kind=RKIND), dimension(:), pointer :: tThreshMLD, tGradientMLD, landIceDraftForSsh real (kind=RKIND), dimension(:), pointer :: dGradientMLD, landIcePressure real (kind=RKIND), dimension(:,:,:), pointer :: tracers integer :: interp_local @@ -212,7 +212,7 @@ subroutine ocn_compute_mixed_layer_depths(domain, timeLevel, err)!{{{ call mpas_pool_get_array(tracersPool, 'activeTracers', tracers, timeLevel) call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) - call mpas_pool_get_array(forcingPool, 'landIceDraft', landIceDraft) + ! landIceDraftForSsh is present in diagnostics variables call mpas_pool_get_array(meshPool, 'latCell', latCell) call mpas_pool_get_array(meshPool, 'lonCell', lonCell) @@ -284,11 +284,11 @@ subroutine ocn_compute_mixed_layer_depths(domain, timeLevel, err)!{{{ !$omp end do !$omp end parallel - if (associated(landIceDraft) ) then + if (associated(landIceDraftForSsh) ) then !$omp parallel !$omp do schedule(runtime) do iCell = 1, nCells - tThreshMLD(iCell) = tThreshMLD(iCell) - abs(landIceDraft(iCell)) + tThreshMLD(iCell) = tThreshMLD(iCell) - abs(landIceDraftForSsh(iCell)) end do !$omp end do !$omp end parallel @@ -350,11 +350,11 @@ subroutine ocn_compute_mixed_layer_depths(domain, timeLevel, err)!{{{ !$omp end parallel !normalize MLD to top of ice cavity - if (associated(landIceDraft) ) then + if (associated(landIceDraftForSsh) ) then !$omp parallel !$omp do schedule(runtime) do iCell = 1, nCells - tGradientMLD(iCell) = tGradientMLD(iCell) - abs(landIceDraft(iCell)) + tGradientMLD(iCell) = tGradientMLD(iCell) - abs(landIceDraftForSsh(iCell)) end do !$omp end do !$omp end parallel @@ -415,11 +415,11 @@ subroutine ocn_compute_mixed_layer_depths(domain, timeLevel, err)!{{{ !$omp end do !$omp end parallel - if (associated(landIceDraft) ) then + if (associated(landIceDraftForSsh) ) then !$omp parallel !$omp do schedule(runtime) do iCell = 1, nCells - dGradientMLD(iCell) = dGradientMLD(iCell) - abs(landIceDraft(iCell)) + dGradientMLD(iCell) = dGradientMLD(iCell) - abs(landIceDraftForSsh(iCell)) end do !$omp end do !$omp end parallel diff --git a/components/mpas-ocean/src/shared/mpas_ocn_eddy_parameterization_helpers.F b/components/mpas-ocean/src/shared/mpas_ocn_eddy_parameterization_helpers.F index 360fa2c7082d..d35aed10f437 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_eddy_parameterization_helpers.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_eddy_parameterization_helpers.F @@ -198,7 +198,7 @@ subroutine ocn_eddy_compute_mixed_layer_depth(statePool, forcingPool) real(kind=RKIND) :: dDenThres, den_ref_lev real(kind=RKIND),dimension(:), allocatable :: depth real (kind=RKIND), dimension(:,:), pointer :: layerThickness - real (kind=RKIND), dimension(:), pointer :: landIceDraft, landIcePressure + real (kind=RKIND), dimension(:), pointer :: landIcePressure logical :: found_den_mld real (kind=RKIND) :: dV, dVp1, refDepth, coeffs(2), mldTemp, dz real (kind=RKIND), dimension(:,:), allocatable :: pressureAdjustedForLandIce @@ -207,7 +207,6 @@ subroutine ocn_eddy_compute_mixed_layer_depth(statePool, forcingPool) if ( config_eddyMLD_use_old ) then call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) - call mpas_pool_get_array(forcingPool, 'landIceDraft', landIceDraft) allocate(pressureAdjustedForLandIce(nVertLevels, size(pressure,2))) @@ -279,11 +278,11 @@ subroutine ocn_eddy_compute_mixed_layer_depth(statePool, forcingPool) !$omp end do !$omp end parallel - if (associated(landIceDraft) ) then + if (associated(landIceDraftForSsh) ) then !$omp parallel !$omp do schedule(runtime) do iCell = 1, nCells - dThreshMLD(iCell) = dThreshMLD(iCell) - abs(landIceDraft(iCell)) + dThreshMLD(iCell) = dThreshMLD(iCell) - abs(landIceDraftForSsh(iCell)) end do !$omp end do !$omp end parallel From 303ff3ac9a27801e0717fe6aa5a4f7a2872aaed0 Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Fri, 14 Mar 2025 18:47:43 -0500 Subject: [PATCH 07/16] Add a new subroutine to update landIceFloating* based on landIceDraft: Subroutine is located in ocn_wetting_drying because it is only used with wetting and drying Subroutine is called from diagnostics A log-related function is moved to ocn_config module to avoid build circularities --- components/mpas-ocean/src/shared/Makefile | 4 +- .../mpas-ocean/src/shared/mpas_ocn_config.F | 30 +++++++++++ .../src/shared/mpas_ocn_diagnostics.F | 37 +++---------- .../src/shared/mpas_ocn_wetting_drying.F | 53 ++++++++++++++++++- 4 files changed, 90 insertions(+), 34 deletions(-) diff --git a/components/mpas-ocean/src/shared/Makefile b/components/mpas-ocean/src/shared/Makefile index 27c3db10fee1..92019f57efe8 100644 --- a/components/mpas-ocean/src/shared/Makefile +++ b/components/mpas-ocean/src/shared/Makefile @@ -85,7 +85,7 @@ mpas_ocn_init_routines.o: mpas_ocn_constants.o mpas_ocn_config.o mpas_ocn_mesh.o mpas_ocn_tendency.o: mpas_ocn_high_freq_thickness_hmix_del2.o mpas_ocn_tracer_surface_restoring.o mpas_ocn_thick_surface_flux.o mpas_ocn_tracer_short_wave_absorption.o mpas_ocn_tracer_advection.o mpas_ocn_tracer_hmix.o mpas_ocn_tracer_nonlocalflux.o mpas_ocn_surface_bulk_forcing.o mpas_ocn_surface_land_ice_fluxes.o mpas_ocn_tracer_surface_flux_to_tend.o mpas_ocn_tracer_interior_restoring.o mpas_ocn_tracer_exponential_decay.o mpas_ocn_tracer_ideal_age.o mpas_ocn_tracer_TTD.o mpas_ocn_vmix.o mpas_ocn_constants.o mpas_ocn_config.o mpas_ocn_frazil_forcing.o mpas_ocn_tidal_forcing.o mpas_ocn_tracer_ecosys.o mpas_ocn_tracer_DMS.o mpas_ocn_tracer_MacroMolecules.o mpas_ocn_tracer_CFC.o mpas_ocn_diagnostics.o mpas_ocn_wetting_drying.o mpas_ocn_vel_self_attraction_loading.o mpas_ocn_vel_tidal_potential.o mpas_ocn_mesh.o mpas_ocn_diagnostics_variables.o mpas_ocn_thick_hadv.o mpas_ocn_thick_vadv.o mpas_ocn_vel_hadv_coriolis.o mpas_ocn_vel_pressure_grad.o mpas_ocn_vel_vadv.o mpas_ocn_vel_hmix.o mpas_ocn_vel_forcing.o mpas_ocn_manufactured_solution.o -mpas_ocn_diagnostics.o: mpas_ocn_thick_ale.o mpas_ocn_equation_of_state.o mpas_ocn_gm.o mpas_ocn_constants.o mpas_ocn_config.o mpas_ocn_mesh.o mpas_ocn_diagnostics_variables.o mpas_ocn_surface_land_ice_fluxes.o mpas_ocn_vertical_advection.o mpas_ocn_submesoscale_eddies.o mpas_ocn_subgrid.o +mpas_ocn_diagnostics.o: mpas_ocn_thick_ale.o mpas_ocn_equation_of_state.o mpas_ocn_gm.o mpas_ocn_constants.o mpas_ocn_config.o mpas_ocn_mesh.o mpas_ocn_diagnostics_variables.o mpas_ocn_surface_land_ice_fluxes.o mpas_ocn_vertical_advection.o mpas_ocn_submesoscale_eddies.o mpas_ocn_subgrid.o mpas_ocn_wetting_drying.o mpas_ocn_diagnostics_variables.o: mpas_ocn_config.o @@ -219,7 +219,7 @@ mpas_ocn_framework_forcing.o: mpas_ocn_time_varying_forcing.o: mpas_ocn_framework_forcing.o mpas_ocn_diagnostics_variables.o mpas_ocn_constants.o mpas_ocn_config.o -mpas_ocn_wetting_drying.o: mpas_ocn_diagnostics.o mpas_ocn_gm.o mpas_ocn_diagnostics_variables.o mpas_ocn_constants.o mpas_ocn_config.o mpas_ocn_gm.o mpas_ocn_mesh.o +mpas_ocn_wetting_drying.o: mpas_ocn_gm.o mpas_ocn_diagnostics_variables.o mpas_ocn_constants.o mpas_ocn_config.o mpas_ocn_gm.o mpas_ocn_mesh.o mpas_ocn_vel_pressure_grad.o mpas_ocn_tidal_potential_forcing.o: mpas_ocn_constants.o mpas_ocn_config.o mpas_ocn_mesh.o mpas_ocn_diagnostics_variables.o diff --git a/components/mpas-ocean/src/shared/mpas_ocn_config.F b/components/mpas-ocean/src/shared/mpas_ocn_config.F index 04db8d666bd7..e4858a78afc8 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_config.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_config.F @@ -47,6 +47,36 @@ subroutine ocn_config_init(configPool)!{{{ end subroutine ocn_config_init!}}} + function ocn_build_log_filename(prefix, identifier) result(filename)!{{{ + character (len=*), intent(in) :: prefix + integer, intent(in) :: identifier + + character (len=StrKIND) :: filename + + character (len=StrKIND) :: identifierString + + if ( identifier .lt. 10 ) then + write(identifierString, '(I1)') identifier + else if ( identifier .lt. 100 ) then + write(identifierString, '(I2)') identifier + else if ( identifier .lt. 1000 ) then + write(identifierString, '(I3)') identifier + else if ( identifier .lt. 10000 ) then + write(identifierString, '(I4)') identifier + else if ( identifier .lt. 100000 ) then + write(identifierString, '(I5)') identifier + else if ( identifier .lt. 1000000 ) then + write(identifierString, '(I6)') identifier + else if ( identifier .lt. 10000000 ) then + write(identifierString, '(I7)') identifier + else + write(identifierString, '(I99)') identifier + end if + + filename = trim(prefix) // trim(identifierString) + + end function ocn_build_log_filename!}}} + !*********************************************************************** end module ocn_config diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 0de192bd6d20..946d3a9b4d82 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -39,6 +39,7 @@ module ocn_diagnostics use ocn_surface_land_ice_fluxes use ocn_vertical_advection use ocn_subgrid + use ocn_wetting_drying, only: ocn_wetting_drying_update_land_ice implicit none private @@ -142,7 +143,7 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe logical :: full_compute = .true. real (kind=RKIND), dimension(:), pointer :: & - frazilSurfacePressure, landIcePressure, landIceDraft, landIceFraction + frazilSurfacePressure, landIcePressure, landIceDraft, landIceFraction, landIceFloatingFraction integer, dimension(:), pointer :: & landIceFloatingMask @@ -182,6 +183,7 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) call mpas_pool_get_array(forcingPool, 'landIceDraft', landIceDraft) call mpas_pool_get_array(forcingPool, 'landIceFloatingMask', landIceFloatingMask) + call mpas_pool_get_array(forcingPool, 'landIceFloatingFraction', landIceFloatingFraction) call mpas_pool_get_array(forcingPool, 'landIceFraction', landIceFraction) if (nCellsAll.gt.0 .AND. landIceFloatingMask(1) == -1) then call mpas_log_write('landIceFloatingMask contains the default value which likely indicates that this field is missing in the initial condition file (e.g. because it is meant for an older E3SM version).', & @@ -476,6 +478,9 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe landIcePressure, landIceDraft, landIceFraction, landIceFloatingMask, timeLevel, & indexTemperature, indexSalinity) end if + if (landIcePressureOn .and. config_use_wetting_drying) then + call ocn_wetting_drying_update_land_ice(landIceFloatingMask, landIceFloatingFraction, err) + end if if ( full_compute ) then @@ -4608,36 +4613,6 @@ subroutine ocn_validate_state(domain, timeLevel)!{{{ end subroutine ocn_validate_state!}}} - function ocn_build_log_filename(prefix, identifier) result(filename)!{{{ - character (len=*), intent(in) :: prefix - integer, intent(in) :: identifier - - character (len=StrKIND) :: filename - - character (len=StrKIND) :: identifierString - - if ( identifier .lt. 10 ) then - write(identifierString, '(I1)') identifier - else if ( identifier .lt. 100 ) then - write(identifierString, '(I2)') identifier - else if ( identifier .lt. 1000 ) then - write(identifierString, '(I3)') identifier - else if ( identifier .lt. 10000 ) then - write(identifierString, '(I4)') identifier - else if ( identifier .lt. 100000 ) then - write(identifierString, '(I5)') identifier - else if ( identifier .lt. 1000000 ) then - write(identifierString, '(I6)') identifier - else if ( identifier .lt. 10000000 ) then - write(identifierString, '(I7)') identifier - else - write(identifierString, '(I99)') identifier - end if - - filename = trim(prefix) // trim(identifierString) - - end function ocn_build_log_filename!}}} - subroutine ocn_write_field_statistics(unitNumber, fieldName, minValue, maxValue) integer, intent(in) :: unitNumber character (len=*), intent(in) :: fieldName diff --git a/components/mpas-ocean/src/shared/mpas_ocn_wetting_drying.F b/components/mpas-ocean/src/shared/mpas_ocn_wetting_drying.F index 16d052df0288..39ce178e0ab6 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_wetting_drying.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_wetting_drying.F @@ -29,7 +29,6 @@ module ocn_wetting_drying use ocn_constants use ocn_config - use ocn_diagnostics use ocn_diagnostics_variables use ocn_gm use ocn_mesh @@ -54,6 +53,7 @@ module ocn_wetting_drying public :: ocn_wetting_drying_verify, ocn_prevent_drying_rk4 public :: ocn_wetting_velocity_factor_on_cell_edges + public :: ocn_wetting_drying_update_land_ice !-------------------------------------------------------------------- ! @@ -637,6 +637,57 @@ subroutine ocn_wetting_velocity_factor_on_cell_edges(wettingVelocityFactor, laye end subroutine ocn_wetting_velocity_factor_on_cell_edges!}}} + subroutine ocn_wetting_drying_update_land_ice(landIceFloatingMask, landIceFloatingFraction, err) + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + ! landIceDraftForSsh is supplied by diagnostic_variables + + integer, dimension(:), intent(inout) :: & + landIceFloatingMask !< Input/Output: land ice floating mask + + real (kind=RKIND), dimension(:), intent(inout) :: & + landIceFloatingFraction !< Input/Output: land ice floating fraction + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell + + err = 0 + + !$omp parallel + !$omp do schedule(runtime) + do iCell = 1, nCellsAll + if (landIceDraftForSsh(iCell) < -bottomDepth(iCell)) then + landIceFloatingMask(iCell) = 0 + landIceFloatingFraction(iCell) = 0.0_RKIND + else + landIceFloatingMask(iCell) = 1 + ! For a simulation with wetting and drying, we do not retain fractional floating areas + landIceFloatingFraction(iCell) = 1.0_RKIND + endif + enddo + !$omp end do + !$omp end parallel + + end subroutine ocn_wetting_drying_update_land_ice + end module ocn_wetting_drying !||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| From 74b760824c90b33f03173c5ecfb141dfee32320b Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Tue, 20 May 2025 09:55:48 -0500 Subject: [PATCH 08/16] Update bld files for config_land_ice_draft_mode --- components/mpas-ocean/bld/build-namelist | 1 + components/mpas-ocean/bld/build-namelist-section | 1 + .../bld/namelist_files/namelist_defaults_mpaso.xml | 1 + .../bld/namelist_files/namelist_definition_mpaso.xml | 8 ++++++++ 4 files changed, 11 insertions(+) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 585d8301d5d7..ff103c099b94 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -819,6 +819,7 @@ if ($OCN_ISMF eq 'coupled') { # Namelist group: land_ice # ############################ +add_default($nl, 'config_land_ice_draft_mode'); add_default($nl, 'config_land_ice_rho_ocean'); ################################### diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index edd1294ed9b0..8976bc526ea4 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -309,6 +309,7 @@ add_default($nl, 'config_frazil_use_surface_pressure'); # Namelist group: land_ice # ############################ +add_default($nl, 'config_land_ice_draft_mode'); add_default($nl, 'config_land_ice_rho_ocean'); ################################### diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 1afd3781e5fa..59c01bc72f54 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -429,6 +429,7 @@ .false. +"pressure-dependent" 1028 diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index adc5eb1b3dbc..fd2e2708d020 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1646,6 +1646,14 @@ Default: Defined in namelist_defaults.xml + +Selects the mode in which land-ice draft is computed. + +Valid values= 'data,'pressure-dependent' +Default: Defined in namelist_defaults.xml + + ocean density used to calculate landIceDraft at floatation (assumed constant and uniform). Should be consistent with MALI's config_ocean_density when used to determine grounding line location. This is an alternative to the coupler variable effectiveDensityInLandIce which is not currently used. From 5f377b6d61900a076cc7ca9bbdf6ce010216c8ed Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Tue, 20 May 2025 12:14:44 -0500 Subject: [PATCH 09/16] Use data landIceDraft mode for old meshes --- .../bld/namelist_files/namelist_defaults_mpaso.xml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 59c01bc72f54..955ae13b9c66 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -429,7 +429,18 @@ .false. -"pressure-dependent" +'pressure-dependent' +'data' +'data' +'data' +'data' +'data' +'data' +'data' +'data' +'data' +'data' +'data' 1028 From 2d4322960801f135294172f6398bd09f90c6455d Mon Sep 17 00:00:00 2001 From: Jon Wolfe Date: Tue, 20 May 2025 18:06:14 -0500 Subject: [PATCH 10/16] Make bld files consistent with Registry --- .../bld/namelist_files/namelist_definition_mpaso.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index fd2e2708d020..507175c6de58 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1646,11 +1646,11 @@ Default: Defined in namelist_defaults.xml - Selects the mode in which land-ice draft is computed. -Valid values= 'data,'pressure-dependent' +Valid values: 'data,'pressure-dependent' Default: Defined in namelist_defaults.xml From 91ca9836f2f57ee6671dc9e10a3c36fcd1716434 Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Fri, 23 May 2025 12:52:42 -0500 Subject: [PATCH 11/16] Remove unused mesh from default settings --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 955ae13b9c66..0810a4d56bbb 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -440,8 +440,7 @@ 'data' 'data' 'data' -'data' -1028 +1028.0 'off' From 84fd0a2bfabe014cf70bb98c4051a242566f1d4d Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Wed, 28 May 2025 13:47:09 -0500 Subject: [PATCH 12/16] Swap out SOwISC mesh for e3sm_hi_res suite --- cime_config/config_grids.xml | 6 +++--- cime_config/tests.py | 2 +- .../bld/namelist_files/namelist_defaults_mpaso.xml | 3 ++- .../bld/namelist_files/namelist_definition_mpaso.xml | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cime_config/config_grids.xml b/cime_config/config_grids.xml index 99e2d13e3525..b4893e886d73 100755 --- a/cime_config/config_grids.xml +++ b/cime_config/config_grids.xml @@ -386,14 +386,14 @@ WCAtl12to45E2r4 - + T62 T62 - SOwISC12to60E2r4 + SOwISC12to60E3r3 rx1 null null - SOwISC12to60E2r4 + SOwISC12to30E3r3 diff --git a/cime_config/tests.py b/cime_config/tests.py index 17d8c0d4d338..a60e01490baa 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -396,7 +396,7 @@ "inherit" : "e3sm_atm_hi_res", "tests" : ( "SMS_Ld3.ne120pg2_r025_RRSwISC6to18E3r5.WCYCL1850NS.eam-cosplite", - "SMS.T62_SOwISC12to60E2r4.GMPAS-IAF", + "SMS.T62_SOwISC12to30E3r3.GMPAS-IAF", ) }, diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 0810a4d56bbb..955ae13b9c66 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -440,7 +440,8 @@ 'data' 'data' 'data' -1028.0 +'data' +1028 'off' diff --git a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml index 507175c6de58..fd2e2708d020 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1646,11 +1646,11 @@ Default: Defined in namelist_defaults.xml - Selects the mode in which land-ice draft is computed. -Valid values: 'data,'pressure-dependent' +Valid values= 'data,'pressure-dependent' Default: Defined in namelist_defaults.xml From 58cfa61c27e68d51209a633dc7d7d91005e6a0d6 Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Thu, 29 May 2025 13:03:54 -0600 Subject: [PATCH 13/16] Remove non-existent mesh from namelist defaults Co-authored-by: Xylar Asay-Davis --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml index 955ae13b9c66..e28e528708a3 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -440,7 +440,6 @@ 'data' 'data' 'data' -'data' 1028 From b910da4f0f1e623348a7c8adae680a7a1f336b9e Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Thu, 29 May 2025 14:11:57 -0500 Subject: [PATCH 14/16] Move rho_floatation from module to local variable --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 946d3a9b4d82..813af66db03f 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -79,7 +79,6 @@ module ocn_diagnostics integer :: ke_cell_flag, ke_vertex_flag real (kind=RKIND) :: fCoef real (kind=RKIND) :: landIceTopDragCoeff - real (kind=RKIND) :: rho_floatation real (kind=RKIND), pointer :: coef_3rd_order ! Methods for computing thickness at edges for flux calculations @@ -3679,7 +3678,8 @@ subroutine ocn_compute_land_ice_flux_input_fields(layerThickness, normalVelocity integer :: iCell, iEdge, cell1, cell2, iLevel, i - real (kind=RKIND) :: blThickness, dz, weightSum, h_nu, Gamma_turb, landIceEdgeFraction, velocityMagnitude + real (kind=RKIND) :: blThickness, dz, weightSum, h_nu, Gamma_turb, landIceEdgeFraction, & + velocityMagnitude, rho_floatation ! Scratch Arrays real (kind=RKIND), dimension(:), allocatable :: & @@ -3705,6 +3705,8 @@ subroutine ocn_compute_land_ice_flux_input_fields(layerThickness, normalVelocity elseif ( trim(config_land_ice_draft_mode) == "pressure-dependent" ) then + rho_floatation = config_land_ice_rho_ocean + #ifdef MPAS_OPENACC !$acc parallel loop present(landIceDraftForSsh, landIcePressure) #else @@ -4693,8 +4695,6 @@ subroutine ocn_diagnostics_init(domain, err)!{{{ landIceTopDragCoeff = config_land_ice_flux_explicit_topDragCoeff endif - rho_floatation = config_land_ice_rho_ocean - if (trim(config_thickness_drag_type) == 'centered') then thickEdgeDragChoice = thickEdgeDragCenter elseif (trim(config_thickness_drag_type) == 'harmonic-mean') then From b2ae028bfc5de48ad3d3cfc3a115c29b1896bbdd Mon Sep 17 00:00:00 2001 From: Carolyn Begeman Date: Thu, 5 Jun 2025 10:49:09 -0500 Subject: [PATCH 15/16] make landIceDraftForSsh only in landIcePressurePKG --- components/mpas-ocean/src/Registry.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 81b297a2672b..cb1fc2bcfef9 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3469,7 +3469,7 @@ Date: Fri, 6 Jun 2025 11:07:53 -0500 Subject: [PATCH 16/16] Remove pointer variable from MLD --- .../src/analysis_members/mpas_ocn_mixed_layer_depths.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F index 3439202af587..cbe607c47729 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_mixed_layer_depths.F @@ -174,7 +174,7 @@ subroutine ocn_compute_mixed_layer_depths(domain, timeLevel, err)!{{{ ! real (kind=RKIND), dimension(:), pointer :: areaCell real (kind=RKIND), dimension(:,:), allocatable :: pressureAdjustedForLandIce - real (kind=RKIND), dimension(:), pointer :: tThreshMLD, tGradientMLD, landIceDraftForSsh + real (kind=RKIND), dimension(:), pointer :: tThreshMLD, tGradientMLD real (kind=RKIND), dimension(:), pointer :: dGradientMLD, landIcePressure real (kind=RKIND), dimension(:,:,:), pointer :: tracers integer :: interp_local