Skip to content

Commit

Permalink
Removes 2D GM code and debug statements
Browse files Browse the repository at this point in the history
Removes the vertical averaging of the GM kappa bolus diffusivity.
Testing shows this functionality is not beneficial to simulations
  • Loading branch information
vanroekel committed Aug 16, 2019
1 parent dab5e06 commit 04874bf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
10 changes: 0 additions & 10 deletions Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,6 @@
description="If true, spatitally and deph varying Bolus Kappa is used, following Danabasoglu et al (2007)"
possible_values=".true. or .false."
/>
<nml_option name="config_gm_kappa_lat_variable" type="logical" default_value=".false." units="NA"
description="If true, use spatially varying kappa, but fixed in depth"
possible_values=".true. or .false."
/>
<nml_option name="config_gm_min_stratification_ratio" type="real" default_value="0.1" units="NA"
description="minimum value for N2/Nmax2 ratio"
possible_values="small positive reals"
Expand Down Expand Up @@ -2572,7 +2568,6 @@
description="Meridional Component of the gradient of sea surface height at cell centers."
packages="forwardMode;analysisMode"
/>

<var name="normalGMBolusVelocity" type="real" dimensions="nVertLevels nEdges Time" units="m s^{-1}"
description="Bolus velocity in Gent-McWilliams eddy parameterization"
packages="forwardMode;analysisMode"
Expand All @@ -2581,14 +2576,9 @@
description="phase speed for the bolus velocity calculation"
packages="forwardMode;analysisMode"
/>
<var name="kappaGM2D" type="real" dimensions="nEdges Time" units="m s^{-1}"
description="spatially varying GM kappa"
packages="forwardMode;analysisMode"
/>
<var name="kappaGM3D" type="real" dimensions="nVertLevels nEdges Time" units="m s^{-1}"
description="spatially and depth varying GM kappa"
packages="forwardMode;analysisMode"

/>
<var name="GMBolusVelocityX" type="real" dimensions="nVertLevels nCells Time" units="m s^{-1}"
description="Bolus velocity in Gent-McWilliams eddy parameterization, x-direction"
Expand Down
33 changes: 1 addition & 32 deletions shared/mpas_ocn_gm.F
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ module ocn_gm
real (kind=RKIND), pointer :: config_Redi_bottom_layer_tapering_depth
logical, pointer :: config_gm_lat_variable_c2
logical, pointer :: config_gm_kappa_lat_depth_variable
logical, pointer :: config_gm_kappa_lat_variable
real (kind=RKIND), pointer :: config_gm_min_stratification_ratio
real (kind=RKIND), pointer :: config_gm_min_phase_speed
real (kind=RKIND), parameter :: epsGM = 1.0e-12_RKIND
Expand Down Expand Up @@ -108,7 +107,7 @@ subroutine ocn_gm_compute_Bolus_velocity(diagnosticsPool, meshPool, scratchPool)
gmStreamFuncTopOfCell, dDensityDzTopOfEdge, dDensityDzTopOfCell, relativeSlopeTapering, relativeSlopeTaperingCell, &
areaCellSum, kappaGM3D

real(kind=RKIND), dimension(:), pointer :: boundaryLayerDepth, gmBolusKappa, cGMphaseSpeed, kappaGM2D, bottomDepth
real(kind=RKIND), dimension(:), pointer :: boundaryLayerDepth, gmBolusKappa, cGMphaseSpeed, bottomDepth
real(kind=RKIND), dimension(:), pointer :: areaCell, dcEdge, dvEdge, tridiagA, tridiagB, tridiagC, rightHandSide
integer, dimension(:), pointer :: maxLevelEdgeTop, maxLevelCell, nEdgesOnCell
integer, dimension(:,:), pointer :: cellsOnEdge, edgesOnCell
Expand All @@ -131,7 +130,6 @@ subroutine ocn_gm_compute_Bolus_velocity(diagnosticsPool, meshPool, scratchPool)
call mpas_pool_get_array(diagnosticsPool, 'zMid', zMid)

call mpas_pool_get_array(diagnosticsPool, 'cGMphaseSpeed', cGMphaseSpeed)
call mpas_pool_get_array(diagnosticsPool, 'kappaGM2D', kappaGM2D)
call mpas_pool_get_array(diagnosticsPool, 'kappaGM3D', kappaGM3D)
call mpas_pool_get_array(diagnosticsPool, 'normalGMBolusVelocity', normalGMBolusVelocity)
call mpas_pool_get_array(diagnosticsPool, 'relativeSlopeTopOfEdge', relativeSlopeTopOfEdge)
Expand Down Expand Up @@ -586,39 +584,11 @@ subroutine ocn_gm_compute_Bolus_velocity(diagnosticsPool, meshPool, scratchPool)

kappaGM3D(k,iEdge) = gmBolusKappa(iEdge)*max(config_gm_min_stratification_ratio, &
BruntVaisalaFreqTopEdge / (maxN + 1.0E-10_RKIND))
if(kappaGM3D(k,iEdge) <= 0) then
print *, 'val = ',kappaGM3D(k,iEdge),k,iEdge
stop
endif
enddo
enddo
!$omp end do

if (config_gm_kappa_lat_variable) then
!$omp do schedule(runtime) private(cell1, cell2, k, kappaSum, ltSum)
do iEdge = 1, nEdges
cell1 = cellsOnEdge(1,iEdge)
cell2 = cellsOnEdge(2,iEdge)

kappaSum = 0.0_RKIND
ltSum = 0.0_RKIND
do k=1,maxLevelEdgeTop(iEdge)
kappaSum = kappaSum + layerThicknessEdge(k,iEdge)*kappaGM3D(k,iEdge)
ltSum = ltSum + layerThicknessEdge(k,iEdge)
enddo

kappaGM2D(iEdge) = kappaSum / ltSum
!over write the kappa 3d variable
kappaGM3D(:,iEdge) = kappaGM2D(iEdge)

enddo
!$omp end do
endif

endif

!next do the 2d bit, just average it for now

nEdges = nEdgesArray( 3 )

!$omp do schedule(runtime)
Expand Down Expand Up @@ -850,7 +820,6 @@ subroutine ocn_gm_init(domain, err)!{{{
call mpas_pool_get_config(ocnConfigs, 'config_Redi_bottom_layer_tapering_depth',config_Redi_bottom_layer_tapering_depth)
call mpas_pool_get_config(ocnConfigs, 'config_gm_lat_variable_c2',config_gm_lat_variable_c2)
call mpas_pool_get_config(ocnConfigs, 'config_gm_kappa_lat_depth_variable', config_gm_kappa_lat_depth_variable)
call mpas_pool_get_config(ocnConfigs, 'config_gm_kappa_lat_variable', config_gm_kappa_lat_variable)
call mpas_pool_get_config(ocnConfigs, 'config_gm_min_stratification_ratio', config_gm_min_stratification_ratio)
call mpas_pool_get_config(ocnConfigs, 'config_gm_min_phase_speed', config_gm_min_phase_speed)

Expand Down

0 comments on commit 04874bf

Please sign in to comment.