Skip to content

Fix qv index lookup for lbc_scalars - #1507

Open
jihyeonjang wants to merge 1 commit into
MPAS-Dev:developfrom
jihyeonjang:fix_lbc_qv_index
Open

Fix qv index lookup for lbc_scalars#1507
jihyeonjang wants to merge 1 commit into
MPAS-Dev:developfrom
jihyeonjang:fix_lbc_qv_index

Conversation

@jihyeonjang

@jihyeonjang jihyeonjang commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

This PR fixes the qv constituent index lookup in the init_atm_case_lbc subroutine.

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 lateral boundary conditions generated for regional MPAS simulations.

@jihyeonjang
jihyeonjang requested a review from mgduda September 3, 2026 21:40
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants