@@ -211,7 +211,7 @@ subroutine physics_update(state, ptend, dt, tend)
211211 use scamMod, only: scm_crm_mode, single_column
212212 use phys_control, only: phys_getopts
213213 use cam_thermo, only: cam_thermo_dry_air_update ! Routine which updates physconst variables (WACCM-X)
214- use air_composition, only: dry_air_species_num
214+ use air_composition, only: dry_air_species_num, thermodynamic_active_species_num, thermodynamic_active_species_idx
215215 use qneg_module , only: qneg3
216216
217217!- -----------------------------Arguments--------------------------------
@@ -231,6 +231,7 @@ subroutine physics_update(state, ptend, dt, tend)
231231 integer :: ixnumsnow, ixnumrain
232232 integer :: ncol ! number of columns
233233 integer :: ixh, ixh2 ! constituent indices for H, H2
234+ logical :: derive_new_geopotential ! derive new geopotential fields?
234235
235236 real (r8 ) :: zvirv(state% psetcols,pver) ! Local zvir array pointer
236237
@@ -419,9 +420,23 @@ subroutine physics_update(state, ptend, dt, tend)
419420 end do
420421 end if
421422
422- ! Derive new geopotential fields if heating or water tendency not 0.
423+ ! Derive new geopotential fields if heating or water species tendency not 0.
424+ derive_new_geopotential = .false.
425+ if (ptend% ls) then
426+ ! Heating tendency not 0
427+ derive_new_geopotential = .true.
428+ else
429+ ! Check all water species and if there are nonzero tendencies
430+ const_water_loop: do m = dry_air_species_num + 1 , thermodynamic_active_species_num
431+ if (ptend% lq(thermodynamic_active_species_idx(m))) then
432+ ! does water species have tendency?
433+ derive_new_geopotential = .true.
434+ exit const_water_loop
435+ endif
436+ enddo const_water_loop
437+ endif
423438
424- if (ptend % ls .or. ptend % lq( 1 ) ) then
439+ if (derive_new_geopotential ) then
425440 call geopotential_t ( &
426441 state% lnpint, state% lnpmid, state% pint , state% pmid , state% pdel , state% rpdel , &
427442 state% t , state% q(:,:,:), rairv_loc(:,:), gravit , zvirv , &
0 commit comments