Option to add effects of Lam2 into MLE restratification.#389
Merged
alperaltuntas merged 24 commits intoNCAR:dev/ncarfrom Sep 29, 2025
Merged
Option to add effects of Lam2 into MLE restratification.#389alperaltuntas merged 24 commits intoNCAR:dev/ncarfrom
alperaltuntas merged 24 commits intoNCAR:dev/ncarfrom
Conversation
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.
Include new entreinment rule depth changes.
- 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.
- Introduced `Lam2` as an optional pointer field in `vertvisc_type` and restart registry. - Extended `mixedlayer_restrat` and `mixedlayer_restrat_Bodner` to accept/use `Lam2` when available, with fallback to equilibrium value. - Added `KPP_get_Lam2` routine to expose Lam2 from KPP control structure. - Connected `Lam2` into `diabatic_ALE_legacy` and `diabatic_ALE` and copied into `visc%Lam2` when allocated. - Enabled allocation and restart registration of `Lam2` when STOKES_MOST and Bodner MLE are used. - Updated MOM.F90 call sites to conditionally pass `Lam2`. This integrates Langmuir turbulence effects via Lam2 into MLE restratification.
Wrapped the mixedlayer_restrat call with an outer check on `associated(CS%visc)` to ensure the derived type is valid before testing `CS%visc%Lam2`. This prevents invalid memory references when `CS%visc` is unassociated.
Read `StokesMOST` and `wave_enhanced_ustar` to determine whether Lam2 should be passed to the `mixedlayer_restrat` subroutine.
Added local logical flag `haveLam2` to ensure Lam2 is only used when both present and associated. This avoids potential segfaults from evaluating `associated(Lam2)` when Lam2 is not passed.
Collaborator
Author
|
As expected, this PR changes answers compared to /glade/derecho/scratch/gmarques/cesm.tests/pr_mom/cesm3_0_alpha07c_cesm3--lam2_mle.intel |
alperaltuntas
approved these changes
Sep 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR should be evaluated after merging #379
Introduced
Lam2as an optional pointer field invertvisc_typeand restart registry.Extended
mixedlayer_restratandmixedlayer_restrat_Bodnerto accept/useLam2whenavailable, with fallback to equilibrium value.
Added
KPP_get_Lam2routine to expose Lam2 from KPP control structure.Connected
Lam2intodiabatic_ALE_legacyanddiabatic_ALEand copied intovisc%Lam2when allocated.Enabled allocation and restart registration of
Lam2when STOKES_MOSTand Bodner MLE are used.
Updated MOM.F90 call sites to conditionally pass
Lam2.