Skip to content

Feature/cp mconv - #554

Merged
ywkawai merged 9 commits into
developfrom
feature/cp_mconv
Jul 27, 2026
Merged

Feature/cp mconv#554
ywkawai merged 9 commits into
developfrom
feature/cp_mconv

Conversation

@ywkawai

@ywkawai ywkawai commented Jul 27, 2026

Copy link
Copy Markdown
Owner

close #551
close #553

Copilot AI left a comment

Copy link
Copy Markdown

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 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 Setup method and call these from AtmosComponent_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 as TRACER_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.

Comment thread FElib/src/common/scale_timeint_rk.F90
Comment thread FElib/src/common/scale_timeint_rk.F90.erb Outdated
Comment thread model/atm_nonhydro3d/src/atmos/mod_atmos_phy_bl_vars.F90
Comment thread model/atm_nonhydro3d/src/atmos/mod_atmos_phy_bl.F90
Comment thread model/atm_nonhydro3d/test/case/boundary_layer/mod_user.F90
Comment thread FElib/src/cumulus/scale_atm_phy_cp_dgm_mconv_adjustment.F90
@ywkawai
ywkawai merged commit 5697259 into develop Jul 27, 2026
1 check passed
@ywkawai
ywkawai deleted the feature/cp_mconv branch July 29, 2026 06:52
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.

Consider vertical diffusion of QV in MYNN level2 scheme Support the moist convective adjustment scheme as a cumulus parametrization scheme

2 participants