From 4f75309e2b3308eba6df5add20445e10cc6893f0 Mon Sep 17 00:00:00 2001 From: Steve Goldhaber Date: Wed, 3 Dec 2025 18:25:14 +0100 Subject: [PATCH 1/2] Use aerosol_is instead of is_bulk --- .../aerosol/aerosol_properties_mod.F90 | 20 ++++++++++++++----- .../aerosol/bulk_aerosol_properties_mod.F90 | 15 ++++++++++---- src/physics/cam/aerosol_optics_cam.F90 | 6 +++--- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/chemistry/aerosol/aerosol_properties_mod.F90 b/src/chemistry/aerosol/aerosol_properties_mod.F90 index 127a8758dc..6c6133dfc5 100644 --- a/src/chemistry/aerosol/aerosol_properties_mod.F90 +++ b/src/chemistry/aerosol/aerosol_properties_mod.F90 @@ -74,7 +74,7 @@ module aerosol_properties_mod procedure(aero_resuspension_resize), deferred :: resuspension_resize procedure(aero_rebin_bulk_fluxes), deferred :: rebin_bulk_fluxes procedure(aero_hydrophilic), deferred :: hydrophilic - procedure :: is_bulk + procedure(aero_id_query) :: aerosol_is procedure :: final=>aero_props_final end type aerosol_properties @@ -457,6 +457,15 @@ logical function aero_hydrophilic(self, bin_ndx) integer, intent(in) :: bin_ndx ! bin number end function aero_hydrophilic + !------------------------------------------------------------------------------ + ! Returns TRUE if the aerosol model matches the query, otherwise FALSE + !------------------------------------------------------------------------------ + logical function aero_id_query(self, query) + import :: aerosol_properties + class(aerosol_properties), intent(in) :: self + character(len=*), intent(in) :: query + end function aero_id_query + end interface contains @@ -734,13 +743,14 @@ pure real(r8) function pom_equivso4_factor(self) end function pom_equivso4_factor !------------------------------------------------------------------------------ - ! returns TRUE if bulk aerosol representation + ! returns TRUE if aerosol model matches query !------------------------------------------------------------------------------ - pure logical function is_bulk(self) + pure logical function aerosol_is(self, query) class(aerosol_properties), intent(in) :: self + character(len=*), intent(in) :: query - is_bulk = .false. + aerosol_is = .false. - end function is_bulk + end function aerosol_is end module aerosol_properties_mod diff --git a/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 b/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 index c5f6304b20..2994719894 100644 --- a/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 +++ b/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 @@ -48,7 +48,7 @@ module bulk_aerosol_properties_mod procedure :: resuspension_resize procedure :: rebin_bulk_fluxes procedure :: hydrophilic - procedure :: is_bulk + procedure :: aerosol_is final :: destructor @@ -712,11 +712,18 @@ end function hydrophilic !------------------------------------------------------------------------------ ! returns TRUE if bulk aerosol representation !------------------------------------------------------------------------------ - pure logical function is_bulk(self) + pure logical function aerosol_is(self, query) class(bulk_aerosol_properties), intent(in) :: self + character(len=*), intent(in) :: query - is_bulk = .true. + if (trim(query) == 'BAM') then + aerosol_is = .true. + else if (trim(query) == 'bulk_model') then + aerosol_is = .true. + else + aerosol_is = .false. + end if - end function is_bulk + end function aerosol_is end module bulk_aerosol_properties_mod diff --git a/src/physics/cam/aerosol_optics_cam.F90 b/src/physics/cam/aerosol_optics_cam.F90 index 1c5b7b201f..b701b908de 100644 --- a/src/physics/cam/aerosol_optics_cam.F90 +++ b/src/physics/cam/aerosol_optics_cam.F90 @@ -874,13 +874,13 @@ subroutine aerosol_optics_cam_sw(list_idx, state, pbuf, nnite, idxnite, tauxar, ga(icol,ilev,iwav) = ga(icol,ilev,iwav) + dopaer(icol)*palb(icol)*pasm(icol) fa(icol,ilev,iwav) = fa(icol,ilev,iwav) + dopaer(icol)*palb(icol)*pasm(icol)*pasm(icol) - if (.not.aeroprops%is_bulk()) then + if (.not.aeroprops%model_is('BAM')) then call update_diags() end if end do column - if (aeroprops%is_bulk().and.iwav==idx_sw_diag) then + if (aeroprops%model_is('BAM').and.iwav==idx_sw_diag) then taubam(:ncol,ilev) = dopaer(:ncol) end if @@ -895,7 +895,7 @@ subroutine aerosol_optics_cam_sw(list_idx, state, pbuf, nnite, idxnite, tauxar, deallocate(aero_optics) nullify(aero_optics) - if (aeroprops%is_bulk()) then + if (aeroprops%model_is('BAM')) then bam_cnt = bam_cnt+1 call aer_vis_diag_out(lchnk, ncol, nnite, idxnite, bam_cnt, taubam, & list_idx, troplev) From 376823ffb260bf8846b45f31d30a5118e3412d8f Mon Sep 17 00:00:00 2001 From: Francis Vitt Date: Thu, 4 Dec 2025 15:58:10 -0700 Subject: [PATCH 2/2] fix the model_is method modified: src/chemistry/aerosol/aerosol_properties_mod.F90 modified: src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 modified: src/chemistry/aerosol/carma_aerosol_properties_mod.F90 modified: src/chemistry/aerosol/modal_aerosol_properties_mod.F90 --- .../aerosol/aerosol_properties_mod.F90 | 13 +------------ .../aerosol/bulk_aerosol_properties_mod.F90 | 14 +++++++------- .../aerosol/carma_aerosol_properties_mod.F90 | 16 ++++++++++++++++ .../aerosol/modal_aerosol_properties_mod.F90 | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/chemistry/aerosol/aerosol_properties_mod.F90 b/src/chemistry/aerosol/aerosol_properties_mod.F90 index 6c6133dfc5..b2bc986fba 100644 --- a/src/chemistry/aerosol/aerosol_properties_mod.F90 +++ b/src/chemistry/aerosol/aerosol_properties_mod.F90 @@ -74,7 +74,7 @@ module aerosol_properties_mod procedure(aero_resuspension_resize), deferred :: resuspension_resize procedure(aero_rebin_bulk_fluxes), deferred :: rebin_bulk_fluxes procedure(aero_hydrophilic), deferred :: hydrophilic - procedure(aero_id_query) :: aerosol_is + procedure(aero_id_query), deferred :: model_is procedure :: final=>aero_props_final end type aerosol_properties @@ -742,15 +742,4 @@ pure real(r8) function pom_equivso4_factor(self) end function pom_equivso4_factor - !------------------------------------------------------------------------------ - ! returns TRUE if aerosol model matches query - !------------------------------------------------------------------------------ - pure logical function aerosol_is(self, query) - class(aerosol_properties), intent(in) :: self - character(len=*), intent(in) :: query - - aerosol_is = .false. - - end function aerosol_is - end module aerosol_properties_mod diff --git a/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 b/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 index 2994719894..3033851289 100644 --- a/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 +++ b/src/chemistry/aerosol/bulk_aerosol_properties_mod.F90 @@ -48,7 +48,7 @@ module bulk_aerosol_properties_mod procedure :: resuspension_resize procedure :: rebin_bulk_fluxes procedure :: hydrophilic - procedure :: aerosol_is + procedure :: model_is final :: destructor @@ -712,18 +712,18 @@ end function hydrophilic !------------------------------------------------------------------------------ ! returns TRUE if bulk aerosol representation !------------------------------------------------------------------------------ - pure logical function aerosol_is(self, query) + pure logical function model_is(self, query) class(bulk_aerosol_properties), intent(in) :: self character(len=*), intent(in) :: query - if (trim(query) == 'BAM') then - aerosol_is = .true. + if (trim(query) == 'BAM' .or. trim(query) == 'bam') then + model_is = .true. else if (trim(query) == 'bulk_model') then - aerosol_is = .true. + model_is = .true. else - aerosol_is = .false. + model_is = .false. end if - end function aerosol_is + end function model_is end module bulk_aerosol_properties_mod diff --git a/src/chemistry/aerosol/carma_aerosol_properties_mod.F90 b/src/chemistry/aerosol/carma_aerosol_properties_mod.F90 index 1f0c4d9287..e00c807257 100644 --- a/src/chemistry/aerosol/carma_aerosol_properties_mod.F90 +++ b/src/chemistry/aerosol/carma_aerosol_properties_mod.F90 @@ -40,6 +40,7 @@ module carma_aerosol_properties_mod procedure :: resuspension_resize procedure :: rebin_bulk_fluxes procedure :: hydrophilic + procedure :: model_is final :: destructor end type carma_aerosol_properties @@ -944,4 +945,19 @@ logical function hydrophilic(self, bin_ndx) end function hydrophilic + !------------------------------------------------------------------------------ + ! returns TRUE if CARMA aerosol representation + !------------------------------------------------------------------------------ + pure logical function model_is(self, query) + class(carma_aerosol_properties), intent(in) :: self + character(len=*), intent(in) :: query + + if (trim(query) == 'CARMA' .or. trim(query) == 'carma') then + model_is = .true. + else + model_is = .false. + end if + + end function model_is + end module carma_aerosol_properties_mod diff --git a/src/chemistry/aerosol/modal_aerosol_properties_mod.F90 b/src/chemistry/aerosol/modal_aerosol_properties_mod.F90 index 5a92b8df5a..e255be91da 100644 --- a/src/chemistry/aerosol/modal_aerosol_properties_mod.F90 +++ b/src/chemistry/aerosol/modal_aerosol_properties_mod.F90 @@ -52,6 +52,7 @@ module modal_aerosol_properties_mod procedure :: resuspension_resize procedure :: rebin_bulk_fluxes procedure :: hydrophilic + procedure :: model_is final :: destructor end type modal_aerosol_properties @@ -1108,4 +1109,21 @@ logical function hydrophilic(self, bin_ndx) end function hydrophilic + !------------------------------------------------------------------------------ + ! returns TRUE if modal aerosol representation + !------------------------------------------------------------------------------ + pure logical function model_is(self, query) + class(modal_aerosol_properties), intent(in) :: self + character(len=*), intent(in) :: query + + if (trim(query) == 'MAM' .or. trim(query) == 'mam') then + model_is = .true. + else if (trim(query) == 'modal') then + model_is = .true. + else + model_is = .false. + end if + + end function model_is + end module modal_aerosol_properties_mod