From d56618a94cc405089b10323334c7a94f6ad854f7 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:22:14 -0600 Subject: [PATCH 01/73] resolved: registry topodrag --- components/mpas-ocean/src/Registry.xml | 21 ++++++++++++++- .../src/shared/mpas_ocn_diagnostics.F | 26 ++++++++++++++----- .../mpas-ocean/src/shared/mpas_ocn_forcing.F | 19 +++++++++++++- .../shared/mpas_ocn_surface_bulk_forcing.F | 18 +++++++++---- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 20 ++++++++++---- .../src/shared/mpas_ocn_thick_surface_flux.F | 26 ++++++++++++++----- 6 files changed, 105 insertions(+), 25 deletions(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 825fe607a5b4..0ed2b0c42462 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,6 +702,10 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> + + @@ -3347,6 +3352,9 @@ + + - + + \date 15 September 2011 !> \details !> This routine computes the horizontal advection tendency for -!> thicknes based on current state and user choices of forcings. +!> thickness based on current state and user choices of forcings. ! !----------------------------------------------------------------------- subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoefficientsRunoff, & - surfaceThicknessFlux, surfaceThicknessFluxRunoff, tend, err)!{{{ + transmissionCoefficientsSubglacialRunoff, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & + surfaceThicknessFluxSubglacialRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -83,11 +84,13 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe real (kind=RKIND), dimension(:,:), intent(in) :: & transmissionCoefficients, &!< Input: Coefficients for the transmission of surface fluxes - transmissionCoefficientsRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff + transmissionCoefficientsRunoff, &!< Input: Coefficients for the transmission of surface fluxes due to river runoff + transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff real (kind=RKIND), dimension(:), intent(in) :: & surfaceThicknessFlux, &!< Input: surface flux of thickness - surfaceThicknessFluxRunoff !< Input: surface flux of thickness due to river runoff + surfaceThicknessFluxRunoff, &!< Input: surface flux of thickness due to river runoff + surfaceThicknessFluxSubglacialRunoff !< Input: surface flux of thickness due to subglacial runoff !----------------------------------------------------------------- @@ -124,10 +127,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe call mpas_timer_start("thick surface flux") #ifdef MPAS_OPENACC - !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff) + !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) !$acc parallel loop & !$acc present(tend, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & + !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & !$acc transmissionCoefficients, transmissionCoefficientsRunoff, minLevelCell, maxLevelCell) & !$acc private(k, remainingFlux, remainingFluxRunoff) #else @@ -137,12 +141,15 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND remainingFluxRunoff = 1.0_RKIND + remainingFluxSubglacialRunoff = 1.0_RKIND do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - transmissionCoefficients(k, iCell) remainingFluxRunoff = remainingFluxRunoff - transmissionCoefficientsRunoff(k, iCell) + remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) tend(k, iCell) = tend(k, iCell) + surfaceThicknessFlux(iCell) * transmissionCoefficients(k, iCell) & - + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) + + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) & + + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) end do if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then @@ -153,6 +160,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + remainingFluxRunoff * surfaceThicknessFluxRunoff(iCell) end if + + if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then + tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + end if end do #ifndef MPAS_OPENACC !$omp end do @@ -160,7 +172,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe #endif #ifdef MPAS_OPENACC - !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff) + !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) #endif call mpas_timer_stop("thick surface flux") From f57b015c4c3532f94787fca00f3ed1a7a0ddb054 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:23:19 -0600 Subject: [PATCH 02/73] resolved: gitignore --- .gitignore | 13 +++++++++++++ .../mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 13 +++++++++++++ .../src/shared/mpas_ocn_diagnostics_variables.F | 13 ++++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d7a1fabfd6bc..d2fcc80bbb71 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,16 @@ components/eamxx/docs/common/eamxx_params.md components/eamxx/src/python/build components/eamxx/src/python/build_src components/eamxx/src/python/dist + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# idea folder +.idea/ diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index a8807b995067..0ca331b57b68 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -4442,6 +4442,19 @@ subroutine ocn_validate_state(domain, timeLevel)!{{{ call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) end if + ! Test riverRunoffFlux + fieldName = 'subglacialRunoffFlux' + minValue = HUGE(minValue) + maxValue = -HUGE(maxValue) + call mpas_pool_get_array(forcingPool, fieldName, real1DArr) + if ( associated(real1DArr) ) then + do iCell = 1, nCellsSolve + minValue = min( minValue, real1DArr(iCell) ) + maxValue = max( maxValue, real1DArr(iCell) ) + end do + call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) + end if + ! Test seaIceSalinityFlux fieldName = 'seaIceSalinityFlux' minValue = HUGE(minValue) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F index 30a62f68c8b9..38f32f88e17c 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics_variables.F @@ -85,6 +85,7 @@ module ocn_diagnostics_variables real (kind=RKIND), dimension(:), pointer :: sfcFlxAttCoeff real (kind=RKIND), dimension(:), pointer :: surfaceFluxAttenuationCoefficientRunoff + real (kind=RKIND), dimension(:), pointer :: surfaceFluxAttenuationCoefficientSubglacialRunoff real (kind=RKIND), dimension(:), pointer :: landIceFrictionVelocity real (kind=RKIND), dimension(:), pointer :: velocityTidalRMS @@ -680,6 +681,9 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e call mpas_pool_get_array(diagnosticsPool, & 'surfaceFluxAttenuationCoefficientRunoff', & surfaceFluxAttenuationCoefficientRunoff) + call mpas_pool_get_array(diagnosticsPool, & + 'surfaceFluxAttenuationCoefficientSubglacialRunoff', & + surfaceFluxAttenuationCoefficientSubglacialRunoff) call mpas_pool_get_array(diagnosticsPool, & 'boundaryLayerDepth', & boundaryLayerDepth) @@ -964,7 +968,8 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e !$acc Time_bnds, & !$acc simulationStartTime, & !$acc boundaryLayerDepthSmooth, & - !$acc surfaceFluxAttenuationCoefficientRunoff & + !$acc surfaceFluxAttenuationCoefficientRunoff, & + !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff & !$acc ) end subroutine ocn_diagnostics_variables_init!}}} @@ -1223,7 +1228,8 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{ !$acc Time_bnds, & !$acc simulationStartTime, & !$acc boundaryLayerDepthSmooth, & - !$acc surfaceFluxAttenuationCoefficientRunoff & + !$acc surfaceFluxAttenuationCoefficientRunoff, & + !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff & !$acc ) ! Nullify pointers @@ -1425,7 +1431,8 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{ Time_bnds, & simulationStartTime, & boundaryLayerDepthSmooth, & - surfaceFluxAttenuationCoefficientRunoff) + surfaceFluxAttenuationCoefficientRunoff, & + surfaceFluxAttenuationCoefficientSubglacialRunoff) end subroutine ocn_diagnostics_variables_destroy!}}} From b4198e827e55af9f6c29cfe3510de83de20a1a46 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 18 Oct 2023 17:28:44 -0600 Subject: [PATCH 03/73] subglacial runoff for tracers, part 1 --- .../src/shared/mpas_ocn_diagnostics.F | 22 ++++++++-- .../shared/mpas_ocn_surface_bulk_forcing.F | 21 +++++++--- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 31 +++++++++++--- .../src/shared/mpas_ocn_thick_surface_flux.F | 2 +- .../mpas_ocn_tracer_surface_flux_to_tend.F | 40 ++++++++++++++++++- 5 files changed, 98 insertions(+), 18 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 0ca331b57b68..4e75d743130a 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3298,6 +3298,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & real (kind=RKIND) :: & fracAbsorbed, &! fraction of sfc flux absorbed fracAbsorbedRunoff, &! same for runoff + fracAbsorbedSubglacialRunoff, &! same for subglacial runoff sumSurfaceStressSquared ! sum of sfc stress squared ! pointers for variable/pool retrievals @@ -3313,6 +3314,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & penetrativeTemperatureFlux, &! various sfc flux components surfaceThicknessFlux, & surfaceThicknessFluxRunoff, & + surfaceThicknessFluxSubglacialRunoff, & rainTemperatureFlux, & evapTemperatureFlux, & icebergTemperatureFlux, & @@ -3325,6 +3327,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & normalVelocity, &! normal velocity activeTracersSurfaceFlux, &! sfc flux of active tracers (T,S) activeTracersSurfaceFluxRunoff, &! flx of tracers in runoff + activeTracersSurfaceFluxSubglacialRunoff, &! flx of tracers in subglacial runoff nonLocalSurfaceTracerFlux ! non-local flux of tracers real (kind=RKIND), dimension(:,:,:), pointer :: & @@ -3388,11 +3391,16 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & call mpas_pool_get_array(tracersSurfaceFluxPool, & 'activeTracersSurfaceFluxRunoff', & activeTracersSurfaceFluxRunoff) + call mpas_pool_get_array(tracersSurfaceFluxPool, & + 'activeTracersSurfaceFluxSubglacialRunoff', & + activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(forcingPool, 'surfaceThicknessFlux', & surfaceThicknessFlux) call mpas_pool_get_array(forcingPool, 'surfaceThicknessFluxRunoff', & surfaceThicknessFluxRunoff) + call mpas_pool_get_array(forcingPool, 'surfaceThicknessFluxSubglacialRunoff', & + surfaceThicknessFluxSubglacialRunoff) call mpas_pool_get_array(forcingPool, 'penetrativeTemperatureFlux', & penetrativeTemperatureFlux) call mpas_pool_get_array(forcingPool, 'surfaceStress', & @@ -3465,7 +3473,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & !$omp parallel !$omp do schedule(runtime) & - !$omp private(kmin, fracAbsorbed, fracAbsorbedRunoff, & + !$omp private(kmin, fracAbsorbed, fracAbsorbedRunoff, fracAbsorbedSubglacialRunoff, & !$omp sumSurfaceStressSquared, i, iEdge) do iCell = 1, nCells @@ -3479,6 +3487,10 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) + fracAbsorbedSubglacialRunoff = 1.0_RKIND & + - exp( max(-100.0_RKIND, & + -layerThickness(kmin, iCell)/ & + config_flux_attenuation_coefficient_subglacial_runoff)) ! Store the total tracer flux below in ! nonLocalSurfaceTemperatureFlux for use in the CVMix nonlocal @@ -3493,13 +3505,17 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & seaIceTemperatureFlux(iCell) + & icebergTemperatureFlux(iCell)) & - fracAbsorbedRunoff* & - activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) + activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) & + - fracAbsorbedSubglacialRunoff* & + activeTracersSurfaceFluxSubglacialRunoff(indexTempFlux,iCell) nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) = & activeTracersSurfaceFlux(indexSaltFlux,iCell) & - fracAbsorbed*surfaceThicknessFlux(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) & - fracAbsorbedRunoff*surfaceThicknessFluxRunoff(iCell)* & + activeTracers(indexSaltFlux,kmin,iCell) & + - fracAbsorbedSubglacialRunoff*surfaceThicknessFluxSubglacialRunoff(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) surfaceBuoyancyForcing(iCell) = & @@ -4442,7 +4458,7 @@ subroutine ocn_validate_state(domain, timeLevel)!{{{ call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) end if - ! Test riverRunoffFlux + ! Test subglacialRunoffFlux fieldName = 'subglacialRunoffFlux' minValue = HUGE(minValue) maxValue = -HUGE(maxValue) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index ca0ca9fc4b89..f37305381792 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -78,7 +78,7 @@ module ocn_surface_bulk_forcing !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ !----------------------------------------------------------------- ! @@ -98,6 +98,8 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux !< Input/Output: Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRunoff !< Input/Output: Surface flux for tracer group due to river runoff + real (kind=RKIND), dimension(:,:), intent(inout) :: & + tracersSurfaceFluxSubglacialRunoff !< Input/Output: Surface flux for tracer group due to subglacial runoff real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRemoved !< Input/Output: Accumulator for ignored Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -122,7 +124,7 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr call mpas_timer_start("bulk_" // trim(groupName)) if ( trim(groupName) == 'activeTracers' ) then call ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) end if call mpas_timer_stop("bulk_" // trim(groupName)) @@ -426,7 +428,7 @@ end subroutine ocn_surface_bulk_forcing_init!}}} !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ !----------------------------------------------------------------- ! @@ -443,6 +445,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRunoff + real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxSubglacialRunoff real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRemoved real (kind=RKIND), dimension(:,:,:), intent(inout) :: tracerGroup real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -470,7 +473,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type(mpas_pool_type),pointer :: tracersSurfaceFluxPool real (kind=RKIND), dimension(:), pointer :: latentHeatFlux, sensibleHeatFlux, longWaveHeatFluxUp, longWaveHeatFluxDown, & - seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux + seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux, subglacialRunoffFlux real (kind=RKIND), dimension(:), pointer :: seaIceFreshWaterFlux, icebergFreshWaterFlux, seaIceSalinityFlux, iceRunoffFlux real (kind=RKIND), dimension(:), pointer :: shortWaveHeatFlux, penetrativeTemperatureFlux real (kind=RKIND), dimension(:), pointer :: snowFlux, rainFlux @@ -572,6 +575,11 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFluxRunoff(index_temperature_flux,iCell) = riverRunoffFlux(iCell) & * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw + ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + ocn_freezing_temperature(salinity=0.0_RKIND, pressure=interfacePressure(iCell), & + inLandIceCavity=.true.) / rho_sw + ! Accumulate fluxes that use the freezing point ! mrp performance note: should call ocn_freezing_temperature just once here seaIceTemperatureFlux(iCell) = seaIceFreshWaterFlux(iCell) * & @@ -587,9 +595,10 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFlux(index_temperature_flux, iCell) = tracersSurfaceFlux(index_temperature_flux, iCell) & + surfaceTemperatureFluxWithoutRunoff - ! add runoff contribution for sending through coupler + ! add river and subglacial runoff contribution for sending through coupler totalFreshWaterTemperatureFlux(iCell) = surfaceTemperatureFluxWithoutRunoff & - + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) + + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) & + + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) ! Fields with zero temperature are not accumulated. These include: ! snowFlux diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 10188a3be11c..2d3dd66cbdb9 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -134,7 +134,8 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ real (kind=RKIND), dimension(:,:), pointer, contiguous :: & tendThick, &! accumulated layer thickness tendency fractionAbsorbed, &! fraction of sfc flux absorbed - fractionAbsorbedRunoff ! fraction of runoff flux absorbed + fractionAbsorbedRunoff, &! fraction of sfc flux absorbed + fractionAbsorbedSubglacialRunoff ! fraction of subglacial runoff flux absorbed !----------------------------------------------------------------- ! local variables @@ -161,6 +162,10 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ fractionAbsorbed) call mpas_pool_get_array(forcingPool, 'fractionAbsorbedRunoff', & fractionAbsorbedRunoff) + call mpas_pool_get_array(forcingPool, 'fractionAbsorbedSubglacialRunoff', & + fractionAbsorbedSubglacialRunoff) + + ! ! layer thickness tendency: @@ -610,9 +615,11 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & real (kind=RKIND), dimension(:,:), pointer, contiguous :: & layerThickness, &! layer thickness tracerGroupSurfaceFlux, &! tracer flux at surface - fractionAbsorbed, &! frac sfc flux aborbed - fractionAbsorbedRunoff, &! frac runoff flux aborbed + fractionAbsorbed, &! frac sfc flux absorbed + fractionAbsorbedRunoff, &! frac runoff flux absorbed + fractionAbsorbedSubglacialRunoff, &! frac subglacial runoff flux absorbed tracerGroupSurfaceFluxRunoff, &! runoff flux + tracerGroupSurfaceFluxSubglacialRunoff, &! subglacial runoff flux tracerGroupSurfaceFluxRemoved,&! total sfc flux absorbed nonLocalSurfaceTracerFlux ! non-local fluxes (eg KPP) @@ -674,6 +681,8 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & fractionAbsorbed) call mpas_pool_get_array(forcingPool, 'fractionAbsorbedRunoff', & fractionAbsorbedRunoff) + call mpas_pool_get_array(forcingPool, 'fractionAbsorbedSubglacialRunoff', & + fractionAbsorbedSubglacialRunoff) ! allocate and transfer data not specific to tracer groups allocate(normalThicknessFlux(nVertLevels, nEdgesAll+1)) @@ -798,6 +807,14 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & modifiedGroupName, & tracerGroupSurfaceFluxRunoff) + ! Get surface flux due to subglacial runoff array + ! only active tracers have subglacial runoff flux for now, + ! but we still need to associate for ALL tracers + modifiedGroupName = groupName // "SurfaceFluxSubglacialRunoff" + call mpas_pool_get_array(tracersSurfaceFluxPool, & + modifiedGroupName, & + tracerGroupSurfaceFluxSubglacialRunoff) + ! Get surface flux removed array to keep track of how much ! flux is ignored modifiedGroupName = groupName // "SurfaceFluxRemoved" @@ -824,6 +841,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & do n=1,nTracersGroup tracerGroupSurfaceFlux (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRunoff (n,iCell) = 0.0_RKIND + tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRemoved(n,iCell) = 0.0_RKIND end do end do @@ -839,6 +857,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & forcingPool, tracerGroup, & tracerGroupSurfaceFlux, & tracerGroupSurfaceFluxRunoff, & + tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupSurfaceFluxRemoved, & dt, layerThickness, err) @@ -1198,9 +1217,9 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & endif ! compute budgets call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, & - fractionAbsorbedRunoff, layerThickness, & - tracerGroupSurfaceFlux, & - tracerGroupSurfaceFluxRunoff, & + fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & + layerThickness, tracerGroupSurfaceFlux, & + tracerGroupSurfaceFluxRunoff, tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupTend, err) ! diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 043ed7b2862b..180b4f79a753 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -85,7 +85,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe real (kind=RKIND), dimension(:,:), intent(in) :: & transmissionCoefficients, &!< Input: Coefficients for the transmission of surface fluxes transmissionCoefficientsRunoff, &!< Input: Coefficients for the transmission of surface fluxes due to river runoff - transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff + transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to subglacial runoff real (kind=RKIND), dimension(:), intent(in) :: & surfaceThicknessFlux, &!< Input: surface flux of thickness diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 57e2949bac9b..4303d1b78ff2 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -71,8 +71,8 @@ module ocn_tracer_surface_flux_to_tend ! !----------------------------------------------------------------------- - subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, layerThickness, & - surfaceTracerFlux, surfaceTracerFluxRunoff, tend, err)!{{{ + subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & + layerThickness, surfaceTracerFlux, surfaceTracerFluxRunoff, surfaceTracerFluxSubglacialRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -97,6 +97,13 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso real (kind=RKIND), dimension(:,:), intent(in) :: & fractionAbsorbedRunoff !< Input: Coefficients for the application of surface fluxes due to river runoff + real (kind=RKIND), dimension(:,:), intent(in), pointer :: & + surfaceTracerFluxSubglacialRunoff !< Input: surface tracer fluxes from subglacial runoff + + real (kind=RKIND), dimension(:,:), intent(in) :: & + fractionAbsorbedSubglacialRunoff !< Input: Coefficients for the application of surface fluxes due to subglacial runoff + + !----------------------------------------------------------------- ! ! input/output variables @@ -197,7 +204,36 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso call mpas_timer_stop("surface_tracer_runoff_flux") end if + ! now do subglacial runoff component + + if (associated(surfaceTracerFluxSubglacialRunoff)) then + call mpas_timer_start("surface_tracer_subglacial_runoff_flux") + + !$omp parallel + !$omp do schedule(runtime) private(remainingFlux, k, iTracer) + do iCell = 1, nCells + remainingFlux = 1.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + remainingFlux = remainingFlux - fractionAbsorbedSubglacialRunoff(k, iCell) + do iTracer = 1, nTracers + tend(iTracer, k, iCell) = tend(iTracer, k, iCell) + & + surfaceTracerFluxSubglacialRunoff(iTracer, iCell) * fractionAbsorbedSubglacialRunoff(k, iCell) + end do + end do + + if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then + do iTracer = 1, nTracers + tend(iTracer, maxLevelCell(iCell), iCell) = tend(iTracer, maxLevelCell(iCell), iCell) & + + surfaceTracerFluxSubglacialRunoff(iTracer, iCell) * remainingFlux + end do + end if + end do + !$omp end do + !$omp end parallel + + call mpas_timer_stop("surface_tracer_subglacial_runoff_flux") + end if !-------------------------------------------------------------------- end subroutine ocn_tracer_surface_flux_tend!}}} From 5cb8a57d5b11a2220b317d28ba2bad76b332457f Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 19 Oct 2023 11:40:43 -0600 Subject: [PATCH 04/73] subglacial runoff for tracers, part 2 - registry --- .../src/tracer_groups/Registry_CFC.xml | 9 ++ .../src/tracer_groups/Registry_DMS.xml | 9 ++ .../tracer_groups/Registry_MacroMolecules.xml | 12 ++ .../tracer_groups/Registry_activeTracers.xml | 8 ++ .../tracer_groups/Registry_debugTracers.xml | 11 ++ .../src/tracer_groups/Registry_ecosys.xml | 128 +++++++++++++++++- .../src/tracer_groups/Registry_idealAge.xml | 5 + 7 files changed, 181 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml b/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml index d77859dcef86..b0adb7d595f5 100644 --- a/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml +++ b/components/mpas-ocean/src/tracer_groups/Registry_CFC.xml @@ -95,6 +95,15 @@ description="CFC12 Surface Flux Due to Runoff" /> + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml b/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml index c6adca3ea636..3a45bc10b794 100644 --- a/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml +++ b/components/mpas-ocean/src/tracer_groups/Registry_idealAge.xml @@ -69,6 +69,11 @@ description="Flux of iAge through the ocean surface due to river runoff. Positive into ocean." /> + + + Date: Thu, 19 Oct 2023 15:43:37 -0600 Subject: [PATCH 05/73] subglacial runoff freezing temperature at landicepressure --- components/mpas-ocean/src/Registry.xml | 8 ++++++++ .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 0ed2b0c42462..3a11826169d4 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3787,6 +3787,14 @@ description="Global sum of fresh water flux from river runoff from the coupler that was removed due to config_remove_AIS_coupler_runoff option. Positive into the ocean." packages="thicknessBulkPKG" /> + + Date: Tue, 9 Jul 2024 12:27:07 -0600 Subject: [PATCH 06/73] resolved: compsets tmix --- components/mpas-ocean/bld/build-namelist | 7 +++++ .../mpas-ocean/bld/build-namelist-section | 1 + .../namelist_defaults_mpaso.xml | 1 + .../namelist_definition_mpaso.xml | 8 ++++++ components/mpas-ocean/cime_config/buildnml | 27 +++++++++++++++++++ .../cime_config/config_component.xml | 13 +++++++++ .../cime_config/config_compsets.xml | 10 +++++++ components/mpas-ocean/src/Registry.xml | 2 +- 8 files changed, 68 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 1c55bcb7be1d..ad8e268fbb0a 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -54,6 +54,9 @@ OPTIONS -ocn_ismf variable for defining how the ocn model will handle ice shelf melt fluxes Options are: none, data, internal, coupled + -ocn_sgr variable for defining how the ocn model will handle subglacial + runoff + Options are: none, data, coupled -decomp_prefix decomp_prefix variable -date_stamp date_stamp variable -cfg_grid Directory containing MPASO configuration scripts. @@ -111,6 +114,7 @@ my %opts = ( help => 0, ocn_forcing => undef, ocn_iceberg => undef, ocn_ismf => undef, + ocn_sgr => undef, decomp_prefix => undef, date_stamp => undef, ocn_bgc => undef, @@ -137,6 +141,7 @@ GetOptions( "ocn_forcing=s" => \$opts{'ocn_forcing'}, "ocn_iceberg=s" => \$opts{'ocn_iceberg'}, "ocn_ismf=s" => \$opts{'ocn_ismf'}, + "ocn_sgr=s" => \$opts{'ocn_sgr'}, "decomp_prefix=s" => \$opts{'decomp_prefix'}, "date_stamp=s" => \$opts{'date_stamp'}, "ocn_bgc=s" => \$opts{'ocn_bgc'}, @@ -180,6 +185,7 @@ my $OCN_GRID = $opts{'ocn_grid'}; my $OCN_FORCING = $opts{'ocn_forcing'}; my $OCN_ICEBERG = $opts{'ocn_iceberg'}; my $OCN_ISMF = $opts{'ocn_ismf'}; +my $OCN_SGR = $opts{'ocn_sgr'}; my $decomp_prefix = $opts{'decomp_prefix'}; my $date_stamp = $opts{'date_stamp'}; my $ocn_bgc = $opts{'ocn_bgc'}; @@ -702,6 +708,7 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index cc1695243faa..7a1d06b35a7c 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -224,6 +224,7 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); ############################ # Namelist group: coupling # 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 c7441c6b2214..5686c0e0a012 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -342,6 +342,7 @@ .true. 0.001 10.0 +10.0 .false. 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 f6c2f9c5b765..ac2bfd411e4b 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1188,6 +1188,14 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml + +The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$. + +Valid values: Any positive real number. +Default: Defined in namelist_defaults.xml + + diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 4c7ed2c0a311..7ee71aee3a33 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -35,6 +35,7 @@ def buildnml(case, caseroot, compname): ocn_forcing = case.get_value("MPASO_FORCING") ocn_iceberg = case.get_value("MPASO_ICEBERG") ocn_ismf = case.get_value("MPASO_ISMF") + ocn_sgr = case.get_value("MPASO_SGR") ocn_bgc = case.get_value("MPASO_BGC") ocn_wave = case.get_value("MPASO_WAVE") ocn_tidal_mixing = case.get_value("MPASO_TIDAL_MIXING") @@ -76,6 +77,7 @@ def buildnml(case, caseroot, compname): analysis_mask_file = '' eco_forcing_file = '' u_tidal_rms_file = '' + data_sgr_file = '' if ocn_grid == 'oEC60to30v3': decomp_date = '230424' @@ -140,6 +142,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_paolo2023.oQU240wLI.20240404.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.oQU240wLI.20240221.nc' + if ocn_sgr == 'data': + data_sgr_file = 'oQU240wLI_DSGR.nc' elif ocn_grid == 'oQU120': decomp_date = '230424' @@ -352,6 +356,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_adusumilli2020.ECwISC30to60E2r1.230429.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.ECwISC30to60E2r1.20240221.nc' + if ocn_sgr == 'data': + data_sgr_file = 'ECwISC30to60E2r1_DSGR.nc' elif ocn_grid == 'IcoswISC30E3r5': decomp_date = '20231120' @@ -436,6 +442,9 @@ def buildnml(case, caseroot, compname): if u_tidal_rms_file != '': input_list.write("u_tidal_rms = {}/ocn/mpas-o/{}/{}\n".format(din_loc_root, ocn_mask, u_tidal_rms_file)) + if data_sgr_file != '': + input_list.write("subglacial_runoff = {}/ocn/mpas-o/{}/{}\n".format(din_loc_root, ocn_mask, data_sgr_file)) + #-------------------------------------------------------------------- # Invoke mpas build-namelist - output will go in $CASEBUILD/mpasoconf #-------------------------------------------------------------------- @@ -495,6 +504,7 @@ def buildnml(case, caseroot, compname): sysmod += " -ocn_forcing '{}'".format(ocn_forcing) sysmod += " -ocn_iceberg '{}'".format(ocn_iceberg) sysmod += " -ocn_ismf '{}'".format(ocn_ismf) + sysmod += " -ocn_sgr '{}'".format(ocn_sgr) sysmod += " -ocn_bgc '{}'".format(ocn_bgc) sysmod += " -ocn_wave '{}'".format(ocn_wave) sysmod += " -ocn_tidal_mixing '{}'".format(ocn_tidal_mixing) @@ -702,6 +712,19 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') + if data_sgr_file != '': + lines.append('') + lines.append('') + lines.append(' ') + lines.append('') + lines.append('') + if analysis_mask_file != '': lines.append('') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') @@ -1533,6 +1557,7 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') @@ -1598,6 +1623,7 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') @@ -1812,6 +1838,7 @@ def buildnml(case, caseroot, compname): lines.append(' ') lines.append(' ') lines.append(' ') + lines.append(' ') lines.append(' ') lines.append(' ') lines.append(' ') diff --git a/components/mpas-ocean/cime_config/config_component.xml b/components/mpas-ocean/cime_config/config_component.xml index e95b63682d95..eb8e09519829 100644 --- a/components/mpas-ocean/cime_config/config_component.xml +++ b/components/mpas-ocean/cime_config/config_component.xml @@ -39,6 +39,19 @@ Option to describe the MPASO prescribed tidal mixing + + char + none,data,coupled + none + + none + data + + case_comp + env_case.xml + Option to describe how MPASO will handle subglacial runoff fluxes + + char false,true diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 448aa7a82b57..27b0218f4a26 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -87,6 +87,11 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCED_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-PISMF-DSGR + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-DISMF 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCED_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV @@ -97,6 +102,11 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDTMIX_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-DISMF-DSGR + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p4 2000_DATM%JRA-1p4-2018_SLND_MPASSI_MPASO%DATMFORCED_DROF%JRA-1p4-2018_SGLC_SWAV diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 3a11826169d4..5e36e828f32b 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,7 +702,7 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From 0fccd7005f50caf729c14c2df81b79224e5c3b11 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Fri, 20 Oct 2023 14:36:43 -0600 Subject: [PATCH 07/73] typo --- 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 5e36e828f32b..f56799eaaf07 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -703,7 +703,7 @@ possible_values="Any positive real number." /> From f820afb71ee2e22ae6326f0e7c5bda7bf67c3eef Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Fri, 20 Oct 2023 15:13:14 -0600 Subject: [PATCH 08/73] more compsets --- components/mpas-ocean/cime_config/config_compsets.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 27b0218f4a26..766b1397bcf2 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -37,6 +37,11 @@ 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-PISMF-DSGR + 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-DISMF 2000_DATM%NYF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV @@ -142,6 +147,11 @@ 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV + + GMPAS-IAF-PISMF-DSGR + 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%IAFAIS45_SGLC_SWAV + + GMPAS-IAF-DISMF 2000_DATM%IAF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV From 71dc2ee55e2b9beabfd713e421f6fed87301b6b8 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 23 Oct 2023 16:53:14 -0600 Subject: [PATCH 09/73] typo: remainingFluxSubglacialRunoff --- .../mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 180b4f79a753..1f7c67b88e09 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -118,7 +118,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe integer :: iCell, k - real (kind=RKIND) :: remainingFlux, remainingFluxRunoff + real (kind=RKIND) :: remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff err = 0 @@ -133,10 +133,10 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe !$acc present(tend, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & !$acc transmissionCoefficients, transmissionCoefficientsRunoff, minLevelCell, maxLevelCell) & - !$acc private(k, remainingFlux, remainingFluxRunoff) + !$acc private(k, remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff) #else !$omp parallel - !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, k) + !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff, k) #endif do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND From 2637229a9be48f2d82474f961d0dc18132da86c3 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 26 Oct 2023 10:58:22 -0600 Subject: [PATCH 10/73] updated sg units --- components/mpas-ocean/src/Registry.xml | 2 +- .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index f56799eaaf07..ad8ce6752441 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3775,7 +3775,7 @@ description="Fresh water flux from river runoff at cell centers from coupler. Positive into the ocean." packages="thicknessBulkPKG" /> - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 4714400951d2..c3a8a6691ddd 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -351,7 +351,7 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur surfaceThicknessFlux(iCell) = surfaceThicknessFlux(iCell) + ( snowFlux(iCell) + rainFlux(iCell) + evaporationFlux(iCell) & + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / rho_sw + surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) end do #ifndef MPAS_OPENACC !$omp end do @@ -581,7 +581,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / rho_sw + inLandIceCavity=.true.) / areaCell(iCell) ! Accumulate fluxes that use the freezing point ! mrp performance note: should call ocn_freezing_temperature just once here From 98dc48b3a0c3f04948e9225f0c7ce808573a35f2 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 31 Oct 2023 14:08:09 -0600 Subject: [PATCH 11/73] change config_flux_attenuation_coefficient_subglacial_runoff default to 1 mm --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- components/mpas-ocean/src/Registry.xml | 2 +- 2 files changed, 2 insertions(+), 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 5686c0e0a012..66a6482c54aa 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -342,7 +342,7 @@ .true. 0.001 10.0 -10.0 +0.001 .false. diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index ad8ce6752441..76e868860a41 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,7 +702,7 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From 239697803ded5efafc22d345fe5fe6adc0d05582 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 31 Oct 2023 14:53:00 -0600 Subject: [PATCH 12/73] add namelist option to include some parts of runoff only: config_use_SGR_opt --- .../mpas-ocean/bld/build-namelist-section | 1 + .../namelist_defaults_mpaso.xml | 1 + .../namelist_definition_mpaso.xml | 8 ++++++++ components/mpas-ocean/src/Registry.xml | 4 ++++ .../shared/mpas_ocn_surface_bulk_forcing.F | 20 +++++++++++++++---- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 7a1d06b35a7c..b8f544edabaf 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -225,6 +225,7 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); +add_default($nl, 'config_use_SGR_opt'); ############################ # Namelist group: coupling # 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 66a6482c54aa..92709a4ee45d 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,6 +343,7 @@ 0.001 10.0 0.001 +0 .false. 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 ac2bfd411e4b..fc6374cc2a7f 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1196,6 +1196,14 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml + +Option to use or not subglacial runoff (SGR). + +Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR +Default: Defined in namelist_defaults.xml + + diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 76e868860a41..083db34082e4 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,6 +706,10 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> + Date: Tue, 31 Oct 2023 14:56:51 -0600 Subject: [PATCH 13/73] more basic compsets --- components/mpas-ocean/cime_config/config_compsets.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 766b1397bcf2..6950fd8c2179 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -42,6 +42,11 @@ 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-DSGR + 2000_DATM%NYF_SLND_MPASSI_MPASO%DATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV + + GMPAS-NYF-DISMF 2000_DATM%NYF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV @@ -97,6 +102,11 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DSGR + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%DATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + + GMPAS-JRA1p5-DIB-DISMF 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCED_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV From 9b786dd97402994a88eca8c1eaa9a6c5663d06aa Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 31 Oct 2023 15:35:05 -0600 Subject: [PATCH 14/73] forgotten bld --- components/mpas-ocean/bld/build-namelist | 1 + 1 file changed, 1 insertion(+) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index ad8e268fbb0a..f70d6204be5f 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -709,6 +709,7 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); +add_default($nl, 'config_use_SGR_opt'); ############################ # Namelist group: coupling # From de04001fe002b961ad230936314e17fc7fbe693d Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 1 Nov 2023 14:31:42 -0600 Subject: [PATCH 15/73] no sg in kpp option --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 4e75d743130a..999d69337abb 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3487,10 +3487,14 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) - fracAbsorbedSubglacialRunoff = 1.0_RKIND & + if (config_use_SGR_opt == -1) then + fracAbsorbedSubglacialRunoff = 1.0_RKIND & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_subglacial_runoff)) + else + fracAbsorbedSubglacialRunoff = 0.0_RKIND + end if ! Store the total tracer flux below in ! nonLocalSurfaceTemperatureFlux for use in the CVMix nonlocal From 0ab238461d06ad3d605033731346d955c6bf2799 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 1 Nov 2023 17:50:46 -0600 Subject: [PATCH 16/73] config_use_SGR_opt -1 correction --- .../bld/namelist_files/namelist_definition_mpaso.xml | 2 +- components/mpas-ocean/src/Registry.xml | 2 +- .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 4 ++-- 3 files changed, 4 insertions(+), 4 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 fc6374cc2a7f..c38d6edd97ad 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1200,7 +1200,7 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Option to use or not subglacial runoff (SGR). -Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR +Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR, -1 use all + KPP Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 083db34082e4..953fa1cb39b4 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -708,7 +708,7 @@ /> diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index a12e628b2cc6..de9898c60997 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -352,7 +352,7 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 2)) then + if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 2) .or. (config_use_SGR_opt == -1)) then surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) else surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND @@ -587,7 +587,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 3)) then + if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 3) .or. (config_use_SGR_opt == -1)) then tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & inLandIceCavity=.true.) / areaCell(iCell) From 81d948887f769ad72ac92a37ad6d78474b467f2c Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 8 Nov 2023 10:38:13 -0700 Subject: [PATCH 17/73] config read in forcing --- components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index f530f67dfa62..8617cc4f8435 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -27,6 +27,7 @@ module ocn_forcing use mpas_dmpar use ocn_constants use ocn_diagnostics_variables + use ocn_config !IV comment implicit none private @@ -197,6 +198,8 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin end do end do + call mpas_log_write('config_use_SGR_opt: $r', realArgs=(/config_use_SGR_opt/)) + end subroutine ocn_forcing_build_fraction_absorbed_array!}}} !*********************************************************************** From 4745779efa824c568f84e4054e5bbf75f9e45031 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 8 Nov 2023 12:28:44 -0700 Subject: [PATCH 18/73] sgr_flux_vertical_location and SGR to sgr --- components/mpas-ocean/bld/build-namelist | 3 +- .../mpas-ocean/bld/build-namelist-section | 3 +- .../namelist_defaults_mpaso.xml | 3 +- .../namelist_definition_mpaso.xml | 10 +++- components/mpas-ocean/src/Registry.xml | 10 ++-- .../src/shared/mpas_ocn_diagnostics.F | 2 +- .../mpas-ocean/src/shared/mpas_ocn_forcing.F | 53 +++++++++++++------ .../shared/mpas_ocn_surface_bulk_forcing.F | 4 +- 8 files changed, 63 insertions(+), 25 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index f70d6204be5f..b413599f1778 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -709,7 +709,8 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); -add_default($nl, 'config_use_SGR_opt'); +add_default($nl, 'config_sgr_flux_vertical_location'); +add_default($nl, 'config_use_sgr_opt'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index b8f544edabaf..9c0ad217b91f 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -225,7 +225,8 @@ add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); -add_default($nl, 'config_use_SGR_opt'); +add_default($nl, 'config_sgr_flux_vertical_location'); +add_default($nl, 'config_use_sgr_opt'); ############################ # Namelist group: coupling # 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 92709a4ee45d..5b3bf93522a6 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,7 +343,8 @@ 0.001 10.0 0.001 -0 +'top' +0 .false. 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 c38d6edd97ad..7629e5663eff 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1196,7 +1196,15 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml - +Selects the vertical location where subglacial runoff is fluxed + +Valid values: 'top','uniform', 'bottom'. +Default: Defined in namelist_defaults.xml + + + Option to use or not subglacial runoff (SGR). diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 953fa1cb39b4..88928169b1ce 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,9 +706,13 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - + diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 999d69337abb..a7d03f5dcc89 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3487,7 +3487,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) - if (config_use_SGR_opt == -1) then + if (config_use_sgr_opt == -1) then fracAbsorbedSubglacialRunoff = 1.0_RKIND & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index 8617cc4f8435..e642e82e2e67 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -184,21 +184,44 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin ! now do subglacial runoff separately - do iCell = 1, nCells - zTop = 0.0_RKIND - transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - do k = minLevelCell(iCell), maxLevelCell(iCell) - zBot = zTop - layerThickness(k,iCell) - transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - - fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot - - zTop = zBot - transmissionCoeffTop = transmissionCoeffBot - end do - end do - - call mpas_log_write('config_use_SGR_opt: $r', realArgs=(/config_use_SGR_opt/)) + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = minLevelCell(iCell), maxLevelCell(iCell) + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + do iCell = 1, nCells + ! calculate total thickness + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + zBot = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + fractionAbsorbedSubglacialRunoff(k, iCell) = layerThickness(k,iCell) / zTop + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + end if end subroutine ocn_forcing_build_fraction_absorbed_array!}}} diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index de9898c60997..f6156609df09 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -352,7 +352,7 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 2) .or. (config_use_SGR_opt == -1)) then + if ((config_use_sgr_opt == 1) .or. (config_use_sgr_opt == 2) .or. (config_use_sgr_opt == -1)) then surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) else surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND @@ -587,7 +587,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw ! Subglacial runoff can have temperature below 0.0C, since it can come out at great depth - if ((config_use_SGR_opt == 1) .or. (config_use_SGR_opt == 3) .or. (config_use_SGR_opt == -1)) then + if ((config_use_sgr_opt == 1) .or. (config_use_sgr_opt == 3) .or. (config_use_sgr_opt == -1)) then tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & inLandIceCavity=.true.) / areaCell(iCell) From e55b516afd33df71a1789b7a32b6f918a5e82b94 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 16 Nov 2023 18:39:57 -0700 Subject: [PATCH 19/73] more sgr testing options for TS separation --- components/mpas-ocean/bld/build-namelist | 6 ++- .../mpas-ocean/bld/build-namelist-section | 6 ++- .../namelist_defaults_mpaso.xml | 7 +++- .../namelist_definition_mpaso.xml | 37 +++++++++++++++++-- components/mpas-ocean/src/Registry.xml | 23 ++++++++++-- .../src/shared/mpas_ocn_diagnostics.F | 2 +- .../shared/mpas_ocn_surface_bulk_forcing.F | 29 ++++++++------- 7 files changed, 87 insertions(+), 23 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index b413599f1778..e1d2548dffeb 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -710,7 +710,11 @@ add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); -add_default($nl, 'config_use_sgr_opt'); +add_default($nl, 'config_use_sgr_opt_kpp'); +add_default($nl, 'config_use_sgr_opt_temp'); +add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_sgr_temperature'); +add_default($nl, 'config_sgr_salinity'); ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 9c0ad217b91f..0d44d3f328b6 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -226,7 +226,11 @@ add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); -add_default($nl, 'config_use_sgr_opt'); +add_default($nl, 'config_use_sgr_opt_kpp'); +add_default($nl, 'config_use_sgr_opt_temp'); +add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_sgr_temperature'); +add_default($nl, 'config_sgr_salinity'); ############################ # Namelist group: coupling # 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 5b3bf93522a6..a2c6465c6d1c 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -344,7 +344,12 @@ 10.0 0.001 'top' -0 +0 +'sgr' +'sgr' +0.0 +0.0 + .false. 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 7629e5663eff..8152b1fec724 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1204,14 +1204,45 @@ Valid values: 'top','uniform', 'bottom'. Default: Defined in namelist_defaults.xml - -Option to use or not subglacial runoff (SGR). +Option to use or not subglacial runoff (sgr) in kpp calculation. -Valid values: 0 - don't use SGR, 1 - use both mass and TS from SGR, 2 - use mass only from SGR , 3 - use TS only from SGR, -1 use all + KPP +Valid values: 0 - don't use, 1 - use Default: Defined in namelist_defaults.xml + +Option to choose sgr temperature + +Valid values: 'sgr','current', 'prescribed'. +Default: Defined in namelist_defaults.xml + + + +Option to choose sgr salinity + +Valid values: 'sgr','current', 'prescribed'. +Default: Defined in namelist_defaults.xml + + + +Option to choose sgr temperature, applied when config_use_sgr_opt_temp = 'prescribed' + +Valid values: Any real number. +Default: Defined in namelist_defaults.xml + + + +Option to choose sgr salinity, applied when config_use_sgr_opt_temp = 'prescribed' + +Valid values: Any real number. +Default: Defined in namelist_defaults.xml + diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 88928169b1ce..b22a9e7f5b94 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -710,10 +710,27 @@ description="Selects the vertical location where subglacial runoff is fluxed." possible_values="'top','uniform', 'bottom'" /> - + + + + + Date: Tue, 9 Jul 2024 12:31:41 -0600 Subject: [PATCH 20/73] resolved: conservation check --- components/mpas-ocean/cime_config/buildnml | 3 ++ .../Registry_conservation_check.xml | 17 +++++++++++ .../mpas_ocn_conservation_check.F | 28 ++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 7ee71aee3a33..9566cc56bbb8 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1192,14 +1192,17 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 0fd2d28d1c6e..646daf743eee 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -106,6 +106,9 @@ + @@ -148,6 +151,10 @@ + + @@ -287,14 +298,17 @@ + + + @@ -343,14 +357,17 @@ + + + diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index bdd07e799b5d..612bb2078bf0 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -828,8 +828,10 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & + accumulatedRemovedSubglacialRunoffFlux, & accumulatedRemovedIceRunoffFlux, & accumulatedIcebergFlux, & accumulatedFrazilFlux, & @@ -852,8 +854,10 @@ subroutine mass_conservation(domain, err) evaporationFlux, & seaIceFreshwaterFlux, & riverRunoffFlux, & + subglacialRunoffFlux, & iceRunoffFlux, & removedRiverRunoffFlux, & + removedSubglacialRunoffFlux, & removedIceRunoffFlux, & icebergFreshwaterFlux, & accumulatedFrazilIceMassNew, & @@ -877,7 +881,7 @@ subroutine mass_conservation(domain, err) iCell, ierr, k integer, parameter :: & - nSums = 12 + nSums = 14 integer, dimension(:), pointer :: minLevelCell, maxLevelCell @@ -900,8 +904,10 @@ subroutine mass_conservation(domain, err) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedSubglacialRunoffFlux",accumulatedRemovedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIcebergFlux", accumulatedIcebergFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedFrazilFlux", accumulatedFrazilFlux) @@ -937,8 +943,10 @@ subroutine mass_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'evaporationFlux', evaporationFlux) call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedRiverRunoffFlux', removedRiverRunoffFlux) + call mpas_pool_get_array(forcingPool, 'removedSubglacialRunoffFlux', removedSubglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedIceRunoffFlux', removedIceRunoffFlux) call mpas_pool_get_array(forcingPool, 'icebergFreshWaterFlux', icebergFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'landIceFreshwaterFlux', landIceFreshwaterFlux) @@ -956,6 +964,8 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) + sumArray(14) = sumArray(14) + areaCell(iCell) * removedSubglacialRunoffFlux(iCell) enddo if (config_use_frazil_ice_formation) then @@ -1002,6 +1012,8 @@ subroutine mass_conservation(domain, err) accumulatedFrazilFlux = accumulatedFrazilFlux + sumArrayOut(10) accumulatedLandIceFlux = accumulatedLandIceFlux + sumArrayOut(11) accumulatedLandIceFrazilFlux = accumulatedLandIceFrazilFlux + sumArrayOut(12) + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux + sumArrayOut(13) + accumulatedRemovedSubglacialRunoffFlux = accumulatedRemovedSubglacialRunoffFlux + sumArrayOut(14) ! cleanup deallocate(sumArray) @@ -1021,8 +1033,10 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux = accumulatedEvaporationFlux /accumulatedFluxCounter accumulatedSeaIceFlux = accumulatedSeaIceFlux /accumulatedFluxCounter accumulatedRiverRunoffFlux = accumulatedRiverRunoffFlux /accumulatedFluxCounter + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux /accumulatedFluxCounter accumulatedIceRunoffFlux = accumulatedIceRunoffFlux /accumulatedFluxCounter accumulatedRemovedRiverRunoffFlux = accumulatedRemovedRiverRunoffFlux /accumulatedFluxCounter + accumulatedRemovedSubglacialRunoffFlux = accumulatedRemovedSubglacialRunoffFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffFlux = accumulatedRemovedIceRunoffFlux /accumulatedFluxCounter accumulatedIcebergFlux = accumulatedIcebergFlux /accumulatedFluxCounter accumulatedFrazilFlux = accumulatedFrazilFlux /accumulatedFluxCounter @@ -1049,6 +1063,7 @@ subroutine mass_conservation(domain, err) + accumulatedEvaporationFlux & + accumulatedSeaIceFlux & + accumulatedRiverRunoffFlux & + + accumulatedSubglacialRunoffFlux & + accumulatedIceRunoffFlux & + accumulatedIcebergFlux & + accumulatedFrazilFlux & @@ -1083,10 +1098,15 @@ subroutine mass_conservation(domain, err) v=accumulatedIcebergFlux ; write(m,"('icebergFreshwaterFlux ',es16.8,' x2o_Fioi_bergw wberg ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedEvaporationFlux ; write(m,"('evaporationFlux ',es16.8,' x2o_Foxx_evap wevap ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffFlux ; write(m,"('riverRunoffFlux ',es16.8,' x2o_Foxx_rofl wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +v=accumulatedSubglacialRunoffFlux ; write(m,"('subglacialRunoffFlux ',es16.8,' x2o_Foxx_rofl wsgr ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v + if (landIceFreshwaterFluxesOn) then v=accumulatedRemovedRiverRunoffFlux; write(m,"('removedRiverRunoffFlux ',es16.8,' wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); v=accumulatedRiverRunoffFlux+accumulatedRemovedRiverRunoffFlux; write(m,"(' SUM: river runoff',es16.8,' x2o_Foxx_rofl wrunoff SUM ',f16.8)") v,v*c; call mpas_log_write(m) +v=accumulatedRemovedSubglacialRunoffFlux; write(m,"('removedSubglacialRunoffFlux ',es16.8,' wsgr ',f16.8)") v,v*c; call mpas_log_write(m); +v=accumulatedSubglacialRunoffFlux+accumulatedRemovedSubglacialRunoffFlux; + write(m,"(' SUM: subglacial runoff',es16.8,' x2o_Foxx_rofl wsgr SUM ',f16.8)") v,v*c; call mpas_log_write(m) endif v=accumulatedIceRunoffFlux ; write(m,"('iceRunoffFlux ',es16.8,' x2o_Foxx_rofi wfrzrof ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v if (landIceFreshwaterFluxesOn) then @@ -2240,8 +2260,10 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & + accumulatedRemovedSubglacialRunoffFlux, & accumulatedRemovedIceRunoffFlux, & accumulatedIcebergFlux, & accumulatedFrazilFlux, & @@ -2310,8 +2332,10 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedSubglacialRunoffFlux",accumulatedRemovedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIcebergFlux", accumulatedIcebergFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedFrazilFlux", accumulatedFrazilFlux) @@ -2323,8 +2347,10 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux = 0.0_RKIND accumulatedSeaIceFlux = 0.0_RKIND accumulatedRiverRunoffFlux = 0.0_RKIND + accumulatedSubglacialRunoffFlux = 0.0_RKIND accumulatedIceRunoffFlux = 0.0_RKIND accumulatedRemovedRiverRunoffFlux = 0.0_RKIND + accumulatedRemovedSubglacialRunoffFlux = 0.0_RKIND accumulatedRemovedIceRunoffFlux = 0.0_RKIND accumulatedIcebergFlux = 0.0_RKIND accumulatedFrazilFlux = 0.0_RKIND From af89287b4221cc4a514ccad511b92b850561f323 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 22 Nov 2023 14:20:29 -0700 Subject: [PATCH 21/73] removed redundant removedSubglacialRunoffFlux --- components/mpas-ocean/cime_config/buildnml | 1 - components/mpas-ocean/src/Registry.xml | 8 -------- .../mpas_ocn_conservation_check.F | 15 +-------------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 9566cc56bbb8..fca676ae03d5 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1202,7 +1202,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index b22a9e7f5b94..7e3b1d125dae 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3812,14 +3812,6 @@ description="Global sum of fresh water flux from river runoff from the coupler that was removed due to config_remove_AIS_coupler_runoff option. Positive into the ocean." packages="thicknessBulkPKG" /> - - Date: Mon, 27 Nov 2023 16:57:56 -0700 Subject: [PATCH 22/73] correct sgr units in flux add up --- .../src/analysis_members/mpas_ocn_conservation_check.F | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index cc1f2f3e288e..18ba8d6989de 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -28,6 +28,7 @@ module ocn_conservation_check use ocn_constants use ocn_config + use ocn_mesh implicit none private @@ -960,7 +961,7 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) - sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw enddo if (config_use_frazil_ice_formation) then From 957d8b218d3cf06b2c4d94325d48a8507c0bdcfd Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 27 Nov 2023 17:46:10 -0700 Subject: [PATCH 23/73] energy conservation check --- .../mpas_ocn_conservation_check.F | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 18ba8d6989de..e793babb51a1 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -428,6 +428,7 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), dimension(:), allocatable :: & @@ -464,7 +465,8 @@ subroutine energy_conservation(domain, err) real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxRunoff + activeTracersSurfaceFluxRunoff, & + activeTracersSurfaceFluxSubglacialRunoff type (MPAS_timeInterval_type) :: & timeStepESMF @@ -481,7 +483,7 @@ subroutine energy_conservation(domain, err) ierr integer, parameter :: & - nSums = 19 + nSums = 20 character(len=160) :: & m @@ -514,6 +516,7 @@ subroutine energy_conservation(domain, err) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) !------------------------------------------------------------- @@ -557,6 +560,7 @@ subroutine energy_conservation(domain, err) call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_temperatureSurfaceFlux', index_temperature_flux) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxRunoff', activeTracersSurfaceFluxRunoff) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassNew, 2) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassOld, 1) @@ -581,6 +585,7 @@ subroutine energy_conservation(domain, err) ! river runoff temperature flux sumArray(14) = sumArray(14) + areaCell(iCell) * activeTracersSurfaceFluxRunoff(index_temperature_flux,iCell) sumArray(15) = sumArray(15) + areaCell(iCell) * icebergTemperatureFlux(iCell) + sumArray(20) = sumArray(20) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) enddo ! iCell @@ -635,6 +640,7 @@ subroutine energy_conservation(domain, err) accumulatedLandIceHeatFlux = accumulatedLandIceHeatFlux + sumArrayOut(17) accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux + sumArrayOut(18) accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux + sumArrayOut(19) + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux + sumArrayOut(20) ! cleanup deallocate(sumArray) @@ -664,6 +670,7 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux = accumulatedEvapTemperatureFlux /accumulatedFluxCounter accumulatedSeaIceTemperatureFlux = accumulatedSeaIceTemperatureFlux /accumulatedFluxCounter accumulatedRiverRunoffTemperatureFlux = accumulatedRiverRunoffTemperatureFlux /accumulatedFluxCounter + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux /accumulatedFluxCounter accumulatedIcebergTemperatureFlux = accumulatedIcebergTemperatureFlux /accumulatedFluxCounter accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux /accumulatedFluxCounter @@ -698,6 +705,7 @@ subroutine energy_conservation(domain, err) + accumulatedEvapTemperatureFlux *rho_sw*cp_sw & + accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw & + accumulatedRiverRunoffTemperatureFlux *rho_sw*cp_sw & + + accumulatedSubglacialRunoffTemperatureFlux *rho_sw*cp_sw & + accumulatedIcebergTemperatureFlux*rho_sw*cp_sw ! note, accumulatedLandIceFrazilHeatFlux not added because already in accumulatedFrazilHeatFlux @@ -761,6 +769,7 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum @@ -2243,6 +2252,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), pointer :: & @@ -2292,6 +2302,7 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) accumulatedFluxCounter = 0 @@ -2310,6 +2321,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux = 0.0_RKIND accumulatedSeaIceTemperatureFlux = 0.0_RKIND accumulatedRiverRunoffTemperatureFlux = 0.0_RKIND + accumulatedSubglacialRunoffTemperatureFlux = 0.0_RKIND accumulatedIcebergTemperatureFlux = 0.0_RKIND accumulatedLandIceFrazilHeatFlux = 0.0_RKIND accumulatedRemovedIceRunoffHeatFlux = 0.0_RKIND From ecb06580badc28a55316eea6caae273eb1fd415b Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:34:50 -0600 Subject: [PATCH 24/73] resolved: conservation check #2 --- components/mpas-ocean/cime_config/buildnml | 1 + .../Registry_conservation_check.xml | 5 +++ .../mpas_ocn_conservation_check.F | 32 ++++++++++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index fca676ae03d5..725c26d28181 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1208,6 +1208,7 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 646daf743eee..8a79ac12629e 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -205,6 +205,9 @@ + + @@ -375,6 +379,7 @@ + diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index e793babb51a1..cdba7b357f2d 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -1180,10 +1180,14 @@ subroutine salt_conservation(domain, err) absoluteSaltError, & relativeSaltError + real(kind=RKIND), dimension(:,:), pointer :: & + activeTracersSurfaceFluxSubglacialRunoff + real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux ! accumulatedLandIceFrazilSalinityFlux is not present because it is always 0 + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), dimension(:), allocatable :: & sumArray, & @@ -1204,14 +1208,15 @@ subroutine salt_conservation(domain, err) dt, dtAvg, v, A, s, c integer, pointer :: & - nCellsSolve + nCellsSolve, & + index_salinity_flux integer :: & iCell, & ierr integer, parameter :: & - nSums = 3 + nSums = 4 logical, pointer :: & activeTracersBulkRestoringPKG @@ -1229,6 +1234,7 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) !------------------------------------------------------------- ! Net salt flux to ice @@ -1254,11 +1260,17 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) + call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) + + do iCell = 1, nCellsSolve ! salt flux to ocean sumArray(1) = sumArray(1) + areaCell(iCell) * seaIceSalinityFlux(iCell) + ! subglacial runoff + sumArray(4) = sumArray(4) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) enddo ! iCell if (config_use_frazil_ice_formation) then @@ -1285,6 +1297,7 @@ subroutine salt_conservation(domain, err) ! accumulate fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux + sumArrayOut(1) accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux + sumArrayOut(2) + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux + sumArrayOut(4) ! cleanup deallocate(sumArray) @@ -1301,6 +1314,7 @@ subroutine salt_conservation(domain, err) ! Average the fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux /accumulatedFluxCounter accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux /accumulatedFluxCounter + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux /accumulatedFluxCounter ! get initial salt content call MPAS_pool_get_array(conservationCheckSaltAMPool, "initialSalt", initialSalt) @@ -1317,7 +1331,8 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "netSaltFlux", netSaltFlux) netSaltFlux = accumulatedSeaIceSalinityFlux & - + accumulatedFrazilSalinityFlux + + accumulatedFrazilSalinityFlux & + + accumulatedSubglacialRunoffSalinityFlux ! compute the final salt error call MPAS_pool_get_array(conservationCheckSaltAMPool, "absoluteSaltError", absoluteSaltError) @@ -1347,6 +1362,8 @@ subroutine salt_conservation(domain, err) .and.config_frazil_under_land_ice) then v=0; write(m,"('LandIceFrazilSalinityFlux',es16.8,' (already in wmelt, do not sum) ',f16.8)") v,v*c; call mpas_log_write(m); !no sum: s=s+v end if +v=accumulatedSubglacialRunoffSalinityFlux ; write(m,"('SubglacialRunoffSalinityFlux ',es16.8,' x2o_Fioi_salt salt ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v + write(m,"('SUM VOLUME FLUXES ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -2272,7 +2289,8 @@ subroutine reset_accumulated_variables(domain) real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), pointer :: & accumulatedCarbonSourceSink, & @@ -2362,9 +2380,13 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedLandIceFrazilSalinityFlux", accumulatedLandIceFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) + accumulatedSeaIceSalinityFlux = 0.0_RKIND accumulatedFrazilSalinityFlux = 0.0_RKIND + accumulatedSubglacialRunoffSalinityFlux = 0.0_RKIND call MPAS_pool_get_subpool(domain % blocklist % structs, "conservationCheckCarbonAM", conservationCheckCarbonAMPool) From a430272a1d1c41468387cc47e1a3038f2aa7187e Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 28 Nov 2023 09:54:29 -0700 Subject: [PATCH 25/73] salt: added tracersSurfaceFluxPool definition --- .../src/analysis_members/mpas_ocn_conservation_check.F | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index cdba7b357f2d..1278342ceb2d 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -1170,7 +1170,8 @@ subroutine salt_conservation(domain, err) conservationCheckSaltAMPool, & meshPool, & statePool, & - forcingPool + forcingPool, & + tracersSurfaceFluxPool real(kind=RKIND), pointer :: & initialSalt, & @@ -1260,6 +1261,7 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) + call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) From 7c404b94c7c25415fac6d8e54b10257b4a20c58c Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 28 Nov 2023 18:19:49 -0700 Subject: [PATCH 26/73] typo in print sgheatflux --- .../src/analysis_members/mpas_ocn_conservation_check.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 1278342ceb2d..881b53efd5b5 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -769,7 +769,7 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v -v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('SubglacialRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum From e89e8544f1ef2740cca4e105fff2a3ea98153e82 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 30 Nov 2023 11:52:31 -0700 Subject: [PATCH 27/73] add subglacial to kpp in diagnostics --- .../src/shared/mpas_ocn_diagnostics.F | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index f65749af25fc..f04893b671c0 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3289,16 +3289,18 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & !----------------------------------------------------------------- integer :: & - iCell, iEdge, i, &! loop indices for cell, edge, neighbors - kmin, &! topmost active cell index - nCells, &! number of cells - err, &! local error code - timeLevel ! time level for state variables (default 1) + iCell, iEdge, i, k, &! loop indices for cell, edge, neighbors + kmin, &! topmost active cell index + nCells, &! number of cells + err, &! local error code + timeLevel ! time level for state variables (default 1) real (kind=RKIND) :: & fracAbsorbed, &! fraction of sfc flux absorbed fracAbsorbedRunoff, &! same for runoff fracAbsorbedSubglacialRunoff, &! same for subglacial runoff + zTop,zBot, &! temporary variables + transmissionCoeffTop,transmissionCoeffBot, &! temporary variables sumSurfaceStressSquared ! sum of sfc stress squared ! pointers for variable/pool retrievals @@ -3488,10 +3490,31 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) if (config_use_sgr_opt_kpp == 1) then - fracAbsorbedSubglacialRunoff = 1.0_RKIND & + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + fracAbsorbedSubglacialRunoff = 1.0_RKIND & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_subglacial_runoff)) + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + ! calculate total thickness into variable zTop + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + fracAbsorbedSubglacialRunoff = layerThickness(kmin, iCell) / zTop + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + zTop = 0.0_RKIND + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + if (k == minLevelCell(iCell)) then + transmissionCoeffTop = exp( max(zTop / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + transmissionCoeffBot = exp( max(zBot / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + fracAbsorbedSubglacialRunoff = transmissionCoeffTop - transmissionCoeffBot + end if + zTop = zBot + end do + end if else fracAbsorbedSubglacialRunoff = 0.0_RKIND end if From 52a47584d0f553a65f0f386516cac415c83e2eee Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 12:36:10 -0600 Subject: [PATCH 28/73] resolved: fris meshes --- components/mpas-ocean/cime_config/buildnml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 725c26d28181..f5a05e03aade 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -281,6 +281,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_adusumilli2020.SOwISC12to60E2r4.230516.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.SOwISC12to60E2r4.20210114.nc' + if ocn_sgr == 'data': + data_sgr_file = 'SOwISC12to60E2r4_DSGR.nc' elif ocn_grid == 'FRISwISC08to60E3r1': decomp_date = '20230913' # changed to date of partiotions in ../files_for_e3sm/assembled_files/inputdata/ocn/mpas-o/FRISwISC08to60E3r1/partitions From c6a0104624162cf57cf49241d3655446cb697885 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 1 Feb 2024 10:53:19 -0700 Subject: [PATCH 29/73] cleanup --- components/mpas-ocean/bld/build-namelist | 2 +- .../bld/namelist_files/namelist_definition_mpaso.xml | 4 ++-- components/mpas-ocean/cime_config/config_component.xml | 2 +- components/mpas-ocean/src/Registry.xml | 4 ++-- components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index e1d2548dffeb..e33f4dc1c796 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -56,7 +56,7 @@ OPTIONS Options are: none, data, internal, coupled -ocn_sgr variable for defining how the ocn model will handle subglacial runoff - Options are: none, data, coupled + Options are: none, data -decomp_prefix decomp_prefix variable -date_stamp date_stamp variable -cfg_grid Directory containing MPASO configuration scripts. 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 8152b1fec724..97bd989f06c5 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1216,7 +1216,7 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Option to choose sgr temperature -Valid values: 'sgr','current', 'prescribed'. +Valid values: 'sgr', 'prescribed'. Default: Defined in namelist_defaults.xml @@ -1224,7 +1224,7 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Option to choose sgr salinity -Valid values: 'sgr','current', 'prescribed'. +Valid values: 'sgr', 'prescribed'. Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/cime_config/config_component.xml b/components/mpas-ocean/cime_config/config_component.xml index eb8e09519829..83b4501ee5e5 100644 --- a/components/mpas-ocean/cime_config/config_component.xml +++ b/components/mpas-ocean/cime_config/config_component.xml @@ -41,7 +41,7 @@ char - none,data,coupled + none,data none none diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 7e3b1d125dae..1ba2259da87f 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -716,11 +716,11 @@ /> Date: Tue, 9 Jul 2024 12:37:17 -0600 Subject: [PATCH 30/73] resolved: fris meshes #2 --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- components/mpas-ocean/cime_config/buildnml | 3 ++- components/mpas-ocean/src/Registry.xml | 2 +- 3 files changed, 4 insertions(+), 3 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 a2c6465c6d1c..9e14fbf04d1b 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,7 +343,7 @@ 0.001 10.0 0.001 -'top' +'uniform' 0 'sgr' 'sgr' diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index f5a05e03aade..4d5029555afc 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -379,6 +379,8 @@ def buildnml(case, caseroot, compname): data_ismf_file = 'prescribed_ismf_paolo2023.IcoswISC30E3r5.20240227.nc' if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' + if ocn_sgr == 'data': + data_sgr_file = 'IcoswISC30E3r5_DSGR.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' @@ -404,7 +406,6 @@ def buildnml(case, caseroot, compname): if ocn_ismf == 'data': data_ismf_file = 'prescribed_ismf_paolo2023.RRSwISC6to18E3r5.20240327.nc' - #-------------------------------------------------------------------- # Set OCN_FORCING = datm_forced_restoring if restoring file is available #-------------------------------------------------------------------- diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 1ba2259da87f..e48a84d2437c 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,7 +706,7 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From cdc60afb77c6129f2ece53ee85b4d49e7c92f095 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 7 Feb 2024 16:13:31 -0700 Subject: [PATCH 31/73] changed sgr kpp default to 1 = use --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- components/mpas-ocean/src/Registry.xml | 2 +- 2 files changed, 2 insertions(+), 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 9e14fbf04d1b..40a3b3ca86f5 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -344,7 +344,7 @@ 10.0 0.001 'uniform' -0 +1 'sgr' 'sgr' 0.0 diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index e48a84d2437c..506dd5772c09 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -710,7 +710,7 @@ description="Selects the vertical location where subglacial runoff is fluxed." possible_values="'top','uniform', 'bottom'" /> - From 1664002c0aba6072e624795f62bb72fa1b185298 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 16:04:08 -0600 Subject: [PATCH 32/73] change config_sgr_flux_vertical_location default to bottom --- 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 506dd5772c09..1ceddac39fcb 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -706,7 +706,7 @@ description="The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> - From f0e802d4a6d447c9dcadcced6bcb02fc06770438 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 13:07:55 -0600 Subject: [PATCH 33/73] rmv conservation check on sgr --- .../Registry_conservation_check.xml | 22 ----- .../mpas_ocn_conservation_check.F | 96 +++++-------------- 2 files changed, 23 insertions(+), 95 deletions(-) diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 8a79ac12629e..0fd2d28d1c6e 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -106,9 +106,6 @@ - @@ -151,10 +148,6 @@ - - @@ -205,9 +194,6 @@ - - - - @@ -319,7 +302,6 @@ - @@ -361,17 +343,14 @@ - - - @@ -379,7 +358,6 @@ - diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 881b53efd5b5..5551d5758db2 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -28,7 +28,6 @@ module ocn_conservation_check use ocn_constants use ocn_config - use ocn_mesh implicit none private @@ -428,7 +427,6 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & - accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), dimension(:), allocatable :: & @@ -465,8 +463,7 @@ subroutine energy_conservation(domain, err) real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxRunoff, & - activeTracersSurfaceFluxSubglacialRunoff + activeTracersSurfaceFluxRunoff type (MPAS_timeInterval_type) :: & timeStepESMF @@ -483,7 +480,7 @@ subroutine energy_conservation(domain, err) ierr integer, parameter :: & - nSums = 20 + nSums = 19 character(len=160) :: & m @@ -516,7 +513,6 @@ subroutine energy_conservation(domain, err) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) - call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) !------------------------------------------------------------- @@ -560,7 +556,6 @@ subroutine energy_conservation(domain, err) call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_temperatureSurfaceFlux', index_temperature_flux) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxRunoff', activeTracersSurfaceFluxRunoff) - call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassNew, 2) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassOld, 1) @@ -585,7 +580,6 @@ subroutine energy_conservation(domain, err) ! river runoff temperature flux sumArray(14) = sumArray(14) + areaCell(iCell) * activeTracersSurfaceFluxRunoff(index_temperature_flux,iCell) sumArray(15) = sumArray(15) + areaCell(iCell) * icebergTemperatureFlux(iCell) - sumArray(20) = sumArray(20) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) enddo ! iCell @@ -640,7 +634,6 @@ subroutine energy_conservation(domain, err) accumulatedLandIceHeatFlux = accumulatedLandIceHeatFlux + sumArrayOut(17) accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux + sumArrayOut(18) accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux + sumArrayOut(19) - accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux + sumArrayOut(20) ! cleanup deallocate(sumArray) @@ -670,7 +663,6 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux = accumulatedEvapTemperatureFlux /accumulatedFluxCounter accumulatedSeaIceTemperatureFlux = accumulatedSeaIceTemperatureFlux /accumulatedFluxCounter accumulatedRiverRunoffTemperatureFlux = accumulatedRiverRunoffTemperatureFlux /accumulatedFluxCounter - accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux /accumulatedFluxCounter accumulatedIcebergTemperatureFlux = accumulatedIcebergTemperatureFlux /accumulatedFluxCounter accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux /accumulatedFluxCounter @@ -705,7 +697,6 @@ subroutine energy_conservation(domain, err) + accumulatedEvapTemperatureFlux *rho_sw*cp_sw & + accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw & + accumulatedRiverRunoffTemperatureFlux *rho_sw*cp_sw & - + accumulatedSubglacialRunoffTemperatureFlux *rho_sw*cp_sw & + accumulatedIcebergTemperatureFlux*rho_sw*cp_sw ! note, accumulatedLandIceFrazilHeatFlux not added because already in accumulatedFrazilHeatFlux @@ -769,7 +760,6 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v -v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('SubglacialRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum @@ -838,7 +828,6 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & - accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -863,7 +852,6 @@ subroutine mass_conservation(domain, err) evaporationFlux, & seaIceFreshwaterFlux, & riverRunoffFlux, & - subglacialRunoffFlux, & iceRunoffFlux, & removedRiverRunoffFlux, & removedIceRunoffFlux, & @@ -889,7 +877,7 @@ subroutine mass_conservation(domain, err) iCell, ierr, k integer, parameter :: & - nSums = 13 + nSums = 12 integer, dimension(:), pointer :: minLevelCell, maxLevelCell @@ -912,7 +900,6 @@ subroutine mass_conservation(domain, err) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) - call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -950,7 +937,6 @@ subroutine mass_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'evaporationFlux', evaporationFlux) call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedRiverRunoffFlux', removedRiverRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedIceRunoffFlux', removedIceRunoffFlux) @@ -970,7 +956,6 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) - sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw enddo if (config_use_frazil_ice_formation) then @@ -1017,7 +1002,6 @@ subroutine mass_conservation(domain, err) accumulatedFrazilFlux = accumulatedFrazilFlux + sumArrayOut(10) accumulatedLandIceFlux = accumulatedLandIceFlux + sumArrayOut(11) accumulatedLandIceFrazilFlux = accumulatedLandIceFrazilFlux + sumArrayOut(12) - accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux + sumArrayOut(13) ! cleanup deallocate(sumArray) @@ -1037,7 +1021,6 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux = accumulatedEvaporationFlux /accumulatedFluxCounter accumulatedSeaIceFlux = accumulatedSeaIceFlux /accumulatedFluxCounter accumulatedRiverRunoffFlux = accumulatedRiverRunoffFlux /accumulatedFluxCounter - accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux /accumulatedFluxCounter accumulatedIceRunoffFlux = accumulatedIceRunoffFlux /accumulatedFluxCounter accumulatedRemovedRiverRunoffFlux = accumulatedRemovedRiverRunoffFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffFlux = accumulatedRemovedIceRunoffFlux /accumulatedFluxCounter @@ -1066,7 +1049,6 @@ subroutine mass_conservation(domain, err) + accumulatedEvaporationFlux & + accumulatedSeaIceFlux & + accumulatedRiverRunoffFlux & - + accumulatedSubglacialRunoffFlux & + accumulatedIceRunoffFlux & + accumulatedIcebergFlux & + accumulatedFrazilFlux & @@ -1101,8 +1083,6 @@ subroutine mass_conservation(domain, err) v=accumulatedIcebergFlux ; write(m,"('icebergFreshwaterFlux ',es16.8,' x2o_Fioi_bergw wberg ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedEvaporationFlux ; write(m,"('evaporationFlux ',es16.8,' x2o_Foxx_evap wevap ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffFlux ; write(m,"('riverRunoffFlux ',es16.8,' x2o_Foxx_rofl wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v -v=accumulatedSubglacialRunoffFlux ; write(m,"('subglacialRunoffFlux ',es16.8,' x2o_Foxx_rofl wsgr ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v - if (landIceFreshwaterFluxesOn) then v=accumulatedRemovedRiverRunoffFlux; write(m,"('removedRiverRunoffFlux ',es16.8,' wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); v=accumulatedRiverRunoffFlux+accumulatedRemovedRiverRunoffFlux; @@ -1170,8 +1150,7 @@ subroutine salt_conservation(domain, err) conservationCheckSaltAMPool, & meshPool, & statePool, & - forcingPool, & - tracersSurfaceFluxPool + forcingPool real(kind=RKIND), pointer :: & initialSalt, & @@ -1181,14 +1160,10 @@ subroutine salt_conservation(domain, err) absoluteSaltError, & relativeSaltError - real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxSubglacialRunoff - real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & + accumulatedFrazilSalinityFlux ! accumulatedLandIceFrazilSalinityFlux is not present because it is always 0 - accumulatedFrazilSalinityFlux, & - accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), dimension(:), allocatable :: & sumArray, & @@ -1209,15 +1184,14 @@ subroutine salt_conservation(domain, err) dt, dtAvg, v, A, s, c integer, pointer :: & - nCellsSolve, & - index_salinity_flux + nCellsSolve integer :: & iCell, & ierr integer, parameter :: & - nSums = 4 + nSums = 3 logical, pointer :: & activeTracersBulkRestoringPKG @@ -1235,7 +1209,6 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) - call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) !------------------------------------------------------------- ! Net salt flux to ice @@ -1261,18 +1234,11 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) - call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) - call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) - call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) - - do iCell = 1, nCellsSolve ! salt flux to ocean sumArray(1) = sumArray(1) + areaCell(iCell) * seaIceSalinityFlux(iCell) - ! subglacial runoff - sumArray(4) = sumArray(4) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) enddo ! iCell if (config_use_frazil_ice_formation) then @@ -1299,7 +1265,6 @@ subroutine salt_conservation(domain, err) ! accumulate fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux + sumArrayOut(1) accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux + sumArrayOut(2) - accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux + sumArrayOut(4) ! cleanup deallocate(sumArray) @@ -1316,7 +1281,6 @@ subroutine salt_conservation(domain, err) ! Average the fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux /accumulatedFluxCounter accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux /accumulatedFluxCounter - accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux /accumulatedFluxCounter ! get initial salt content call MPAS_pool_get_array(conservationCheckSaltAMPool, "initialSalt", initialSalt) @@ -1333,8 +1297,7 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "netSaltFlux", netSaltFlux) netSaltFlux = accumulatedSeaIceSalinityFlux & - + accumulatedFrazilSalinityFlux & - + accumulatedSubglacialRunoffSalinityFlux + + accumulatedFrazilSalinityFlux ! compute the final salt error call MPAS_pool_get_array(conservationCheckSaltAMPool, "absoluteSaltError", absoluteSaltError) @@ -1364,8 +1327,6 @@ subroutine salt_conservation(domain, err) .and.config_frazil_under_land_ice) then v=0; write(m,"('LandIceFrazilSalinityFlux',es16.8,' (already in wmelt, do not sum) ',f16.8)") v,v*c; call mpas_log_write(m); !no sum: s=s+v end if -v=accumulatedSubglacialRunoffSalinityFlux ; write(m,"('SubglacialRunoffSalinityFlux ',es16.8,' x2o_Fioi_salt salt ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v - write(m,"('SUM VOLUME FLUXES ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -1562,11 +1523,11 @@ subroutine carbon_conservation(domain, err) block => domain % blocklist do while (associated(block)) call MPAS_pool_get_dimension(block % dimensions, "nCellsSolve", nCellsSolve) - + call MPAS_pool_get_subpool(block % structs, "mesh", meshPool) call MPAS_pool_get_subpool(block % structs, "forcing", forcingPool) call MPAS_pool_get_subpool(block % structs, "state", statePool) - + call MPAS_pool_get_array(meshPool, "areaCell", areaCell) call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell) @@ -1633,7 +1594,7 @@ subroutine carbon_conservation(domain, err) + ecosysTracersSurfaceFlux(index_spCFlux, iCell) & + ecosysTracersSurfaceFlux(index_diatCFlux, iCell) & + ecosysTracersSurfaceFlux(index_diazCFlux, iCell)) - + do k = 1, maxLevelCell(iCell) sumArray(4) = sumArray(4) + areaCell(iCell) * ( & ecosysTracersTend(index_DICTend, k, iCell) & @@ -1684,7 +1645,7 @@ subroutine carbon_conservation(domain, err) !------------------------------------------------------------- if (MPAS_stream_mgr_ringing_alarms(domain % streamManager, "conservationCheckOutput", ierr=ierr)) then - + ! Average the fluxes accumulatedCarbonSourceSink = accumulatedCarbonSourceSink /accumulatedFluxCounter accumulatedCarbonSedimentFlux = accumulatedCarbonSedimentFlux /accumulatedFluxCounter @@ -1696,7 +1657,7 @@ subroutine carbon_conservation(domain, err) ! get initial carbon call MPAS_pool_get_array(conservationCheckCarbonAMPool, "initialCarbon", initialCarbon) - + ! get final carbon call MPAS_pool_get_array(conservationCheckCarbonAMPool, "finalCarbon", finalCarbon) call compute_total_carbon(domain, finalCarbon) @@ -1733,13 +1694,13 @@ subroutine carbon_conservation(domain, err) relativeCarbonErrorBounds = & relativeCarbonErrorStepBounds*relativeCarbonErrorBoundsFac*totalTimeSteps relativeCarbonErrorPerTimeStep = relativeCarbonError/accumulatedFluxCounter - + !------------------------------------------------------------- ! Output to log file !------------------------------------------------------------- if (config_AM_conservationCheck_write_to_logfile) then - + call mpas_log_write('') call mpas_log_write('----------------------------------------------------------') call mpas_log_write('CARBON CONSERVATION CHECK') @@ -1770,7 +1731,7 @@ subroutine carbon_conservation(domain, err) v=accumulatedIceOceanInorganicCarbonFlux*mmol_to_kg_C write(m,"('Ice-Ocean Inorganic Flux ',es16.8,' ',f16.8)") v,v*c call mpas_log_write(m) - write(m,"('SUM FLUXES (surf + sed) ',es16.8,' ',f16.8,es16.8)") s, s*c; + write(m,"('SUM FLUXES (surf + sed) ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -1790,24 +1751,24 @@ subroutine carbon_conservation(domain, err) write(m,"('Carbon change ', 3es16.8)") & carbonChange*mmol_to_kg_C, & carbonChange*mmol_to_kg_C/dtAvg, & - carbonChange*mmol_to_kg_C/dtAvg*c + carbonChange*mmol_to_kg_C/dtAvg*c call mpas_log_write(m) write(m,"('Net carbon flux ', 3es16.8)") & netCarbonFlux*mmol_to_kg_C*dtAvg, & netCarbonFlux*mmol_to_kg_C, & - netCarbonFlux*mmol_to_kg_C*c + netCarbonFlux*mmol_to_kg_C*c call mpas_log_write(m) write(m,"('Absolute carbon error ', 3es16.8)") & absoluteCarbonError*mmol_to_kg_C, & absoluteCarbonError*mmol_to_kg_C/dtAvg, & - absoluteCarbonError*mmol_to_kg_C/dtAvg*c + absoluteCarbonError*mmol_to_kg_C/dtAvg*c call mpas_log_write(m) call mpas_log_write(' ') write(m,"('RELATIVE CARBON ERROR =', es16.8)") & relativeCarbonError call mpas_log_write(m) call mpas_log_write(' ') - + write(m,"('Relative carbon error per timestep = ', es16.8)") & relativeCarbonErrorPerTimeStep call mpas_log_write(m) @@ -1853,7 +1814,7 @@ subroutine carbon_conservation(domain, err) endif end subroutine carbon_conservation - + !*********************************************************************** ! ! routine compute_total_energy @@ -2229,7 +2190,7 @@ subroutine compute_total_carbon(domain, totalCarbon) call MPAS_dmpar_sum_real(domain % dminfo, carbon, totalCarbon) end subroutine compute_total_carbon - + !*********************************************************************** ! ! routine reset_accumulated_variables @@ -2271,7 +2232,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & - accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), pointer :: & @@ -2280,7 +2240,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & - accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -2291,8 +2250,7 @@ subroutine reset_accumulated_variables(domain) real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux, & - accumulatedSubglacialRunoffSalinityFlux + accumulatedFrazilSalinityFlux real(kind=RKIND), pointer :: & accumulatedCarbonSourceSink, & @@ -2322,7 +2280,6 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) - call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) accumulatedFluxCounter = 0 @@ -2341,7 +2298,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux = 0.0_RKIND accumulatedSeaIceTemperatureFlux = 0.0_RKIND accumulatedRiverRunoffTemperatureFlux = 0.0_RKIND - accumulatedSubglacialRunoffTemperatureFlux = 0.0_RKIND accumulatedIcebergTemperatureFlux = 0.0_RKIND accumulatedLandIceFrazilHeatFlux = 0.0_RKIND accumulatedRemovedIceRunoffHeatFlux = 0.0_RKIND @@ -2354,7 +2310,6 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) - call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -2368,7 +2323,6 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux = 0.0_RKIND accumulatedSeaIceFlux = 0.0_RKIND accumulatedRiverRunoffFlux = 0.0_RKIND - accumulatedSubglacialRunoffFlux = 0.0_RKIND accumulatedIceRunoffFlux = 0.0_RKIND accumulatedRemovedRiverRunoffFlux = 0.0_RKIND accumulatedRemovedIceRunoffFlux = 0.0_RKIND @@ -2382,13 +2336,9 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) - call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedLandIceFrazilSalinityFlux", accumulatedLandIceFrazilSalinityFlux) - call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) - accumulatedSeaIceSalinityFlux = 0.0_RKIND accumulatedFrazilSalinityFlux = 0.0_RKIND - accumulatedSubglacialRunoffSalinityFlux = 0.0_RKIND call MPAS_pool_get_subpool(domain % blocklist % structs, "conservationCheckCarbonAM", conservationCheckCarbonAMPool) From ea8bb59c4710c99561d0993a57cdfc505ac39216 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 13:32:31 -0600 Subject: [PATCH 34/73] rmv conservation check on sgr buildnml --- components/mpas-ocean/cime_config/buildnml | 1 - 1 file changed, 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 4d5029555afc..91c481ad8f5c 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1195,7 +1195,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') From e969c31a02875303c5e0f0435195fb7a0ff1edcb Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 13:56:39 -0600 Subject: [PATCH 35/73] rmv conservation check on sgr buildnml #2 --- components/mpas-ocean/cime_config/buildnml | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 91c481ad8f5c..d6d40491baa6 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1201,7 +1201,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') @@ -1210,7 +1209,6 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') - lines.append('') lines.append('') lines.append('') lines.append('') From 800961c2e6f6efa310da7a00018b91fa51f3ba93 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 12:14:43 -0600 Subject: [PATCH 36/73] pkg change in bld --- components/mpas-ocean/bld/build-namelist | 5 +++++ components/mpas-ocean/bld/build-namelist-section | 1 + .../bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- .../bld/namelist_files/namelist_definition_mpaso.xml | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index e33f4dc1c796..2c5ee97b0df2 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -715,6 +715,11 @@ add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); add_default($nl, 'config_sgr_temperature'); add_default($nl, 'config_sgr_salinity'); +if ($OCN_SGR eq 'data') { + add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); +} else { + add_default($nl, 'config_subglacial_runoff_mode'); +} ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 0d44d3f328b6..3f2d4ab4839d 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -231,6 +231,7 @@ add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); add_default($nl, 'config_sgr_temperature'); add_default($nl, 'config_sgr_salinity'); +add_default($nl, 'config_subglacial_runoff_mode'); ############################ # Namelist group: coupling # 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 40a3b3ca86f5..0514704b9514 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -349,7 +349,7 @@ 'sgr' 0.0 0.0 - +'off' .false. 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 97bd989f06c5..616ec67d24cd 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1244,6 +1244,14 @@ Valid values: Any real number. Default: Defined in namelist_defaults.xml + +Selects the mode in which subglacial runoff fluxes are computed. + +Valid values: 'off', 'data' +Default: Defined in namelist_defaults.xml + + Date: Mon, 8 Jul 2024 12:32:42 -0600 Subject: [PATCH 37/73] pkg in driver and registry --- components/mpas-ocean/src/Registry.xml | 5 +++++ .../mpas-ocean/src/driver/mpas_ocn_core_interface.F | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 1ceddac39fcb..bab430733500 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -702,6 +702,10 @@ description="The length scale of exponential decay of river runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$." possible_values="Any positive real number." /> + + diff --git a/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F b/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F index 7d9eb083f907..6d542fb0c3f3 100644 --- a/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F +++ b/components/mpas-ocean/src/driver/mpas_ocn_core_interface.F @@ -123,6 +123,7 @@ function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{ logical, pointer :: dataLandIceFluxesPKGActive logical, pointer :: landIceFluxesPKGActive logical, pointer :: landIceCouplingPKGActive + logical, pointer :: dataSubglacialRunoffFluxPKGActive logical, pointer :: thicknessBulkPKGActive logical, pointer :: frazilIceActive logical, pointer :: tidalForcingActive @@ -186,6 +187,7 @@ function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{ logical, pointer :: config_use_bulk_thickness_flux logical, pointer :: config_compute_active_tracer_budgets character (len=StrKIND), pointer :: config_land_ice_flux_mode + character (len=StrKIND), pointer :: config_subglacial_runoff_mode type (mpas_pool_iterator_type) :: groupItr character (len=StrKIND) :: tracerGroupName, configName, packageName @@ -319,6 +321,15 @@ function ocn_setup_packages(configPool, packagePool, iocontext) result(ierr)!{{{ landIceCouplingPKGActive = .true. end if + ! + ! test for use of subglacial runoff flux, dataSubglacialRunoffFluxPKGActive + ! + call mpas_pool_get_package(packagePool, 'dataSubglacialRunoffFluxPKGActive', dataSubglacialRunoffFluxPKGActive) + call mpas_pool_get_config(configPool, 'config_subglacial_runoff_mode', config_subglacial_runoff_mode) + if ( trim(config_subglacial_runoff_mode) == 'data' ) then + dataSubglacialRunoffFluxPKGActive = .true. + end if + ! ! test for use of frazil ice formation, frazilIceActive ! From b07587b10a5d5f9c767dcbd07ee58a384c5aa09c Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 13:05:43 -0600 Subject: [PATCH 38/73] fix group for sgr in namelist_definition_mpaso --- .../mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 616ec67d24cd..43ba139ab65f 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1245,7 +1245,7 @@ Default: Defined in namelist_defaults.xml + category="forcing" group="forcing"> Selects the mode in which subglacial runoff fluxes are computed. Valid values: 'off', 'data' From f1b13ba8657dd579a5aae5e2fa18c8fd8a3ccb5a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 14:10:11 -0600 Subject: [PATCH 39/73] sgr pkg in shared folder, add loops --- .../src/shared/mpas_ocn_diagnostics.F | 100 ++++++++++-------- .../mpas-ocean/src/shared/mpas_ocn_forcing.F | 77 +++++++------- .../shared/mpas_ocn_surface_bulk_forcing.F | 55 ++++++---- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 12 ++- .../src/shared/mpas_ocn_thick_surface_flux.F | 21 ++-- .../mpas_ocn_tracer_surface_flux_to_tend.F | 2 +- 6 files changed, 153 insertions(+), 114 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index f04893b671c0..daf9bfcab6d5 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1904,9 +1904,13 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & config_flux_attenuation_coefficient surfaceFluxAttenuationCoefficientRunoff(iCell) = & config_flux_attenuation_coefficient_runoff - surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & - config_flux_attenuation_coefficient_subglacial_runoff end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCells + surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & + config_flux_attenuation_coefficient_subglacial_runoff + end do + end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel @@ -3489,34 +3493,36 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & - exp( max(-100.0_RKIND, & -layerThickness(kmin, iCell)/ & config_flux_attenuation_coefficient_runoff)) - if (config_use_sgr_opt_kpp == 1) then - if ( trim(config_sgr_flux_vertical_location) == 'top' ) then - fracAbsorbedSubglacialRunoff = 1.0_RKIND & - - exp( max(-100.0_RKIND, & - -layerThickness(kmin, iCell)/ & - config_flux_attenuation_coefficient_subglacial_runoff)) - else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then - ! calculate total thickness into variable zTop - zTop = 0.0_RKIND - do k = minLevelCell(iCell), maxLevelCell(iCell) - zTop = zTop + layerThickness(k,iCell) - end do - ! distribute flux evenly throughout water column - fracAbsorbedSubglacialRunoff = layerThickness(kmin, iCell) / zTop - else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then - zTop = 0.0_RKIND - do k = maxLevelCell(iCell), minLevelCell(iCell), -1 - zBot = zTop - layerThickness(k,iCell) - if (k == minLevelCell(iCell)) then - transmissionCoeffTop = exp( max(zTop / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) - transmissionCoeffBot = exp( max(zBot / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) - fracAbsorbedSubglacialRunoff = transmissionCoeffTop - transmissionCoeffBot - end if - zTop = zBot - end do - end if - else - fracAbsorbedSubglacialRunoff = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + if (config_use_sgr_opt_kpp == 1) then + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + fracAbsorbedSubglacialRunoff = 1.0_RKIND & + - exp( max(-100.0_RKIND, & + -layerThickness(kmin, iCell)/ & + config_flux_attenuation_coefficient_subglacial_runoff)) + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + ! calculate total thickness into variable zTop + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + fracAbsorbedSubglacialRunoff = layerThickness(kmin, iCell) / zTop + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + zTop = 0.0_RKIND + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + if (k == minLevelCell(iCell)) then + transmissionCoeffTop = exp( max(zTop / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + transmissionCoeffBot = exp( max(zBot / config_flux_attenuation_coefficient_runoff, -100.0_RKIND) ) + fracAbsorbedSubglacialRunoff = transmissionCoeffTop - transmissionCoeffBot + end if + zTop = zBot + end do + end if + else + fracAbsorbedSubglacialRunoff = 0.0_RKIND + end if end if ! Store the total tracer flux below in @@ -3532,18 +3538,24 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & seaIceTemperatureFlux(iCell) + & icebergTemperatureFlux(iCell)) & - fracAbsorbedRunoff* & - activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) & + activeTracersSurfaceFluxRunoff(indexTempFlux,iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + nonLocalSurfaceTracerFlux(indexTempFlux, iCell) = nonLocalSurfaceTracerFlux(indexTempFlux, iCell) & - fracAbsorbedSubglacialRunoff* & activeTracersSurfaceFluxSubglacialRunoff(indexTempFlux,iCell) + end if nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) = & activeTracersSurfaceFlux(indexSaltFlux,iCell) & - fracAbsorbed*surfaceThicknessFlux(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) & - fracAbsorbedRunoff*surfaceThicknessFluxRunoff(iCell)* & - activeTracers(indexSaltFlux,kmin,iCell) & + activeTracers(indexSaltFlux,kmin,iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) = nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) & - fracAbsorbedSubglacialRunoff*surfaceThicknessFluxSubglacialRunoff(iCell)* & activeTracers(indexSaltFlux,kmin,iCell) + end if surfaceBuoyancyForcing(iCell) = & thermalExpansionCoeff(kmin,iCell)* & @@ -4485,17 +4497,19 @@ subroutine ocn_validate_state(domain, timeLevel)!{{{ call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) end if - ! Test subglacialRunoffFlux - fieldName = 'subglacialRunoffFlux' - minValue = HUGE(minValue) - maxValue = -HUGE(maxValue) - call mpas_pool_get_array(forcingPool, fieldName, real1DArr) - if ( associated(real1DArr) ) then - do iCell = 1, nCellsSolve - minValue = min( minValue, real1DArr(iCell) ) - maxValue = max( maxValue, real1DArr(iCell) ) - end do - call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) + if (trim(config_subglacial_runoff_mode) == 'data') then + ! Test subglacialRunoffFlux + fieldName = 'subglacialRunoffFlux' + minValue = HUGE(minValue) + maxValue = -HUGE(maxValue) + call mpas_pool_get_array(forcingPool, fieldName, real1DArr) + if ( associated(real1DArr) ) then + do iCell = 1, nCellsSolve + minValue = min( minValue, real1DArr(iCell) ) + maxValue = max( maxValue, real1DArr(iCell) ) + end do + call ocn_write_field_statistics(debugUnit, fieldName, minValue, maxValue) + end if end if ! Test seaIceSalinityFlux diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index 75fc20c8d7ed..5cfce4c4e690 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -183,44 +183,45 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin end do ! now do subglacial runoff separately - - if ( trim(config_sgr_flux_vertical_location) == 'top' ) then - do iCell = 1, nCells - zTop = 0.0_RKIND - transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - do k = minLevelCell(iCell), maxLevelCell(iCell) - zBot = zTop - layerThickness(k,iCell) - transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot - zTop = zBot - transmissionCoeffTop = transmissionCoeffBot - end do - end do - else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then - do iCell = 1, nCells - ! calculate total thickness - zTop = 0.0_RKIND - do k = minLevelCell(iCell), maxLevelCell(iCell) - zTop = zTop + layerThickness(k,iCell) - end do - ! distribute flux evenly throughout water column - zBot = 0.0_RKIND - do k = minLevelCell(iCell), maxLevelCell(iCell) - fractionAbsorbedSubglacialRunoff(k, iCell) = layerThickness(k,iCell) / zTop - end do - end do - else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then - do iCell = 1, nCells - zTop = 0.0_RKIND - transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - do k = maxLevelCell(iCell), minLevelCell(iCell), -1 - zBot = zTop - layerThickness(k,iCell) - transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) - fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot - zTop = zBot - transmissionCoeffTop = transmissionCoeffBot - end do - end do + if ( trim(config_subglacial_runoff_mode) == 'data' ) then + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = minLevelCell(iCell), maxLevelCell(iCell) + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + do iCell = 1, nCells + ! calculate total thickness + zTop = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + zTop = zTop + layerThickness(k,iCell) + end do + ! distribute flux evenly throughout water column + zBot = 0.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + fractionAbsorbedSubglacialRunoff(k, iCell) = layerThickness(k,iCell) / zTop + end do + end do + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + do iCell = 1, nCells + zTop = 0.0_RKIND + transmissionCoeffTop = ocn_forcing_transmission(zTop, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + do k = maxLevelCell(iCell), minLevelCell(iCell), -1 + zBot = zTop - layerThickness(k,iCell) + transmissionCoeffBot = ocn_forcing_transmission(zBot, surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell)) + fractionAbsorbedSubglacialRunoff(k, iCell) = transmissionCoeffTop - transmissionCoeffBot + zTop = zBot + transmissionCoeffTop = transmissionCoeffBot + end do + end do + end if end if end subroutine ocn_forcing_build_fraction_absorbed_array!}}} diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index fe4f2cac5abf..0547f73319dd 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -351,8 +351,12 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur surfaceThicknessFlux(iCell) = surfaceThicknessFlux(iCell) + ( snowFlux(iCell) + rainFlux(iCell) + evaporationFlux(iCell) & + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw - surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCells + surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) + end do + end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel @@ -578,28 +582,30 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFluxRunoff(index_temperature_flux,iCell) = riverRunoffFlux(iCell) & * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw - if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature / areaCell(iCell) - else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / areaCell(iCell) - end if - - if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity / areaCell(iCell) - else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then + !sgr with fixed prescribed temperature (for debugging only) + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_temperature / areaCell(iCell) + else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & + inLandIceCavity=.true.) / areaCell(iCell) + end if + + if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then + !sgr with fixed prescribed temperature (for debugging only) + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_salinity / areaCell(iCell) + else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND + end if end if ! Accumulate fluxes that use the freezing point -! mrp performance note: should call ocn_freezing_temperature just once here +! mrp performance note: should call ocn_freezing_temperature just once here seaIceTemperatureFlux(iCell) = seaIceFreshWaterFlux(iCell) * & ocn_freezing_temperature( tracerGroup(index_salinity_flux, minLevelCell(iCell), iCell), pressure=0.0_RKIND, & inLandIceCavity=.false.) / rho_sw @@ -613,10 +619,15 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFlux(index_temperature_flux, iCell) = tracersSurfaceFlux(index_temperature_flux, iCell) & + surfaceTemperatureFluxWithoutRunoff - ! add river and subglacial runoff contribution for sending through coupler + ! add river runoff contribution for sending through coupler totalFreshWaterTemperatureFlux(iCell) = surfaceTemperatureFluxWithoutRunoff & - + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) & + + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) + + ! add subglacial runoff contribution for sending through coupler + if (trim(config_subglacial_runoff_mode) == 'data') then + totalFreshWaterTemperatureFlux(iCell) = totalFreshWaterTemperatureFlux(iCell) & + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) + end if ! Fields with zero temperature are not accumulated. These include: ! snowFlux diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 2d3dd66cbdb9..30584386666c 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -186,11 +186,15 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ do iCell = 1, nCellsAll surfaceThicknessFlux(iCell) = 0.0_RKIND surfaceThicknessFluxRunoff(iCell) = 0.0_RKIND - surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND do k=1,nVertLevels tendThick(k, iCell) = 0.0_RKIND end do end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCellsAll + surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND + end do + end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel @@ -841,9 +845,13 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & do n=1,nTracersGroup tracerGroupSurfaceFlux (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRunoff (n,iCell) = 0.0_RKIND - tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRemoved(n,iCell) = 0.0_RKIND end do + if (trim(config_subglacial_runoff_mode) == 'data') then + do n=1,nTracersGroup + tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND + end do + end if end do !$omp end do !$omp end parallel diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 1f7c67b88e09..eb531a999582 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -141,15 +141,18 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND remainingFluxRunoff = 1.0_RKIND - remainingFluxSubglacialRunoff = 1.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + remainingFluxSubglacialRunoff = 1.0_RKIND + end if do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - transmissionCoefficients(k, iCell) remainingFluxRunoff = remainingFluxRunoff - transmissionCoefficientsRunoff(k, iCell) - remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) - tend(k, iCell) = tend(k, iCell) + surfaceThicknessFlux(iCell) * transmissionCoefficients(k, iCell) & - + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) & - + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) + + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) + tend(k, iCell) = tend(k, iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) + end if end do if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then @@ -161,9 +164,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe + remainingFluxRunoff * surfaceThicknessFluxRunoff(iCell) end if - if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then - tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & - + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then + tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + end if end if end do #ifndef MPAS_OPENACC diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 4303d1b78ff2..4a1dc5fce098 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -206,7 +206,7 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso ! now do subglacial runoff component - if (associated(surfaceTracerFluxSubglacialRunoff)) then + if (trim(config_subglacial_runoff_mode) == 'data') then call mpas_timer_start("surface_tracer_subglacial_runoff_flux") !$omp parallel From 9b3e339867dfbf0f564be21ef25deb71ce089ffe Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 8 Jul 2024 14:46:56 -0600 Subject: [PATCH 40/73] pkg dataSubglacialRunoffFluxPKG into registry variables --- components/mpas-ocean/src/Registry.xml | 7 ++++--- .../src/tracer_groups/Registry_activeTracers.xml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index bab430733500..79ef88b33181 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3384,6 +3384,7 @@ /> @@ -3807,7 +3808,7 @@ /> - + From 5ea51b28153984ba3c484d453a55cd48181b8edb Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 16:30:12 -0600 Subject: [PATCH 41/73] add conservation registry and streams --- components/mpas-ocean/cime_config/buildnml | 3 +++ .../Registry_conservation_check.xml | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index d6d40491baa6..4d5029555afc 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -1195,12 +1195,14 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') @@ -1209,6 +1211,7 @@ def buildnml(case, caseroot, compname): lines.append('') lines.append('') lines.append('') + lines.append('') lines.append('') lines.append('') lines.append('') diff --git a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml index 0fd2d28d1c6e..7870e6fc2178 100644 --- a/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml +++ b/components/mpas-ocean/src/analysis_members/Registry_conservation_check.xml @@ -106,6 +106,10 @@ + @@ -145,6 +149,10 @@ description="Fresh water flux from river runoff from coupler. Positive into the ocean." packages="thicknessBulkPKG" /> + @@ -194,6 +202,11 @@ + + + + @@ -302,6 +317,7 @@ + @@ -343,12 +359,14 @@ + + @@ -358,6 +376,7 @@ + From 361900104fd6e9fa284639f73395d5ca04732ffc Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 9 Jul 2024 17:04:01 -0600 Subject: [PATCH 42/73] try copy mpas_ocn_conservation_check.F --- .../mpas_ocn_conservation_check.F | 105 ++++++++++++++++-- 1 file changed, 97 insertions(+), 8 deletions(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 5551d5758db2..756328a3d5dd 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -28,6 +28,7 @@ module ocn_conservation_check use ocn_constants use ocn_config + use ocn_mesh implicit none private @@ -427,6 +428,7 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), dimension(:), allocatable :: & @@ -463,7 +465,8 @@ subroutine energy_conservation(domain, err) real(kind=RKIND), dimension(:,:), pointer :: & - activeTracersSurfaceFluxRunoff + activeTracersSurfaceFluxRunoff, & + activeTracersSurfaceFluxSubglacialRunoff type (MPAS_timeInterval_type) :: & timeStepESMF @@ -480,7 +483,7 @@ subroutine energy_conservation(domain, err) ierr integer, parameter :: & - nSums = 19 + nSums = 20 character(len=160) :: & m @@ -513,6 +516,7 @@ subroutine energy_conservation(domain, err) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) !------------------------------------------------------------- @@ -556,6 +560,7 @@ subroutine energy_conservation(domain, err) call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_temperatureSurfaceFlux', index_temperature_flux) call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxRunoff', activeTracersSurfaceFluxRunoff) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassNew, 2) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceMass', accumulatedFrazilIceMassOld, 1) @@ -581,6 +586,11 @@ subroutine energy_conservation(domain, err) sumArray(14) = sumArray(14) + areaCell(iCell) * activeTracersSurfaceFluxRunoff(index_temperature_flux,iCell) sumArray(15) = sumArray(15) + areaCell(iCell) * icebergTemperatureFlux(iCell) + ! subglacial river runoff temperature flux + if (trim(config_subglacial_runoff_mode) == 'data') then + sumArray(20) = sumArray(20) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) + end if + enddo ! iCell if (config_use_frazil_ice_formation) then @@ -634,6 +644,9 @@ subroutine energy_conservation(domain, err) accumulatedLandIceHeatFlux = accumulatedLandIceHeatFlux + sumArrayOut(17) accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux + sumArrayOut(18) accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux + sumArrayOut(19) + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux + sumArrayOut(20) + end if ! cleanup deallocate(sumArray) @@ -663,6 +676,9 @@ subroutine energy_conservation(domain, err) accumulatedEvapTemperatureFlux = accumulatedEvapTemperatureFlux /accumulatedFluxCounter accumulatedSeaIceTemperatureFlux = accumulatedSeaIceTemperatureFlux /accumulatedFluxCounter accumulatedRiverRunoffTemperatureFlux = accumulatedRiverRunoffTemperatureFlux /accumulatedFluxCounter + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffTemperatureFlux = accumulatedSubglacialRunoffTemperatureFlux /accumulatedFluxCounter + end if accumulatedIcebergTemperatureFlux = accumulatedIcebergTemperatureFlux /accumulatedFluxCounter accumulatedLandIceFrazilHeatFlux = accumulatedLandIceFrazilHeatFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffHeatFlux = accumulatedRemovedIceRunoffHeatFlux /accumulatedFluxCounter @@ -699,6 +715,9 @@ subroutine energy_conservation(domain, err) + accumulatedRiverRunoffTemperatureFlux *rho_sw*cp_sw & + accumulatedIcebergTemperatureFlux*rho_sw*cp_sw ! note, accumulatedLandIceFrazilHeatFlux not added because already in accumulatedFrazilHeatFlux + if (trim(config_subglacial_runoff_mode) == 'data') then + netEnergyFlux = netEnergyFlux + accumulatedSubglacialRunoffTemperatureFlux * rho_sw*cp_sw + end if ! compute the final energy error call MPAS_pool_get_array(conservationCheckEnergyAMPool, "absoluteEnergyError", absoluteEnergyError) @@ -760,6 +779,9 @@ subroutine energy_conservation(domain, err) v=accumulatedEvapTemperatureFlux *rho_sw*cp_sw; write(m,"('EvapTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedSeaIceTemperatureFlux *rho_sw*cp_sw; write(m,"('SeaIceTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('RiverRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +if (trim(config_subglacial_runoff_mode) == 'data') then + v=accumulatedSubglacialRunoffTemperatureFlux*rho_sw*cp_sw; write(m,"('SubglacialRunoffTempFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v +end if v=accumulatedIcebergTemperatureFlux*rho_sw*cp_sw; write(m,"('IcebergTemperatureFlux ',es16.8,' ',f16.8)") v,v/A; call mpas_log_write(m); s=s+v write(m,"('SUM IMPLICIT HEAT FLUXES ',es16.8,' hh20temp ',f16.8,es16.8)") s, s/A; call mpas_log_write(m) s = s + explicitHeatFluxSum @@ -828,6 +850,7 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -852,6 +875,7 @@ subroutine mass_conservation(domain, err) evaporationFlux, & seaIceFreshwaterFlux, & riverRunoffFlux, & + subglacialRunoffFlux, & iceRunoffFlux, & removedRiverRunoffFlux, & removedIceRunoffFlux, & @@ -877,7 +901,7 @@ subroutine mass_conservation(domain, err) iCell, ierr, k integer, parameter :: & - nSums = 12 + nSums = 13 integer, dimension(:), pointer :: minLevelCell, maxLevelCell @@ -900,6 +924,7 @@ subroutine mass_conservation(domain, err) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -937,6 +962,7 @@ subroutine mass_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'evaporationFlux', evaporationFlux) call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshwaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedRiverRunoffFlux', removedRiverRunoffFlux) call mpas_pool_get_array(forcingPool, 'removedIceRunoffFlux', removedIceRunoffFlux) @@ -956,6 +982,9 @@ subroutine mass_conservation(domain, err) sumArray( 7) = sumArray( 7) + areaCell(iCell) * removedRiverRunoffFlux(iCell) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) + if (trim(config_subglacial_runoff_mode) == 'data') then + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw + end if enddo if (config_use_frazil_ice_formation) then @@ -1002,6 +1031,9 @@ subroutine mass_conservation(domain, err) accumulatedFrazilFlux = accumulatedFrazilFlux + sumArrayOut(10) accumulatedLandIceFlux = accumulatedLandIceFlux + sumArrayOut(11) accumulatedLandIceFrazilFlux = accumulatedLandIceFrazilFlux + sumArrayOut(12) + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux + sumArrayOut(13) + end if ! cleanup deallocate(sumArray) @@ -1021,6 +1053,9 @@ subroutine mass_conservation(domain, err) accumulatedEvaporationFlux = accumulatedEvaporationFlux /accumulatedFluxCounter accumulatedSeaIceFlux = accumulatedSeaIceFlux /accumulatedFluxCounter accumulatedRiverRunoffFlux = accumulatedRiverRunoffFlux /accumulatedFluxCounter + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffFlux = accumulatedSubglacialRunoffFlux /accumulatedFluxCounter + end if accumulatedIceRunoffFlux = accumulatedIceRunoffFlux /accumulatedFluxCounter accumulatedRemovedRiverRunoffFlux = accumulatedRemovedRiverRunoffFlux /accumulatedFluxCounter accumulatedRemovedIceRunoffFlux = accumulatedRemovedIceRunoffFlux /accumulatedFluxCounter @@ -1054,6 +1089,9 @@ subroutine mass_conservation(domain, err) + accumulatedFrazilFlux & + accumulatedLandIceFlux ! note, accumulatedLandIceFrazilFlux not added because already in accumulatedFrazilFlux + if (trim(config_subglacial_runoff_mode) == 'data') then + netMassFlux = netMassFlux + accumulatedSubglacialRunoffFlux + end if ! compute the final mass error call MPAS_pool_get_array(conservationCheckMassAMPool, "absoluteMassError", absoluteMassError) @@ -1083,6 +1121,10 @@ subroutine mass_conservation(domain, err) v=accumulatedIcebergFlux ; write(m,"('icebergFreshwaterFlux ',es16.8,' x2o_Fioi_bergw wberg ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedEvaporationFlux ; write(m,"('evaporationFlux ',es16.8,' x2o_Foxx_evap wevap ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v v=accumulatedRiverRunoffFlux ; write(m,"('riverRunoffFlux ',es16.8,' x2o_Foxx_rofl wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +if (trim(config_subglacial_runoff_mode) == 'data') then + v=accumulatedSubglacialRunoffFlux ; write(m,"('subglacialRunoffFlux ',es16.8,' x2o_Foxx_rofl wsgr ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +end if + if (landIceFreshwaterFluxesOn) then v=accumulatedRemovedRiverRunoffFlux; write(m,"('removedRiverRunoffFlux ',es16.8,' wrunoff ',f16.8)") v,v*c; call mpas_log_write(m); v=accumulatedRiverRunoffFlux+accumulatedRemovedRiverRunoffFlux; @@ -1150,7 +1192,8 @@ subroutine salt_conservation(domain, err) conservationCheckSaltAMPool, & meshPool, & statePool, & - forcingPool + forcingPool, & + tracersSurfaceFluxPool real(kind=RKIND), pointer :: & initialSalt, & @@ -1160,9 +1203,13 @@ subroutine salt_conservation(domain, err) absoluteSaltError, & relativeSaltError + real(kind=RKIND), dimension(:,:), pointer :: & + activeTracersSurfaceFluxSubglacialRunoff + real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux ! accumulatedLandIceFrazilSalinityFlux is not present because it is always 0 real(kind=RKIND), dimension(:), allocatable :: & @@ -1184,14 +1231,15 @@ subroutine salt_conservation(domain, err) dt, dtAvg, v, A, s, c integer, pointer :: & - nCellsSolve + nCellsSolve, & + index_salinity_flux integer :: & iCell, & ierr integer, parameter :: & - nSums = 3 + nSums = 4 logical, pointer :: & activeTracersBulkRestoringPKG @@ -1209,6 +1257,7 @@ subroutine salt_conservation(domain, err) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) !------------------------------------------------------------- ! Net salt flux to ice @@ -1234,12 +1283,23 @@ subroutine salt_conservation(domain, err) call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityOld, 1) call mpas_pool_get_array(statePool, 'accumulatedFrazilIceSalinity', accumulatedFrazilIceSalinityNew, 2) + call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) + call mpas_pool_get_array(tracersSurfaceFluxPool, 'activeTracersSurfaceFluxSubglacialRunoff', activeTracersSurfaceFluxSubglacialRunoff) + call mpas_pool_get_dimension(tracersSurfaceFluxPool, 'index_salinitySurfaceFlux', index_salinity_flux) + + do iCell = 1, nCellsSolve ! salt flux to ocean sumArray(1) = sumArray(1) + areaCell(iCell) * seaIceSalinityFlux(iCell) enddo ! iCell + ! subglacial runoff + if (trim(config_subglacial_runoff_mode) == 'data') then + do iCell = 1, nCellsSolve + sumArray(4) = sumArray(4) + areaCell(iCell) * activeTracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) + enddo ! iCell + end if if (config_use_frazil_ice_formation) then do iCell = 1, nCellsSolve @@ -1265,6 +1325,9 @@ subroutine salt_conservation(domain, err) ! accumulate fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux + sumArrayOut(1) accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux + sumArrayOut(2) + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux + sumArrayOut(4) + end if ! cleanup deallocate(sumArray) @@ -1281,6 +1344,9 @@ subroutine salt_conservation(domain, err) ! Average the fluxes accumulatedSeaIceSalinityFlux = accumulatedSeaIceSalinityFlux /accumulatedFluxCounter accumulatedFrazilSalinityFlux = accumulatedFrazilSalinityFlux /accumulatedFluxCounter + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffSalinityFlux = accumulatedSubglacialRunoffSalinityFlux /accumulatedFluxCounter + end if ! get initial salt content call MPAS_pool_get_array(conservationCheckSaltAMPool, "initialSalt", initialSalt) @@ -1299,6 +1365,10 @@ subroutine salt_conservation(domain, err) netSaltFlux = accumulatedSeaIceSalinityFlux & + accumulatedFrazilSalinityFlux + if (trim(config_subglacial_runoff_mode) == 'data') then + netSaltFlux = netSaltFlux + accumulatedSubglacialRunoffSalinityFlux + end if + ! compute the final salt error call MPAS_pool_get_array(conservationCheckSaltAMPool, "absoluteSaltError", absoluteSaltError) call MPAS_pool_get_array(conservationCheckSaltAMPool, "relativeSaltError", relativeSaltError) @@ -1327,6 +1397,10 @@ subroutine salt_conservation(domain, err) .and.config_frazil_under_land_ice) then v=0; write(m,"('LandIceFrazilSalinityFlux',es16.8,' (already in wmelt, do not sum) ',f16.8)") v,v*c; call mpas_log_write(m); !no sum: s=s+v end if +if (trim(config_subglacial_runoff_mode) == 'data') then + v=accumulatedSubglacialRunoffSalinityFlux ; write(m,"('SubglacialRunoffSalinityFlux ',es16.8,' x2o_Fioi_salt salt ',f16.8)") v,v*c; call mpas_log_write(m); s=s+v +end if + write(m,"('SUM VOLUME FLUXES ',es16.8,' ',f16.8,es16.8)") s, s*c; call mpas_log_write(m) call mpas_log_write(' ') @@ -2232,6 +2306,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux, & accumulatedSeaIceTemperatureFlux, & accumulatedRiverRunoffTemperatureFlux, & + accumulatedSubglacialRunoffTemperatureFlux, & accumulatedIcebergTemperatureFlux real(kind=RKIND), pointer :: & @@ -2240,6 +2315,7 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux, & accumulatedSeaIceFlux, & accumulatedRiverRunoffFlux, & + accumulatedSubglacialRunoffFlux, & accumulatedIceRunoffFlux, & accumulatedRemovedRiverRunoffFlux, & accumulatedRemovedIceRunoffFlux, & @@ -2250,7 +2326,8 @@ subroutine reset_accumulated_variables(domain) real(kind=RKIND), pointer :: & accumulatedSeaIceSalinityFlux, & - accumulatedFrazilSalinityFlux + accumulatedFrazilSalinityFlux, & + accumulatedSubglacialRunoffSalinityFlux real(kind=RKIND), pointer :: & accumulatedCarbonSourceSink, & @@ -2280,6 +2357,7 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedEvapTemperatureFlux", accumulatedEvapTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSeaIceTemperatureFlux", accumulatedSeaIceTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedRiverRunoffTemperatureFlux", accumulatedRiverRunoffTemperatureFlux) + call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedSubglacialRunoffTemperatureFlux", accumulatedSubglacialRunoffTemperatureFlux) call MPAS_pool_get_array(conservationCheckEnergyAMPool, "accumulatedIcebergTemperatureFlux", accumulatedIcebergTemperatureFlux) accumulatedFluxCounter = 0 @@ -2298,6 +2376,9 @@ subroutine reset_accumulated_variables(domain) accumulatedEvapTemperatureFlux = 0.0_RKIND accumulatedSeaIceTemperatureFlux = 0.0_RKIND accumulatedRiverRunoffTemperatureFlux = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffTemperatureFlux = 0.0_RKIND + end if accumulatedIcebergTemperatureFlux = 0.0_RKIND accumulatedLandIceFrazilHeatFlux = 0.0_RKIND accumulatedRemovedIceRunoffHeatFlux = 0.0_RKIND @@ -2310,6 +2391,7 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedEvaporationFlux", accumulatedEvaporationFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSeaIceFlux", accumulatedSeaIceFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRiverRunoffFlux", accumulatedRiverRunoffFlux) + call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedSubglacialRunoffFlux", accumulatedSubglacialRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedIceRunoffFlux", accumulatedIceRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedRiverRunoffFlux",accumulatedRemovedRiverRunoffFlux) call MPAS_pool_get_array(conservationCheckMassAMPool, "accumulatedRemovedIceRunoffFlux", accumulatedRemovedIceRunoffFlux) @@ -2323,6 +2405,9 @@ subroutine reset_accumulated_variables(domain) accumulatedEvaporationFlux = 0.0_RKIND accumulatedSeaIceFlux = 0.0_RKIND accumulatedRiverRunoffFlux = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffFlux = 0.0_RKIND + end if accumulatedIceRunoffFlux = 0.0_RKIND accumulatedRemovedRiverRunoffFlux = 0.0_RKIND accumulatedRemovedIceRunoffFlux = 0.0_RKIND @@ -2336,9 +2421,13 @@ subroutine reset_accumulated_variables(domain) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSeaIceSalinityFlux", accumulatedSeaIceSalinityFlux) call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedFrazilSalinityFlux", accumulatedFrazilSalinityFlux) + call MPAS_pool_get_array(conservationCheckSaltAMPool, "accumulatedSubglacialRunoffSalinityFlux", accumulatedSubglacialRunoffSalinityFlux) accumulatedSeaIceSalinityFlux = 0.0_RKIND accumulatedFrazilSalinityFlux = 0.0_RKIND + if (trim(config_subglacial_runoff_mode) == 'data') then + accumulatedSubglacialRunoffSalinityFlux = 0.0_RKIND + end if call MPAS_pool_get_subpool(domain % blocklist % structs, "conservationCheckCarbonAM", conservationCheckCarbonAMPool) From 26720b56bd801322af5b5cb92bc9f2e491be035a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 10 Jul 2024 15:45:14 -0600 Subject: [PATCH 43/73] update dsgr files --- components/mpas-ocean/cime_config/buildnml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 4d5029555afc..6ac2b043aaf3 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -143,7 +143,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.oQU240wLI.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'oQU240wLI_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.oQU240wLI.20240328.nc' elif ocn_grid == 'oQU120': decomp_date = '230424' @@ -282,7 +282,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.SOwISC12to60E2r4.20210114.nc' if ocn_sgr == 'data': - data_sgr_file = 'SOwISC12to60E2r4_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.SOwISC12to60E2r4.20240328.nc' elif ocn_grid == 'FRISwISC08to60E3r1': decomp_date = '20230913' # changed to date of partiotions in ../files_for_e3sm/assembled_files/inputdata/ocn/mpas-o/FRISwISC08to60E3r1/partitions @@ -359,7 +359,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.ECwISC30to60E2r1.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'ECwISC30to60E2r1_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.ECwISC30to60E2r1.20240328.nc' elif ocn_grid == 'IcoswISC30E3r5': decomp_date = '20231120' @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'IcoswISC30E3r5_DSGR.nc' + data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' From 21a593e20d77166c25ea6b09ec02d0789c9139e7 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 10 Jul 2024 15:51:33 -0600 Subject: [PATCH 44/73] remove redundant compsets --- .../cime_config/config_compsets.xml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/components/mpas-ocean/cime_config/config_compsets.xml b/components/mpas-ocean/cime_config/config_compsets.xml index 6950fd8c2179..be36f0103472 100644 --- a/components/mpas-ocean/cime_config/config_compsets.xml +++ b/components/mpas-ocean/cime_config/config_compsets.xml @@ -42,11 +42,6 @@ 2000_DATM%NYF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV - - GMPAS-NYF-DSGR - 2000_DATM%NYF_SLND_MPASSI_MPASO%DATMFORCEDDSGR_DROF%NYFAIS45_SGLC_SWAV - - GMPAS-NYF-DISMF 2000_DATM%NYF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%NYFAIS45_SGLC_SWAV @@ -103,8 +98,8 @@ - GMPAS-JRA1p5-DSGR - 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%DATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV + GMPAS-JRA1p5-DIB-PISMF-DSGR-TMIX + 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDDSGRTMIX_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV @@ -117,11 +112,6 @@ 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBPISMFDATMFORCEDTMIX_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV - - GMPAS-JRA1p5-DIB-DISMF-DSGR - 2000_DATM%JRA-1p5_SLND_MPASSI%DIB_MPASO%IBDISMFDATMFORCEDDSGR_DROF%JRA-1p5-AIS0ROF_SGLC_SWAV - - GMPAS-JRA1p4 2000_DATM%JRA-1p4-2018_SLND_MPASSI_MPASO%DATMFORCED_DROF%JRA-1p4-2018_SGLC_SWAV @@ -157,11 +147,6 @@ 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV - - GMPAS-IAF-PISMF-DSGR - 2000_DATM%IAF_SLND_MPASSI_MPASO%PISMFDATMFORCEDDSGR_DROF%IAFAIS45_SGLC_SWAV - - GMPAS-IAF-DISMF 2000_DATM%IAF_SLND_MPASSI_MPASO%DISMFDATMFORCED_DROF%IAFAIS45_SGLC_SWAV From fe4380c621bd7c5ea21c6fe15337c56ed9572c0a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 10 Jul 2024 16:25:01 -0600 Subject: [PATCH 45/73] fix typo in dsgr filename --- components/mpas-ocean/cime_config/buildnml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 6ac2b043aaf3..192fd70bc6ae 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc.nc' + data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' From 8f147f9101c196801cfcb0663cce9df37cee0043 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 10:44:22 -0600 Subject: [PATCH 46/73] fix omp and acc added loops --- .../src/shared/mpas_ocn_diagnostics.F | 17 ++++++++++--- .../shared/mpas_ocn_surface_bulk_forcing.F | 22 +++++++++++++---- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 24 +++++++++++++++++-- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index daf9bfcab6d5..7dc43284a755 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1893,8 +1893,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & #ifdef MPAS_OPENACC !$acc parallel loop & !$acc present(surfaceFluxAttenuationCoefficient, & - !$acc surfaceFluxAttenuationCoefficientRunoff, & - !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff) + !$acc surfaceFluxAttenuationCoefficientRunoff) #else !$omp parallel !$omp do schedule(runtime) @@ -1905,16 +1904,28 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & surfaceFluxAttenuationCoefficientRunoff(iCell) = & config_flux_attenuation_coefficient_runoff end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc parallel loop & + !$acc present(surfaceFluxAttenuationCoefficientSubglacialRunoff) +#else + !$omp parallel + !$omp do schedule(runtime) +#endif do iCell = 1, nCells surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & config_flux_attenuation_coefficient_subglacial_runoff end do - end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif + end if !-------------------------------------------------------------------- diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 0547f73319dd..4375ae8f9eaf 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -336,13 +336,13 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur ! Build surface fluxes at cell centers #ifdef MPAS_OPENACC !$acc enter data copyin(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & - !$acc riverRunoffFlux, subglacialRunoffFlux, iceRunoffFlux, rainFlux) + !$acc riverRunoffFlux, iceRunoffFlux, rainFlux) !$acc parallel loop & !$acc present(surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff, evaporationFlux, snowFlux, & + !$acc evaporationFlux, snowFlux, & !$acc seaIceFreshWaterFlux, icebergFreshWaterFlux, riverRunoffFlux, & - !$acc subglacialRunoffFlux, iceRunoffFlux, rainFlux) + !$acc iceRunoffFlux, rainFlux) #else !$omp parallel !$omp do schedule(runtime) @@ -352,15 +352,29 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur + seaIceFreshWaterFlux(iCell) + icebergFreshWaterFlux(iCell) + iceRunoffFlux(iCell) ) / rho_sw surfaceThicknessFluxRunoff(iCell) = riverRunoffFlux(iCell) / rho_sw end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc enter data copyin(subglacialRunoffFlux) + + !$acc parallel loop & + !$acc present(surfaceThicknessFluxSubglacialRunoff, subglacialRunoffFlux, areaCell) +#else + !$omp parallel + !$omp do schedule(runtime) +#endif do iCell = 1, nCells surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) end do - end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif + end if #ifdef MPAS_OPENACC !$acc exit data delete(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 30584386666c..727b55f4e5b8 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -190,15 +190,29 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ tendThick(k, iCell) = 0.0_RKIND end do end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc enter data create(surfaceThicknessFluxSubglacialRunoff) + + !$acc parallel loop & + !$acc present(surfaceThicknessFluxSubglacialRunoff) +#else + !$omp parallel + !$omp do schedule(runtime) +#endif do iCell = 1, nCellsAll surfaceThicknessFluxSubglacialRunoff(iCell) = 0.0_RKIND end do - end if #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif + end if ! If turned off, return with zero fluxes, tendencies ! Otherwise, start time and call routines to accumulate @@ -847,14 +861,20 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & tracerGroupSurfaceFluxRunoff (n,iCell) = 0.0_RKIND tracerGroupSurfaceFluxRemoved(n,iCell) = 0.0_RKIND end do + end do + !$omp end do + !$omp end parallel + if (trim(config_subglacial_runoff_mode) == 'data') then + !$omp do schedule(runtime) private(n) + do iCell = 1, nCellsAll do n=1,nTracersGroup tracerGroupSurfaceFluxSubglacialRunoff (n,iCell) = 0.0_RKIND end do - end if end do !$omp end do !$omp end parallel + end if ! ! compute surface tracer flux from bulk forcing From 43c3190dd1f0ee672f5e7aba701a914fa452b323 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 11:14:30 -0600 Subject: [PATCH 47/73] fix omp in tendency --- components/mpas-ocean/src/shared/mpas_ocn_tendency.F | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index 727b55f4e5b8..c6d9e72f83a9 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -172,12 +172,10 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ ! initialize to zero and start accumulating tendency terms ! #ifdef MPAS_OPENACC - !$acc enter data create(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff) + !$acc enter data create(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff) !$acc parallel loop & - !$acc present(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff) & + !$acc present(tendThick, surfaceThicknessFlux, surfaceThicknessFluxRunoff) & !$acc private(k) #else !$omp parallel @@ -866,6 +864,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & !$omp end parallel if (trim(config_subglacial_runoff_mode) == 'data') then + !$omp parallel !$omp do schedule(runtime) private(n) do iCell = 1, nCellsAll do n=1,nTracersGroup From 89c14b8540fcf1916d92356738361f00fd010950 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 11:42:50 -0600 Subject: [PATCH 48/73] add sgr fail if bad string option --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 2 ++ components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 2 ++ 2 files changed, 4 insertions(+) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 7dc43284a755..3e7f432a415b 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3530,6 +3530,8 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & end if zTop = zBot end do + else + call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if else fracAbsorbedSubglacialRunoff = 0.0_RKIND diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index 5cfce4c4e690..afdacc6c942c 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -221,6 +221,8 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin transmissionCoeffTop = transmissionCoeffBot end do end do + else + call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if end if From 7491a836e534a13d4ef1d59ae98b6f36b4f92870 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 11 Jul 2024 12:12:34 -0600 Subject: [PATCH 49/73] add line --- components/mpas-ocean/src/Registry.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 79ef88b33181..01e96c635c1d 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3740,6 +3740,7 @@ description="Divergence of transmission through interfaces of surface fluxes below the surface layer at cell centers. These are applied only to subglacial runoff." packages="dataSubglacialRunoffFluxPKG" /> + Date: Fri, 12 Jul 2024 10:11:39 -0600 Subject: [PATCH 50/73] Update components/mpas-ocean/src/Registry.xml description Co-authored-by: Carolyn Begeman --- 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 01e96c635c1d..8dbd4870dc65 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -707,7 +707,7 @@ possible_values="'off', 'data'" /> Date: Tue, 16 Jul 2024 09:36:47 -0600 Subject: [PATCH 51/73] rename config_sgr_salinity to config_sgr_salinity_prescribed --- components/mpas-ocean/bld/build-namelist | 4 ++-- components/mpas-ocean/bld/build-namelist-section | 4 ++-- .../bld/namelist_files/namelist_defaults_mpaso.xml | 4 ++-- .../bld/namelist_files/namelist_definition_mpaso.xml | 4 ++-- components/mpas-ocean/src/Registry.xml | 8 ++++---- .../mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 2c5ee97b0df2..f891c5d089a8 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -713,8 +713,8 @@ add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); -add_default($nl, 'config_sgr_temperature'); -add_default($nl, 'config_sgr_salinity'); +add_default($nl, 'config_sgr_temperature_prescribed'); +add_default($nl, 'config_sgr_salinity_prescribed'); if ($OCN_SGR eq 'data') { add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); } else { diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 3f2d4ab4839d..9091c1e961c0 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -229,8 +229,8 @@ add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); add_default($nl, 'config_use_sgr_opt_temp'); add_default($nl, 'config_use_sgr_opt_salt'); -add_default($nl, 'config_sgr_temperature'); -add_default($nl, 'config_sgr_salinity'); +add_default($nl, 'config_sgr_temperature_prescribed'); +add_default($nl, 'config_sgr_salinity_prescribed'); add_default($nl, 'config_subglacial_runoff_mode'); ############################ 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 0514704b9514..4957f2ce60f9 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -347,8 +347,8 @@ 1 'sgr' 'sgr' -0.0 -0.0 +0.0 +0.0 '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 43ba139ab65f..725308006f53 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1228,7 +1228,7 @@ Valid values: 'sgr', 'prescribed'. Default: Defined in namelist_defaults.xml - Option to choose sgr temperature, applied when config_use_sgr_opt_temp = 'prescribed' @@ -1236,7 +1236,7 @@ Valid values: Any real number. Default: Defined in namelist_defaults.xml - Option to choose sgr salinity, applied when config_use_sgr_opt_temp = 'prescribed' diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 8dbd4870dc65..07afdb0f9af4 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -720,17 +720,17 @@ /> - - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 4375ae8f9eaf..1c7cba2f39cf 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -600,7 +600,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then !sgr with fixed prescribed temperature (for debugging only) tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature / areaCell(iCell) + config_sgr_temperature_prescribed / areaCell(iCell) else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & @@ -611,7 +611,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then !sgr with fixed prescribed temperature (for debugging only) tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity / areaCell(iCell) + config_sgr_salinity_prescribed / areaCell(iCell) else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND From 307b4d0e3f5abe341fada74494c86a4d2e1a232a Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 10:51:53 -0600 Subject: [PATCH 52/73] change config_use_sgr_opt_property from character to logical --- components/mpas-ocean/bld/build-namelist | 4 ++-- components/mpas-ocean/bld/build-namelist-section | 4 ++-- .../namelist_files/namelist_defaults_mpaso.xml | 4 ++-- .../namelist_files/namelist_definition_mpaso.xml | 16 ++++++++-------- components/mpas-ocean/src/Registry.xml | 16 ++++++++-------- .../src/shared/mpas_ocn_surface_bulk_forcing.F | 12 ++++++------ 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index f891c5d089a8..490100040c00 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -711,8 +711,8 @@ add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); -add_default($nl, 'config_use_sgr_opt_temp'); -add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_use_sgr_opt_temp_prescribed'); +add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); if ($OCN_SGR eq 'data') { diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 9091c1e961c0..189d32fc7b52 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -227,8 +227,8 @@ add_default($nl, 'config_flux_attenuation_coefficient_runoff'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); -add_default($nl, 'config_use_sgr_opt_temp'); -add_default($nl, 'config_use_sgr_opt_salt'); +add_default($nl, 'config_use_sgr_opt_temp_prescribed'); +add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); add_default($nl, 'config_subglacial_runoff_mode'); 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 4957f2ce60f9..3147d1cc92d4 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -345,8 +345,8 @@ 0.001 'uniform' 1 -'sgr' -'sgr' +.false. +.false. 0.0 0.0 '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 725308006f53..803b280a1241 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1212,25 +1212,25 @@ Valid values: 0 - don't use, 1 - use Default: Defined in namelist_defaults.xml - -Option to choose sgr temperature +If true, subglacial runoff temperature is set to config_sgr_temperature_prescribed. If false, the temperature is set to local freezing point. -Valid values: 'sgr', 'prescribed'. +Valid values: .true. or .false. Default: Defined in namelist_defaults.xml - -Option to choose sgr salinity +If true, subglacial runoff salinity is set to config_sgr_salinity_prescribed. If false, the salinity is set to 0 PSU. -Valid values: 'sgr', 'prescribed'. +Valid values: .true. or .false. Default: Defined in namelist_defaults.xml -Option to choose sgr temperature, applied when config_use_sgr_opt_temp = 'prescribed' +Prescribed subglacial runoff temperature value, applied when config_use_sgr_opt_temp_prescribed = .true. Valid values: Any real number. Default: Defined in namelist_defaults.xml @@ -1238,7 +1238,7 @@ Default: Defined in namelist_defaults.xml -Option to choose sgr salinity, applied when config_use_sgr_opt_temp = 'prescribed' +Prescribed subglacial runoff salinity value, applied when config_use_sgr_opt_salt_prescribed = .true. Valid values: Any real number. Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 07afdb0f9af4..3fdfd58ca61d 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -718,20 +718,20 @@ description="option to use or not subglacial runoff (sgr) in kpp calculation" possible_values="0 - don't use, 1 - use" /> - - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 1c7cba2f39cf..ce019053fc7c 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -597,22 +597,22 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw if (trim(config_subglacial_runoff_mode) == 'data') then - if ( trim(config_use_sgr_opt_temp) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) + if ( config_use_sgr_opt_temp_prescribed ) then + !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & config_sgr_temperature_prescribed / areaCell(iCell) - else if ( trim(config_use_sgr_opt_temp) == 'sgr' ) then + else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & inLandIceCavity=.true.) / areaCell(iCell) end if - if ( trim(config_use_sgr_opt_salt) == 'prescribed' ) then - !sgr with fixed prescribed temperature (for debugging only) + if ( config_use_sgr_opt_salt_prescribed ) then + !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & config_sgr_salinity_prescribed / areaCell(iCell) - else if ( trim(config_use_sgr_opt_salt) == 'sgr' ) then + else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND end if From f6cbc38e7ef811504d6b90bd45d813d00659aea6 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 11:01:42 -0600 Subject: [PATCH 53/73] change config_use_sgr_opt_kpp to logical variable --- .../bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- .../bld/namelist_files/namelist_definition_mpaso.xml | 6 +++--- components/mpas-ocean/src/Registry.xml | 10 +++++----- .../mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 2 +- 4 files changed, 10 insertions(+), 10 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 3147d1cc92d4..dce88f0127e3 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -344,7 +344,7 @@ 10.0 0.001 'uniform' -1 +.true. .false. .false. 0.0 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 803b280a1241..fed7828e6a8b 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1204,11 +1204,11 @@ Valid values: 'top','uniform', 'bottom'. Default: Defined in namelist_defaults.xml - -Option to use or not subglacial runoff (sgr) in kpp calculation. +If true, include subglacial runoff (sgr) contribution in kpp calculation. -Valid values: 0 - don't use, 1 - use +Valid values: .true. or .false. Default: Defined in namelist_defaults.xml diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 3fdfd58ca61d..3e339aefe1a3 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -714,16 +714,16 @@ description="Selects the vertical location where subglacial runoff is fluxed." possible_values="'top','uniform', 'bottom'" /> - Date: Tue, 16 Jul 2024 11:18:15 -0600 Subject: [PATCH 54/73] Move checking for valid string in config_sgr_flux_vertical_location to an init routine --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 9 +++++++-- components/mpas-ocean/src/shared/mpas_ocn_forcing.F | 2 -- 2 files changed, 7 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 368e4e9a50da..a6539f520f1b 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -3530,8 +3530,6 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, & end if zTop = zBot end do - else - call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if else fracAbsorbedSubglacialRunoff = 0.0_RKIND @@ -4695,6 +4693,13 @@ subroutine ocn_diagnostics_init(domain, err)!{{{ call ocn_diagnostics_variables_init(domain, jenkinsOn, & hollandJenkinsOn, err) + if ( trim(config_sgr_flux_vertical_location) == 'top' ) then + else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then + else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then + else + call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) + end if + end subroutine ocn_diagnostics_init!}}} !*********************************************************************** diff --git a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F index afdacc6c942c..5cfce4c4e690 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_forcing.F @@ -221,8 +221,6 @@ subroutine ocn_forcing_build_fraction_absorbed_array(meshPool, statePool, forcin transmissionCoeffTop = transmissionCoeffBot end do end do - else - call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if end if From c1616ddef28349131adedd98741dccc2a19d1b0f Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 11:31:26 -0600 Subject: [PATCH 55/73] set config_sgr_flux_vertical_location to bottom in namelist_defaults_mpaso.xml for consistency with Registry --- .../mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml | 2 +- 1 file changed, 1 insertion(+), 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 dce88f0127e3..c57920e5c388 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -343,7 +343,7 @@ 0.001 10.0 0.001 -'uniform' +'bottom' .true. .false. .false. From b45249581205070d1f39e2400cc574907a4ab6d8 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 16 Jul 2024 12:35:25 -0600 Subject: [PATCH 56/73] Change subglacialRunoffFlux into mass flux from volume flux for consistency with riverRunoffFlux and reference density, update DSGR files --- components/mpas-ocean/cime_config/buildnml | 8 ++++---- components/mpas-ocean/src/Registry.xml | 2 +- .../src/shared/mpas_ocn_surface_bulk_forcing.F | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index 192fd70bc6ae..f3eb22881683 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -143,7 +143,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.oQU240wLI.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.oQU240wLI.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.oQU240wLI.20240328.nc' elif ocn_grid == 'oQU120': decomp_date = '230424' @@ -282,7 +282,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.SOwISC12to60E2r4.20210114.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.SOwISC12to60E2r4.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.SOwISC12to60E2r4.20240328.nc' elif ocn_grid == 'FRISwISC08to60E3r1': decomp_date = '20230913' # changed to date of partiotions in ../files_for_e3sm/assembled_files/inputdata/ocn/mpas-o/FRISwISC08to60E3r1/partitions @@ -359,7 +359,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.ECwISC30to60E2r1.20240221.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.ECwISC30to60E2r1.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.ECwISC30to60E2r1.20240328.nc' elif ocn_grid == 'IcoswISC30E3r5': decomp_date = '20231120' @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.MALI.out2055.IcoswISC30E3r5.20240328.nc' + data_sgr_file = 'DSGR.massFlux.massFlux.MALI.out2055.IcoswISC30E3r5.20240328.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' diff --git a/components/mpas-ocean/src/Registry.xml b/components/mpas-ocean/src/Registry.xml index 3e339aefe1a3..bf02edf96b51 100644 --- a/components/mpas-ocean/src/Registry.xml +++ b/components/mpas-ocean/src/Registry.xml @@ -3807,7 +3807,7 @@ description="Fresh water flux from river runoff at cell centers from coupler. Positive into the ocean." packages="thicknessBulkPKG" /> - diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index ce019053fc7c..2cf79881a7f8 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -362,13 +362,13 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur !$acc enter data copyin(subglacialRunoffFlux) !$acc parallel loop & - !$acc present(surfaceThicknessFluxSubglacialRunoff, subglacialRunoffFlux, areaCell) + !$acc present(surfaceThicknessFluxSubglacialRunoff, subglacialRunoffFlux) #else !$omp parallel !$omp do schedule(runtime) #endif do iCell = 1, nCells - surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / areaCell(iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) = subglacialRunoffFlux(iCell) / rho_sw end do #ifndef MPAS_OPENACC !$omp end do @@ -600,18 +600,18 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer if ( config_use_sgr_opt_temp_prescribed ) then !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature_prescribed / areaCell(iCell) + config_sgr_temperature_prescribed / rho_sw else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / areaCell(iCell) + inLandIceCavity=.true.) / rho_sw end if if ( config_use_sgr_opt_salt_prescribed ) then !sgr with fixed prescribed temperature tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity_prescribed / areaCell(iCell) + config_sgr_salinity_prescribed / rho_sw else !sgr with temperature equal to the local freezing point of freshwater tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND From 3b0dca4de256cc4c14c0b907a8371e7074d6aa48 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 17 Jul 2024 10:53:17 -0600 Subject: [PATCH 57/73] introduce separate subroutine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff --- .../src/shared/mpas_ocn_diagnostics.F | 88 ++++++++++++++----- 1 file changed, 68 insertions(+), 20 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index a6539f520f1b..82fe1d9a950d 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -452,13 +452,16 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe ! ! inputs: layerThickness, activeTracers, layerThicknessEdgeFlux, normalVelocity ! outputs: tracersSurfaceLayerValue, indexSurfaceLayerDepth, normalVelocitySurfaceLayer, - ! surfaceFluxAttenuationCoefficient, surfaceFluxAttenuationCoefficientRunoff, - ! surfaceFluxAttenuationCoefficientSubglacialRunoff + ! surfaceFluxAttenuationCoefficient, surfaceFluxAttenuationCoefficientRunoff call ocn_diagnostic_solve_surfaceLayer(layerThickness, activeTracers, & layerThickEdgeFlux, normalVelocity, tracersSurfaceLayerValue, & indexSurfaceLayerDepth, normalVelocitySurfaceLayer, & - sfcFlxAttCoeff, surfaceFluxAttenuationCoefficientRunoff, & - surfaceFluxAttenuationCoefficientSubglacialRunoff) + sfcFlxAttCoeff, surfaceFluxAttenuationCoefficientRunoff) + + if (trim(config_subglacial_runoff_mode) == 'data') then + ! outputs: surfaceFluxAttenuationCoefficientSubglacialRunoff + call ocn_diagnostic_solve_surfaceLayer_subglacialRunoff(surfaceFluxAttenuationCoefficientSubglacialRunoff) + end if end if ! full_compute @@ -565,8 +568,11 @@ subroutine ocn_diagnostic_solve(dt, statePool, forcingPool, meshPool, verticalMe ! !$acc indexSurfaceLayerDepth, & ! !$acc normalVelocitySurfaceLayer, & ! !$acc sfcFlxAttCoeff, & -! !$acc surfaceFluxAttenuationCoefficientRunoff, & -! !$acc surfaceFluxAttenuationCoefficientSubglacialRunoff) +! !$acc surfaceFluxAttenuationCoefficientRunoff) +! if (trim(config_subglacial_runoff_mode) == 'data') then +! !$acc update host(surfaceFluxAttenuationCoefficientSubglacialRunoff) +! end if + ! end if ! full_compute ! !$acc exit data delete (atmosphericPressure, seaIcePressure) @@ -1701,9 +1707,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & activeTracers, layerThicknessEdgeFlux, normalVelocity, & tracersSurfaceLayerValue, indexSurfaceLayerDepth, & normalVelocitySurfaceLayer, & - surfaceFluxAttenuationCoefficient, & - surfaceFluxAttenuationCoefficientRunoff, & - surfaceFluxAttenuationCoefficientSubglacialRunoff)!{{{ + surfaceFluxAttenuationCoefficient)!{{{ !----------------------------------------------------------------- ! input variables @@ -1728,8 +1732,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & indexSurfaceLayerDepth, &!< [out] layer index at sfc lyr depth normalVelocitySurfaceLayer, &!< [out] avg velocity over sfc layer surfaceFluxAttenuationCoefficient, &!< [out] sfc flx attenuation - surfaceFluxAttenuationCoefficientRunoff, &!< [out] sfc flx attenuation - surfaceFluxAttenuationCoefficientSubglacialRunoff !< [out] sfc flx attenuation + surfaceFluxAttenuationCoefficientRunoff &!< [out] sfc flx attenuation !----------------------------------------------------------------- ! local variables @@ -1909,27 +1912,72 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & !$omp end parallel #endif - if (trim(config_subglacial_runoff_mode) == 'data') then + !-------------------------------------------------------------------- + + end subroutine ocn_diagnostic_solve_surfaceLayer !}}} + +!*********************************************************************** +! +! routine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff +! +!> \brief Computes diagnostic subglacialRunoff variables for surface layer +!> \author Irena Vankova +!> \date July 2024 +!> \details +! +!----------------------------------------------------------------------- + + subroutine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff(surfaceFluxAttenuationCoefficientSubglacialRunoff)!{{{ + + !----------------------------------------------------------------- + ! input variables + !----------------------------------------------------------------- + + !----------------------------------------------------------------- + ! output variables + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:), intent(out) :: & + surfaceFluxAttenuationCoefficientSubglacialRunoff !< [out] sfc flx attenuation + + !----------------------------------------------------------------- + ! local variables + !----------------------------------------------------------------- + + integer :: & + nCells, &! num of cells + iCell ! loop indices for cell + + ! End preamble + !----------------------------------------------------------------- + ! Begin code + + ! compute the attenuation coefficient for subglacial runoff surface fluxes + + nCells = nCellsHalo( 1 ) + #ifdef MPAS_OPENACC - !$acc parallel loop & - !$acc present(surfaceFluxAttenuationCoefficientSubglacialRunoff) + !$acc parallel loop & + !$acc present(surfaceFluxAttenuationCoefficientSubglacialRunoff) #else - !$omp parallel - !$omp do schedule(runtime) + !$omp parallel + !$omp do schedule(runtime) #endif - do iCell = 1, nCells + do iCell = 1, nCells surfaceFluxAttenuationCoefficientSubglacialRunoff(iCell) = & config_flux_attenuation_coefficient_subglacial_runoff - end do + end do #ifndef MPAS_OPENACC !$omp end do !$omp end parallel #endif - end if !-------------------------------------------------------------------- - end subroutine ocn_diagnostic_solve_surfaceLayer !}}} + end subroutine ocn_diagnostic_solve_surfaceLayer_subglacialRunoff !}}} + +!*********************************************************************** + !*********************************************************************** ! From 7fa3a50ebc4d682f52d125ac85874da692665676 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 17 Jul 2024 11:14:07 -0600 Subject: [PATCH 58/73] correct extra delete --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index 82fe1d9a950d..f50d6bb697a3 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1707,7 +1707,8 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & activeTracers, layerThicknessEdgeFlux, normalVelocity, & tracersSurfaceLayerValue, indexSurfaceLayerDepth, & normalVelocitySurfaceLayer, & - surfaceFluxAttenuationCoefficient)!{{{ + surfaceFluxAttenuationCoefficient, & + surfaceFluxAttenuationCoefficientRunoff)!{{{ !----------------------------------------------------------------- ! input variables From 579e3dd8eab64098afb47109bd6175302eba3fc0 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Wed, 17 Jul 2024 13:59:02 -0600 Subject: [PATCH 59/73] remove & --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F index f50d6bb697a3..5046e19d5d59 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -1733,7 +1733,7 @@ subroutine ocn_diagnostic_solve_surfaceLayer(layerThickness, & indexSurfaceLayerDepth, &!< [out] layer index at sfc lyr depth normalVelocitySurfaceLayer, &!< [out] avg velocity over sfc layer surfaceFluxAttenuationCoefficient, &!< [out] sfc flx attenuation - surfaceFluxAttenuationCoefficientRunoff &!< [out] sfc flx attenuation + surfaceFluxAttenuationCoefficientRunoff !< [out] sfc flx attenuation !----------------------------------------------------------------- ! local variables From f78062d1a993acd389681c7f4445e45cc258f4bf Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 17:56:52 -0600 Subject: [PATCH 60/73] make separate subroutines whenever subglacial needs to be in subroutine argument --- .../shared/mpas_ocn_surface_bulk_forcing.F | 79 ++++++++-- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 20 ++- .../src/shared/mpas_ocn_thick_surface_flux.F | 139 ++++++++++++++---- .../mpas_ocn_tracer_surface_flux_to_tend.F | 116 ++++++++++++--- 4 files changed, 291 insertions(+), 63 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 2cf79881a7f8..168f8c31e279 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -49,7 +49,8 @@ module ocn_surface_bulk_forcing public :: ocn_surface_bulk_forcing_tracers, & ocn_surface_bulk_forcing_vel, & ocn_surface_bulk_forcing_thick, & - ocn_surface_bulk_forcing_init + ocn_surface_bulk_forcing_init, & + ocn_surface_bulk_forcing_thick_subglacial_runoff !-------------------------------------------------------------------- ! @@ -281,7 +282,7 @@ end subroutine ocn_surface_bulk_forcing_vel!}}} ! !----------------------------------------------------------------------- - subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, surfaceThicknessFluxRunoff, surfaceThicknessFluxSubglacialRunoff, err)!{{{ + subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, surfaceThicknessFluxRunoff, err)!{{{ !----------------------------------------------------------------- ! @@ -292,8 +293,6 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur real (kind=RKIND), dimension(:), intent(inout) :: surfaceThicknessFlux !< Input/Output: Array for surface thickness flux real (kind=RKIND), dimension(:), intent(inout) :: & surfaceThicknessFluxRunoff !< Input/Output: Array for surface thickness flux due to river runoff - real (kind=RKIND), dimension(:), intent(inout) :: & - surfaceThicknessFluxSubglacialRunoff !< Input/Output: Array for surface thickness flux due to subglacial runoff !----------------------------------------------------------------- ! @@ -313,7 +312,6 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur real (kind=RKIND), dimension(:), pointer :: evaporationFlux, snowFlux real (kind=RKIND), dimension(:), pointer :: seaIceFreshWaterFlux, icebergFreshWaterFlux, riverRunoffFlux, iceRunoffFlux - real (kind=RKIND), dimension(:), pointer :: subglacialRunoffFlux real (kind=RKIND), dimension(:), pointer :: rainFlux err = 0 @@ -327,7 +325,6 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur call mpas_pool_get_array(forcingPool, 'seaIceFreshWaterFlux', seaIceFreshWaterFlux) call mpas_pool_get_array(forcingPool, 'icebergFreshWaterFlux', icebergFreshWaterFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'rainFlux', rainFlux) @@ -357,7 +354,68 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur !$omp end parallel #endif - if (trim(config_subglacial_runoff_mode) == 'data') then +#ifdef MPAS_OPENACC + !$acc exit data delete(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & + !$acc riverRunoffFlux, iceRunoffFlux, rainFlux) +#endif + + call mpas_timer_stop("bulk_thick") + + end subroutine ocn_surface_bulk_forcing_thick!}}} + +!*********************************************************************** +! +! routine ocn_surface_bulk_forcing_thick_subglacial_runoff +! +!> \brief Determines the thickness forcing array used for the bulk forcing. +!> \author Doug Jacobsen +!> \date 04/25/12 +!> \details +!> This routine computes the thickness forcing arrays used later in MPAS. +! +!----------------------------------------------------------------------- + + subroutine ocn_surface_bulk_forcing_thick_subglacial_runoff(forcingPool, surfaceThicknessFluxSubglacialRunoff, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information + real (kind=RKIND), dimension(:), intent(inout) :: & + surfaceThicknessFluxSubglacialRunoff !< Input/Output: Array for surface thickness flux due to subglacial runoff + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: Error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, nCells + + real (kind=RKIND), dimension(:), pointer :: subglacialRunoffFlux + + err = 0 + + if (bulkThicknessFluxOff) return + + call mpas_timer_start("bulk_thick", .false.) + + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) + + nCells = nCellsHalo( 2 ) + + ! Build surface fluxes at cell centers + #ifdef MPAS_OPENACC !$acc enter data copyin(subglacialRunoffFlux) @@ -374,16 +432,15 @@ subroutine ocn_surface_bulk_forcing_thick(forcingPool, surfaceThicknessFlux, sur !$omp end do !$omp end parallel #endif - end if #ifdef MPAS_OPENACC - !$acc exit data delete(evaporationFlux, snowFlux, seaIceFreshWaterFlux, icebergFreshWaterFlux, & - !$acc riverRunoffFlux, subglacialRunoffFlux, iceRunoffFlux, rainFlux) + !$acc exit data delete(subglacialRunoffFlux) #endif call mpas_timer_stop("bulk_thick") - end subroutine ocn_surface_bulk_forcing_thick!}}} + end subroutine ocn_surface_bulk_forcing_thick_subglacial_runoff!}}} + !*********************************************************************** ! diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index c6d9e72f83a9..e3f47d1316b0 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -220,8 +220,12 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ ! Compute surface mass flux array from bulk forcing call ocn_surface_bulk_forcing_thick(forcingPool, & surfaceThicknessFlux, & - surfaceThicknessFluxRunoff, & + surfaceThicknessFluxRunoff, err) + + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_surface_bulk_forcing_thick_subglacial_runoff(forcingPool, & surfaceThicknessFluxSubglacialRunoff, err) + end if ! Compute surface thickness flux from land ice call ocn_surface_land_ice_fluxes_thick(forcingPool, & @@ -242,11 +246,14 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ ! Compute surface flux tendency call ocn_thick_surface_flux_tend(fractionAbsorbed, & fractionAbsorbedRunoff, & - fractionAbsorbedSubglacialRunoff, & surfaceThicknessFlux, & surfaceThicknessFluxRunoff, & + tendThick, err) + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_thick_surface_flux_tend(fractionAbsorbedSubglacialRunoff, & surfaceThicknessFluxSubglacialRunoff, & tendThick, err) + end if ! Compute contribution from frazil ice formation call ocn_frazil_forcing_layer_thickness(forcingPool, & @@ -1244,10 +1251,15 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & endif ! compute budgets call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, & - fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & + fractionAbsorbedRunoff, & layerThickness, tracerGroupSurfaceFlux, & - tracerGroupSurfaceFluxRunoff, tracerGroupSurfaceFluxSubglacialRunoff, & + tracerGroupSurfaceFluxRunoff, & + tracerGroupTend, err) + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbedSubglacialRunoff, & + layerThickness, tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupTend, err) + end if ! ! Compute shortwave absorption diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index eb531a999582..8e389a74ba37 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -46,7 +46,8 @@ module ocn_thick_surface_flux !-------------------------------------------------------------------- public :: ocn_thick_surface_flux_tend, & - ocn_thick_surface_flux_init + ocn_thick_surface_flux_init, & + ocn_thick_surface_flux_tend_subglacial_runoff !-------------------------------------------------------------------- ! @@ -74,8 +75,7 @@ module ocn_thick_surface_flux !----------------------------------------------------------------------- subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoefficientsRunoff, & - transmissionCoefficientsSubglacialRunoff, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - surfaceThicknessFluxSubglacialRunoff, tend, err)!{{{ + surfaceThicknessFlux, surfaceThicknessFluxRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -84,13 +84,11 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe real (kind=RKIND), dimension(:,:), intent(in) :: & transmissionCoefficients, &!< Input: Coefficients for the transmission of surface fluxes - transmissionCoefficientsRunoff, &!< Input: Coefficients for the transmission of surface fluxes due to river runoff - transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to subglacial runoff + transmissionCoefficientsRunoff !< Input: Coefficients for the transmission of surface fluxes due to river runoff real (kind=RKIND), dimension(:), intent(in) :: & - surfaceThicknessFlux, &!< Input: surface flux of thickness - surfaceThicknessFluxRunoff, &!< Input: surface flux of thickness due to river runoff - surfaceThicknessFluxSubglacialRunoff !< Input: surface flux of thickness due to subglacial runoff + surfaceThicknessFlux, &!< Input: surface flux of thickness + surfaceThicknessFluxRunoff !< Input: surface flux of thickness due to river runoff !----------------------------------------------------------------- @@ -118,7 +116,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe integer :: iCell, k - real (kind=RKIND) :: remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff + real (kind=RKIND) :: remainingFlux, remainingFluxRunoff err = 0 @@ -127,32 +125,24 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe call mpas_timer_start("thick surface flux") #ifdef MPAS_OPENACC - !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) + !$acc enter data copyin(transmissionCoefficients, transmissionCoefficientsRunoff) !$acc parallel loop & !$acc present(tend, surfaceThicknessFlux, surfaceThicknessFluxRunoff, & - !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & !$acc transmissionCoefficients, transmissionCoefficientsRunoff, minLevelCell, maxLevelCell) & - !$acc private(k, remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff) + !$acc private(k, remainingFlux, remainingFluxRunoff) #else !$omp parallel - !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff, k) + !$omp do schedule(runtime) private(remainingFlux, remainingFluxRunoff, k) #endif do iCell = 1, nCellsOwned remainingFlux = 1.0_RKIND remainingFluxRunoff = 1.0_RKIND - if (trim(config_subglacial_runoff_mode) == 'data') then - remainingFluxSubglacialRunoff = 1.0_RKIND - end if do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - transmissionCoefficients(k, iCell) remainingFluxRunoff = remainingFluxRunoff - transmissionCoefficientsRunoff(k, iCell) tend(k, iCell) = tend(k, iCell) + surfaceThicknessFlux(iCell) * transmissionCoefficients(k, iCell) & + surfaceThicknessFluxRunoff(iCell) * transmissionCoefficientsRunoff(k, iCell) - if (trim(config_subglacial_runoff_mode) == 'data') then - remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) - tend(k, iCell) = tend(k, iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) - end if end do if(maxLevelCell(iCell) > 0 .and. remainingFlux > 0.0_RKIND) then @@ -164,12 +154,6 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe + remainingFluxRunoff * surfaceThicknessFluxRunoff(iCell) end if - if (trim(config_subglacial_runoff_mode) == 'data') then - if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then - tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & - + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) - end if - end if end do #ifndef MPAS_OPENACC !$omp end do @@ -177,7 +161,7 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe #endif #ifdef MPAS_OPENACC - !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff, transmissionCoefficientsSubglacialRunoff) + !$acc exit data delete(transmissionCoefficients, transmissionCoefficientsRunoff) #endif call mpas_timer_stop("thick surface flux") @@ -186,6 +170,107 @@ subroutine ocn_thick_surface_flux_tend(transmissionCoefficients, transmissionCoe end subroutine ocn_thick_surface_flux_tend!}}} +!*********************************************************************** +! +! routine ocn_thick_surface_flux_tend_subglacial_runoff +! +!> \brief Computes tendency term from horizontal advection of thickness +!> \author Doug Jacobsen +!> \date 15 September 2011 +!> \details +!> This routine computes the horizontal advection tendency for +!> thickness based on current state and user choices of forcings. +! +!----------------------------------------------------------------------- + + subroutine ocn_thick_surface_flux_tend_subglacial_runoff(transmissionCoefficientsSubglacialRunoff, & + surfaceThicknessFluxSubglacialRunoff, tend, err)!{{{ + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:,:), intent(in) :: & + transmissionCoefficientsSubglacialRunoff !< Input: Coefficients for the transmission of surface fluxes due to subglacial runoff + + real (kind=RKIND), dimension(:), intent(in) :: & + surfaceThicknessFluxSubglacialRunoff !< Input: surface flux of thickness due to subglacial runoff + + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:,:), intent(inout) :: & + tend !< Input/Output: thickness tendency + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, k + + real (kind=RKIND) :: remainingFlux, remainingFluxRunoff, remainingFluxSubglacialRunoff + + err = 0 + + if (.not. surfaceThicknessFluxOn) return + + call mpas_timer_start("thick surface flux") + +#ifdef MPAS_OPENACC + !$acc enter data copyin(transmissionCoefficientsSubglacialRunoff) + + !$acc parallel loop & + !$acc present(tend, & + !$acc surfaceThicknessFluxSubglacialRunoff, transmissionCoefficientsSubglacialRunoff, & + !$acc minLevelCell, maxLevelCell) & + !$acc private(k, remainingFluxSubglacialRunoff) +#else + !$omp parallel + !$omp do schedule(runtime) private(remainingFluxSubglacialRunoff, k) +#endif + do iCell = 1, nCellsOwned + remainingFluxSubglacialRunoff = 1.0_RKIND + do k = minLevelCell(iCell), maxLevelCell(iCell) + remainingFluxSubglacialRunoff = remainingFluxSubglacialRunoff - transmissionCoefficientsSubglacialRunoff(k, iCell) + tend(k, iCell) = tend(k, iCell) + surfaceThicknessFluxSubglacialRunoff(iCell) * transmissionCoefficientsSubglacialRunoff(k, iCell) + end do + + if(maxLevelCell(iCell) > 0 .and. remainingFluxSubglacialRunoff > 0.0_RKIND) then + tend(maxLevelCell(iCell), iCell) = tend(maxLevelCell(iCell), iCell) & + + remainingFluxSubglacialRunoff * surfaceThicknessFluxSubglacialRunoff(iCell) + end if + + end do +#ifndef MPAS_OPENACC + !$omp end do + !$omp end parallel +#endif + +#ifdef MPAS_OPENACC + !$acc exit data delete(transmissionCoefficientsSubglacialRunoff) +#endif + + call mpas_timer_stop("thick surface flux") + + !-------------------------------------------------------------------- + + end subroutine ocn_thick_surface_flux_tend_subglacial_runoff!}}} + !*********************************************************************** ! ! routine ocn_thick_surface_flux_init diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 4a1dc5fce098..fd754562a579 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -45,7 +45,8 @@ module ocn_tracer_surface_flux_to_tend !-------------------------------------------------------------------- public :: ocn_tracer_surface_flux_tend, & - ocn_tracer_surface_flux_init + ocn_tracer_surface_flux_init, & + ocn_tracer_surface_flux_tend_subglacial_runoff !-------------------------------------------------------------------- ! @@ -71,8 +72,8 @@ module ocn_tracer_surface_flux_to_tend ! !----------------------------------------------------------------------- - subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, fractionAbsorbedSubglacialRunoff, & - layerThickness, surfaceTracerFlux, surfaceTracerFluxRunoff, surfaceTracerFluxSubglacialRunoff, tend, err)!{{{ + subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbsorbedRunoff, & + layerThickness, surfaceTracerFlux, surfaceTracerFluxRunoff, tend, err)!{{{ !----------------------------------------------------------------- ! ! input variables @@ -97,13 +98,6 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso real (kind=RKIND), dimension(:,:), intent(in) :: & fractionAbsorbedRunoff !< Input: Coefficients for the application of surface fluxes due to river runoff - real (kind=RKIND), dimension(:,:), intent(in), pointer :: & - surfaceTracerFluxSubglacialRunoff !< Input: surface tracer fluxes from subglacial runoff - - real (kind=RKIND), dimension(:,:), intent(in) :: & - fractionAbsorbedSubglacialRunoff !< Input: Coefficients for the application of surface fluxes due to subglacial runoff - - !----------------------------------------------------------------- ! ! input/output variables @@ -204,14 +198,96 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso call mpas_timer_stop("surface_tracer_runoff_flux") end if + !-------------------------------------------------------------------- + + end subroutine ocn_tracer_surface_flux_tend!}}} + + +!*********************************************************************** +! +! routine ocn_tracer_surface_flux_tend_subglacial_runoff +! +!> \brief Computes tendency term for surface fluxes +!> \author Doug Jacobsen +!> \date 12/17/12 +!> \details +!> This routine computes the tendency for tracers based on surface fluxes. +! +!----------------------------------------------------------------------- + + subroutine ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbsorbedSubglacialRunoff, & + layerThickness, surfaceTracerFluxSubglacialRunoff, tend, err)!{{{ + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + + type (mpas_pool_type), intent(in) :: & + meshPool !< Input: mesh information + + real (kind=RKIND), dimension(:,:), intent(in) :: & + layerThickness !< Input: Layer thickness + + real (kind=RKIND), dimension(:,:), intent(in), pointer :: & + surfaceTracerFluxSubglacialRunoff !< Input: surface tracer fluxes from subglacial runoff + + real (kind=RKIND), dimension(:,:), intent(in) :: & + fractionAbsorbedSubglacialRunoff !< Input: Coefficients for the application of surface fluxes due to subglacial runoff + + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + + real (kind=RKIND), dimension(:,:,:), intent(inout) :: & + tend !< Input/Output: velocity tendency + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, k, iTracer, nTracers, nCells + integer, pointer :: nVertLevels + integer, dimension(:), pointer :: nCellsArray + integer, dimension(:), pointer :: minLevelCell, maxLevelCell + + real (kind=RKIND) :: remainingFlux + + err = 0 + + if (.not. surfaceTracerFluxOn) return + + call mpas_timer_start("surface_tracer_flux") + + call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray) + call mpas_pool_get_dimension(meshPool, 'nVertLevels', nVertLevels) + nTracers = size(tend, dim=1) + + call mpas_pool_get_array(meshPool, 'minLevelCell', minLevelCell) + call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell) + + nCells = nCellsArray( 1 ) + ! now do subglacial runoff component - if (trim(config_subglacial_runoff_mode) == 'data') then - call mpas_timer_start("surface_tracer_subglacial_runoff_flux") + call mpas_timer_start("surface_tracer_subglacial_runoff_flux") - !$omp parallel - !$omp do schedule(runtime) private(remainingFlux, k, iTracer) - do iCell = 1, nCells + !$omp parallel + !$omp do schedule(runtime) private(remainingFlux, k, iTracer) + do iCell = 1, nCells remainingFlux = 1.0_RKIND do k = minLevelCell(iCell), maxLevelCell(iCell) remainingFlux = remainingFlux - fractionAbsorbedSubglacialRunoff(k, iCell) @@ -228,15 +304,13 @@ subroutine ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbed, fractionAbso + surfaceTracerFluxSubglacialRunoff(iTracer, iCell) * remainingFlux end do end if - end do - !$omp end do - !$omp end parallel + end do + !$omp end do + !$omp end parallel - call mpas_timer_stop("surface_tracer_subglacial_runoff_flux") - end if !-------------------------------------------------------------------- - end subroutine ocn_tracer_surface_flux_tend!}}} + end subroutine ocn_tracer_surface_flux_tend_subglacial_runoff!}}} !*********************************************************************** ! From 9ff4253ce41be1da822001d6cb7f3208e0a92260 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 18:53:48 -0600 Subject: [PATCH 61/73] fix function call typos --- components/mpas-ocean/src/shared/mpas_ocn_tendency.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index e3f47d1316b0..b855512fb294 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -250,7 +250,7 @@ subroutine ocn_tend_thick(tendPool, forcingPool)!{{{ surfaceThicknessFluxRunoff, & tendThick, err) if (trim(config_subglacial_runoff_mode) == 'data') then - call ocn_thick_surface_flux_tend(fractionAbsorbedSubglacialRunoff, & + call ocn_thick_surface_flux_tend_subglacial_runoff(fractionAbsorbedSubglacialRunoff, & surfaceThicknessFluxSubglacialRunoff, & tendThick, err) end if @@ -1256,7 +1256,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & tracerGroupSurfaceFluxRunoff, & tracerGroupTend, err) if (trim(config_subglacial_runoff_mode) == 'data') then - call ocn_tracer_surface_flux_tend(meshPool, fractionAbsorbedSubglacialRunoff, & + call ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbsorbedSubglacialRunoff, & layerThickness, tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupTend, err) end if From 476908cbf811143a1066833171c2b1c9f250f925 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 21:15:47 -0600 Subject: [PATCH 62/73] more new subrutines with _subglacial_runoff --- .../shared/mpas_ocn_surface_bulk_forcing.F | 218 +++++++++++++++--- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 6 +- 2 files changed, 187 insertions(+), 37 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 168f8c31e279..81732b637a97 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -50,8 +50,10 @@ module ocn_surface_bulk_forcing ocn_surface_bulk_forcing_vel, & ocn_surface_bulk_forcing_thick, & ocn_surface_bulk_forcing_init, & + ocn_surface_bulk_forcing_tracers_subglacial_runoff, & ocn_surface_bulk_forcing_thick_subglacial_runoff + !-------------------------------------------------------------------- ! ! Private module variables @@ -79,7 +81,7 @@ module ocn_surface_bulk_forcing !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, dt, layerThickness, err)!{{{ !----------------------------------------------------------------- ! @@ -99,8 +101,6 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux !< Input/Output: Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRunoff !< Input/Output: Surface flux for tracer group due to river runoff - real (kind=RKIND), dimension(:,:), intent(inout) :: & - tracersSurfaceFluxSubglacialRunoff !< Input/Output: Surface flux for tracer group due to subglacial runoff real (kind=RKIND), dimension(:,:), intent(inout) :: & tracersSurfaceFluxRemoved !< Input/Output: Accumulator for ignored Surface flux for tracer group real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -125,12 +125,69 @@ subroutine ocn_surface_bulk_forcing_tracers(meshPool, groupName, forcingPool, tr call mpas_timer_start("bulk_" // trim(groupName)) if ( trim(groupName) == 'activeTracers' ) then call ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err) end if call mpas_timer_stop("bulk_" // trim(groupName)) end subroutine ocn_surface_bulk_forcing_tracers!}}} +!*********************************************************************** +! +! routine ocn_surface_bulk_forcing_tracers_subglacial_runoff +! +!> \brief Determines the tracers forcing array used for the bulk forcing. +!> \author Doug Jacobsen +!> \date 04/25/12 +!> \details +!> This routine computes the tracers forcing arrays used later in MPAS. +! +!----------------------------------------------------------------------- + + subroutine ocn_surface_bulk_forcing_tracers_subglacial_runoff(meshPool, groupName, forcingPool, & + tracersSurfaceFluxSubglacialRunoff, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(in) :: meshPool !< Input: mesh information + character (len=*) :: groupName !< Input: Name of tracer group + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information + real (kind=RKIND), dimension(:,:), intent(inout) :: & + tracersSurfaceFluxSubglacialRunoff !< Input/Output: Surface flux for tracer group due to subglacial runoff + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: Error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + err = 0 + + call mpas_timer_start("bulk_" // trim(groupName)) + if ( trim(groupName) == 'activeTracers' ) then + call ocn_surface_bulk_forcing_active_tracers_subglacial_runoff(meshPool, forcingPool, & + tracersSurfaceFluxSubglacialRunoff, err) + end if + call mpas_timer_stop("bulk_" // trim(groupName)) + + end subroutine ocn_surface_bulk_forcing_tracers_subglacial_runoff!}}} + !*********************************************************************** ! ! routine ocn_surface_bulk_forcing_vel @@ -503,7 +560,7 @@ end subroutine ocn_surface_bulk_forcing_init!}}} !----------------------------------------------------------------------- subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracerGroup, & - tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxSubglacialRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ + tracersSurfaceFlux, tracersSurfaceFluxRunoff, tracersSurfaceFluxRemoved, layerThickness, dt, err)!{{{ !----------------------------------------------------------------- ! @@ -520,7 +577,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFlux real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRunoff - real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxSubglacialRunoff real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxRemoved real (kind=RKIND), dimension(:,:,:), intent(inout) :: tracerGroup real (kind=RKIND), dimension(:,:), intent(in) :: layerThickness @@ -548,7 +604,7 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer type(mpas_pool_type),pointer :: tracersSurfaceFluxPool real (kind=RKIND), dimension(:), pointer :: latentHeatFlux, sensibleHeatFlux, longWaveHeatFluxUp, longWaveHeatFluxDown, & - seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux, subglacialRunoffFlux + seaIceHeatFlux, icebergHeatFlux, evaporationFlux, riverRunoffFlux real (kind=RKIND), dimension(:), pointer :: seaIceFreshWaterFlux, icebergFreshWaterFlux, seaIceSalinityFlux, iceRunoffFlux real (kind=RKIND), dimension(:), pointer :: shortWaveHeatFlux, penetrativeTemperatureFlux real (kind=RKIND), dimension(:), pointer :: snowFlux, rainFlux @@ -589,7 +645,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer call mpas_pool_get_array(forcingPool, 'seaIceSalinityFlux', seaIceSalinityFlux) call mpas_pool_get_array(forcingPool, 'iceRunoffFlux', iceRunoffFlux) call mpas_pool_get_array(forcingPool, 'riverRunoffFlux', riverRunoffFlux) - call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) call mpas_pool_get_array(forcingPool, 'penetrativeTemperatureFlux', penetrativeTemperatureFlux) call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) @@ -653,28 +708,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer tracersSurfaceFluxRunoff(index_temperature_flux,iCell) = riverRunoffFlux(iCell) & * max(tracerGroup(index_temperature_flux,minLevelCell(iCell),iCell), 0.0_RKIND) / rho_sw - if (trim(config_subglacial_runoff_mode) == 'data') then - if ( config_use_sgr_opt_temp_prescribed ) then - !sgr with fixed prescribed temperature - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_temperature_prescribed / rho_sw - else - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & - ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & - inLandIceCavity=.true.) / rho_sw - end if - - if ( config_use_sgr_opt_salt_prescribed ) then - !sgr with fixed prescribed temperature - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & - config_sgr_salinity_prescribed / rho_sw - else - !sgr with temperature equal to the local freezing point of freshwater - tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND - end if - end if - ! Accumulate fluxes that use the freezing point ! mrp performance note: should call ocn_freezing_temperature just once here seaIceTemperatureFlux(iCell) = seaIceFreshWaterFlux(iCell) * & @@ -694,12 +727,6 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer totalFreshWaterTemperatureFlux(iCell) = surfaceTemperatureFluxWithoutRunoff & + tracersSurfaceFluxRunoff(index_temperature_flux,iCell) - ! add subglacial runoff contribution for sending through coupler - if (trim(config_subglacial_runoff_mode) == 'data') then - totalFreshWaterTemperatureFlux(iCell) = totalFreshWaterTemperatureFlux(iCell) & - + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) - end if - ! Fields with zero temperature are not accumulated. These include: ! snowFlux ! iceRunoffFlux @@ -720,6 +747,125 @@ subroutine ocn_surface_bulk_forcing_active_tracers(meshPool, forcingPool, tracer end subroutine ocn_surface_bulk_forcing_active_tracers!}}} +!*********************************************************************** +! +! routine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff +! +!> \brief Determines the active tracers forcing array used for the bulk forcing. +!> \author Doug Jacobsen +!> \date 04/25/12 +!> \details +!> This routine computes the active tracers forcing arrays used later in MPAS. +! +!----------------------------------------------------------------------- + + subroutine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff(meshPool, forcingPool, & + tracersSurfaceFluxSubglacialRunoff, err)!{{{ + + !----------------------------------------------------------------- + ! + ! input variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(in) :: meshPool !< Input: mesh information + + !----------------------------------------------------------------- + ! + ! input/output variables + ! + !----------------------------------------------------------------- + type (mpas_pool_type), intent(inout) :: forcingPool !< Input: Forcing information + real (kind=RKIND), dimension(:,:), intent(inout) :: tracersSurfaceFluxSubglacialRunoff + + !----------------------------------------------------------------- + ! + ! output variables + ! + !----------------------------------------------------------------- + + integer, intent(out) :: err !< Output: Error flag + + !----------------------------------------------------------------- + ! + ! local variables + ! + !----------------------------------------------------------------- + + integer :: iCell, nCells + integer, pointer :: index_temperature_fluxPtr, index_salinity_fluxPtr + integer :: index_temperature_flux, index_salinity_flux + integer, dimension(:), pointer :: nCellsArray + + type(mpas_pool_type),pointer :: tracersSurfaceFluxPool + + real (kind=RKIND), dimension(:), pointer :: subglacialRunoffFlux + real (kind=RKIND), dimension(:), pointer :: totalFreshWaterTemperatureFlux + real (kind=RKIND), dimension(:), pointer :: landIcePressure + + err = 0 + + call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray) + + call mpas_pool_get_subpool(forcingPool, 'tracersSurfaceFlux',tracersSurfaceFluxPool) + + call mpas_pool_get_dimension(tracersSurfaceFluxPool, & + 'index_temperatureSurfaceFlux', & + index_temperature_fluxPtr) + call mpas_pool_get_dimension(tracersSurfaceFluxPool, & + 'index_salinitySurfaceFlux', & + index_salinity_fluxPtr) + index_temperature_flux = index_temperature_fluxPtr + index_salinity_flux = index_salinity_fluxPtr + + call mpas_pool_get_array(forcingPool, 'subglacialRunoffFlux', subglacialRunoffFlux) + + call mpas_pool_get_array(forcingPool, 'landIcePressure', landIcePressure) + + call mpas_pool_get_array(forcingPool, 'totalFreshWaterTemperatureFlux', totalFreshWaterTemperatureFlux) + + nCells = nCellsArray( 3 ) + + ! Surface fluxes of water have an associated heat content, but the coupled system does not account for this + ! Assume surface fluxes of water have a temperature dependent on the incoming mass flux. + ! Assume surface fluxes of water have zero salinity. So the RHS forcing is zero for salinity. + ! Only include this heat forcing when bulk thickness is turned on + ! indices on tracerGroup are (iTracer, iLevel, iCell) + if (.not. bulkThicknessFluxOff) then + !$omp parallel + !$omp do schedule(runtime) + do iCell = 1, nCells + + if ( config_use_sgr_opt_temp_prescribed ) then + !sgr with fixed prescribed temperature + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_temperature_prescribed / rho_sw + else + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) = subglacialRunoffFlux(iCell) * & + ocn_freezing_temperature(salinity=0.0_RKIND, pressure=landIcePressure(iCell), & + inLandIceCavity=.true.) / rho_sw + end if + + if ( config_use_sgr_opt_salt_prescribed ) then + !sgr with fixed prescribed temperature + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = subglacialRunoffFlux(iCell) * & + config_sgr_salinity_prescribed / rho_sw + else + !sgr with temperature equal to the local freezing point of freshwater + tracersSurfaceFluxSubglacialRunoff(index_salinity_flux,iCell) = 0.0_RKIND + end if + + ! add subglacial runoff contribution for sending through coupler + totalFreshWaterTemperatureFlux(iCell) = totalFreshWaterTemperatureFlux(iCell) & + + tracersSurfaceFluxSubglacialRunoff(index_temperature_flux,iCell) + + end do + !$omp end do + !$omp end parallel + endif ! bulkThicknessFluxOn + + end subroutine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff!}}} + end module ocn_surface_bulk_forcing diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index b855512fb294..f42df59a629c 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -891,9 +891,13 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & forcingPool, tracerGroup, & tracerGroupSurfaceFlux, & tracerGroupSurfaceFluxRunoff, & - tracerGroupSurfaceFluxSubglacialRunoff, & tracerGroupSurfaceFluxRemoved, & dt, layerThickness, err) + if (trim(config_subglacial_runoff_mode) == 'data') then + call ocn_surface_bulk_forcing_tracers(meshPool, groupName, & + forcingPool, & + tracerGroupSurfaceFluxSubglacialRunoff, err) + end if end if ! sfc bulk forcing From 5a54e97cf2577dbc9bed3bff0c25379ad4fc72e1 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 21:43:49 -0600 Subject: [PATCH 63/73] fix function call typo _subglacial_runoff --- components/mpas-ocean/src/shared/mpas_ocn_tendency.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index f42df59a629c..a0f4ae74e5ec 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -894,7 +894,7 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & tracerGroupSurfaceFluxRemoved, & dt, layerThickness, err) if (trim(config_subglacial_runoff_mode) == 'data') then - call ocn_surface_bulk_forcing_tracers(meshPool, groupName, & + call ocn_surface_bulk_forcing_tracers_subglacial_runoff(meshPool, groupName, & forcingPool, & tracerGroupSurfaceFluxSubglacialRunoff, err) end if From bdd8761563b4e46fb575c11830289c0fd4facd13 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Sun, 21 Jul 2024 23:12:28 -0600 Subject: [PATCH 64/73] fix timer for sgr --- .../src/shared/mpas_ocn_tracer_surface_flux_to_tend.F | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index fd754562a579..280ebc72844b 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -270,8 +270,6 @@ subroutine ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbso if (.not. surfaceTracerFluxOn) return - call mpas_timer_start("surface_tracer_flux") - call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray) call mpas_pool_get_dimension(meshPool, 'nVertLevels', nVertLevels) nTracers = size(tend, dim=1) @@ -308,6 +306,8 @@ subroutine ocn_tracer_surface_flux_tend_subglacial_runoff(meshPool, fractionAbso !$omp end do !$omp end parallel + call mpas_timer_stop("surface_tracer_subglacial_runoff_flux") + !-------------------------------------------------------------------- end subroutine ocn_tracer_surface_flux_tend_subglacial_runoff!}}} From 0b72d7532ee6d28b926ed2365b3d68c86a022f54 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 22 Jul 2024 13:20:13 -0600 Subject: [PATCH 65/73] corrected subglacialRunoffFlux add up in conservation check so that it is as mass, not volume flux --- .../src/analysis_members/mpas_ocn_conservation_check.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F index 756328a3d5dd..beed937d6767 100644 --- a/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F +++ b/components/mpas-ocean/src/analysis_members/mpas_ocn_conservation_check.F @@ -983,7 +983,7 @@ subroutine mass_conservation(domain, err) sumArray( 8) = sumArray( 8) + areaCell(iCell) * removedIceRunoffFlux(iCell) sumArray( 9) = sumArray( 9) + areaCell(iCell) * icebergFreshwaterFlux(iCell) if (trim(config_subglacial_runoff_mode) == 'data') then - sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) / areaCell(iCell) * rho_sw + sumArray(13) = sumArray(13) + areaCell(iCell) * subglacialRunoffFlux(iCell) end if enddo From 00fc2618b0ad0d064870659e92ac51d8f4246c13 Mon Sep 17 00:00:00 2001 From: irenavankova Date: Wed, 17 Jul 2024 12:18:10 -0600 Subject: [PATCH 66/73] Change if statement for config_sgr_flux_vertical_location init check Co-authored-by: Carolyn Begeman --- components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F | 7 +++---- 1 file changed, 3 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 5046e19d5d59..a2d6586a7d63 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F @@ -4742,10 +4742,9 @@ subroutine ocn_diagnostics_init(domain, err)!{{{ call ocn_diagnostics_variables_init(domain, jenkinsOn, & hollandJenkinsOn, err) - if ( trim(config_sgr_flux_vertical_location) == 'top' ) then - else if ( trim(config_sgr_flux_vertical_location) == 'uniform' ) then - else if ( trim(config_sgr_flux_vertical_location) == 'bottom' ) then - else + if ( trim(config_sgr_flux_vertical_location) /= 'top' .and. & + trim(config_sgr_flux_vertical_location) /= 'uniform' .and. & + trim(config_sgr_flux_vertical_location) /= 'bottom' ) then call mpas_log_write("config_sgr_flux_vertical_location not one of 'bottom', 'uniform', 'top'.", MPAS_LOG_CRIT) end if From 77feb929dcad7ab939f7108c6b4f292d716e5530 Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Tue, 23 Jul 2024 13:45:38 -0600 Subject: [PATCH 67/73] change author on new subroutines --- .../src/shared/mpas_ocn_surface_bulk_forcing.F | 12 ++++++------ .../src/shared/mpas_ocn_thick_surface_flux.F | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F index 81732b637a97..11d70ae9c40d 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_surface_bulk_forcing.F @@ -136,8 +136,8 @@ end subroutine ocn_surface_bulk_forcing_tracers!}}} ! routine ocn_surface_bulk_forcing_tracers_subglacial_runoff ! !> \brief Determines the tracers forcing array used for the bulk forcing. -!> \author Doug Jacobsen -!> \date 04/25/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the tracers forcing arrays used later in MPAS. ! @@ -425,8 +425,8 @@ end subroutine ocn_surface_bulk_forcing_thick!}}} ! routine ocn_surface_bulk_forcing_thick_subglacial_runoff ! !> \brief Determines the thickness forcing array used for the bulk forcing. -!> \author Doug Jacobsen -!> \date 04/25/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the thickness forcing arrays used later in MPAS. ! @@ -752,8 +752,8 @@ end subroutine ocn_surface_bulk_forcing_active_tracers!}}} ! routine ocn_surface_bulk_forcing_active_tracers_subglacial_runoff ! !> \brief Determines the active tracers forcing array used for the bulk forcing. -!> \author Doug Jacobsen -!> \date 04/25/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the active tracers forcing arrays used later in MPAS. ! diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index 8e389a74ba37..b959a89bff1d 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -175,8 +175,8 @@ end subroutine ocn_thick_surface_flux_tend!}}} ! routine ocn_thick_surface_flux_tend_subglacial_runoff ! !> \brief Computes tendency term from horizontal advection of thickness -!> \author Doug Jacobsen -!> \date 15 September 2011 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the horizontal advection tendency for !> thickness based on current state and user choices of forcings. @@ -276,8 +276,8 @@ end subroutine ocn_thick_surface_flux_tend_subglacial_runoff!}}} ! routine ocn_thick_surface_flux_init ! !> \brief Initializes ocean horizontal thickness surface fluxes -!> \author Doug Jacobsen -!> \date 12/17/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine initializes quantities related to thickness !> surface fluxes in the ocean. From 0288938beae15cf92f0a86d077e0cd12b3ffaf3c Mon Sep 17 00:00:00 2001 From: Jon Wolfe Date: Thu, 25 Jul 2024 11:06:20 -0500 Subject: [PATCH 68/73] Make bld files consistent with Registry --- components/mpas-ocean/bld/build-namelist | 10 ++++---- .../mpas-ocean/bld/build-namelist-section | 2 +- .../namelist_defaults_mpaso.xml | 2 +- .../namelist_definition_mpaso.xml | 23 ++++++++++--------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/components/mpas-ocean/bld/build-namelist b/components/mpas-ocean/bld/build-namelist index 490100040c00..37c8b88f67e6 100755 --- a/components/mpas-ocean/bld/build-namelist +++ b/components/mpas-ocean/bld/build-namelist @@ -708,6 +708,11 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +if ($OCN_SGR eq 'data') { + add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); +} else { + add_default($nl, 'config_subglacial_runoff_mode'); +} add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); @@ -715,11 +720,6 @@ add_default($nl, 'config_use_sgr_opt_temp_prescribed'); add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); -if ($OCN_SGR eq 'data') { - add_default($nl, 'config_subglacial_runoff_mode', 'val'=>"data"); -} else { - add_default($nl, 'config_subglacial_runoff_mode'); -} ############################ # Namelist group: coupling # diff --git a/components/mpas-ocean/bld/build-namelist-section b/components/mpas-ocean/bld/build-namelist-section index 189d32fc7b52..9e646beb6b5e 100644 --- a/components/mpas-ocean/bld/build-namelist-section +++ b/components/mpas-ocean/bld/build-namelist-section @@ -224,6 +224,7 @@ add_default($nl, 'config_use_bulk_wind_stress'); add_default($nl, 'config_use_bulk_thickness_flux'); add_default($nl, 'config_flux_attenuation_coefficient'); add_default($nl, 'config_flux_attenuation_coefficient_runoff'); +add_default($nl, 'config_subglacial_runoff_mode'); add_default($nl, 'config_flux_attenuation_coefficient_subglacial_runoff'); add_default($nl, 'config_sgr_flux_vertical_location'); add_default($nl, 'config_use_sgr_opt_kpp'); @@ -231,7 +232,6 @@ add_default($nl, 'config_use_sgr_opt_temp_prescribed'); add_default($nl, 'config_use_sgr_opt_salt_prescribed'); add_default($nl, 'config_sgr_temperature_prescribed'); add_default($nl, 'config_sgr_salinity_prescribed'); -add_default($nl, 'config_subglacial_runoff_mode'); ############################ # Namelist group: coupling # 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 c57920e5c388..b70f7942686e 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_defaults_mpaso.xml @@ -342,6 +342,7 @@ .true. 0.001 10.0 +'off' 0.001 'bottom' .true. @@ -349,7 +350,6 @@ .false. 0.0 0.0 -'off' .false. 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 fed7828e6a8b..601b121e5768 100644 --- a/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml +++ b/components/mpas-ocean/bld/namelist_files/namelist_definition_mpaso.xml @@ -1188,9 +1188,17 @@ Valid values: Any positive real number. Default: Defined in namelist_defaults.xml + +Selects the mode in which subglacial runoff fluxes are implemented. + +Valid values: 'off', 'data' +Default: Defined in namelist_defaults.xml + + -The length scale of exponential decay of subglacial runoff. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$. +The length scale of exponential decay of subglacial runoff, used when config_sgr_flux_vertical_location is 'top' or 'bottom'. Fluxes are multiplied by $e^{z/\gamma}$, where this coefficient is $\gamma$. Valid values: Any positive real number. Default: Defined in namelist_defaults.xml @@ -1198,9 +1206,9 @@ Default: Defined in namelist_defaults.xml -Selects the vertical location where subglacial runoff is fluxed +Selects the vertical location where subglacial runoff is fluxed. -Valid values: 'top','uniform', 'bottom'. +Valid values: 'top','uniform', 'bottom' Default: Defined in namelist_defaults.xml @@ -1240,17 +1248,10 @@ Default: Defined in namelist_defaults.xml category="forcing" group="forcing"> Prescribed subglacial runoff salinity value, applied when config_use_sgr_opt_salt_prescribed = .true. -Valid values: Any real number. +Valid values: Any positive real number Default: Defined in namelist_defaults.xml - -Selects the mode in which subglacial runoff fluxes are computed. - -Valid values: 'off', 'data' -Default: Defined in namelist_defaults.xml - From 48cee50966dfefddfad8b90e8502c9296bf62573 Mon Sep 17 00:00:00 2001 From: irenavankova Date: Thu, 25 Jul 2024 10:12:31 -0600 Subject: [PATCH 69/73] Correct DSGR file name Co-authored-by: Xylar Asay-Davis --- components/mpas-ocean/cime_config/buildnml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mpas-ocean/cime_config/buildnml b/components/mpas-ocean/cime_config/buildnml index f3eb22881683..8f5193c334be 100755 --- a/components/mpas-ocean/cime_config/buildnml +++ b/components/mpas-ocean/cime_config/buildnml @@ -380,7 +380,7 @@ def buildnml(case, caseroot, compname): if ocn_tidal_mixing == 'true': u_tidal_rms_file = 'velocityTidalRMS_CATS2008.IcoswISC30E3r5.20231120.nc' if ocn_sgr == 'data': - data_sgr_file = 'DSGR.massFlux.massFlux.MALI.out2055.IcoswISC30E3r5.20240328.nc' + data_sgr_file = 'DSGR.massFlux.MALI.out2055.IcoswISC30E3r5.20240328.nc' elif ocn_grid == 'IcosXISC30E3r7': decomp_date = '20240314' From 5a0f2842c03cb058d51dd8c09a133efece7cd2ca Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 25 Jul 2024 10:44:04 -0600 Subject: [PATCH 70/73] Corrected authorship --- .../mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F | 4 ++-- .../src/shared/mpas_ocn_tracer_surface_flux_to_tend.F | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F index b959a89bff1d..1c535532cea2 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_thick_surface_flux.F @@ -276,8 +276,8 @@ end subroutine ocn_thick_surface_flux_tend_subglacial_runoff!}}} ! routine ocn_thick_surface_flux_init ! !> \brief Initializes ocean horizontal thickness surface fluxes -!> \author Irena Vankova -!> \date July 2024 +!> \author Doug Jacobsen +!> \date 12/17/12 !> \details !> This routine initializes quantities related to thickness !> surface fluxes in the ocean. diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F index 280ebc72844b..ba97203c4ec3 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tracer_surface_flux_to_tend.F @@ -208,8 +208,8 @@ end subroutine ocn_tracer_surface_flux_tend!}}} ! routine ocn_tracer_surface_flux_tend_subglacial_runoff ! !> \brief Computes tendency term for surface fluxes -!> \author Doug Jacobsen -!> \date 12/17/12 +!> \author Irena Vankova +!> \date July 2024 !> \details !> This routine computes the tendency for tracers based on surface fluxes. ! From 9ddd011645f60d3c59e7783476f75d5359ed06ae Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Thu, 25 Jul 2024 10:49:40 -0600 Subject: [PATCH 71/73] Added DSGR to stealth feature tests --- cime_config/tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cime_config/tests.py b/cime_config/tests.py index c1f6cfaa1b70..12ab829c51dd 100644 --- a/cime_config/tests.py +++ b/cime_config/tests.py @@ -274,6 +274,7 @@ "ERS_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF.mpaso-jra_1958", "PEM_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF.mpaso-jra_1958", "SMS_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF-TMIX.mpaso-jra_1958", + "SMS_P480_Ld5.TL319_IcoswISC30E3r5.GMPAS-JRA1p5-DIB-PISMF-DSGR.mpaso-jra_1958", ) }, From 24f24b88665c4e671f91bde4aacb0f3007c20d3b Mon Sep 17 00:00:00 2001 From: Irena Vankova Date: Mon, 29 Jul 2024 09:28:12 -0600 Subject: [PATCH 72/73] added package condition in tendency tracers --- .../mpas-ocean/src/shared/mpas_ocn_tendency.F | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F index a0f4ae74e5ec..601d134ceec8 100644 --- a/components/mpas-ocean/src/shared/mpas_ocn_tendency.F +++ b/components/mpas-ocean/src/shared/mpas_ocn_tendency.F @@ -830,13 +830,15 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, & modifiedGroupName, & tracerGroupSurfaceFluxRunoff) - ! Get surface flux due to subglacial runoff array - ! only active tracers have subglacial runoff flux for now, - ! but we still need to associate for ALL tracers - modifiedGroupName = groupName // "SurfaceFluxSubglacialRunoff" - call mpas_pool_get_array(tracersSurfaceFluxPool, & - modifiedGroupName, & - tracerGroupSurfaceFluxSubglacialRunoff) + if (trim(config_subglacial_runoff_mode) == 'data') then + ! Get surface flux due to subglacial runoff array + ! only active tracers have subglacial runoff flux for now, + ! but we still need to associate for ALL tracers + modifiedGroupName = groupName // "SurfaceFluxSubglacialRunoff" + call mpas_pool_get_array(tracersSurfaceFluxPool, & + modifiedGroupName, & + tracerGroupSurfaceFluxSubglacialRunoff) + end if ! Get surface flux removed array to keep track of how much ! flux is ignored From 624d9ac5757e18db32477702dba04f442e24d247 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 26 Aug 2024 06:07:59 -0500 Subject: [PATCH 73/73] Revert changes to .gitignore --- .gitignore | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitignore b/.gitignore index d2fcc80bbb71..d7a1fabfd6bc 100644 --- a/.gitignore +++ b/.gitignore @@ -51,16 +51,3 @@ components/eamxx/docs/common/eamxx_params.md components/eamxx/src/python/build components/eamxx/src/python/build_src components/eamxx/src/python/dist - -# OS generated files # -###################### -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db - -# idea folder -.idea/