LCOV - code coverage report
Current view: | top level - hemco/HEMCO/src/Extensions - drydep_toolbox_mod.F90 (source / functions) |  |  | Hit | Total | Coverage
Test: | coverage.info |  | Lines: | 0 | 50 | 0.0 %
Date: | 2025-01-13 21:54:50 |  | Functions: | 0 | 4 | 0.0 %

              Line data    Source code
           1             : !------------------------------------------------------------------------------
           2             : !                   Harmonized Emissions Component (HEMCO)                    !
           3             : !------------------------------------------------------------------------------
           4             : !BOP
           5             : !
           6             : ! !MODULE: drydep_toolbox_mod.F90
           7             : !
           8             : ! !DESCRIPTION: Module DryEep\_ToolBox\_Mod contains routines used for dry
           9             : ! deposition (and soil NOx emissions) calculations, as implemented into!
          10             : ! the GEOS-Chem model.
          11             : !\\
          12             : !\\
          13             : ! !INTERFACE:
          14             : !
          15             : MODULE DryDep_ToolBox_Mod
          16             : !
          17             : ! !USES:
          18             : !
          19             :   USE HCO_ERROR_MOD, ONLY : hp     ! Precision (hp)
          20             :
          21             :   IMPLICIT NONE
          22             :   PRIVATE
          23             : !
          24             : ! !PUBLIC MEMBER FUNCTIONS:
          25             : !
          26             :   PUBLIC  :: BioFit
          27             :   INTERFACE BioFit
          28             :     MODULE PROCEDURE BioFit_R4
          29             :     MODULE PROCEDURE BioFit_R8
          30             :   END INTERFACE
          31             :
          32             : !
          33             : ! !PRIVATE MEMBER FUNCTIONS:
          34             : !
          35             :   PRIVATE :: SunParam_R4
          36             :   PRIVATE :: SunParam_R8
          37             : !
          38             : ! !REVISION HISTORY:
          39             : !  14 Nov 2013 - C. Keller   - Created from BIOFIT.F and SUNPARAM.F
          40             : !  See https://github.com/geoschem/hemco for complete history
          41             : !EOP
          42             : !------------------------------------------------------------------------------
          43             : !BOC
          44             : CONTAINS
          45             : !EOC
          46             : !------------------------------------------------------------------------------
          47             : !                   Harmonized Emissions Component (HEMCO)                    !
          48             : !------------------------------------------------------------------------------
          49             : !BOP
          50             : !
          51             : ! !ROUTINE: BIOFIT_R4
          52             : !
          53             : ! !DESCRIPTION: Function BioFit computes the light correction used in the
          54             : !  dry deposition and canopy NOx modules.
          55             : !\\
          56             : !\\
          57             : ! !INTERFACE:
          58             : !
          59           0 :   FUNCTION BioFit_R4( COEFF1, XLAI1, SUNCOS1, CFRAC1, NPOLY ) RESULT( BIO_FIT )
          60             : !
          61             : ! !INPUT PARAMETERS:
          62             : !
          63             :     INTEGER, INTENT(IN) :: NPOLY           ! # of drydep coefficients
          64             :     REAL*4,  INTENT(IN) :: COEFF1(NPOLY)   ! Baldocchi drydep coefficients
          65             :     REAL*4,  INTENT(IN) :: XLAI1           ! Leaf area index [cm2/cm2]
          66             :     REAL*4,  INTENT(IN) :: SUNCOS1         ! Cosine( Solar Zenith Angle )
          67             :     REAL*4,  INTENT(IN) :: CFRAC1          ! Cloud fraction [unitless]
          68             : !
          69             : ! !RETURN VALUE:
          70             : !
          71             :     REAL*4              :: BIO_FIT         ! Resultant light correction
          72             : !
          73             : ! !REMARKS:
          74             : !  This routine is ancient code from Yuhang Wang.  It was part of the old
          75             : !  Harvard-GISS CTM and was ported into GEOS-Chem.  See this reference for
          76             : !  more information:
          77             : !                                                                             .
          78             : !    Wang, Y., D.J. Jacob, and J.A. Logan, "Global simulation of tropospheric
          79             : !     O3-NOx-hydrocarbon chemistry, 1. Model formulation", J. Geophys. Res.,
          80             : !     103/D9, 10,713-10,726, 1998.
          81             : !
          82             : ! !REVISION HISTORY:
          83             : !  13 Dec 2012 - R. Yantosca - Added ProTeX headers
          84             : !  See https://github.com/geoschem/hemco for complete history
          85             : !EOP
          86             : !------------------------------------------------------------------------------
          87             : !BOC
          88             : !
          89             : ! !DEFINED PARAMETERS:
          90             : !
          91             :     INTEGER, PARAMETER :: KK = 4
          92             : !
          93             : ! !LOCAL VARIABLES:
          94             : !
          95             :     REAL*4             :: TERM(KK)
          96           0 :     REAL*4             :: REALTERM(NPOLY)
          97             :     INTEGER            :: K,K1,K2,K3
          98             :
          99             :     !=================================================================
         100             :     ! BIOFIT begins here!
         101             :     !=================================================================
         102           0 :     TERM(1) = 1.0e0
         103           0 :     TERM(2) = XLAI1
         104           0 :     TERM(3) = SUNCOS1
         105           0 :     TERM(4) = CFRAC1
         106           0 :     CALL SUNPARAM_R4( TERM(2:4) )
         107           0 :     K = 0
         108           0 :     DO K3 = 1, KK
         109           0 :        DO K2 = K3, KK
         110           0 :           DO K1 = K2, KK
         111           0 :              K = K + 1
         112           0 :              REALTERM(K)=TERM(K1)*TERM(K2)*TERM(K3)
         113             :           ENDDO
         114             :        ENDDO
         115             :     ENDDO
         116             :
         117             :     ! Now explicitly use REAL*4 precision.  This will cause very small
         118             :     ! differences at the level of numerical noise when comparing to
         119             :     ! prior states of the code like v10-01e.  But this is something that
         120             :     ! we can live with.  Stick with REAL*8 precision for now, but we'll
         121             :     ! try to implement flexible precision into this routine at a later
         122             :     ! point. (bmy, myannetti, 12/10/14)
         123             :     BIO_FIT = 0e0
         124           0 :     DO K = 1, NPOLY
         125           0 :        BIO_FIT = BIO_FIT + COEFF1(K)*REALTERM(K)
         126             :     END DO
         127           0 :     IF ( BIO_FIT .LT. 0.1e0 ) BIO_FIT = 0.1e0
         128             :
         129           0 :   END FUNCTION BioFit_R4
         130             : !EOC
         131             : !------------------------------------------------------------------------------
         132             : !                   Harmonized Emissions Component (HEMCO)                    !
         133             : !------------------------------------------------------------------------------
         134             : !BOP
         135             : !
         136             : ! !ROUTINE: BIOFIT_R8
         137             : !
         138             : ! !DESCRIPTION: Function BioFit computes the light correction used in the
         139             : !  dry deposition and canopy NOx modules.
         140             : !\\
         141             : !\\
         142             : ! !INTERFACE:
         143             : !
         144           0 :   FUNCTION BioFit_R8( COEFF1, XLAI1, SUNCOS1, CFRAC1, NPOLY ) RESULT( BIO_FIT )
         145             : !
         146             : ! !INPUT PARAMETERS:
         147             : !
         148             :     INTEGER, INTENT(IN) :: NPOLY           ! # of drydep coefficients
         149             :     REAL*8,  INTENT(IN) :: COEFF1(NPOLY)   ! Baldocchi drydep coefficients
         150             :     REAL*8,  INTENT(IN) :: XLAI1           ! Leaf area index [cm2/cm2]
         151             :     REAL*8,  INTENT(IN) :: SUNCOS1         ! Cosine( Solar Zenith Angle )
         152             :     REAL*8,  INTENT(IN) :: CFRAC1          ! Cloud fraction [unitless]
         153             : !
         154             : ! !RETURN VALUE:
         155             : !
         156             :     REAL*8              :: BIO_FIT         ! Resultant light correction
         157             : !
         158             : ! !REMARKS:
         159             : !  This routine is ancient code from Yuhang Wang.  It was part of the old
         160             : !  Harvard-GISS CTM and was ported into GEOS-Chem.  See this reference for
         161             : !  more information:
         162             : !                                                                             .
         163             : !    Wang, Y., D.J. Jacob, and J.A. Logan, "Global simulation of tropospheric
         164             : !     O3-NOx-hydrocarbon chemistry, 1. Model formulation", J. Geophys. Res.,
         165             : !     103/D9, 10,713-10,726, 1998.
         166             : !
         167             : ! !REVISION HISTORY:
         168             : !  13 Dec 2012 - R. Yantosca - Added ProTeX headers
         169             : !  See https://github.com/geoschem/hemco for complete history
         170             : !EOP
         171             : !------------------------------------------------------------------------------
         172             : !BOC
         173             : !
         174             : ! !DEFINED PARAMETERS:
         175             : !
         176             :     INTEGER, PARAMETER :: KK = 4
         177             : !
         178             : ! !LOCAL VARIABLES:
         179             : !
         180             :     REAL*8             :: TERM(KK)
         181           0 :     REAL*8             :: REALTERM(NPOLY)
         182             :     INTEGER            :: K,K1,K2,K3
         183             :
         184             :     !=================================================================
         185             :     ! BIOFIT begins here!
         186             :     !=================================================================
         187           0 :     TERM(1) = 1.0d0
         188           0 :     TERM(2) = XLAI1
         189           0 :     TERM(3) = SUNCOS1
         190           0 :     TERM(4) = CFRAC1
         191           0 :     CALL SUNPARAM_R8(TERM(2:4))
         192           0 :     K=0
         193           0 :     DO K3 = 1, KK
         194           0 :        DO K2 = K3, KK
         195           0 :           DO K1 = K2, KK
         196           0 :              K = K + 1
         197           0 :              REALTERM(K)=TERM(K1)*TERM(K2)*TERM(K3)
         198             :           ENDDO
         199             :        ENDDO
         200             :     ENDDO
         201             :
         202             :     ! Now explicitly use REAL*8 precision.  This will cause very small
         203             :     ! differences at the level of numerical noise when comparing to
         204             :     ! prior states of the code like v10-01e.  But this is something that
         205             :     ! we can live with.  Stick with REAL*8 precision for now, but we'll
         206             :     ! try to implement flexible precision into this routine at a later
         207             :     ! point. (bmy, myannetti, 12/10/14)
         208             :     BIO_FIT = 0d0
         209           0 :     DO K = 1, NPOLY
         210           0 :        BIO_FIT = BIO_FIT + COEFF1(K)*REALTERM(K)
         211             :     END DO
         212           0 :     IF ( BIO_FIT .LT. 0.1d0 ) BIO_FIT = 0.1d0
         213             :
         214           0 :   END FUNCTION BIOFIT_R8
         215             : !EOC
         216             : !------------------------------------------------------------------------------
         217             : !                   Harmonized Emissions Component (HEMCO)                    !
         218             : !------------------------------------------------------------------------------
         219             : !BOP
         220             : !
         221             : ! !IROUTINE: SunParam_R4
         222             : !
         223             : ! !DESCRIPTION: Subroutine SUNPARAM is called by BIOFIT to perform the
         224             : !  light correction used in the dry deposition and canopy NOx modules.
         225             : !\\
         226             : !\\
         227             : ! !INTERFACE:
         228             : !
         229           0 :   SUBROUTINE SunParam_R4( X )
         230             : !
         231             : ! !DEFINED PARAMETERS:
         232             : !
         233             :     INTEGER, PARAMETER    :: NN = 3  ! # of variables (LAI, SUNCOS, CLDFRC)
         234             : !
         235             : ! !INPUT/OUTPUT PARAMETERS:
         236             : !
         237             :     REAL*4, INTENT(INOUT) :: X(NN)   ! LAI, SUNCOS, or cloud fraction
         238             : !
         239             : ! !REMARKS:
         240             : !  This routine is ancient code from Yuhang Wang.  It was part of the old
         241             : !  Harvard-GISS CTM and was ported into GEOS-Chem.  See this reference for
         242             : !  more information:
         243             : !                                                                             .
         244             : !    Wang, Y., D.J. Jacob, and J.A. Logan, "Global simulation of tropospheric
         245             : !     O3-NOx-hydrocarbon chemistry, 1. Model formulation", J. Geophys. Res.,
         246             : !     103/D9, 10,713-10,726, 1998.
         247             : !
         248             : ! !REVISION HISTORY:
         249             : !  13 Dec 2012 - R. Yantosca - Added ProTeX headers
         250             : !  See https://github.com/geoschem/hemco for complete history
         251             : !EOP
         252             : !------------------------------------------------------------------------------
         253             : !BOC
         254             :
         255             :     !===============================================
         256             :     ! the sequence is lai,suncos,cloud fraction
         257             :     !===============================================
         258             :
         259             :     ! ND = scaling factor for each variable
         260             :     INTEGER :: I
         261             :     REAL*4  :: ND(NN) = (/ 55.0e0, 20.0e0, 11.0e0 /)
         262             :     REAL*4  :: X0(NN) = (/ 11.0e0,  1.0e0,  1.0e0 /)
         263             :
         264             :     !  X0 = maximum for each variable
         265             :     REAL*4  :: XLOW
         266             :
         267           0 :     DO I = 1, NN
         268           0 :        X(I) = MIN( X(I), X0(I) )
         269             :        ! XLOW = minimum for each variable
         270           0 :        IF ( I .NE. 3 ) THEN
         271           0 :           XLOW = X0(I) / ND(I)
         272             :        ELSE
         273             :           XLOW = 0.0e0
         274             :        ENDIF
         275           0 :        X(I) = MAX( X(I), XLOW )
         276           0 :        X(I) = X(I) / X0(I)
         277             :     ENDDO
         278             :
         279           0 :   END SUBROUTINE SunParam_R4
         280             : !EOC
         281             : !------------------------------------------------------------------------------
         282             : !                   Harmonized Emissions Component (HEMCO)                    !
         283             : !------------------------------------------------------------------------------
         284             : !BOP
         285             : !
         286             : ! !IROUTINE: SunParam_r8
         287             : !
         288             : ! !DESCRIPTION: Subroutine SUNPARAM is called by BIOFIT to perform the
         289             : !  light correction used in the dry deposition and canopy NOx modules.
         290             : !\\
         291             : !\\
         292             : ! !INTERFACE:
         293             : !
         294           0 :   SUBROUTINE SunParam_R8( X )
         295             : !
         296             : ! !DEFINED PARAMETERS:
         297             : !
         298             :     INTEGER, PARAMETER    :: NN = 3  ! # of variables (LAI, SUNCOS, CLDFRC)
         299             : !
         300             : ! !INPUT/OUTPUT PARAMETERS:
         301             : !
         302             :     REAL*8, INTENT(INOUT) :: X(NN)   ! LAI, SUNCOS, or cloud fraction
         303             : !
         304             : ! !REMARKS:
         305             : !  This routine is ancient code from Yuhang Wang.  It was part of the old
         306             : !  Harvard-GISS CTM and was ported into GEOS-Chem.  See this reference for
         307             : !  more information:
         308             : !                                                                             .
         309             : !    Wang, Y., D.J. Jacob, and J.A. Logan, "Global simulation of tropospheric
         310             : !     O3-NOx-hydrocarbon chemistry, 1. Model formulation", J. Geophys. Res.,
         311             : !     103/D9, 10,713-10,726, 1998.
         312             : !
         313             : ! !REVISION HISTORY:
         314             : !  13 Dec 2012 - R. Yantosca - Added ProTeX headers
         315             : !  See https://github.com/geoschem/hemco for complete history
         316             : !EOP
         317             : !------------------------------------------------------------------------------
         318             : !BOC
         319             :
         320             :     !===============================================
         321             :     ! the sequence is lai,suncos,cloud fraction
         322             :     !===============================================
         323             :
         324             :     !  ND = scaling factor for each variable
         325             :     INTEGER :: I
         326             :     REAL*8  :: ND(NN) = (/ 55.0d0, 20.0d0, 11.0d0 /)
         327             :     REAL*8  :: X0(NN) = (/ 11.0e0,  1.0e0,  1.0e0 /)
         328             :
         329             :     !  X0 = maximum for each variable
         330             :     REAL*8  :: XLOW
         331             :
         332           0 :     DO I = 1, NN
         333           0 :        X(I) = MIN( X(I), X0(I) )
         334             :        ! XLOW = minimum for each variable
         335           0 :        IF ( I .NE. 3 ) THEN
         336           0 :           XLOW = X0(I) / ND(I)
         337             :        ELSE
         338             :           XLOW = 0.0d0
         339             :        END IF
         340           0 :        X(I) = MAX( X(I), XLOW )
         341           0 :        X(I) = X(I) / X0(I)
         342             :     END DO
         343             :
         344           0 :   END SUBROUTINE SunParam_R8
         345             : !EOC
         346             : END MODULE DryDep_ToolBox_Mod

Generated by: LCOV version 1.14