From f7034c7b99da5b7117c681f6c9cc991b3a41d923 Mon Sep 17 00:00:00 2001 From: "michael.lueken" Date: Fri, 25 Sep 2020 18:31:44 +0000 Subject: [PATCH] GitHub Issue NOAA-EMC/GSI#13. Continuing to clear through coding standard issues in the master. Finished through src/gsi/normal_rh_to_q.f90. --- src/gsi/nltransf.f90 | 30 +++++++++--------- src/gsi/normal_rh_to_q.f90 | 62 +++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/gsi/nltransf.f90 b/src/gsi/nltransf.f90 index 8eb251aeb6..03a06960f0 100644 --- a/src/gsi/nltransf.f90 +++ b/src/gsi/nltransf.f90 @@ -3,7 +3,7 @@ module nltransf !$$$ module documentation block ! module: nltransf ! program history log: -! 2018-01-18 yang/Guo ! Jim Purser's nonlinear transformation for vis and cldch. +! 2018-01-18 yang/Guo ! jim purser's nonlinear transformation for vis and cldch. ! will work on the document late !$$$ end documentation block ! . . . . @@ -15,13 +15,13 @@ module nltransf private public:: nltransf_forward - interface nltransf_forward ; module procedure forward; end interface + interface nltransf_forward ; module procedure forward; end interface public:: nltransf_inverse - interface nltransf_inverse ; module procedure inverse; end interface + interface nltransf_inverse ; module procedure inverse; end interface ! -CONTAINS +contains subroutine forward(zin,zout,powerp,scale_cv) @@ -33,20 +33,20 @@ subroutine forward(zin,zout,powerp,scale_cv) ! zout - the vis or cldch after the nonlinear transformation !-------------------------------------------------------------- implicit none - real(r_kind),intent(in):: zin - real(r_kind),intent(in):: powerp - real(r_kind),intent(in):: scale_cv - real(r_kind) :: zout + real(r_kind),intent(in) :: zin + real(r_kind),intent(in) :: powerp + real(r_kind),intent(in) :: scale_cv + real(r_kind),intent(out):: zout ! local variable real(r_kind) :: temp ! after the nltransformation ! do not choose negative powerp if (abs(powerp) > zero) then - !non-log conversion + !non-log conversion temp =(zin/scale_cv)**powerp zout =(temp-1.0_r_kind)/powerp else - !log conversion + !log conversion zout=log(zin/scale_cv) endif return @@ -54,10 +54,10 @@ end subroutine forward subroutine inverse(zin,zout,powerp,scale_cv) implicit none - real(r_kind),intent(in):: zin - real(r_kind),intent(in):: powerp - real(r_kind),intent(in):: scale_cv - real(r_kind) :: zout + real(r_kind),intent(in) :: zin + real(r_kind),intent(in) :: powerp + real(r_kind),intent(in) :: scale_cv + real(r_kind),intent(out):: zout ! Local variable real(r_kind) :: powerpinv @@ -65,7 +65,7 @@ subroutine inverse(zin,zout,powerp,scale_cv) !change zin from nltr space back to physical space if (abs(powerp)> zero) then - ! non-log conversion + ! non-log conversion powerpinv=1.0_r_kind/powerp z1=(powerp*zin + 1.0_r_kind) z1=z1**powerpinv diff --git a/src/gsi/normal_rh_to_q.f90 b/src/gsi/normal_rh_to_q.f90 index 5341f54c9b..576cc721b0 100644 --- a/src/gsi/normal_rh_to_q.f90 +++ b/src/gsi/normal_rh_to_q.f90 @@ -1,10 +1,10 @@ subroutine normal_rh_to_q(rhnorm,t,p,q) !$$$ subprogram documentation block ! . . . . -! subprogram: normal_rh_to_q tlm for normalized RH to q +! subprogram: normal_rh_to_q tlm for normalized rh to q ! prgmmr: wu org: np20 date: 2005-03-06 ! -! abstract: get specific humidity q from normalized RH +! abstract: get specific humidity q from normalized rh ! ! program history log: ! 2005-03-06 wu @@ -17,7 +17,7 @@ subroutine normal_rh_to_q(rhnorm,t,p,q) ! 2015-10-27 mahajan - code clean-up ! ! input argument list: -! rhnorm - normalized RH +! rhnorm - normalized rh ! t - virtual temperature ! p - psfc ! @@ -44,20 +44,20 @@ subroutine normal_rh_to_q(rhnorm,t,p,q) integer(i_kind) i,j,k ! Convert normalized rh to q - do k=1,nsig - do j=1,lon2 - do i=1,lat2 - q(i,j,k) = dqdrh(i,j,k)*rhnorm(i,j,k) - if ( qoption == 2 ) then - q(i,j,k) = q(i,j,k) + & - dqdt(i,j,k)*t(i,j,k) - & - dqdp(i,j,k)*(p(i,j,k) + p(i,j,k+1)) - endif - enddo - enddo - enddo + do k=1,nsig + do j=1,lon2 + do i=1,lat2 + q(i,j,k) = dqdrh(i,j,k)*rhnorm(i,j,k) + if ( qoption == 2 ) then + q(i,j,k) = q(i,j,k) + & + dqdt(i,j,k)*t(i,j,k) - & + dqdp(i,j,k)*(p(i,j,k) + p(i,j,k+1)) + endif + enddo + enddo + enddo - return + return end subroutine normal_rh_to_q @@ -82,7 +82,7 @@ subroutine normal_rh_to_q_ad(rhnorm,t,p,q) ! 2015-10-27 mahajan - code clean-up ! ! input argument list: -! rhnorm - normalized RH +! rhnorm - normalized rh ! t - virtual temperature ! p - psfc ! @@ -111,20 +111,20 @@ subroutine normal_rh_to_q_ad(rhnorm,t,p,q) integer(i_kind) i,j,k ! Adjoint of convert normalized rh to q - do k=1,nsig - do j=1,lon2 - do i=1,lat2 - rhnorm(i,j,k) = rhnorm(i,j,k) + dqdrh(i,j,k)*q(i,j,k) - if ( qoption == 2 ) then - t(i,j,k ) = t(i,j,k ) + dqdt(i,j,k)*q(i,j,k) - p(i,j,k ) = p(i,j,k ) - dqdp(i,j,k)*q(i,j,k) - p(i,j,k+1) = p(i,j,k+1) - dqdp(i,j,k)*q(i,j,k) - endif - q(i,j,k) = zero - enddo - enddo - enddo + do k=1,nsig + do j=1,lon2 + do i=1,lat2 + rhnorm(i,j,k) = rhnorm(i,j,k) + dqdrh(i,j,k)*q(i,j,k) + if ( qoption == 2 ) then + t(i,j,k ) = t(i,j,k ) + dqdt(i,j,k)*q(i,j,k) + p(i,j,k ) = p(i,j,k ) - dqdp(i,j,k)*q(i,j,k) + p(i,j,k+1) = p(i,j,k+1) - dqdp(i,j,k)*q(i,j,k) + endif + q(i,j,k) = zero + enddo + enddo + enddo - return + return end subroutine normal_rh_to_q_ad