From 76c73ed26d110b3e62b4ae1eeb290a679333c3f7 Mon Sep 17 00:00:00 2001 From: jihyeonjang Date: Thu, 3 Sep 2026 15:17:51 -0600 Subject: [PATCH] Fix qv index lookup for lbc_scalars The init_atm_case_lbc subroutine retrieves the lbc_scalars array from the lbc_state pool, but obtains the qv constituent index from the state pool using index_qv. The scalars and lbc_scalars arrays are separate variable arrays, and their constituent indices are generated independently. Therefore, the index_lbc_qv should be retrieved from lbc_state and used when indexing lbc_scalars. Since index_qv and index_lbc_qv are expected to always be the same (both equal to 1), this change would not affect the results, which are the lateral boundary conditions generated for regional MPAS simulations. However, care is needed when adding new variables to scalars and lbc_scalars. For example, I added a passive tracer as the last variable in both scalars and lbc_scalars arrays in Registry.xml. During init_atm_case_lbc, using an index from scalars accessed the wrong constituent in lbc_scalars, because currently tke is included in scalars but not in lbc_scalars. --- src/core_init_atmosphere/mpas_init_atm_cases.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_init_atmosphere/mpas_init_atm_cases.F b/src/core_init_atmosphere/mpas_init_atm_cases.F index fb67a5164b..1381612e9f 100644 --- a/src/core_init_atmosphere/mpas_init_atm_cases.F +++ b/src/core_init_atmosphere/mpas_init_atm_cases.F @@ -5623,7 +5623,7 @@ subroutine init_atm_case_lbc(timestamp, block, mesh, nCells, nEdges, nVertLevels call mpas_pool_get_dimension(dims, 'nCellsSolve', nCellsSolve) nVertLevelsP1 = nVertLevels + 1 - call mpas_pool_get_dimension(state, 'index_qv', index_qv) + call mpas_pool_get_dimension(lbc_state, 'index_lbc_qv', index_qv) etavs = (1.0_RKIND - 0.252_RKIND) * pii / 2.0_RKIND rcv = rgas / (cp - rgas)