Feature/cp mconv - #554
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a moist convective adjustment (MCONV) cumulus parameterization pathway and extends the PBL/turbulence plumbing to handle tracer (QV) vertical diffusion, alongside a refactor that splits physics variable initialization into Init vs Setup phases and wires physics history output accordingly.
Changes:
- Add a new DG moist convective adjustment cumulus scheme and integrate it into the atmospheric CP component.
- Extend BL/PBL turbulence tendency computation to include tracer tendencies and update the boundary-layer test case outputs/config accordingly.
- Refactor multiple physics “vars” modules to introduce a
Setupmethod and call these fromAtmosComponent_setup_vars; adjust RK time integration initialization logic.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| model/atm_nonhydro3d/test/case/boundary_layer/visualize/visualize.sh | Adds QV/BL_QV_t plots and reorders plotted fields. |
| model/atm_nonhydro3d/test/case/boundary_layer/run.conf | Enables QV history output and adds BL_QV_t history item. |
| model/atm_nonhydro3d/test/case/boundary_layer/mod_user.F90 | Updates boundary-layer initial conditions (surface potential temperature + RH-based QV init logic). |
| model/atm_nonhydro3d/test/case/boundary_layer/init.conf | Renames TEMP0→SFC_POTT and changes ENV_RH default. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_tb_vars.F90 | Introduces Setup method; shifts variable-object setup responsibilities. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_sfc.F90 | Passes default surface temp into vars initialization; removes separate default-value call. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_sfc_vars.F90 | Splits vars init vs setup; moves allocation/registration into Setup. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_rd_vars.F90 | Splits vars init vs setup for radiation variables. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_mp_vars.F90 | Splits vars init vs setup for microphysics variables. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_cp.F90 | Adds CP type for moist convective adjustment; integrates tendency calculation/finalize hooks. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_cp_vars.F90 | Adds Setup, tendency-field getter helper, and expands history writing for CP vars. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_bl.F90 | Extends BL tendency computation to include tracer tendencies and apply them to forcing terms. |
| model/atm_nonhydro3d/src/atmos/mod_atmos_phy_bl_vars.F90 | Adds Setup and registers BL tracer tendency variables (but currently with range/count issues). |
| model/atm_nonhydro3d/src/atmos/mod_atmos_component.F90 | Calls physics vars Setup for activated components during Atmos vars setup. |
| model/atm_nonhydro3d/src/admin/mod_dg_driver.F90 | Adds CP vars history output in normal and restart-read output paths. |
| FElib/src/Makefile | Adds cumulus directory and CP object(s) to the build. |
| FElib/src/fluid_dyn_solver/scale_atm_dyn_dgm_driver_trcadv3d.F90 | Fixes/ensures local mesh pointer is set before per-cell update. |
| FElib/src/depend | Adds dependency line for the new cumulus adjustment object. |
| FElib/src/cumulus/scale_atm_phy_cp_dgm_mconv_adjustment.F90 | New moist convective adjustment DG implementation producing density/rhot/rhoqv tendencies and rain flux. |
| FElib/src/common/scale_timeint_rk.F90.erb | Updates RK init logic for stage 1 and adds var0 initialization (OpenACC present-list needs update). |
| FElib/src/common/scale_timeint_rk.F90 | Same RK change as template; currently missing var0 mapping in OpenACC present(...). |
| FElib/src/bl_turbulence/scale_atm_phy_bl_dgm_mynn_lv2.F90 | Extends MYNN lv2 visc/diff coef calc to include Rtot gradient term in stability metrics. |
| FElib/src/bl_turbulence/scale_atm_phy_bl_dgm_common.F90 | Extends BL common vertical diffusion solver to handle QA tracer components in the block system. |
Comments suppressed due to low confidence (3)
FElib/src/common/scale_timeint_rk.F90:2227
- The OpenACC region writes to var0_2d(i,j,varID), but var0_2d is not included in the
present(...)clause. With OpenACC enabled this can fail at runtime due to missing device data mapping.
if ( nowstage == 1 .and. (.not. this%imex_flag) ) then
!$omp parallel do
!$acc parallel loop collapse(2) present( q, varTmp_2d )
do j=js, je
do i=is, ie
var0_2d(i,j,varID) = q(i,j)
FElib/src/common/scale_timeint_rk.F90:2593
- The OpenACC region writes to var0_3d(i,j,k,varID), but var0_3d is not listed in the
present(...)clause. This is likely to cause an OpenACC runtime error (data not present on device).
if ( nowstage == 1 .and. (.not. this%imex_flag) ) then
!$omp parallel do collapse(2)
!$acc parallel loop collapse(3) present( q, varTmp_3d )
do k=ks, ke
do j=js, je
do i=is, ie
var0_3d(i,j,k,varID) = q(i,j,k)
varTmp_3d(i,j,k,varID) = q(i,j,k)
model/atm_nonhydro3d/src/atmos/mod_atmos_phy_bl_vars.F90:193
- This loop iterates
iq=1,QA(global tracer count) but indexes tracer metadata asTRACER_NAME(this%QS+iq-1). With the current BL setup (QS_BL=QA, QA_BL=0) this will immediately reference tracers outside the BL range and can go out of bounds when QA>1.
do iq = 1, QA
iv = ATMOS_PHY_BL_TENDS_NUM1 + iq
qtrc_tp_vinfo_tmp%keyID = iv
qtrc_tp_vinfo_tmp%NAME = 'BL_'//trim(TRACER_NAME(this%QS+iq-1))//'_t'
qtrc_tp_vinfo_tmp%DESC = 'tendency of rho*'//trim(TRACER_NAME(this%QS+iq-1))//' in BL process'
qtrc_tp_vinfo_tmp%UNIT = 'kg/m3/s'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
close #551
close #553