Skip to content

Add entrainment rule BLD calculation to KPP#379

Merged
alperaltuntas merged 8 commits intoNCAR:dev/ncarfrom
gustavo-marques:kpp_ER_depth
Sep 18, 2025
Merged

Add entrainment rule BLD calculation to KPP#379
alperaltuntas merged 8 commits intoNCAR:dev/ncarfrom
gustavo-marques:kpp_ER_depth

Conversation

@gustavo-marques
Copy link
Collaborator

This commit introduces an alternative method for computing the boundary layer depth (BLD) in KPP, based on the entrainment rule. This method is activated when the non-solar surface buoyancy flux (surfBuoy_NS) is negative and STOKES_MOST = True. In all other cases, the standard Richardson Number-based method is used.

The non-solar surface buoyancy flux is estimated internally using an exponential attenuation function, since only the total surface buoyancy flux (solar + non-solar) is currently available to the module. Ideally, the non-solar component should be provided explicitly.

Several new diagnostics have been added, and some of the existing ones have been updated. Specifically, the parameterized shear, buoyancy, and Stokes TKE production terms are calculated. We conducted multiple tests where these terms are passed to the MLE module and used in the denominator of the Bodner streamfunction. However, because of the small Cr value we adopted (0.01), this had minimal effect on the solutions, so we decided to keep the original simpler implementation and not pursue this option for now.

This commit should be evaluated together with CVMix/CVMix-src#106.

This commit introduces an alternative method for computing the boundary layer depth
(BLD) in KPP, based on the entrainment rule. This method is activated when the
non-solar surface buoyancy flux (surfBuoy_NS) is negative and STOKES_MOST = True.
In all other cases, the standard Richardson Number-based method is used.

The non-solar surface buoyancy flux is estimated internally using an exponential
attenuation function, since only the total surface buoyancy flux (solar + non-solar)
is currently available to the module. Ideally, the non-solar component should be
provided explicitly.

Several new diagnostics have been added, and some of the existing ones have been
updated. Specifically, the parameterized shear, buoyancy, and Stokes TKE production
terms are calculated. We conducted multiple tests where these terms are passed to
the MLE module and used in the denominator of the Bodner streamfunction.
However, because of the small Cr value we adopted (0.01), this had minimal effect
on the solutions, so we decided to keep the original simpler implementation
and not pursue this option for now.

This commit should be evaluated together with CVMix/CVMix-src#106.
@alperaltuntas alperaltuntas requested a review from Copilot August 7, 2025 19:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds an alternative entrainment rule (ER) method for computing the boundary layer depth (BLD) in KPP, which is activated when the non-solar surface buoyancy flux is negative and STOKES_MOST = True. It introduces several new diagnostics including parameterized TKE production terms and implements internal estimation of non-solar surface buoyancy flux using exponential attenuation.

Key changes include:

  • Implementation of entrainment rule boundary layer depth calculation as an alternative to Richardson Number method
  • Addition of parameterized shear, Stokes, and buoyancy TKE production diagnostics
  • Internal estimation of non-solar surface buoyancy flux using exponential decay approximation

@mnlevy1981 mnlevy1981 self-requested a review September 9, 2025 17:23
- Removed unused `ustar` array from KPP_CS type.
- Restricted registration, allocation, and posting of StokesMOST
  diagnostics (`StokesXI`, `Lam2`, `BEdE_ER`, `ERdepth`, `RNdepth`,
  `PU_TKE`, `PS_TKE`, `PB_TKE`) to cases when `CS%StokesMOST` is enabled.
- Moved allocations of related arrays inside StokesMOST conditional block.
- Updated condition for calculating `surfBuoy_NS` to avoid division
  by zero in alog(buoyFlux(i,j,2)/buoyFlux(i,j,3)).
- Wrapped diagnostic and debug checks in `if (CS%StokesMOST)` conditions.
- Minor cleanup of comments and diagnostic labeling.
@gustavo-marques
Copy link
Collaborator Author

This PR introduces expected answer changes for pr_mom; all other tests pass successfully.

/glade/derecho/scratch/gmarques/cesm.tests/pr_mom/alpha07c_dev_ncar--kpp_ER_depth.intel

  DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods (Overall: DIFF) details:
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods CREATE_NEWCASE
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods XML
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods SETUP
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods SHAREDLIB_BUILD time=43
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods NLCOMP
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods MODEL_BUILD time=145
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods SUBMIT
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods RUN time=4552
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods COMPARE_dimscale_1_Tp_base
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods COMPARE_dimscale_2_Lp_base
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods COMPARE_dimscale_3_Hp_base
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods COMPARE_dimscale_4_Zp_base
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods COMPARE_dimscale_5_Rp_base
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods COMPARE_dimscale_6_Qp_base
    FAIL DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods BASELINE alpha07c_dev_ncar--dev_ncar: DIFF
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods TPUTCOMP
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods MEMLEAK insufficient data for memleak test
    PASS DIMCSL_Ld1.TL319_t232.G_JRA.derecho_intel.mom-cfc_mods SHORT_TERM_ARCHIVER
  ERI.TL319_t232.G_JRA.derecho_intel.mom-debug (Overall: DIFF) details:
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug CREATE_NEWCASE
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug XML
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug SETUP
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug SHAREDLIB_BUILD time=10
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug NLCOMP
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug MODEL_BUILD time=96
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug SUBMIT
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug RUN time=2715
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug COMPARE_base_hybrid
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug COMPARE_base_rest
    FAIL ERI.TL319_t232.G_JRA.derecho_intel.mom-debug BASELINE alpha07c_dev_ncar--dev_ncar: DIFF
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug TPUTCOMP
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug MEMLEAK insufficient data for memleak test
    PASS ERI.TL319_t232.G_JRA.derecho_intel.mom-debug SHORT_TERM_ARCHIVER
  ERS.TL319_t232_wg37.GW_JRA.derecho_intel (Overall: DIFF) details:
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel CREATE_NEWCASE
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel XML
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel SETUP
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel SHAREDLIB_BUILD time=9
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel NLCOMP
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel MODEL_BUILD time=310
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel SUBMIT
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel RUN time=965
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel COMPARE_base_rest
    FAIL ERS.TL319_t232_wg37.GW_JRA.derecho_intel BASELINE alpha07c_dev_ncar--dev_ncar: DIFF
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel MEMCOMP
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel TPUTCOMP
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel MEMLEAK
    PASS ERS.TL319_t232_wg37.GW_JRA.derecho_intel SHORT_TERM_ARCHIVER
  SMS_D.TL319_t232.G_JRA_RYF.derecho_intel (Overall: DIFF) details:
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel CREATE_NEWCASE
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel XML
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel SETUP
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel SHAREDLIB_BUILD time=9
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel NLCOMP
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel MODEL_BUILD time=56
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel SUBMIT
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel RUN time=1054
    FAIL SMS_D.TL319_t232.G_JRA_RYF.derecho_intel BASELINE alpha07c_dev_ncar--dev_ncar: DIFF
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel MEMCOMP
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel TPUTCOMP
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel MEMLEAK
    PASS SMS_D.TL319_t232.G_JRA_RYF.derecho_intel SHORT_TERM_ARCHIVER
  SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel (Overall: DIFF) details:
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel CREATE_NEWCASE
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel XML
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel SETUP
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel SHAREDLIB_BUILD time=139
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel NLCOMP
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel MODEL_BUILD time=321
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel SUBMIT
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel RUN time=402
    FAIL SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel BASELINE alpha07c_dev_ncar--dev_ncar: DIFF
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel TPUTCOMP
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel MEMLEAK insufficient data for memleak test
    PASS SMS_Ld2.ne30pg3_t232.B1850C_LTso.derecho_intel SHORT_TERM_ARCHIVER

@alperaltuntas alperaltuntas merged commit 175047b into NCAR:dev/ncar Sep 18, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants