From 7644b0c46f17c97a865b5e4231a29970d6bbd8ae Mon Sep 17 00:00:00 2001 From: Grant Firl Date: Tue, 16 Aug 2022 15:15:26 -0400 Subject: [PATCH] miscellaneous NRL-found checks on variables for stability and argument intent --- physics/cu_gf_deep.F90 | 8 ++++---- physics/h2ophys.f | 2 +- physics/radiation_astronomy.f | 4 +++- physics/sflx.f | 14 +++++--------- physics/ugwp_driver_v0.F | 2 +- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/physics/cu_gf_deep.F90 b/physics/cu_gf_deep.F90 index 7d4b1ce02..e1976d55c 100644 --- a/physics/cu_gf_deep.F90 +++ b/physics/cu_gf_deep.F90 @@ -2908,12 +2908,12 @@ subroutine cup_env(z,qes,he,hes,t,q,p,z1, & !$acc declare copyin(p,t,q) real(kind=kind_phys), dimension (its:ite,kts:kte) & ,intent (out ) :: & - he,hes,qes -!$acc declare copyout(he,hes,qes) + hes,qes +!$acc declare copyout(hes,qes) real(kind=kind_phys), dimension (its:ite,kts:kte) & ,intent (inout) :: & - z -!$acc declare copy(z) + he,z +!$acc declare copy(he,z) real(kind=kind_phys), dimension (its:ite) & ,intent (in ) :: & psur,z1 diff --git a/physics/h2ophys.f b/physics/h2ophys.f index 47bc200c9..f46868e58 100644 --- a/physics/h2ophys.f +++ b/physics/h2ophys.f @@ -122,7 +122,7 @@ subroutine h2ophys_run(im, levs, kh2o, dt, h2o, ph2o, prsl, & enddo endif do i=1,im - if (prsl(i,l) < prsmax) then + if (prsl(i,l) < prsmax .and. pltc(i,2) /= 0.0) then h2oib(i) = h2o(i,l) ! no filling tem = 1.0 / pltc(i,2) ! 1/teff h2o(i,l) = (h2oib(i) + (pltc(i,1)+pltc(i,3)*tem)*dt) diff --git a/physics/radiation_astronomy.f b/physics/radiation_astronomy.f index f5a683bf3..1d60c74ef 100644 --- a/physics/radiation_astronomy.f +++ b/physics/radiation_astronomy.f @@ -887,7 +887,9 @@ subroutine coszmn & do i = 1, IM coszdg(i) = coszen(i) * rstp - if (istsun(i) > 0) coszen(i) = coszen(i) / istsun(i) + if (istsun(i) > 0 .and. coszen(i) /= 0.0_kind_phys) then + coszen(i) = coszen(i) / istsun(i) + endif enddo ! return diff --git a/physics/sflx.f b/physics/sflx.f index c2fe18a0c..a020e217a 100644 --- a/physics/sflx.f +++ b/physics/sflx.f @@ -906,15 +906,11 @@ subroutine gfssflx &! --- input eta = etp endif -#ifdef SINGLE_PREC - IF (ETP == 0.0) THEN - BETA = 0.0 - ELSE - BETA = ETA/ETP - ENDIF -#else - beta = eta / etp -#endif + if (etp == 0.0) then + beta = 0.0 + else + beta = eta/etp + endif !> - Convert the sign of soil heat flux so that: !! - ssoil>0: warm the surface (night time) diff --git a/physics/ugwp_driver_v0.F b/physics/ugwp_driver_v0.F index 6d5d5c2e2..0f4ad447e 100644 --- a/physics/ugwp_driver_v0.F +++ b/physics/ugwp_driver_v0.F @@ -1343,7 +1343,7 @@ subroutine fv3_ugwp_solv2_v0(klon, klev, dtime, else kzw2 = zero endif - if ( kzw2 > zero ) then + if ( kzw2 > zero .and. cdf2 > zero) then v_kzw = sqrt(kzw2) ! !linsatdis: kzw2, kzw3, kdsat, c2f2, cdf2, cdf1