From 2978860f9946454974f015db43c44aeab862fe19 Mon Sep 17 00:00:00 2001 From: "yuanjian.z" Date: Tue, 19 Nov 2024 15:44:07 -0600 Subject: [PATCH 1/2] Check if mass flux is top-down and flip accordingly --- .../GCHPctmEnv_GridCompMod.F90 | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/GCHP_GridComp/GCHPctmEnv_GridComp/GCHPctmEnv_GridCompMod.F90 b/src/GCHP_GridComp/GCHPctmEnv_GridComp/GCHPctmEnv_GridCompMod.F90 index a6b47ff27..2b7fd3de2 100644 --- a/src/GCHP_GridComp/GCHPctmEnv_GridComp/GCHPctmEnv_GridCompMod.F90 +++ b/src/GCHP_GridComp/GCHPctmEnv_GridComp/GCHPctmEnv_GridCompMod.F90 @@ -826,6 +826,10 @@ subroutine prepare_massflux_exports(IMPORT, EXPORT, PLE, dt, RC) real(r8), pointer, dimension(:,:,:) :: SPHU0_EXPORT => null() ! Pointers to imports + real, pointer, dimension(:,:,:) :: MFX_IMPORT => null() + real, pointer, dimension(:,:,:) :: MFY_IMPORT => null() + real, pointer, dimension(:,:,:) :: CX_IMPORT => null() + real, pointer, dimension(:,:,:) :: CY_IMPORT => null() real, pointer, dimension(:,:,:) :: UA_IMPORT => null() real, pointer, dimension(:,:,:) :: VA_IMPORT => null() @@ -833,7 +837,6 @@ subroutine prepare_massflux_exports(IMPORT, EXPORT, PLE, dt, RC) real(r8), pointer, dimension(:,:,:) :: UpwardsMassFlux => null() ! Pointers to local arrays - real, pointer, dimension(:,:,:) :: temp3d_r4 => null() real, pointer, dimension(:,:,:) :: UC => null() real, pointer, dimension(:,:,:) :: VC => null() real(r8), pointer, dimension(:,:,:) :: UCr8 => null() @@ -868,30 +871,32 @@ subroutine prepare_massflux_exports(IMPORT, EXPORT, PLE, dt, RC) endif ! Get imports (real4) and copy to exports, converting to real8 - call MAPL_GetPointer(IMPORT, temp3d_r4, 'MFXC', RC=STATUS) + call MAPL_GetPointer(IMPORT, MFX_IMPORT, 'MFXC', RC=STATUS) _VERIFY(STATUS) - if ( correct_mass_flux_for_humidity > 0 ) then - MFX_EXPORT = dble(temp3d_r4) / ( 1.d0 - SPHU0_EXPORT ) + call MAPL_GetPointer(IMPORT, MFY_IMPORT, 'MFYC', RC=STATUS) + _VERIFY(STATUS) + call MAPL_GetPointer(IMPORT, CX_IMPORT, 'CXC', RC=STATUS) + _VERIFY(STATUS) + call MAPL_GetPointer(IMPORT, CY_IMPORT, 'CYC', RC=STATUS) + _VERIFY(STATUS) + + if (meteorology_vertical_index_is_top_down) then + MFX_EXPORT = dble(MFX_IMPORT(:,:,:)) + MFY_EXPORT = dble(MFY_IMPORT(:,:,:)) + CX_EXPORT = dble(CX_IMPORT(:,:,:)) + CY_EXPORT = dble(CY_IMPORT(:,:,:)) else - MFX_EXPORT = dble(temp3d_r4) + MFX_EXPORT = dble(MFX_IMPORT(:,:,LM:1:-1)) + MFY_EXPORT = dble(MFY_IMPORT(:,:,LM:1:-1)) + CX_EXPORT = dble(CX_IMPORT(:,:,LM:1:-1)) + CY_EXPORT = dble(CY_IMPORT(:,:,LM:1:-1)) endif - call MAPL_GetPointer(IMPORT, temp3d_r4, 'MFYC', RC=STATUS) - _VERIFY(STATUS) if ( correct_mass_flux_for_humidity > 0 ) then - MFY_EXPORT = dble(temp3d_r4) / ( 1.d0 - SPHU0_EXPORT ) - else - MFY_EXPORT = dble(temp3d_r4) + MFX_EXPORT = MFX_EXPORT / ( 1.d0 - SPHU0_EXPORT ) + MFY_EXPORT = MFY_EXPORT / ( 1.d0 - SPHU0_EXPORT ) endif - call MAPL_GetPointer(IMPORT, temp3d_r4, 'CXC', RC=STATUS) - _VERIFY(STATUS) - CX_EXPORT = dble(temp3d_r4) - - call MAPL_GetPointer(IMPORT, temp3d_r4, 'CYC', RC=STATUS) - _VERIFY(STATUS) - CY_EXPORT = dble(temp3d_r4) - else ! Get wind imports (real4, A-grid) @@ -963,10 +968,13 @@ subroutine prepare_massflux_exports(IMPORT, EXPORT, PLE, dt, RC) CX_EXPORT => null() CY_EXPORT => null() SPHU0_EXPORT => null() + MFX_IMPORT => null() + MFY_IMPORT => null() + CX_IMPORT => null() + CY_IMPORT => null() UA_IMPORT => null() VA_IMPORT => null() UpwardsMassFlux => null() - temp3d_r4 => null() UC => null() VC => null() UCr8 => null() From 43a337c513c3e0ca25807759e2536f50350fd536 Mon Sep 17 00:00:00 2001 From: "yuanjian.z" Date: Tue, 19 Nov 2024 15:46:14 -0600 Subject: [PATCH 2/2] Update ChangeLog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02b7144b1..447bccf35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ This file documents all notable changes to the GCHP wrapper repository starting The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] - TBD +### Added + +### Fixed +- Check if mass flux is top-down and flip accordingly + +### Changed + +### Removed + ## [14.5.0] - 2024-11-08 ### Added - Added documentation about GEOS convection change affecting meteorology starting June 1, 2020