From d885ef159c4e4e837ca0fa0815263bb63e853db4 Mon Sep 17 00:00:00 2001 From: Laura Fowler Date: Tue, 30 Apr 2024 09:04:55 -0600 Subject: [PATCH] * Made a couple of corrections in subroutines advance_scalars and atm_advance_scalars_mono_work so that they can be called with state arrays different than "scalars": -> in subroutine advance_scalars, modified the line: call mpas_pool_get_dimension(state, 'num_scalars', num_scalars) to call mpas_pool_get_dimension(state, 'num_'//trim(field_name), num_scalars) to expand the definition of num_scalars to state arrays different than "scalars". -> in subroutine atm_advance_scalars_mono_work, modified the line: call exchange_halo_group(block % domain, 'dynamics:scalars_old') to call exchange_halo_group(block % domain, 'dynamics:'//trim(field_name)//'_old') so that halo exchange can be applied to state arrays different than "scalars". --- src/core_atmosphere/dynamics/mpas_atm_time_integration.F | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F index a68b3e5a19..9098f4e658 100644 --- a/src/core_atmosphere/dynamics/mpas_atm_time_integration.F +++ b/src/core_atmosphere/dynamics/mpas_atm_time_integration.F @@ -1352,7 +1352,7 @@ subroutine advance_scalars(field_name, domain, rk_step, rk_timestep, config_mono call mpas_pool_get_dimension(mesh, 'nCells', nCells) call mpas_pool_get_dimension(mesh, 'nEdges', nEdges) call mpas_pool_get_dimension(mesh, 'nVertLevels', nVertLevels) - call mpas_pool_get_dimension(state, 'num_scalars', num_scalars) + call mpas_pool_get_dimension(state, 'num_'//trim(field_name), num_scalars) call mpas_pool_get_dimension(block % dimensions, 'nThreads', nThreads) @@ -3234,7 +3234,7 @@ subroutine atm_advance_scalars_mono(field_name, block, tend, state, diag, mesh, call mpas_allocate_scratch_field(scale) call mpas_pool_get_array(halo_scratch, 'scale', scale_arr) - call atm_advance_scalars_mono_work(block, state, nCells, nEdges, num_scalars, dt, & + call atm_advance_scalars_mono_work(field_name, block, state, nCells, nEdges, num_scalars, dt, & cellStart, cellEnd, edgeStart, edgeEnd, & cellSolveStart, cellSolveEnd, & coef_3rd_order, nCellsSolve, uhAvg, wwAvg, scalar_tend, rho_zz_old, & @@ -3282,7 +3282,7 @@ end subroutine atm_advance_scalars_mono !> as used in the RK3 scheme as described in Wang et al MWR 2009 ! !----------------------------------------------------------------------- - subroutine atm_advance_scalars_mono_work(block, state, nCells, nEdges, num_scalars, dt, & + subroutine atm_advance_scalars_mono_work(field_name, block, state, nCells, nEdges, num_scalars, dt, & cellStart, cellEnd, edgeStart, edgeEnd, & cellSolveStart, cellSolveEnd, & coef_3rd_order, nCellsSolve, uhAvg, wwAvg, scalar_tend, rho_zz_old, & @@ -3297,6 +3297,7 @@ subroutine atm_advance_scalars_mono_work(block, state, nCells, nEdges, num_scala implicit none + character(len=*), intent(in) :: field_name type (block_type), intent(inout), target :: block type (mpas_pool_type), intent(inout) :: state integer, intent(in) :: nCells ! for allocating stack variables @@ -3401,7 +3402,7 @@ subroutine atm_advance_scalars_mono_work(block, state, nCells, nEdges, num_scala !$OMP BARRIER !$OMP MASTER - call exchange_halo_group(block % domain, 'dynamics:scalars_old') + call exchange_halo_group(block % domain, 'dynamics:'//trim(field_name)//'_old') !$OMP END MASTER !$OMP BARRIER