Skip to content

Changes to CVMix forcing and interface #683

New issue

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

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

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: ocean/develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/core_ocean/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,6 @@
description="Integer value defining the water type used in Jerlov short wave absorption."
possible_values="Integer values between 1 and 5"
/>
<nml_option name="config_surface_buoyancy_depth" type="real" default_value="1" units="m"
description="Depth over which to apply penetrating SW to sfcBuoyancyFlux"
possible_values="Real Values greater than zero less than bottomDepth"
/>
</nml_record>
<nml_record name="tidal_forcing" mode="init;forward">
<nml_option name="config_use_tidal_forcing" type="logical" default_value=".false." units="unitless"
Expand Down
5 changes: 3 additions & 2 deletions src/core_ocean/shared/mpas_ocn_tendency.F
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,9 @@ subroutine ocn_tend_tracer(tendPool, statePool, forcingPool, diagnosticsPool, me
!$omp end parallel
endif

call ocn_tracer_short_wave_absorption_tend(meshPool, swForcingPool, forcingPool, indexTemperature, &
layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tracerGroupTend, err)
call ocn_tracer_short_wave_absorption_tend(meshPool, diagnosticsPool, swForcingPool, forcingPool, &
indexTemperature, layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, &
tracerGroupTend, err)

if (config_compute_active_tracer_budgets) then
!$omp parallel
Expand Down
15 changes: 8 additions & 7 deletions src/core_ocean/shared/mpas_ocn_tracer_short_wave_absorption.F
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ module ocn_tracer_short_wave_absorption
!
!-----------------------------------------------------------------------

subroutine ocn_tracer_short_wave_absorption_tend(meshPool, swForcingPool, forcingPool, index_temperature, & !{{{
layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tend, err)
subroutine ocn_tracer_short_wave_absorption_tend(meshPool, diagnosticsPool, swForcingPool, forcingPool, & !{{{
index_temperature, layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, &
tend, err)

!-----------------------------------------------------------------
!
Expand All @@ -74,7 +75,7 @@ subroutine ocn_tracer_short_wave_absorption_tend(meshPool, swForcingPool, forcin
!-----------------------------------------------------------------

type (mpas_pool_type), intent(in) :: &
meshPool, swForcingPool, forcingPool !< Input: mesh information
meshPool, swForcingPool, diagnosticsPool, forcingPool !< Input: mesh information

real (kind=RKIND), dimension(:), intent(in) :: &
penetrativeTemperatureFlux !< Input: short wave heat flux
Expand Down Expand Up @@ -115,11 +116,11 @@ subroutine ocn_tracer_short_wave_absorption_tend(meshPool, swForcingPool, forcin

err = 0
if(useJerlov) then
call ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, forcingPool, index_temperature, layerThickness, &
penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tend, err)
call ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, diagnosticsPool, forcingPool, index_temperature, &
layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tend, err)
else
call ocn_tracer_short_wave_absorption_variable_tend(meshPool,swForcingPool, forcingPool, index_temperature, &
layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL,tend,err)
call ocn_tracer_short_wave_absorption_variable_tend(meshPool, diagnosticsPool, swForcingPool, forcingPool, &
index_temperature, layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL,tend,err)
endif

call mpas_timer_stop("short wave")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ module ocn_tracer_short_wave_absorption_jerlov
!
!-----------------------------------------------------------------------

subroutine ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, forcingPool, index_temperature, layerThickness, &
penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tend, err)!{{{
subroutine ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, diagnosticsPool, forcingPool, index_temperature, &!{{{
layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tend, err)

!-----------------------------------------------------------------
!
Expand All @@ -85,7 +85,7 @@ subroutine ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, forcingPool, i
!-----------------------------------------------------------------

type (mpas_pool_type), intent(in) :: &
meshPool, forcingPool !< Input: mesh information
meshPool, forcingPool, diagnosticsPool !< Input: mesh information

real (kind=RKIND), dimension(:), intent(in) :: &
penetrativeTemperatureFlux !< Input: penetrative temperature flux through the surface
Expand Down Expand Up @@ -120,21 +120,22 @@ subroutine ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, forcingPool, i
!
!-----------------------------------------------------------------

integer :: iCell, k, depLev, nCells
integer :: iCell, k, nCells
integer, pointer :: nVertLevels
integer, dimension(:), pointer :: nCellsArray

integer, dimension(:), pointer :: maxLevelCell

real (kind=RKIND) :: depth
real (kind=RKIND), dimension(:), pointer :: refBottomDepth
real (kind=RKIND) :: depth, weightOSBL
real (kind=RKIND), dimension(:), pointer :: boundaryLayerDepth, refBottomDepth
real (kind=RKIND), dimension(:), allocatable :: weights

err = 0

call mpas_pool_get_dimension(meshPool, 'nCellsArray', nCellsArray)
call mpas_pool_get_dimension(meshPool, 'nVertLevels', nVertLevels)

call mpas_pool_get_array(diagnosticsPool, 'boundaryLayerDepth', boundaryLayerDepth)
call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell)
call mpas_pool_get_array(meshPool, 'refBottomDepth', refBottomDepth)

Expand All @@ -146,7 +147,7 @@ subroutine ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, forcingPool, i

#ifndef CPRPGI
!$omp parallel
!$omp do schedule(runtime) private(depth, k, depLev) &
!$omp do schedule(runtime) private(weightOSBL, depth, k) &
!$omp firstprivate(weights)
#endif
do iCell = 1, nCells
Expand All @@ -159,18 +160,8 @@ subroutine ocn_tracer_short_wave_absorption_jerlov_tend(meshPool, forcingPool, i
* (weights(k) - weights(k+1))
end do

depth = 0.0_RKIND
do k=1,maxLevelCell(iCell)
depth = depth + layerThickness(k,iCell)
if(depth > abs(config_surface_buoyancy_depth)) exit
enddo

if(k == maxLevelCell(iCell) .or. k == 1) then
depLev=2
else
depLev=k
endif
penetrativeTemperatureFluxOBL(iCell)=penetrativeTemperatureFlux(iCell)*weights(depLev)
call ocn_get_jerlov_fraction(boundaryLayerDepth(iCell), weightOSBL)
penetrativeTemperatureFluxOBL(iCell)=penetrativeTemperatureFlux(iCell)*weightOSBL

end do
#ifndef CPRPGI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ module ocn_tracer_short_wave_absorption_variable
!
!-----------------------------------------------------------------------

subroutine ocn_tracer_short_wave_absorption_variable_tend(meshPool, swForcingPool, forcingPool, index_temperature, & !{{{
layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tend, err)
subroutine ocn_tracer_short_wave_absorption_variable_tend(meshPool, diagnosticsPool, swForcingPool, forcingPool, &!{{{
index_temperature, layerThickness, penetrativeTemperatureFlux, penetrativeTemperatureFluxOBL, tend, &
err)

!-----------------------------------------------------------------
!
Expand All @@ -84,7 +85,8 @@ subroutine ocn_tracer_short_wave_absorption_variable_tend(meshPool, swForcingPoo
type (mpas_pool_type), intent(in) :: &
meshPool, & !< Input: mesh information
swForcingPool, & !< Input: chlorophyll, cloud, zenith data
forcingPool
forcingPool, &
diagnosticsPool

real (kind=RKIND), dimension(:), intent(in) :: &
penetrativeTemperatureFlux !< Input: penetrative temperature flux through the surface
Expand Down Expand Up @@ -119,14 +121,14 @@ subroutine ocn_tracer_short_wave_absorption_variable_tend(meshPool, swForcingPoo
!
!-----------------------------------------------------------------

integer :: iCell, k, depLev, nCells
integer :: iCell, k, nCells
integer, pointer :: nVertLevels
integer, dimension(:), pointer :: nCellsArray

integer, dimension(:), pointer :: maxLevelCell

real (kind=RKIND) :: depth
real (kind=RKIND), dimension(:), pointer :: refBottomDepth
real (kind=RKIND) :: weightOSBL, depth
real (kind=RKIND), dimension(:), pointer :: boundaryLayerDepth, refBottomDepth
real (kind=RKIND), dimension(:), allocatable :: weights
real (kind=RKIND), dimension(:), pointer :: chlorophyllA, zenithAngle, clearSkyRadiation
real (kind=RKIND), dimension(4) :: Avals, Kvals
Expand All @@ -139,6 +141,7 @@ subroutine ocn_tracer_short_wave_absorption_variable_tend(meshPool, swForcingPoo

call mpas_pool_get_array(meshPool, 'maxLevelCell', maxLevelCell)
call mpas_pool_get_array(meshPool, 'refBottomDepth', refBottomDepth)
call mpas_pool_get_array(diagnosticsPool, 'boundaryLayerDepth', boundaryLayerDepth)

allocate(weights(nVertLevels+1))
weights = 0.0_RKIND
Expand All @@ -154,7 +157,7 @@ subroutine ocn_tracer_short_wave_absorption_variable_tend(meshPool, swForcingPoo
nCells = nCellsArray( 3 )

!$omp parallel
!$omp do schedule(runtime) private(depth, cloudRatio, k, depLev, Avals, Kvals, weights)
!$omp do schedule(runtime) private(depth, cloudRatio, k, weightOSBL, Avals, Kvals, weights)
do iCell = 1, nCells
depth = 0.0_RKIND
cloudRatio = min(1.0_RKIND, 1.0_RKIND - penetrativeTemperatureFlux(iCell)/(hflux_factor*(1.0E-15_RKIND + &
Expand All @@ -171,18 +174,8 @@ subroutine ocn_tracer_short_wave_absorption_variable_tend(meshPool, swForcingPoo
* (weights(k) - weights(k+1) )
end do

depth = 0.0_RKIND
do k=1,maxLevelCell(iCell)
depth = depth + layerThickness(k,iCell)
if(depth > abs(config_surface_buoyancy_depth)) exit
enddo

if(k == maxLevelCell(iCell) .or. k == 1) then
depLev=2
else
depLev=k
endif
penetrativeTemperatureFluxOBL(iCell)=penetrativeTemperatureFlux(iCell)*weights(depLev)
call ocn_get_variable_sw_fraction(boundaryLayerDepth(iCell), weightOSBL, Avals, Kvals)
penetrativeTemperatureFluxOBL(iCell)=penetrativeTemperatureFlux(iCell)*weightOSBL

end do
!$omp end do
Expand Down
21 changes: 4 additions & 17 deletions src/core_ocean/shared/mpas_ocn_vmix_cvmix.F
Original file line number Diff line number Diff line change
Expand Up @@ -674,23 +674,10 @@ subroutine ocn_vmix_coefs_cvmix_build(meshPool, statePool, forcingPool, diagnost
! intent out of BoundaryLayerDepth is boundary layer depth measured in meters and vertical index
indexBoundaryLayerDepth(iCell) = cvmix_variables % kOBL_depth



if(config_cvmix_kpp_matching .eq. 'SimpleShapes') then
do k = 1, int(indexBoundaryLayerDepth(iCell))
vertViscTopOfCell(k,iCell) = vertViscTopOfCell(k,iCell) + cvmix_variables % Mdiff_iface(k)
vertDiffTopOfCell(k,iCell) = vertDiffTopOfCell(k,iCell) + cvmix_variables % Tdiff_iface(k)
end do
do k = int(indexBoundaryLayerDepth(iCell))+1, maxLevelCell(iCell)+1
vertViscTopOfCell(k,iCell) = cvmix_variables % Mdiff_iface(k)
vertDiffTopOfCell(k,iCell) = cvmix_variables % Tdiff_iface(k)
enddo
else
do k = 1, maxLevelCell(iCell) + 1
vertViscTopOfCell(k, iCell) = cvmix_variables % Mdiff_iface(k)
vertDiffTopOfCell(k, iCell) = cvmix_variables % Tdiff_iface(k)
end do
endif
do k = 1, maxLevelCell(iCell) + 1
vertViscTopOfCell(k, iCell) = cvmix_variables % Mdiff_iface(k)
vertDiffTopOfCell(k, iCell) = cvmix_variables % Tdiff_iface(k)
end do

! store non-local flux terms
! these flux terms must be multiplied by the surfaceTracerFlux field
Expand Down