Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fixes to KPP interface #107

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 4 additions & 22 deletions components/mpas-ocean/src/shared/mpas_ocn_diagnostics.F
Original file line number Diff line number Diff line change
Expand Up @@ -3303,8 +3303,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, &
evapTemperatureFlux, &
icebergTemperatureFlux, &
seaIceTemperatureFlux, &
surfaceStress, &
surfaceStressMagnitude
sfcStressMag, &

real (kind=RKIND), dimension(:,:), pointer :: &
layerThickness, &! layer thickness
Expand Down Expand Up @@ -3381,10 +3380,8 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, &
surfaceThicknessFluxRunoff)
call mpas_pool_get_array(forcingPool, 'penetrativeTemperatureFlux', &
penetrativeTemperatureFlux)
call mpas_pool_get_array(forcingPool, 'surfaceStress', &
surfaceStress)
call mpas_pool_get_array(forcingPool, 'surfaceStressMagnitude', &
surfaceStressMagnitude)
sfcStressMag)
call mpas_pool_get_array(forcingPool, 'rainTemperatureFlux', &
rainTemperatureFlux)
call mpas_pool_get_array(forcingPool, 'evapTemperatureFlux', &
Expand Down Expand Up @@ -3477,9 +3474,7 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, &
- fracAbsorbed* (rainTemperatureFlux(iCell) + &
evapTemperatureFlux(iCell) + &
seaIceTemperatureFlux(iCell) + &
icebergTemperatureFlux(iCell)) &
- fracAbsorbedRunoff* &
activeTracersSurfaceFluxRunoff(indexTempFlux,iCell)
icebergTemperatureFlux(iCell))

nonLocalSurfaceTracerFlux(indexSaltFlux,iCell) = &
activeTracersSurfaceFlux(indexSaltFlux,iCell) &
Expand All @@ -3500,21 +3495,8 @@ subroutine ocn_compute_KPP_input_fields(statePool, forcingPool, &
surfaceBuoyancyForcing(iCell) = surfaceBuoyancyForcing(iCell)* &
gravity

! compute magnitude of surface stress
sumSurfaceStressSquared = 0.0_RKIND
do i = 1, nEdgesOnCell(iCell)
iEdge = edgesOnCell(i, iCell)
sumSurfaceStressSquared = sumSurfaceStressSquared &
+ edgeAreaFractionOfCell(i,iCell)* &
surfaceStress(iEdge)**2
enddo

! NOTE that the factor of 2 is from averaging dot products
! to cell centers on a C-grid
surfaceStressMagnitude(iCell) = &
sqrt(2.0_RKIND * sumSurfaceStressSquared)
surfaceFrictionVelocity(iCell) = &
sqrt(surfaceStressMagnitude(iCell) / rho_sw)
sqrt(sfcStressMag(iCell) / rho_sw)

enddo
!$omp end do
Expand Down
13 changes: 7 additions & 6 deletions components/mpas-ocean/src/shared/mpas_ocn_vmix_cvmix.F
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module ocn_vmix_cvmix
type(cvmix_tidal_params_type) :: cvmix_tidal_params

logical :: cvmixOn, cvmixConvectionOn, cvmixKPPOn
real (kind=RKIND) :: backgroundVisc, backgroundDiff
real (kind=RKIND) :: multVal, backgroundVisc, backgroundDiff
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vanroekel Searching for this value doesn't bring up anything for me. Where is it assigned?


integer :: cvmixBackgroundChoice ! user choice of cvmix background scheme

Expand Down Expand Up @@ -725,9 +725,9 @@ subroutine ocn_vmix_coefs_cvmix_build(meshPool, statePool, forcingPool, err, tim
! intent out of BoundaryLayerDepth is boundary layer depth measured in meters and vertical index
indexBoundaryLayerDepth(iCell) = cvmix_variables % kOBL_depth

do k = minLevelCell(iCell), maxLevelCell(iCell) + 1
vertViscTopOfCell(k, iCell) = cvmix_variables % Mdiff_iface(k)
vertDiffTopOfCell(k, iCell) = cvmix_variables % Tdiff_iface(k)
do k = minLevelCell(iCell), floor(indexBoundaryLayerDepth(iCell)) + 1
vertViscTopOfCell(k, iCell) = multVal*vertViscTopOfCell(k,iCell) + cvmix_variables % Mdiff_iface(k)
vertDiffTopOfCell(k, iCell) = multVal*vertDiffTopOfCell(k,iCell) + cvmix_variables % Tdiff_iface(k)
end do

! store non-local flux terms
Expand All @@ -751,7 +751,7 @@ subroutine ocn_vmix_coefs_cvmix_build(meshPool, statePool, forcingPool, err, tim
! add convective mixing to vertical viscosity/diffusivity
! if using KPP, then do not apply convective mixing within the ocean boundary layer
if(config_use_cvmix_kpp) then
do k = ceiling(indexBoundaryLayerDepth(iCell)) + 1, maxLevelCell(iCell)
do k = floor(indexBoundaryLayerDepth(iCell)) + 1, maxLevelCell(iCell)
vertViscTopOfCell(k,iCell) = vertViscTopOfCell(k,iCell) + cvmix_variables % Mdiff_iface(k)
vertDiffTopOfCell(k,iCell) = vertDiffTopOfCell(k,iCell) + cvmix_variables % Tdiff_iface(k)
enddo
Expand Down Expand Up @@ -1081,13 +1081,14 @@ subroutine ocn_vmix_cvmix_init(domain,err)!{{{
call cvmix_init_kpp ( &
ri_crit = config_cvmix_kpp_criticalBulkRichardsonNumber, &
interp_type = config_cvmix_kpp_interpolationOMLType, &
interp_type2 = config_cvmix_kpp_interpolationOMLType, &
interp_type2 = 'LMD94', &
lEkman = config_cvmix_kpp_EkmanOBL, &
lMonOb = config_cvmix_kpp_MonObOBL, &
MatchTechnique = config_cvmix_kpp_matching, &
surf_layer_ext = config_cvmix_kpp_surface_layer_extent, &
langmuir_mixing_str = config_cvmix_kpp_langmuir_mixing_opt, &
langmuir_entrainment_str = config_cvmix_kpp_langmuir_entrainment_opt, &
lnoDGat1 = .true., &
lenhanced_diff = config_cvmix_kpp_use_enhanced_diff)
endif

Expand Down
Loading