From 0cd30184f975a5870f64f682ae55185076c4a8c7 Mon Sep 17 00:00:00 2001 From: "Joseph.Mouallem" Date: Tue, 18 Jun 2024 18:31:06 -0400 Subject: [PATCH 1/2] fix bug when calling unallocated diagnostics --- GFS_layer/GFS_radiation_driver.F90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GFS_layer/GFS_radiation_driver.F90 b/GFS_layer/GFS_radiation_driver.F90 index 85befc1b..372730dd 100644 --- a/GFS_layer/GFS_radiation_driver.F90 +++ b/GFS_layer/GFS_radiation_driver.F90 @@ -1386,7 +1386,9 @@ subroutine GFS_radiation_driver & ! air and moles of co2 per square meter following the method in ! radlw_main.f. These can be used later to compute a global mean carbon ! dioxide volume mixing ratio diagnostic if requested. - call compute_column_integrated_moles_of_dry_air_and_co2(Statein, gasvmr, IM, LMK, NF_VGAS, Diag) + if (Model%ldiag3d) then + call compute_column_integrated_moles_of_dry_air_and_co2(Statein, gasvmr, IM, LMK, NF_VGAS, Diag) + endif !> - Get temperature at layer interface, and layer moisture. do k = 2, LMK From 91e8c413f6deb655116db4aa21bb97a40d2d63c3 Mon Sep 17 00:00:00 2001 From: "Joseph.Mouallem" Date: Wed, 19 Jun 2024 09:26:30 -0400 Subject: [PATCH 2/2] Move column_moles diag outside of ldiag3d --- GFS_layer/GFS_radiation_driver.F90 | 4 +--- GFS_layer/GFS_typedefs.F90 | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/GFS_layer/GFS_radiation_driver.F90 b/GFS_layer/GFS_radiation_driver.F90 index 372730dd..85befc1b 100644 --- a/GFS_layer/GFS_radiation_driver.F90 +++ b/GFS_layer/GFS_radiation_driver.F90 @@ -1386,9 +1386,7 @@ subroutine GFS_radiation_driver & ! air and moles of co2 per square meter following the method in ! radlw_main.f. These can be used later to compute a global mean carbon ! dioxide volume mixing ratio diagnostic if requested. - if (Model%ldiag3d) then - call compute_column_integrated_moles_of_dry_air_and_co2(Statein, gasvmr, IM, LMK, NF_VGAS, Diag) - endif + call compute_column_integrated_moles_of_dry_air_and_co2(Statein, gasvmr, IM, LMK, NF_VGAS, Diag) !> - Get temperature at layer interface, and layer moisture. do k = 2, LMK diff --git a/GFS_layer/GFS_typedefs.F90 b/GFS_layer/GFS_typedefs.F90 index 1721adb6..1c7905c1 100644 --- a/GFS_layer/GFS_typedefs.F90 +++ b/GFS_layer/GFS_typedefs.F90 @@ -3918,6 +3918,8 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%pfr(IM,Model%levs)) allocate (Diag%pfs(IM,Model%levs)) allocate (Diag%pfg(IM,Model%levs)) + allocate (Diag%column_moles_co2_per_square_meter(IM)) + allocate (Diag%column_moles_dry_air_per_square_meter(IM)) !--- 3D diagnostics if (Model%ldiag3d) then @@ -3935,8 +3937,6 @@ subroutine diag_create (Diag, IM, Model) allocate (Diag%wu2_shal(IM,Model%levs)) allocate (Diag%eta_shal(IM,Model%levs)) allocate (Diag%co2(IM,Model%levs)) - allocate (Diag%column_moles_co2_per_square_meter(IM)) - allocate (Diag%column_moles_dry_air_per_square_meter(IM)) !--- needed to allocate GoCart coupling fields allocate (Diag%upd_mf (IM,Model%levs))