From 3fc213be6ca2f3765510b33f1f112a7fd2bcb487 Mon Sep 17 00:00:00 2001 From: kayee Date: Fri, 1 Apr 2022 18:00:00 -0600 Subject: [PATCH 1/4] This is part of Issue #392. Fixes the doxygen warnings in CALVOR.f, CALWXT_BOURG.f, CLDRAD.f, COLLECT.f, COLLECT_LOC.f, DEALLOCATE.f, and DEALLOCATE.f. --- sorc/ncep_post.fd/CALVOR.f | 171 ++++++++++----------------- sorc/ncep_post.fd/CALWXT_BOURG.f | 114 ++++++++---------- sorc/ncep_post.fd/CLDRAD.f | 193 ++++++++++++------------------- sorc/ncep_post.fd/COLLECT.f | 44 +++---- sorc/ncep_post.fd/COLLECT_LOC.f | 44 +++---- sorc/ncep_post.fd/DEALLOCATE.f | 44 ++----- sorc/ncep_post.fd/DEWPOINT.f | 87 +++++++------- 7 files changed, 260 insertions(+), 437 deletions(-) diff --git a/sorc/ncep_post.fd/CALVOR.f b/sorc/ncep_post.fd/CALVOR.f index ea5bb3deb..73a0032b3 100644 --- a/sorc/ncep_post.fd/CALVOR.f +++ b/sorc/ncep_post.fd/CALVOR.f @@ -1,47 +1,28 @@ !> @file -! -!> SUBPROGRAM: CALVOR COMPUTES ABSOLUTE VORTICITY -!! PRGRMMR: TREADON ORG: W/NP2 DATE: 92-12-22 -!! -!! ABSTRACT: -!! THIS ROUTINE COMPUTES THE ABSOLUTE VORTICITY. -!! -!! PROGRAM HISTORY LOG: -!! 92-12-22 RUSS TREADON -!! 98-06-08 T BLACK - CONVERSION FROM 1-D TO 2-D -!! 00-01-04 JIM TUCCILLO - MPI VERSION -!! 02-01-15 MIKE BALDWIN - WRF VERSION C-GRID -!! 05-03-01 H CHUANG - ADD NMM E GRID -!! 05-05-17 H CHUANG - ADD POTENTIAL VORTICITY CALCULATION -!! 05-07-07 B ZHOU - ADD RSM IN COMPUTING DVDX, DUDY AND UAVG -!! 13-08-09 S MOORTHI - Optimize the vorticity loop including threading -!! 16-08-05 S Moorthi - add zonal filetering -!! 2019-10-17 Y Mao - Skip calculation when U/V is SPVAL -!! 2020-11-06 J Meng - USE UPP_MATH MODULE - - -!! -!! USAGE: CALL CALVOR(UWND,VWND,ABSV) -!! INPUT ARGUMENT LIST: -!! UWND - U WIND (M/S) MASS-POINTS -!! VWND - V WIND (M/S) MASS-POINTS -!! -!! OUTPUT ARGUMENT LIST: -!! ABSV - ABSOLUTE VORTICITY (1/S) MASS-POINTS -!! -!! OUTPUT FILES: -!! NONE -!! -!! SUBPROGRAMS CALLED: -!! UTILITIES: -!! NONE -!! LIBRARY: -!! COMMON - CTLBLK -!! -!! ATTRIBUTES: -!! LANGUAGE: FORTRAN -!! MACHINE : WCOSS -!! +!> @brief Subroutine that computes absolute vorticity. +!> +!> This routine computes the absolute vorticity. +!> +!> @param[in] UWND U wind (m/s) mass-points. +!> @param[in] VWND V wind (m/s) mass-points. +!> @param[out] ABSV absolute vorticity (1/s) mass-points. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 1992-12-22 | Russ Treadon | Initial +!> 1998-06-08 | T Black | Convesion from 1-D to 2-D +!> 2000-01-04 | Jim Tuccillo | MPI Version +!> 2002-01-15 | Mike Baldwin | WRF Version C-grid +!> 2005-03-01 | H Chuang | Add NMM E grid +!> 2005-05-17 | H Chuang | Add Potential vorticity calculation +!> 2005-07-07 | B Zhou | Add RSM in computing DVDX, DUDY and UAVG +!> 2013-08-09 | S Moorthi | Optimize the vorticity loop including threading +!> 2016-08-05 | S Moorthi | add zonal filetering +!> 2019-10-17 | Y Mao | Skip calculation when U/V is SPVAL +!> 2020-11-06 | J Meng | Use UPP_MATH Module +!> +!> @author Russ Treadon W/NP2 @date 1992-12-22 SUBROUTINE CALVOR(UWND,VWND,ABSV) ! @@ -411,43 +392,27 @@ SUBROUTINE CALVOR(UWND,VWND,ABSV) END SUBROUTINE CALDIV(UWND,VWND,DIV) -!$$$ SUBPROGRAM DOCUMENTATION BLOCK -! . . . -! SUBPROGRAM: CALDIV COMPUTES DIVERGENCE -! PRGRMMR: SAJAL KAR ORG: W/NP2 DATE: 16-05-05 -! -! ABSTRACT: -! FOR GFS, THIS ROUTINE COMPUTES THE HORIZONTAL DIVERGENCE -! USING 2ND-ORDER CENTERED SCHEME ON A LAT-LON GRID -! -! PROGRAM HISTORY LOG: -! 16-05-05 SAJAL KAR MODIFIED CALVORT TO COMPUTE DIVERGENCE FROM -! WIND COMPONENTS -! 16-07-22 S Moorthi modifying polar divergence calculation -! -! USAGE: CALL CALDIV(UWND,VWND,DIV) -! INPUT ARGUMENT LIST: -! UWND - U WIND (M/S) MASS-POINTS -! VWND - V WIND (M/S) MASS-POINTS -! -! OUTPUT ARGUMENT LIST: -! DIV - DIVERGENCE (1/S) MASS-POINTS -! -! OUTPUT FILES: -! NONE -! -! SUBPROGRAMS CALLED: -! UTILITIES: -! NONE -! LIBRARY: -! COMMON - CTLBLK -! -! ATTRIBUTES: -! LANGUAGE: FORTRAN -! MACHINE : WCOSS -!$$$ +!> CALDIV computes divergence. +!> +!> For GFS, this routine copmutes the horizontal divergence +!> using 2nd-order centered scheme on a lat-lon grid +!> +!> @param[in] UWND U wind (m/s) mass-points. +!> @param[in] VWND V wind (m/s) mass-points. +!> @param[out] DIV divergence (1/s) mass-points. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 2016-05-05 | Sajal Kar | Modified CALVORT to compute divergence from wind components +!> 2016-07-22 | S Moorthi | Modified polar divergence calculation +!> +!> @author Sajal Kar W/NP2 @date 2016-05-05 + SUBROUTINE CALVOR(UWND,VWND,ABSV) + ! ! + use vrbls2d, only: f use masks, only: gdlat, gdlon use params_mod, only: d00, dtr, small, erad use ctlblk_mod, only: jsta_2l, jend_2u, spval, modelname, global, & @@ -683,41 +648,21 @@ SUBROUTINE CALDIV(UWND,VWND,DIV) END SUBROUTINE CALDIV SUBROUTINE CALGRADPS(PS,PSX,PSY) -!$$$ SUBPROGRAM DOCUMENTATION BLOCK -! . . . -! SUBPROGRAM: CALGRADPS COMPUTES GRADIENTS OF A SCALAR FIELD PS OR LNPS -! PRGRMMR: SAJAL KAR ORG: W/NP2 DATE: 16-05-05 -! -! ABSTRACT: -! FOR GFS, THIS ROUTINE COMPUTES HRIZONTAL GRADIENTS OF PS OR LNPS -! USING 2ND-ORDER CENTERED SCHEME ON A LAT-LON GRID -! -! PROGRAM HISTORY LOG: -! 16-05-05 SAJAL KAR REDUCED FROM CALVORT TO ZONAL AND MERIDIONAL -! GRADIENTS OF GIVEN SURFACE PRESSURE PS, OR LNPS -! -! USAGE: CALL CALGRADPS(PS,PSX,PSY) -! INPUT ARGUMENT LIST: -! PS - SURFACE PRESSURE (PA) MASS-POINTS -! -! OUTPUT ARGUMENT LIST: -! PSX - ZONAL GRADIENT OF PS AT MASS-POINTS -! PSY - MERIDIONAL GRADIENT OF PS AT MASS-POINTS -! -! OUTPUT FILES: -! NONE -! -! SUBPROGRAMS CALLED: -! UTILITIES: -! NONE -! LIBRARY: -! COMMON - CTLBLK -! -! ATTRIBUTES: -! LANGUAGE: FORTRAN -! MACHINE : WCOSS -!$$$ -! +!> CALGRADPS computes gardients of a scalar field PS or LNPS. +!> +!> For GFS, this routine computes horizontal gradients of PS or LNPS. +!> Using 2nd-order centered scheme on a lat-lon grid. +!> +!> @param[in] PS Surface pressure (Pa) mass-points. +!> @param[out] PSX Zonal gradient of PS at mass-points. +!> @param[out] PSY Meridional gradient of PS at mass-points. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 2016-05-05 | Sajal Kar | Reduced from CALVORT to zonal and meridional gradients of given surface pressure PS, or LNPS +!> +!> @author Sajal Kar W/NP2 @date 2016-05-05 use masks, only: gdlat, gdlon use params_mod, only: dtr, d00, small, erad use ctlblk_mod, only: jsta_2l, jend_2u, spval, modelname, global, & diff --git a/sorc/ncep_post.fd/CALWXT_BOURG.f b/sorc/ncep_post.fd/CALWXT_BOURG.f index aef3300f1..fa584b8b5 100644 --- a/sorc/ncep_post.fd/CALWXT_BOURG.f +++ b/sorc/ncep_post.fd/CALWXT_BOURG.f @@ -1,68 +1,54 @@ !> @file -! -!> Subprogram: calwxt_bourg Calculate precipitation type (Bourgouin) -!! Prgmmr: Baldwin Org: np22 Date: 1999-07-06 -!! -!! Abstract: This routine computes precipitation type -!! using a decision tree approach that uses the so-called -!! "energy method" of Bourgouin of AES (Canada) 1992 -!! -!! Program history log: -!! 1999-07-06 M Baldwin -!! 1999-09-20 M Baldwin make more consistent with bourgouin (1992) -!! 2005-08-24 G Manikin added to wrf post -!! 2007-06-19 M Iredell mersenne twister, best practices -!! 2015-00-00 S Moorthi changed random number call and optimization and cleanup -!! -!! Usage: call calwxt_bourg(im,jm,jsta_2l,jend_2u,jsta,jend,lm,lp1, & -!! & iseed,g,pthresh, & -!! & t,q,pmid,pint,lmh,prec,zint,ptype) -!! Input argument list: -!! im integer i dimension -!! jm integer j dimension -!! jsta_2l integer j dimension start point (including haloes) -!! jend_2u integer j dimension end point (including haloes) -!! jsta integer j dimension start point (excluding haloes) -!! jend integer j dimension end point (excluding haloes) -!! lm integer k dimension -!! lp1 integer k dimension plus 1 -!! iseed integer random number seed -!! g real gravity (m/s**2) -!! pthresh real precipitation threshold (m) -!! t real(im,jsta_2l:jend_2u,lm) mid layer temp (K) -!! q real(im,jsta_2l:jend_2u,lm) specific humidity (kg/kg) -!! pmid real(im,jsta_2l:jend_2u,lm) mid layer pressure (Pa) -!! pint real(im,jsta_2l:jend_2u,lp1) interface pressure (Pa) -!! lmh real(im,jsta_2l:jend_2u) max number of layers -!! prec real(im,jsta_2l:jend_2u) precipitation (m) -!! zint real(im,jsta_2l:jend_2u,lp1) interface height (m) -!! Output argument list: -!! ptype integer(im,jm) instantaneous weather type () -!! acts like a 4 bit binary -!! 1111 = rain/freezing rain/ice pellets/snow -!! where the one's digit is for snow -!! the two's digit is for ice pellets -!! the four's digit is for freezing rain -!! and the eight's digit is for rain -!! in other words... -!! ptype=1 snow -!! ptype=2 ice pellets/mix with ice pellets -!! ptype=4 freezing rain/mix with freezing rain -!! ptype=8 rain -!! -!! Modules used: -!! mersenne_twister pseudo-random number generator -!! -!! Subprograms called: -!! random_number pseudo-random number generator -!! -!! Attributes: -!! Language: Fortran 90 -!! -!! Remarks: vertical order of arrays must be layer 1 = top -!! and layer lmh = bottom -!! -!! +!> @brief Subroutine that calculate precipitation type (Bourgouin). +!> +!> This routine computes precipitation type. +!> using a decision tree approach that uses the so-called +!> "energy method" of Bourgouin of AES (Canada) 1992. +!> +!> @param[in] im integer i dimension. +!> @param[in] jm integer j dimension. +!> @param[in] jsta_2l integer j dimension start point (including haloes). +!> @param[in] jend_2u integer j dimension end point (including haloes). +!> @param[in] jsta integer j dimension start point (excluding haloes). +!> @param[in] jend integer j dimension end point (excluding haloes). +!> @param[in] lm integer k dimension. +!> @param[in] lp1 integer k dimension plus 1. +!> @param[in] iseed integer random number seed. +!> @param[in] g real gravity (m/s**2). +!> @param[in] pthresh real precipitation threshold (m). +!> @param[in] t real(im,jsta_2l:jend_2u,lm) mid layer temp (K). +!> @param[in] q real(im,jsta_2l:jend_2u,lm) specific humidity (kg/kg). +!> @param[in] pmid real(im,jsta_2l:jend_2u,lm) mid layer pressure (Pa). +!> @param[in] pint real(im,jsta_2l:jend_2u,lp1) interface pressure (Pa). +!> @param[in] lmh real(im,jsta_2l:jend_2u) max number of layers. +!> @param[in] prec real(im,jsta_2l:jend_2u) precipitation (m). +!> @param[in] zint real(im,jsta_2l:jend_2u,lp1) interface height (m). +!> @param[out] ptype integer(im,jm) instantaneous weather type () acts like a 4 bit binary 1111 = rain/freezing rain/ice pellets/snow. +!>
+!>                   where the one's digit is for snow
+!>                         the two's digit is for ice pellets
+!>                         the four's digit is for freezing rain
+!>                         and the eight's digit is for rain
+!>                         in other words...
+!>                         ptype=1 snow
+!>                         ptype=2 ice pellets/mix with ice pellets
+!>                         ptype=4 freezing rain/mix with freezing rain
+!>                         ptype=8 rain
+!>
+!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 1999-07-06 | M Baldwin | Initial +!> 1999-09-20 | M Baldwin | make more consistent with bourgouin (1992) +!> 2005-08-24 | G Manikin | added to wrf post +!> 2007-06-19 | M Iredell | mersenne twister, best practices +!> 2015-??-?? | S Moorthi | changed random number call and optimization and cleanup +!> +!> Remarks: vertical order of arrays must be layer 1 = top +!> and layer lmh = bottom +!> +!> @author M Baldwin np22 @date 1999-07-06 subroutine calwxt_bourg_post(im,jm,jsta_2l,jend_2u,jsta,jend,lm,lp1, & & iseed,g,pthresh, & diff --git a/sorc/ncep_post.fd/CLDRAD.f b/sorc/ncep_post.fd/CLDRAD.f index 461fcac48..2fc50ea00 100644 --- a/sorc/ncep_post.fd/CLDRAD.f +++ b/sorc/ncep_post.fd/CLDRAD.f @@ -1,99 +1,71 @@ !> @file -! . . . -!> SUBPROGRAM: CLDRAD POST SNDING/CLOUD/RADTN FIELDS -!! PRGRMMR: TREADON ORG: W/NP2 DATE: 93-08-30 -!! -!! ABSTRACT: THIS ROUTINE COMPUTES/POSTS SOUNDING, CLOUD -!! RELATED, AND RADIATION FIELDS. UNDER THE HEADING OF -!! SOUNDING FIELDS FALL THE THREE ETA MODEL LIFTED INDICES, -!! CAPE, CIN, AND TOTAL COLUMN PRECIPITABLE WATER. -!! -!! THE THREE ETA MODEL LIFTED INDICES DIFFER ONLY IN THE -!! DEFINITION OF THE PARCEL TO LIFT. ONE LIFTS PARCELS FROM -!! THE LOWEST ABOVE GROUND ETA LAYER. ANOTHER LIFTS MEAN -!! PARCELS FROM ANY OF NBND BOUNDARY LAYERS (SEE SUBROUTINE -!! BNDLYR). THE FINAL TYPE OF LIFTED INDEX IS A BEST LIFTED -!! INDEX BASED ON THE NBND BOUNDARY LAYER LIFTED INDICES. -!! -!! TWO TYPES OF CAPE/CIN ARE AVAILABLE. ONE IS BASED ON PARCELS -!! IN THE LOWEST ETA LAYER ABOVE GROUND. THE OTHER IS BASED -!! ON A LAYER MEAN PARCEL IN THE N-TH BOUNDARY LAYER ABOVE -!! THE GROUND. SEE SUBROUTINE CALCAPE FOR DETAILS. -!! -!! THE CLOUD FRACTION AND LIQUID CLOUD WATER FIELDS ARE DIRECTLY -!! FROM THE MODEL WITH MINIMAL POST PROCESSING. THE LIQUID -!! CLOUD WATER, 3-D CLOUD FRACTION, AND TEMPERATURE TENDENCIES -!! DUE TO PRECIPITATION ARE NOT POSTED IN THIS ROUTINE. SEE -!! SUBROUTINE ETAFLD FOR THESE FIELDS. LIFTING CONDENSATION -!! LEVEL HEIGHT AND PRESSURE ARE COMPUTED AND POSTED IN -!! SUBROUTINE MISCLN. -!! -!! THE RADIATION FIELDS POSTED BY THIS ROUTINE ARE THOSE COMPUTED -!! DIRECTLY IN THE MODEL. -!! -!! PROGRAM HISTORY LOG: -!! 93-08-30 RUSS TREADON -!! 94-08-04 MICHAEL BALDWIN - ADDED OUTPUT OF INSTANTANEOUS SFC -!! FLUXES OF NET SW AND LW DOWN RADIATION -!! 97-04-25 MICHAEL BALDWIN - FIX PDS FOR PRECIPITABLE WATER -!! 97-04-29 GEOFF MANIKIN - MOVED CLOUD TOP TEMPS CALCULATION -!! TO THIS SUBROUTINE. CHANGED METHOD -!! OF DETERMINING WHERE CLOUD BASE AND -!! TOP ARE FOUND AND ADDED HEIGHT OPTION -!! FOR TOP AND BASE. -!! 98-04-29 GEOFF MANIKIN - CHANGED VALUE FOR CLOUD BASE/TOP PRESSURES -!! AND HEIGHTS FROM SPVAL TO -500 -!! 98-06-15 T BLACK - CONVERSION FROM 1-D TO 2-D -!! 98-07-17 MIKE BALDWIN - REMOVED LABL84 -!! 00-01-04 JIM TUCCILLO - MPI VERSION -!! 00-02-22 GEOFF MANIKIN - CHANGED VALUE FOR CLOUD BASE/TOP PRESSURES -!! AND HEIGHTS FROM SPVAL TO -500 (WAS NOT IN -!! PREVIOUS IBM VERSION) -!! 01-10-22 H CHUANG - MODIFIED TO PROCESS HYBRID MODEL OUTPUT -!! 02-01-15 MIKE BALDWIN - WRF VERSION -!! 05-01-06 H CHUANG - ADD VARIOUS CLOUD FIELDS -!! 05-07-07 BINBIN ZHOU - ADD RSM MODEL -!! 05-08-30 BINBIN ZHOU - ADD CEILING and FLIGHT CONDITION RESTRICTION -!! 10-09-09 GEOFF MANIKIN - REVISED CALL TO CALCAPE -!! 11-02-06 Jun Wang - ADD GRIB2 OPTION -!! 11-12-14 SARAH LU - ADD AEROSOL OPTICAL PROPERTIES -!! 11-12-16 SARAH LU - ADD AEROSOL 2D DIAG FIELDS -!! 11-12-23 SARAH LU - CONSOLIDATE ALL GOCART FIELDS TO BLOCK 4 -!! 11-12-23 SARAH LU - ADD AOD AT ADDITIONAL CHANNELS -!! 12-04-03 Jun Wang - Add lftx and GFS convective cloud cover for grib2 -!! 13-05-06 Shrinivas Moorthi - Add cloud condensate to total precip water -!! 13-12-23 LU/Wang - READ AEROSOL OPTICAL PROPERTIES LUTS to compute dust aod, -!! non-dust aod, and use geos5 gocart LUTS -!! 15-??-?? S. Moorthi - threading, optimization, local dimension -!! 19-07-24 Li(Kate) Zhang Merge and update ARAH Lu's work from NGAC into FV3-Chem -!! 19-10-30 Bo CUI - Remove "GOTO" statement -!! 20-03-25 Jesse Meng - remove grib1 -!! 20-05-20 Jesse Meng - CALRH unification with NAM scheme -!! 20-11-10 Jesse Meng - USE UPP_PHYSICS MODULE -!! 21-02-08 Anning Cheng, read aod550, aod550_du/su/ss/oc/bc -!! directly from fv3gfs and output to grib2 by setting rdaod -!! 21-04-01 Jesse Meng - COMPUTATION ON DEFINED POINTS ONLY -!! -!! USAGE: CALL CLDRAD -!! INPUT ARGUMENT LIST: -!! -!! OUTPUT ARGUMENT LIST: -!! NONE -!! -!! OUTPUT FILES: -!! NONE -!! -!! SUBPROGRAMS CALLED: -!! UTILITIES: -!! NONE -!! LIBRARY: -!! COMMON - RQSTFLD -!! CTLBLK -!! -!! ATTRIBUTES: -!! LANGUAGE: FORTRAN -!! MACHINE : IBM SP -!! +!> @brief Subroutine that post SNDING/CLOUD/RADTN fields. +!> +!> This routine computes/posts sounding cloud +!> related, and radiation fields. Under the heading of +!> sounding fields fall the three ETA model lifted indices, +!> CAPE, CIN, and total column precipitable water. +!> +!> The three ETA model lifted indices differ only in the +!> definition of the parcel to lift. One lifts parcels from +!> the lowest above ground ETA layer. Another lifts mean +!> parcels from any of NBND boundary layers (See subroutine +!> BNDLYR). The final type of lifted index is a best lifted +!> inden based on the NBND bouddary layer lifted indices. +!> +!> Two types of CAPE/CIN are available. One is based on parcels +!> in the lowest ETA layer above ground. The other is based +!> on a layer mean parcel in the N-th boundary layer above +!> the ground. See subroutine CALCAPE for details. +!> +!> The cloud fraction and liquid cloud water fields are directly +!> from the model with minimal post processing. The liquid +!> cloud water, 3-D cloud fraction, and temperature tendencies +!> due to precipotation are not posted in this routine. See +!> sunroutine ETAFLD for these fields. Lifting condensation +!> level height and pressure are computed and posted in +!> subroutine MISCLN. +!> +!> The radiation fields posted by this routine are those computed +!> directly in the model. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 1993-08-30 | Russ Treadon | Initial +!> 1994-08-04 | Mike Baldwin | Added output of instantaneous SFC fluxes of net SW and LW down radiation +!> 1997-04-25 | Mike Baldwin | Fix PDS for precipitable water +!> 1997-04-29 | Geoff Manikin | Moved cloud top temps calculation to this subroutine. Changed method of determining where cloud base and top are found and added height option for top and base +!> 1998-04-29 | Geoff Manikin | Changed value for cloud base/top pressures and heights from SPVAL to -500 +!> 1998-06-15 | T Black | Conversion from 1-D to 2-D +!> 1998-07-17 | Mike Baldwin | Removed LABL84 +!> 2000-01-04 | Jim Tuccillo | MPI Version +!> 2000-02-22 | Geoff Manikin | Changed value for cloud base/top pressures and heights from SPVAL to -500 (was not in previous IBM version) +!> 2001-10-22 | H Chuang | Modified to process hybrid model output +!> 2002-01-15 | Mike Baldwin | WRF version +!> 2005-01-06 | H Chuang | Add various cloud fields +!> 2005-07-07 | Binbin Zhou | Add RSM model +!> 2005-08-30 | Binbin Zhou | Add ceiling and flight condition restriction +!> 2010-09-09 | Geoff Manikin | Revised call to CALCAPE +!> 2011-02-06 | Jun Wang | Add GRIB2 Option +!> 2011-12-14 | Sarah Lu | Add Aerosol optical properties +!> 2011-12-16 | Sarah Lu | Add Aerosol 2D DIAG fields +!> 2011-12-23 | Sarah Lu | Consolidate all GOCART fields to BLOCK 4 +!> 2011-12-23 | Sarah Lu | Add AOD at additional channels +!> 2012-04-03 | Jun Wang | Add lftx and GFS convective cloud cover for grib2 +!> 2013-05-06 | Shrinivas Moorthi | Add cloud condensate to total precip water +!> 2013-12-23 | Lu/Wang | Read aerosol optical properties LUTS to compute dust aod, non-dust aod, and use geos5 gocart LUTS +!> 2015-??-?? | S. Moorthi | threading, optimization, local dimension +!> 2019-07-24 | Li(Kate) Zhang | Merge and update ARAH Lu's work from NGAC into FV3-Chem +!> 2019-10-30 | Bo CUI | Remove "GOTO" statement +!> 2020-03-25 | Jesse Meng | Remove grib1 +!> 2020-05-20 | Jesse Meng | CALRH unification with NAM scheme +!> 2020-11-10 | Jesse Meng | Use UPP_PHYSICS Module +!> 2021-02-08 | Anning Cheng | read aod550, aod550_du/su/ss/oc/bc directly from fv3gfs and output to grib2 by setting rdaod +!> 2021-04-01 | Jesse Meng | Computation on defined points only +!> +!> @author Russ Treadon W/NP2 @date 1993-08-30 + SUBROUTINE CLDRAD ! @@ -107,19 +79,18 @@ SUBROUTINE CLDRAD HBOT, HBOTD, HBOTS, HTOP, HTOPD, HTOPS, FIS, PBLH, & PBOT, PBOTL, PBOTM, PBOTH, CNVCFR, PTOP, PTOPL, & PTOPM, PTOPH, TTOPL, TTOPM, TTOPH, PBLCFR, CLDWORK, & - ASWIN, AUVBIN, AUVBINC, ASWOUT,ALWOUT, ASWTOA, & + ASWIN, AUVBIN, AUVBINC, ASWIN, ASWOUT,ALWOUT, ASWTOA,& RLWTOA, CZMEAN, CZEN, RSWIN, ALWIN, ALWTOA, RLWIN, & SIGT4, RSWOUT, RADOT, RSWINC, ASWINC, ASWOUTC, & ASWTOAC, ALWOUTC, ASWTOAC, AVISBEAMSWIN, & - AVISDIFFSWIN, ASWINTOA, ASWTOAC, AIRBEAMSWIN, & + AVISDIFFSWIN, ASWINTOA, ASWINC, ASWTOAC, AIRBEAMSWIN,& AIRDIFFSWIN, DUSMASS, DUSMASS25, DUCMASS, DUCMASS25, & ALWINC, ALWTOAC, SWDDNI, SWDDIF, SWDNBC, SWDDNIC, & SWDDIFC, SWUPBC, LWDNBC, LWUPBC, SWUPT, & TAOD5502D, AERSSA2D, AERASY2D, MEAN_FRP, LWP, IWP, & AVGCPRATE, & DUSTCB,SSCB,BCCB,OCCB,SULFCB,DUSTPM,SSPM,aod550, & - du_aod550,ss_aod550,su_aod550,oc_aod550,bc_aod550, & - PWAT + du_aod550,ss_aod550,su_aod550,oc_aod550,bc_aod550 use masks, only: LMH, HTM use params_mod, only: TFRZ, D00, H99999, QCLDMIN, SMALL, D608, H1, ROG, & GI, RD, QCONV, ABSCOEFI, ABSCOEF, STBOL, PQ0, A2, & @@ -255,7 +226,6 @@ SUBROUTINE CLDRAD data INDX_EXT / 610, 611, 612, 613, 614 / data INDX_SCA / 651, 652, 653, 654, 655 / logical, parameter :: debugprint = .false. - logical :: Model_Pwat ! ! !************************************************************************* @@ -419,29 +389,12 @@ SUBROUTINE CLDRAD IF (IGET(080) > 0) THEN ! dong GRID1 = spval - Model_Pwat = .false. - DO J=JSTA,JEND - DO I=1,IM - IF(ABS(PWAT(I,J)-SPVAL)>SMALL) THEN - Model_Pwat = .true. - exit - ENDIF - END DO - END DO - IF (Model_Pwat) THEN - DO J=JSTA,JEND - DO I=1,IM - GRID1(I,J) = PWAT(I,J) - END DO - END DO - ELSE CALL CALPW(GRID1(1,jsta),1) DO J=JSTA,JEND DO I=1,IM IF(FIS(I,J) >= SPVAL) GRID1(I,J)=spval END DO END DO - ENDIF CALL BOUND(GRID1,D00,H99999) if(grib == "grib2" )then cfld = cfld + 1 @@ -5613,9 +5566,9 @@ SUBROUTINE CLDRAD END subroutine cb_cover(cbcov) -! Calculate CB coverage by using fuzzy logic -! Evaluate membership of val in a fuzzy set fuzzy. -! Assume f is in x-log scale +!> Calculate CB coverage by using fuzzy logic +!> Evaluate membership of val in a fuzzy set fuzzy. +!> Assume f is in x-log scale use ctlblk_mod, only: SPVAL,JSTA,JEND,IM implicit none real, intent(inout) :: cbcov(IM,JSTA:JEND) diff --git a/sorc/ncep_post.fd/COLLECT.f b/sorc/ncep_post.fd/COLLECT.f index bcc8fab57..fc1a56f8f 100644 --- a/sorc/ncep_post.fd/COLLECT.f +++ b/sorc/ncep_post.fd/COLLECT.f @@ -1,35 +1,17 @@ !> @file -! -!> SUBPROGRAM: COLLECT GATHERS FROM ALL MPI TASKS -!! PRGRMMR: TUCCILLO ORG: IBM -!! -!! ABSTRACT: -!! GATHER "A" FROM ALL MPI TASKS ONTO TASK 0 -!! -!! PROGRAM HISTORY LOG: -!! 00-01-06 TUCCILLO - ORIGINAL -!! -!! USAGE: CALL COLLECT(A) -!! INPUT ARGUMENT LIST: -!! A - ARRAY BEING GATHERED -!! -!! OUTPUT ARGUMENT LIST: -!! A - GATHERED ARRAY - ONLY VALID ON TASK 0 -!! -!! OUTPUT FILES: -!! STDOUT - RUN TIME STANDARD OUT. -!! -!! SUBPROGRAMS CALLED: -!! MPI_GATHERV -!! UTILITIES: -!! NONE -!! LIBRARY: -!! COMMON - CTLBLK.comm -!! -!! ATTRIBUTES: -!! LANGUAGE: FORTRAN -!! MACHINE : IBM RS/6000 SP -!! +!> @brief Subroutine that collect gathers from all MPI tasks. +!> +!> @param[in] A Array being gathered. +!> @param[out] A gathered array - only valid on task 0. +!> +!> Gather "A" from all MPI tasks onto task 0. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 2000-01-06 | Jim Tuccillo | Initial +!> +!> @author Jim Tuccillo IBM @date 2000-01-06 SUBROUTINE COLLECT (A, B) diff --git a/sorc/ncep_post.fd/COLLECT_LOC.f b/sorc/ncep_post.fd/COLLECT_LOC.f index 589cee1ba..7f9c60e9d 100644 --- a/sorc/ncep_post.fd/COLLECT_LOC.f +++ b/sorc/ncep_post.fd/COLLECT_LOC.f @@ -1,35 +1,17 @@ !> @file -! -!> SUBPROGRAM: COLLECT GATHERS FROM ALL MPI TASKS -!! PRGRMMR: TUCCILLO ORG: IBM -!! -!! ABSTRACT: -!! GATHER "A" FROM ALL MPI TASKS ONTO TASK 0 -!! -!! PROGRAM HISTORY LOG: -!! 00-01-06 TUCCILLO - ORIGINAL -!! -!! USAGE: CALL COLLECT(A) -!! INPUT ARGUMENT LIST: -!! A - ARRAY BEING GATHERED -!! -!! OUTPUT ARGUMENT LIST: -!! A - GATHERED ARRAY - ONLY VALID ON TASK 0 -!! -!! OUTPUT FILES: -!! STDOUT - RUN TIME STANDARD OUT. -!! -!! SUBPROGRAMS CALLED: -!! MPI_GATHERV -!! UTILITIES: -!! NONE -!! LIBRARY: -!! COMMON - CTLBLK.comm -!! -!! ATTRIBUTES: -!! LANGUAGE: FORTRAN -!! MACHINE : IBM RS/6000 SP -!! +!> @brief Subroutine that collect gathers from all MPI tasks. +!> +!> @param[in] A Array being gathered. +!> @param[out] A gathered array - only valid on task 0. +!> +!> Gather "A" from all MPI tasks onto task 0. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 2000-01-06 | Jim Tuccillo | Initial +!> +!> @author Jim Tuccillo IBM @date 2000-01-06 SUBROUTINE COLLECT_LOC ( A, B ) diff --git a/sorc/ncep_post.fd/DEALLOCATE.f b/sorc/ncep_post.fd/DEALLOCATE.f index f16cf8b6e..fe8204072 100644 --- a/sorc/ncep_post.fd/DEALLOCATE.f +++ b/sorc/ncep_post.fd/DEALLOCATE.f @@ -1,35 +1,16 @@ !> @file -! -!> SUBPROGRAM: MPI_FIRST SET UP MESSGAE PASSING INFO -!! PRGRMMR: TUCCILLO ORG: IBM -!! -!! ABSTRACT: -!! SETS UP MESSAGE PASSING INFO -!! -!! PROGRAM HISTORY LOG: -!! 00-01-06 TUCCILLO - ORIGINAL -!! 01-10-25 H CHUANG - MODIFIED TO PROCESS HYBRID MODEL OUTPUT -!! 02-06-19 MIKE BALDWIN - WRF VERSION -!! -!! USAGE: CALL MPI_FIRST -!! INPUT ARGUMENT LIST: -!! -!! OUTPUT ARGUMENT LIST: -!! -!! OUTPUT FILES: -!! STDOUT - RUN TIME STANDARD OUT. -!! -!! SUBPROGRAMS CALLED: -!! PARA_RANGE -!! UTILITIES: -!! NONE -!! LIBRARY: -!! COMMON - CTLBLK.comm -!! -!! ATTRIBUTES: -!! LANGUAGE: FORTRAN -!! MACHINE : IBM RS/6000 SP -!! +!> @brief MPI_FIRST set up message passing info. +!> +!> This routine sets up message passing info. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 2000-01-06 | Jim Tuccillo | Initial +!> 2001-10-25 | H Chuang | Modified to process hybrid model output +!> 2002-06-19 | Mike Baldwin | WRF version +!> +!> @author Jim Tuccillo IBM @date 2000-01-06 SUBROUTINE DE_ALLOCATE ! @@ -386,7 +367,6 @@ SUBROUTINE DE_ALLOCATE deallocate(tedir) deallocate(twa) deallocate(fdnsst) - deallocate(pwat) ! GSD deallocate(rainc_bucket) deallocate(rainc_bucket1) diff --git a/sorc/ncep_post.fd/DEWPOINT.f b/sorc/ncep_post.fd/DEWPOINT.f index e310dd778..4284ecdbf 100644 --- a/sorc/ncep_post.fd/DEWPOINT.f +++ b/sorc/ncep_post.fd/DEWPOINT.f @@ -1,50 +1,45 @@ !> @file -! -!> SUBPROGRAM: DEWPOINT COMPUTES DEWPOINTS FROM VAPOR PRESSURE -!! PRGMMR: J TUCCILLO ORG: W/NP2 DATE: 90-05-19 -!! -!! ABSTRACT: COMPUTES THE DEWPOINTS FOR THE N VALUES -!! OF VAPOR PRESSURE IN ARRAY VP. -!! THE FORMULA: -!! -!! VP = 0.611 * (X**A) * EXP( (A+B)*(1-X) ) -!! -!! IS USED TO GET DEWPOINT TEMPERATURE T, WHERE -!! -!! X = T3/T, T3=TRIPLE PT TEMPERATURE, -!! VP=VAPOR PRESSURE IN CBS, 0.611=VP AT T3, -!! A=(SPEC. HT. OF WATER-CSUBP OF VAPOR)/GAS CONST OF VAPOR -!! AND -!! B=LATENT HEAT AT T3/(GAS CONST OF VAPOR TIMES T3). -!! -!! ON THE FIRST CALL, A TABLE TDP IS CONSTRUCTED GIVING -!! DEWPOINT AS A FUNCTION OF VAPOR PRESSURE. -!! -!! VALUES OF VP LESS THAN THE FIRST TABLE ENTRY -!! (RVP1 IN THE CODE) WILL BE GIVEN DEWPOINTS FOR -!! THAT BEGINNING VALUE. SIMILARLY , VP VALUES THAT -!! EXCEED THE MAXIMUM TABLE VALUE (RVP2 IN THE CODE) -!! WILL BE ASSIGNED DEWPOINTS FOR THAT MAXIMUM VALUE. -!! -!! THE VALUES 0.02 AND 8.0 FOR RVP1 AND RVP2 YIELD -!! DEWPOINTS OF 233.6K AND 314.7K,RESPECTIVELY. -!! -!! PROGRAM HISTORY LOG: -!! - 90-05-19 J TUCCILLO -!! - 93-05-12 R TREADON - EXPANDED TABLE SIZE AND RESET -!! RANGE OF PRESSURES COVERED BY -!! TABLE. -!! - 98-06-12 T BLACK - CONVERSION FROM 1-D TO 2-D -!! - 00-01-04 JIM TUCCILLO - MPI VERSION -!! - 21-07-26 W Meng - Restrict computation from undefined grids -!! -!! USAGE: CALL DEWPOINT( VP, TD) -!! INPUT ARGUMENT LIST: -!! VP - ARRAY OF N VAPOR PRESSURES(CENTIBARS) -!! -!! OUTPUT ARGUMENT LIST: -!! TD - DEWPOINT IN DEGREES ABSOLUTE -!! +!> @brief Subroutine that computes dewpoints from vapor pressure. +!> +!> This routine is to computes the dewpoints for the N values +!> of vapor pressure in array VP. +!> The forumla: +!> +!> VP = 0.611 * (X**A) * EXP( (A+B)*(1-X) ) +!> +!> is used to get dewpoint temperature T, where +!> +!> X = T3/T, T3=Triple PT temperature, +!> VP=Vapor pressure in CBS, 0.611=VP at T3, +!> A=(Spec. HT. of WATER-CSUBP of vapor)/gas const of vapor +!> and +!> B=Latent heat at T3/(gas const of vapor times T3). +!> +!> on the first call, a table TDP is constructed giving +!> dewpoint as a function of vapor pressure. +!> +!> Values of VP less than the first table entry +!> (RVP1 in the code) will be given dewpoints for +!> that beginning valus. Similarly, VP vaules that +!> exceed the maximum table value (RVP2 in the code) +!> will be assigned dewpoints for that maximum value. +!> +!> The values 0.02 and 8.0 for RVP1 and RVP2 yield +!> dewpoints of 233.6K and 314.7K,respectively. +!> +!> @param[in] VP Array of N vapor pressures(centibars). +!> @param[out] TD Dewpoint in degrees absolute. +!> +!> ### Program history log: +!> Date | Programmer | Comments +!> -----|------------|--------- +!> 1990-05-19 | Jim Tuccillo | Initial +!> 1993-05-12 | R Treadon | Expanded table size and reset range of pressures covered by table. +!> 1998-06-12 | T Black | Conversion from 1-D to 2-D +!> 2000-01-04 | Jim Tuccillo | MPI Version +!> 2021-07-26 | W Meng | Restrict computation from undefined grids +!> +!> @author Jim Tuccillo W/NP2 @date 1990-05-19 SUBROUTINE DEWPOINT( VP, TD) use ctlblk_mod, only: jsta, jend, im, spval From 38d6046cfece227b9c60a7df692db4a0c11a9839 Mon Sep 17 00:00:00 2001 From: kayee Date: Fri, 1 Apr 2022 18:19:53 -0600 Subject: [PATCH 2/4] Fixed minor bug in CALVOR.f. --- sorc/ncep_post.fd/CALVOR.f | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sorc/ncep_post.fd/CALVOR.f b/sorc/ncep_post.fd/CALVOR.f index 73a0032b3..56a118703 100644 --- a/sorc/ncep_post.fd/CALVOR.f +++ b/sorc/ncep_post.fd/CALVOR.f @@ -391,7 +391,6 @@ SUBROUTINE CALVOR(UWND,VWND,ABSV) RETURN END - SUBROUTINE CALDIV(UWND,VWND,DIV) !> CALDIV computes divergence. !> !> For GFS, this routine copmutes the horizontal divergence @@ -408,10 +407,7 @@ SUBROUTINE CALDIV(UWND,VWND,DIV) !> 2016-07-22 | S Moorthi | Modified polar divergence calculation !> !> @author Sajal Kar W/NP2 @date 2016-05-05 - SUBROUTINE CALVOR(UWND,VWND,ABSV) - -! -! + SUBROUTINE CALDIV(UWND,VWND,DIV) use vrbls2d, only: f use masks, only: gdlat, gdlon use params_mod, only: d00, dtr, small, erad From 584b56c00ecfb5dba9fe572622726374ce320fb8 Mon Sep 17 00:00:00 2001 From: kayee Date: Mon, 4 Apr 2022 11:29:22 -0600 Subject: [PATCH 3/4] Update to PR#453. --- sorc/ncep_post.fd/CLDRAD.f | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/sorc/ncep_post.fd/CLDRAD.f b/sorc/ncep_post.fd/CLDRAD.f index 2fc50ea00..1eabc8610 100644 --- a/sorc/ncep_post.fd/CLDRAD.f +++ b/sorc/ncep_post.fd/CLDRAD.f @@ -57,7 +57,7 @@ !> 2013-12-23 | Lu/Wang | Read aerosol optical properties LUTS to compute dust aod, non-dust aod, and use geos5 gocart LUTS !> 2015-??-?? | S. Moorthi | threading, optimization, local dimension !> 2019-07-24 | Li(Kate) Zhang | Merge and update ARAH Lu's work from NGAC into FV3-Chem -!> 2019-10-30 | Bo CUI | Remove "GOTO" statement +!> 2019-10-30 | Bo Cui | Remove "GOTO" statement !> 2020-03-25 | Jesse Meng | Remove grib1 !> 2020-05-20 | Jesse Meng | CALRH unification with NAM scheme !> 2020-11-10 | Jesse Meng | Use UPP_PHYSICS Module @@ -65,7 +65,6 @@ !> 2021-04-01 | Jesse Meng | Computation on defined points only !> !> @author Russ Treadon W/NP2 @date 1993-08-30 - SUBROUTINE CLDRAD ! @@ -79,18 +78,19 @@ SUBROUTINE CLDRAD HBOT, HBOTD, HBOTS, HTOP, HTOPD, HTOPS, FIS, PBLH, & PBOT, PBOTL, PBOTM, PBOTH, CNVCFR, PTOP, PTOPL, & PTOPM, PTOPH, TTOPL, TTOPM, TTOPH, PBLCFR, CLDWORK, & - ASWIN, AUVBIN, AUVBINC, ASWIN, ASWOUT,ALWOUT, ASWTOA,& + ASWIN, AUVBIN, AUVBINC, ASWOUT,ALWOUT, ASWTOA, & RLWTOA, CZMEAN, CZEN, RSWIN, ALWIN, ALWTOA, RLWIN, & SIGT4, RSWOUT, RADOT, RSWINC, ASWINC, ASWOUTC, & ASWTOAC, ALWOUTC, ASWTOAC, AVISBEAMSWIN, & - AVISDIFFSWIN, ASWINTOA, ASWINC, ASWTOAC, AIRBEAMSWIN,& + AVISDIFFSWIN, ASWINTOA, ASWTOAC, AIRBEAMSWIN, & AIRDIFFSWIN, DUSMASS, DUSMASS25, DUCMASS, DUCMASS25, & ALWINC, ALWTOAC, SWDDNI, SWDDIF, SWDNBC, SWDDNIC, & SWDDIFC, SWUPBC, LWDNBC, LWUPBC, SWUPT, & TAOD5502D, AERSSA2D, AERASY2D, MEAN_FRP, LWP, IWP, & AVGCPRATE, & DUSTCB,SSCB,BCCB,OCCB,SULFCB,DUSTPM,SSPM,aod550, & - du_aod550,ss_aod550,su_aod550,oc_aod550,bc_aod550 + du_aod550,ss_aod550,su_aod550,oc_aod550,bc_aod550, & + PWAT use masks, only: LMH, HTM use params_mod, only: TFRZ, D00, H99999, QCLDMIN, SMALL, D608, H1, ROG, & GI, RD, QCONV, ABSCOEFI, ABSCOEF, STBOL, PQ0, A2, & @@ -226,6 +226,7 @@ SUBROUTINE CLDRAD data INDX_EXT / 610, 611, 612, 613, 614 / data INDX_SCA / 651, 652, 653, 654, 655 / logical, parameter :: debugprint = .false. + logical :: Model_Pwat ! ! !************************************************************************* @@ -389,12 +390,29 @@ SUBROUTINE CLDRAD IF (IGET(080) > 0) THEN ! dong GRID1 = spval + Model_Pwat = .false. + DO J=JSTA,JEND + DO I=1,IM + IF(ABS(PWAT(I,J)-SPVAL)>SMALL) THEN + Model_Pwat = .true. + exit + ENDIF + END DO + END DO + IF (Model_Pwat) THEN + DO J=JSTA,JEND + DO I=1,IM + GRID1(I,J) = PWAT(I,J) + END DO + END DO + ELSE CALL CALPW(GRID1(1,jsta),1) DO J=JSTA,JEND DO I=1,IM IF(FIS(I,J) >= SPVAL) GRID1(I,J)=spval END DO END DO + ENDIF CALL BOUND(GRID1,D00,H99999) if(grib == "grib2" )then cfld = cfld + 1 From ebe32992d03446333c1daa60978771f6915ce342 Mon Sep 17 00:00:00 2001 From: kayee Date: Mon, 4 Apr 2022 11:45:34 -0600 Subject: [PATCH 4/4] More updates. --- sorc/ncep_post.fd/CALVOR.f | 1 - sorc/ncep_post.fd/DEALLOCATE.f | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/ncep_post.fd/CALVOR.f b/sorc/ncep_post.fd/CALVOR.f index 56a118703..4e052de5c 100644 --- a/sorc/ncep_post.fd/CALVOR.f +++ b/sorc/ncep_post.fd/CALVOR.f @@ -408,7 +408,6 @@ SUBROUTINE CALVOR(UWND,VWND,ABSV) !> !> @author Sajal Kar W/NP2 @date 2016-05-05 SUBROUTINE CALDIV(UWND,VWND,DIV) - use vrbls2d, only: f use masks, only: gdlat, gdlon use params_mod, only: d00, dtr, small, erad use ctlblk_mod, only: jsta_2l, jend_2u, spval, modelname, global, & diff --git a/sorc/ncep_post.fd/DEALLOCATE.f b/sorc/ncep_post.fd/DEALLOCATE.f index fe8204072..1bcfdd788 100644 --- a/sorc/ncep_post.fd/DEALLOCATE.f +++ b/sorc/ncep_post.fd/DEALLOCATE.f @@ -367,6 +367,7 @@ SUBROUTINE DE_ALLOCATE deallocate(tedir) deallocate(twa) deallocate(fdnsst) + deallocate(pwat) ! GSD deallocate(rainc_bucket) deallocate(rainc_bucket1)