Skip to content

Commit

Permalink
add distinct passive tracer background vert diffusivity
Browse files Browse the repository at this point in the history
  • Loading branch information
maltrud committed Feb 26, 2024
1 parent a97c668 commit 48bff80
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/mpas-ocean/bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@ add_default($nl, 'config_use_cvmix');
add_default($nl, 'config_cvmix_prandtl_number');
add_default($nl, 'config_cvmix_background_scheme');
add_default($nl, 'config_cvmix_background_diffusion');
add_default($nl, 'config_cvmix_background_diffusion_passive_enable');
add_default($nl, 'config_cvmix_background_diffusion_passive');
add_default($nl, 'config_cvmix_background_viscosity');
add_default($nl, 'config_cvmix_BryanLewis_bl1');
add_default($nl, 'config_cvmix_BryanLewis_bl2');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@
<config_cvmix_prandtl_number>1.0</config_cvmix_prandtl_number>
<config_cvmix_background_scheme>'constant'</config_cvmix_background_scheme>
<config_cvmix_background_diffusion>0.0</config_cvmix_background_diffusion>
<config_cvmix_background_diffusion_passive_enable>.false.</config_cvmix_background_diffusion_passive_enable>
<config_cvmix_background_diffusion_passive>0.0</config_cvmix_background_diffusion_passive>
<config_cvmix_background_viscosity>1.0e-4</config_cvmix_background_viscosity>
<config_cvmix_BryanLewis_bl1>8.0e-5</config_cvmix_BryanLewis_bl1>
<config_cvmix_BryanLewis_bl2>1.05E-4</config_cvmix_BryanLewis_bl2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,22 @@ Valid values: Any positive real value.
Default: Defined in namelist_defaults.xml
</entry>

<entry id="config_cvmix_background_diffusion_passive_enable" type="logical"
category="cvmix" group="cvmix">
Enable different background vertical diffusion value for passive tracer quantities

Valid values: .true. or .false.
Default: Defined in namelist_defaults.xml
</entry>

<entry id="config_cvmix_background_diffusion_passive" type="real"
category="cvmix" group="cvmix">
Background vertical diffusion applied to passive tracer quantities if enabled

Valid values: Any positive real value.
Default: Defined in namelist_defaults.xml
</entry>

<entry id="config_cvmix_background_viscosity" type="real"
category="cvmix" group="cvmix">
Background vertical viscosity applied to horizontal velocity
Expand Down
12 changes: 12 additions & 0 deletions components/mpas-ocean/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,14 @@
description="Background vertical diffusion applied to tracer quantities"
possible_values="Any positive real value."
/>
<nml_option name="config_cvmix_background_diffusion_passive" type="real" default_value="1.0e-5" units="m^2 s^-1"
description="Background vertical diffusion applied to passive tracer quantities"
possible_values="Any positive real value."
/>
<nml_option name="config_cvmix_background_diffusion_passive_enable" type="logical" default_value=".false."
description="flag to enable using a different background vertical diffusion for passive tracers"
possible_values=".true. or .false."
/>
<nml_option name="config_cvmix_background_viscosity" type="real" default_value="1.0e-4" units="m^2 s^-1"
description="Background vertical viscosity applied to horizontal velocity"
possible_values="Any positive real value."
Expand Down Expand Up @@ -3085,6 +3093,10 @@
description="vertical diffusion defined at the cell center (horizontally) and top (vertically)"
packages="forwardMode;analysisMode"
/>
<var name="vertDiffPassiveTopOfCell" type="real" dimensions="nVertLevelsP1 nCells Time" units="m^2 s^-1"
description="vertical diffusion defined at the cell center (horizontally) and top (vertically) for passive tracers"
packages="forwardMode;analysisMode"
/>
<var name="bulkRichardsonNumber" type="real" dimensions="nVertLevels nCells Time" units="1"
description="CVMix/KPP: bulk Richardson number"
missing_value="FILLVAL" missing_value_mask="cellMask"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ module ocn_diagnostics_variables
type (field2DReal), pointer :: wettingVelocityField

real (kind=RKIND), dimension(:,:), pointer :: vertDiffTopOfCell
real (kind=RKIND), dimension(:,:), pointer :: vertDiffPassiveTopOfCell
real (kind=RKIND), dimension(:,:,:), pointer :: vertNonLocalFlux
integer, dimension(:,:), pointer :: rediLimiterCount
real (kind=RKIND), dimension(:,:,:), pointer :: activeTracerSurfaceFluxTendency
Expand Down Expand Up @@ -494,6 +495,8 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e
vertViscTopOfCell)
call mpas_pool_get_array(diagnosticsPool, 'vertDiffTopOfCell', &
vertDiffTopOfCell)
call mpas_pool_get_array(diagnosticsPool, 'vertDiffPassiveTopOfCell', &
vertDiffPassiveTopOfCell)
call mpas_pool_get_array(diagnosticsPool, 'vertAleTransportTop', &
vertAleTransportTop)
call mpas_pool_get_array(diagnosticsPool, 'vertTransportVelocityTop', &
Expand Down Expand Up @@ -752,6 +755,7 @@ subroutine ocn_diagnostics_variables_init(domain, jenkinsOn, hollandJenkinsOn, e
!$acc barotropicForcing, &
!$acc vertViscTopOfCell, &
!$acc vertDiffTopOfCell, &
!$acc vertDiffPassiveTopOfCell, &
!$acc GMStreamFuncZonal, &
!$acc relativeVorticity, &
!$acc kineticEnergyCell, &
Expand Down Expand Up @@ -999,6 +1003,7 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{
!$acc barotropicForcing, &
!$acc vertViscTopOfCell, &
!$acc vertDiffTopOfCell, &
!$acc vertDiffPassiveTopOfCell, &
!$acc GMStreamFuncZonal, &
!$acc relativeVorticity, &
!$acc kineticEnergyCell, &
Expand Down Expand Up @@ -1204,6 +1209,7 @@ subroutine ocn_diagnostics_variables_destroy(err) !{{{
barotropicForcing, &
vertViscTopOfCell, &
vertDiffTopOfCell, &
vertDiffPassiveTopOfCell, &
GMStreamFuncZonal, &
relativeVorticity, &
kineticEnergyCell, &
Expand Down
19 changes: 18 additions & 1 deletion components/mpas-ocean/src/shared/mpas_ocn_vmix.F
Original file line number Diff line number Diff line change
Expand Up @@ -1583,9 +1583,26 @@ subroutine ocn_vmix_implicit(dt, meshPool, statePool, forcingPool, scratchPool,
!$acc enter data copyin(tracerGroupSurfaceFlux)
#endif
call ocn_tracer_vmix_tend_implicit(dt, vertDiffTopOfCell, layerThickness, tracersGroup, &
if (trim(groupItr % memberName) /= 'activeTracers' .and. &
config_cvmix_background_diffusion_passive_enable) then
vertDiffPassiveTopOfCell = vertDiffTopOfCell - &
config_cvmix_background_diffusion + config_cvmix_background_diffusion_passive
#ifdef MPAS_OPENACC
!$acc update host (vertDiffPassiveTopOfCell)
#endif
!maltrud debug
do k = 1, maxLevelCell(1)
write(*,*)' DEBUG01: ',k,vertDiffPassiveTopOfCell(k,1)
enddo
call ocn_tracer_vmix_tend_implicit(dt, vertDiffPassiveTopOfCell, layerThickness, tracersGroup, &
vertNonLocalFlux, tracerGroupSurfaceFlux, &
config_cvmix_kpp_nonlocal_with_implicit_mix, err)
else
call ocn_tracer_vmix_tend_implicit(dt, vertDiffTopOfCell, layerThickness, tracersGroup, &
vertNonLocalFlux, tracerGroupSurfaceFlux, &
config_cvmix_kpp_nonlocal_with_implicit_mix, err)
end if
#ifdef MPAS_OPENACC
!$acc exit data delete(tracerGroupSurfaceFlux)
#endif
Expand Down

0 comments on commit 48bff80

Please sign in to comment.