From 5dc67685b7b778cc3517fe49a166e1bfeed2ee6c Mon Sep 17 00:00:00 2001 From: bcroft Date: Mon, 21 Feb 2022 07:19:40 -0600 Subject: [PATCH 01/23] Updates to enable TOMAS to run in GCHP --- src/Extensions/hcox_tomas_jeagle_mod.F90 | 630 ++++++++++++++++++++++- 1 file changed, 607 insertions(+), 23 deletions(-) diff --git a/src/Extensions/hcox_tomas_jeagle_mod.F90 b/src/Extensions/hcox_tomas_jeagle_mod.F90 index 58a7f53c..c4989f22 100644 --- a/src/Extensions/hcox_tomas_jeagle_mod.F90 +++ b/src/Extensions/hcox_tomas_jeagle_mod.F90 @@ -59,12 +59,40 @@ MODULE HCOX_TOMAS_Jeagle_Mod INTEGER :: ExtNr ! HEMCO extension # REAL(dp) :: TOMAS_COEF ! Seasalt emiss coeff. + !Tracer IDs + LOGICAL :: EmitSnowSS ! Calculate sea salt emission blowing snow + + ! Arrays INTEGER, ALLOCATABLE :: HcoIDs (: ) ! HEMCO species ID's REAL(dp), POINTER :: TOMAS_DBIN(: ) ! TOMAS bin width REAL(dp), POINTER :: DRFAC (: ) ! TOMAS area? REAL(dp), POINTER :: TC1 (:,:,:,:) ! Aerosol mass REAL(dp), POINTER :: TC2 (:,:,:,:) ! Aerosol number + LOGICAL :: ColdSST ! Flag to correct SSA emissions over cold waters + + ! Scale factors + REAL*8 :: NSLNT_FYI ! North Hemisphere snow salinity on first year ice (FYI) (psu) + REAL*8 :: NSLNT_MYI ! North Hemisphere snow salinity on multiyear ice (MYI) (psu) + REAL*8 :: SSLNT_FYI ! South Hemisphere snow salinity on FYI (psu) + REAL*8 :: SSLNT_MYI ! South Hemisphere snow salinity on MYI (psu) + REAL*8 :: NAGE ! North Hemisphere snow age (days) + REAL*8 :: SAGE ! South Hemisphere snow age (days) + REAL*8 :: NP ! number of particle per snowflake + + !Module variables + REAL*8, POINTER :: SS_DEN(:) ! densities + REAL*8, POINTER :: F_DI_N_FYI(:,:) ! add for blowing snow for NH + REAL*8, POINTER :: F_DI_N_MYI(:,:) ! add for blowing snow for NH + REAL*8, POINTER :: F_DI_S_FYI(:,:) ! add for blowing snow for SH + REAL*8, POINTER :: F_DI_S_MYI(:,:) ! add for blowing snow for SH + REAL*8, POINTER :: F_DN_N_FYI(:,:) ! add for blowing snow for NH + REAL*8, POINTER :: F_DN_N_MYI(:,:) ! add for blowing snow for NH + REAL*8, POINTER :: F_DN_S_FYI(:,:) ! add for blowing snow for SH + REAL*8, POINTER :: F_DN_S_MYI(:,:) ! add for blowing snow for SH + + !Number densities + REAL(sp), POINTER :: MULTIICE(:,:) => NULL() ! add for blowing snow TYPE(MyInst), POINTER :: NextInst => NULL() END TYPE MyInst @@ -72,6 +100,9 @@ MODULE HCOX_TOMAS_Jeagle_Mod ! Pointer to instances TYPE(MyInst), POINTER :: AllInst => NULL() + !INTEGER, PARAMETER :: NR_MAX = 200 ! max. # of bins per mode + INTEGER, PARAMETER :: NR_MAX = 4000 ! max. # of bins per mode + CONTAINS !EOC !------------------------------------------------------------------------------ @@ -95,6 +126,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) USE HCO_GeoTools_Mod, ONLY : HCO_LandType USE HCO_FluxArr_mod, ONLY : HCO_EmisAdd USE HCO_State_Mod, ONLY : HCO_GetHcoID + USE HCO_Calc_Mod, ONLY : HCO_EvalFld ! ! !INPUT PARAMETERS: ! @@ -106,7 +138,32 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) INTEGER, INTENT(INOUT) :: RC ! Success or failure? ! ! !REMARKS: -! +! References +! ============================================================================ +! (1 ) Chin, M., P. Ginoux, S. Kinne, B. Holben, B. Duncan, R. Martin, +! J. Logan, A. Higurashi, and T. Nakajima, "Tropospheric aerosol +! optical thickness from the GOCART model and comparisons with +! satellite and sunphotometers measurements", J. Atmos Sci., 2001. +! (2 ) Gong, S., L. Barrie, and J.-P. Blanchet, "Modeling sea-salt +! aerosols in the atmosphere. 1. Model development", J. Geophys. Res., +! v. 102, 3805-3818, 1997. +! (3 ) Gong, S. L., "A parameterization of sea-salt aerosol source function +! for sub- and super-micron particles", Global Biogeochem. Cy., 17(4), +! 1097, doi:10.1029/2003GB002079, 2003. +! (4 ) Jaegle, L., P.K. Quinn, T.S. Bates, B. Alexander, J.-T. Lin, "Global +! distribution of sea salt aerosols: New constraints from in situ and +! remote sensing observations", Atmos. Chem. Phys., 11, 3137-3157, +! doi:10.5194/acp-11-3137-2011. +! (5 ) Huang, J., Jaeglé, L., "Wintertime enhancements of sea salt aerosol in +! polar regions consistent with a sea ice source from blowing snow." +! Atmos. Chem. Phys. 17, 3699–3712. https://doi.org/10.5194/acp-17-3699-2017, 2017. +! (6 ) Huang, J., Jaeglé, L., Chen, Q., Alexander, B., Sherwen, T., +! Evans, M. J., Theys, N., and Choi, S. "Evaluating the impact of +! blowing snow sea salt aerosol on springtime BrO and O3 in the Arctic, +! Atmos. Chem. Phys. Discuss., https://doi.org/10.5194/acp-2019-1094, 2020. +! (7 ) Tschudi, M., W. N. Meier, J. S. Stewart, C. Fowler, and J. Maslanik. +! "EASE-Grid Sea Ice Age, Version 4." NASA National Snow and Ice Data Center +! Distributed Active Archive Center. doi: https://doi.org/10.5067/UTAV7490FEPB., 2019. ! ! !REVISION HISTORY: ! 01 Oct 2014 - R. Yantosca - Initial version, based on TOMAS SRCSALT30 code @@ -121,8 +178,50 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) INTEGER :: I, J, L, K, HcoID REAL(sp) :: FOCEAN, W10M, DTEMIS REAL(dp) :: F100, W, A_M2, FEMIS, NUMBER, MASS, NUMBER_TOT + REAL(dp) :: NUMBER2 REAL(dp) :: rwet, dfo, B, A, SST, SCALE - CHARACTER(LEN=255):: MSG + !CHARACTER(LEN=255):: MSG + + ! New variables for blowing snow (huang, 04/09/20) + + REAL*8 :: SNOWSALT + REAL*8 :: FROPEN, FRFIRST + REAL*8 :: FRICTVEL, WVMR, TEMP + REAL*8 :: PRESS, P_ICE, RH_ICE + REAL*8 :: D, FK, FD + REAL*8 :: PSI, QSPRIME, UT, APRIM + REAL*8 :: QS, QSNOWICE_FYI, QSNOWICE_MYI,QBSALT, QB0 + REAL*8 :: SLNT, SLNT_FYI, SLNT_MYI + REAL*8 :: AGE, ISFROST + + ! New parameters for blowing snow (huang, 04/09/20) + REAL*8, PARAMETER :: LS = 2839d3 ! Latent heat of sublimation @ T=-30C (J/kg). + ! Varies very little with Temperature + REAL*8, PARAMETER :: RV = 461.5d0 !J kg-1 K-1 + REAL*8, PARAMETER :: RHONACL = 2160.0d0 !kg/m3 + REAL*8, PARAMETER :: RHOICE = 900.0d0 !kg/m3 + REAL*8, PARAMETER :: K0 = 2.16d-2 !J m-1 s-1 K-1 + REAL*8, PARAMETER :: A0 = 3.78407d-1 + REAL*8, PARAMETER :: A1 = -8.64089d-2 + REAL*8, PARAMETER :: A2 = -1.60570d-2 + REAL*8, PARAMETER :: A3 = 7.25516d-4 + REAL*8, PARAMETER :: A4 = -1.25650d-1 + REAL*8, PARAMETER :: A5 = 2.48430d-2 + REAL*8, PARAMETER :: A6 = -9.56871d-4 + REAL*8, PARAMETER :: A7 = 1.24600d-2 + REAL*8, PARAMETER :: A8 = 1.56862d-3 + REAL*8, PARAMETER :: A9 = -2.93002d-4 + REAL*8, PARAMETER :: A_SALT = 2.0d0 !from Mann et al. 2000 + REAL*8, PARAMETER :: B_SALT = 37.5d0 !in um + !REAL*8, PARAMETER :: DDSNOW = 2.0d0 !in um for snow particle interval + REAL*8, PARAMETER :: DDSNOW = 0.1d0 !in um for snow particle interval + LOGICAL, SAVE :: FIRST = .TRUE. + LOGICAL, SAVE :: FIRSTSAL = .TRUE. + CHARACTER(LEN=31) :: FLDNME + INTEGER :: NDAYS!, cYYYY, cMM, cDD, K + REAL(hp), TARGET :: MULTI(HcoState%NX,HcoState%NY) + REAL(hp), TARGET :: SNOWSALA (HcoState%NX,HcoState%NY) + REAL(hp), TARGET :: SNOWSALC (HcoState%NX,HcoState%NY) REAL*8, PARAMETER :: BETHA=2.22d0 !wet diameter (80% Rel Hum) to dry diam @@ -138,6 +237,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! Error handling LOGICAL :: ERR + CHARACTER(LEN=255) :: MSG !================================================================= ! SRCSALT30 begins here! @@ -155,7 +255,8 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) CALL InstGet ( ExtState%TOMAS_Jeagle, Inst, RC ) IF ( RC /= HCO_SUCCESS ) THEN WRITE(MSG,*) 'Cannot find TOMAS_Jeagle instance Nr. ', ExtState%TOMAS_Jeagle - CALL HCO_ERROR(MSG,RC) + !CALL HCO_ERROR(HcoState%Config%Err,MSG,RC) + CALL HCO_ERROR(MSG, RC ) RETURN ENDIF @@ -163,11 +264,27 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) Inst%TC1 = 0.0_hp Inst%TC2 = 0.0_hp + IF ( Inst%EmitSnowSS ) THEN + ! Read in distribution of multi-year sea ice from + ! remotely sensed observations of sea ice motion and sea + ! ice extent for the Arctic (Tschudi et al., 2019). For the + ! Antarctic, the multi year sea ice extent is based on the minimum + ! MERRA-2 sea ice extent of the previous summer. + + CALL HCO_EvalFld ( HcoState, 'MULTISEAICE', MULTI, RC ) + IF ( RC /= HCO_SUCCESS ) THEN + WRITE(MSG,*) 'Cannot find MULTISEAICE data for blowing snow' + !CALL HCO_ERROR(HcoState%Config%Err, MSG, RC) + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + ENDIF + ! Depending on the grid resolution. 4x5 (default) doesn't need ! adjusting coeff !### Debug - !print*, 'JACK IN HCOX TOMAS Jeagle' + print*, 'JACK IN HCOX TOMAS Jeagle' ! Init ptr3D => NULL() @@ -179,19 +296,26 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) DO J = 1, HcoState%NY DO I = 1, HcoState%NX + Inst%TC1(I,J,:,:) = 0d0 + Inst%TC2(I,J,:,:) = 0d0 + ! Grid box surface area [m2] A_M2 = HcoState%Grid%AREA_M2%Val(I,J) - ! Get the fraction of the box that is over water - IF ( HCO_LandType( ExtState%WLI%Arr%Val(I,J), & - ExtState%ALBD%Arr%Val(I,J) ) == 0 ) THEN - FOCEAN = 1d0 - ExtState%FRCLND%Arr%Val(I,J) - ELSE - FOCEAN = 0.d0 - ENDIF + ! Advance to next grid box if it's not over water or sea ice + IF ( ExtState%FROCEAN%Arr%Val(I,J)<=0d0 .and. & + ExtState%FRSEAICE%Arr%Val(I,J)<=0d0 ) CYCLE - ! Skip boxes that are not at least 50% water - IF ( FOCEAN > 0.5d0 ) THEN +! ! Get the fraction of the box that is over water +! IF ( HCO_LandType( ExtState%WLI%Arr%Val(I,J), & +! ExtState%ALBD%Arr%Val(I,J) ) == 0 ) THEN +! FOCEAN = 1d0 - ExtState%FRCLND%Arr%Val(I,J) +! ELSE +! FOCEAN = 0.d0 +! ENDIF + +! ! Skip boxes that are not at least 50% water ! betty use IF above +! IF ( FOCEAN > 0.5d0 ) THEN ! Wind speed at 10 m altitude [m/s] W10M = SQRT( ExtState%U10M%Arr%Val(I,J)**2 & @@ -208,6 +332,107 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) SCALE = 0.329d0 + 0.0904d0*SST - & 0.00717d0*SST**2d0 + 0.000207d0*SST**3d0 + ! Limit the SST scaling factor to 0.25 over cold SST (below 5C) + IF ( Inst%ColdSST .and. SST<= 5.0d0 ) SCALE = 0.25d0 + + ! Apply to only the open ocean fraction of the gridbox (Huang 06/12/20) + FROPEN = ExtState%FROCEAN%Arr%Val(I,J)-ExtState%FRSEAICE%Arr%Val(I,J) + IF ( FROPEN < 0d0 ) FROPEN = 0d0 + + ! Eventually apply wind scaling factor. + !SCALE = SCALE * Inst%WindScale * FROPEN + SCALE = SCALE * FROPEN + + !---------------------------------------------------------------- + ! huang, 04/09/20: Add blowing snow emissions over sea ice + !---------------------------------------------------------------- + + IF ( Inst%EmitSnowSS ) THEN + IF ( ExtState%FRSEAICE%Arr%Val(I,J) > 0d0 )THEN + ! Friction velocity [m/s] + FRICTVEL = ExtState%USTAR%Arr%Val(I,J) + ! Convert specific humidity [g H2O/kg air] to water vapor mixing ratio [v/v] + ! QV2m is in kg H2O/kg air + WVMR = ExtState%QV2M%Arr%Val(I,J) * 28.973d0 / 18.0d0 + ! Temperature at 2M in grid box (I,J) [K] + TEMP = ExtState%T2M%Arr%Val(I,J) + ! Surface pressure at grid box (I,J). Convert from [Pa] to [hPa] + PRESS = HcoState%Grid%PSFC%Val( I, J ) /100d0 + ! Calculate saturation vapor pressure over ice [in Pa] at temperature + ! TS [K] + P_ICE = 10d0**(-2663.5d0/TEMP+12.537d0) + ! Calculate relative humidity with respect to ice [%] + RH_ICE = PRESS * WVMR / (P_ICE*0.01d0) *100.0d0 + ! Limit RH to 100% + IF (RH_ICE > 100d0) RH_ICE =100.0d0 + ! Coefficient of Diffusion of water vapor in air [m2/s] + ! Parameterization of Massman, W.J. "A review of teh molecular diffusivities of + ! H2O, CO2, CH4... in air, O2 and N2 near STP" Atmos. Env., 32, 6, 1111-1127, 1998. + D = 2.178d-5*(1000d0/PRESS)*(TEMP/273.15d0)**1.81 + ! Heat conductivity and vapor diffusion terms [m s/kg] + ! Rogers and Yau "A short course in cloud physics", 1989, Eqn 9.4, with + ! RV = 461.5 [J/kg/K] Individual gas constant for water vapor + ! LS = 2839.0*1d3 [J/kg ] Latent heat of sublimation @ T=-30C + ! K = 2.16d-2 [J/(m s K)] Coeff of thermal conductivity of Air [Table 7.1 Rogers and Yau] + FK = ( LS / (RV * TEMP ) -1d0 ) * LS / (K0 * TEMP) + FD = ( RV * TEMP ) / (D * P_ICE) + ! Variable PSI [m2/s] Equation 11 from Dery and Yau (2001) + ! RHOICE = 900 kg/m3 Density of ice + PSI = (RH_ICE/100.d0 - 1d0)/(2d0 * RHOICE * (FK + FD)) + ! Convert PSI from m2/s to units of -1x10d-12 m2/s + PSI = PSI * (-1.0d12) + ! Qs prime [mm/day snow water equivalent] Equation 11 Dery and Yau (2001) + QSPRIME = A0 + A1*PSI + A2*PSI**2d0 + A3*PSI**3d0 & + + A4* W10M + A5*PSI*W10M & + + A6*W10M*PSI**2d0 + A7*W10M**2d0 & + + A8*PSI*W10M**2d0 + A9*W10M**3d0 + IF ( QSPRIME < 0.0d0 ) QSPRIME = 0.0d0 + !APRIM + IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) AGE = Inst%SAGE*24.0d0 + IF ( HcoState%Grid%YEDGE%Val(I,J) .ge. 0 ) AGE = Inst%NAGE*24.0d0 + APRIM = (1.038d0+0.03758d0*AGE-0.00014349d0*AGE**2d0 & + + (1.911315d-7*AGE**3d0) )**(-1d0) + ! Threshold wind speed [m/s] + UT = 6.975d0 + 0.0033d0 * (TEMP - 273.15d0 + 27.27d0 )**2.0d0 + !IF (W10M > UT) THEN + ! add RH<100 too + + IF (W10M > UT .and. RH_ICE<100d0) THEN + QBSALT = 0.385d0*(1.0d0-Ut/W10M)**2.59d0/FRICTVEL + QB0 = 0.385d0*(1d0-6.975d0/W10M)**2.59d0/FRICTVEL + ! Snow sublimation rate [kg/m2/s] Equation 1 in Yang et al. (2008) + ! The constant 1.1574d-5 converts mm/day column integrated sublimation rate to kg m-2 s-1 + + QS = 1.1574d-5*APRIM*QSPRIME*QBSALT/QB0 + ELSE + QS = 0d0 + ENDIF + !set up the snow salinity + IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) SLNT_FYI = Inst%SSLNT_FYI + IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) SLNT_MYI = Inst%SSLNT_MYI + IF ( HcoState%Grid%YEDGE%Val(I,J) .ge. 0 ) SLNT_FYI = Inst%NSLNT_FYI + IF ( HcoState%Grid%YEDGE%Val(I,J) .ge. 0 ) SLNT_MYI = Inst%NSLNT_MYI + ! Sea ice fraction that is first year + FRFIRST = ExtState%FRSEAICE%Arr%Val(I,J) - MULTI(I,J) + IF ( FRFIRST < 0d0 ) FRFIRST = 0d0 + ! Apply FYI salinity to FYI seaice fraction and MYI salinity to MYI fraction + !SLNT = SLNT_FYI * FRFIRST + SLNT_MYI * MULTI(I,J) + ! Assume MYI salinity is 50% of FYI + !SLNT = SLNT * FRFIRST + SLNT * 0.5 * MULTI(I,J) + ! Convert snow sublimation rate to sea salt production rate [kg/m2/s] + ! Calculate it separately for FYI and MYI, scaled by their respective sea ice fraction + QSNOWICE_FYI = QS * SLNT_FYI * FRFIRST / 1000d0 + QSNOWICE_MYI = QS * SLNT_MYI * MULTI(I,J) / 1000d0 + !print *, 'Bettyhere is QSNOW ',QSNOWICE_FYI,QSNOWICE_MYI, I,J + ELSE + QSNOWICE_FYI = 0.0d0 + QSNOWICE_MYI = 0.0d0 + ENDIF + ENDIF + ! End of added blowing snow section + + !----------------------------------------------------------------- + !--------------------------------------------------------------- ! Partition TOMAS_Jeagle emissions w/in the boundary layer !--------------------------------------------------------------- @@ -223,11 +448,13 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) else - dfo=0.d0 - endif + dfo=0.d0 + endif - dfo=dfo*Inst%DRFAC(k)*BETHA !hemco units???? jkodros - dfo=dfo*focean*SCALE + dfo=dfo*Inst%DRFAC(k)*BETHA !hemco units???? jkodros (?m-2 s-1) + + !dfo=dfo*focean*SCALE ! scale now includes ocean fraction - remove this line + dfo=dfo*SCALE ! note: scale now includes ocean fraction ! Loop thru the boundary layer DO L = 1, HcoState%Nz @@ -239,8 +466,45 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) IF ( FEMIS > 0d0 ) THEN ! Number - NUMBER = dfo * FEMIS - + !betty NUMBER = dfo * FEMIS ! need to move after add blowing snow + + ! update seasalt from blowing snow - huang 1/4/18 + IF (( Inst%EmitSnowSS )) THEN + IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) THEN + ! Southern Hemisphere + + !if (K > 3 ) THEN + NUMBER = FEMIS* (dfo + & + (( QSNOWICE_FYI * SUM( Inst%F_DN_S_FYI(:,K) ) + & + QSNOWICE_MYI * SUM( Inst%F_DN_S_MYI(:,K) ) ) * DDSNOW)) + + !NUMBER = FEMIS* (dfo) + FEMIS* ( & + ! (( QSNOWICE_FYI * SUM( Inst%F_DI_S_FYI(:,K) ) + & + ! QSNOWICE_MYI * SUM( Inst%F_DI_S_MYI(:,K) ) ) * DDSNOW)) & + ! / (Inst%SS_DEN( K ) * ((Inst%TOMAS_DBIN(k))**3.d0) & + ! * HcoState%Phys%PI/6.0d0) + !else + ! NUMBER = FEMIS * dfo + !endif + !IF (NUMBER2 .GT. 5.e5) THEN + ! print *, 'First', NUMBER2,NUMBER, I,J,K,L,FEMIS + !ENDIF + + !IF (NUMBER .GT. 5.e5) THEN + !!print*,'Betty here are emissions',NUMBER,dfo*FEMIS,K,I,J,L, & + ! Inst%F_DN_S_FYI(:,K), DDSNOW, SUM( Inst%F_DN_S_FYI(:,K) ), & + ! QSNOWICE_FYI, QSNOWICE_MYI, FEMIS + !ENDIF + ELSE + ! Northern Hemisphere + NUMBER = FEMIS* (dfo + & + (( QSNOWICE_FYI * SUM( Inst%F_DN_N_FYI(:,K) ) + & + QSNOWICE_MYI * SUM( Inst%F_DN_N_MYI(:,K) ) ) * DDSNOW)) + ENDIF + ELSE ! only open ocean sea salt + NUMBER = dfo * FEMIS + ENDIF + ! Mass MASS = NUMBER & * SQRT( HcoState%MicroPhys%BinBound(K ) * & @@ -253,10 +517,10 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ENDIF ENDDO ENDDO - ELSE - Inst%TC1(I,J,:,:) = 0d0 - Inst%TC2(I,J,:,:) = 0d0 - ENDIF + !ELSE ! move initialization to start of loop + ! Inst%TC1(I,J,:,:) = 0d0 + ! Inst%TC2(I,J,:,:) = 0d0 + !ENDIF ENDDO ENDDO @@ -270,6 +534,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! Add mass to the HEMCO data structure (jkodros) CALL HCO_EmisAdd( HcoState, Inst%TC2(:,:,:,K), Inst%HcoIDs(K), RC) IF ( RC /= HCO_SUCCESS ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'HCO_EmisAdd error: FLUXSALT', RC ) CALL HCO_ERROR( 'HCO_EmisAdd error: FLUXSALT', RC ) RETURN ENDIF @@ -291,6 +556,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! Add number to the HEMCO data structure CALL HCO_EmisAdd( HcoState, Inst%TC1(:,:,:,K), HcoID, RC) IF ( RC /= HCO_SUCCESS ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'HCO_EmisAdd error: FLUXSALT', RC ) CALL HCO_ERROR( 'HCO_EmisAdd error: FLUXSALT', RC ) RETURN ENDIF @@ -328,6 +594,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) USE HCO_State_Mod, ONLY : HCO_GetHcoID USE HCO_STATE_MOD, ONLY : HCO_GetExtHcoID USE HCO_ExtList_Mod, ONLY : GetExtNr + USE HCO_ExtList_Mod, ONLY : GetExtOpt ! ! !INPUT PARAMETERS: ! @@ -362,6 +629,16 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ! Pointers TYPE(MyInst), POINTER :: Inst + ! Local variables for blowing snow + INTEGER :: K, ND, IH !IH for different hemisphere + REAL*8 :: D_SNOW, D_DRY + REAL*8, PARAMETER :: A_SALT = 2.0d0 !from Mann et al. 2000 + REAL*8, PARAMETER :: B_SALT = 37.5d0 !in um + !REAL*8, PARAMETER :: DDSNOW = 2.0d0 !in um for snow particle interval + REAL*8, PARAMETER :: DDSNOW = 0.1d0 !in um for snow particle interval + REAL*8, PARAMETER :: RHONACL = 2160.0d0 !kg/m3 + REAL*8, PARAMETER :: RHOICE = 900.0d0 !kg/m3 + !================================================================= ! HCOX_TOMAS_Jeagle_Init begins here! !================================================================= @@ -378,6 +655,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) Inst => NULL() CALL InstCreate ( ExtNr, ExtState%TOMAS_Jeagle, Inst, RC ) IF ( RC /= HCO_SUCCESS ) THEN + !CALL HCO_ERROR ( HcoState%Config%Err, 'Cannot create TOMAS_Jeagle instance', RC ) CALL HCO_ERROR ( 'Cannot create TOMAS_Jeagle instance', RC ) RETURN ENDIF @@ -388,20 +666,184 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ! Get species IDs and settings ! ---------------------------------------------------------------------- + ! betty + ! print *,'Betty start of options' + + ! fix scaling factor over cold water SST (<5 degC) + CALL GetExtOpt ( HcoState%Config, Inst%ExtNr, 'Reduce SS cold water', & + OptValBool=Inst%ColdSST, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + + ! Add a SSA source from blowing snow (by J. Huang) + CALL GetExtOpt ( HcoState%Config, Inst%ExtNr, 'Blowing Snow SS', & + OptValBool=Inst%EmitSnowSS, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + + ! Whether or not differentiate snow salinity on FYI and MYI (by J. Huang) + !CALL GetExtOpt ( HcoState%Config, Inst%ExtNr, 'Diff salinity on ice', & + ! OptValBool=Inst%FYIsnow, RC=RC ) + !IF ( RC /= HCO_SUCCESS ) RETURN + ! Add snow salinity (NH and SH), snow age and number of particles + ! per snowflake as external factor from configuration file + IF ( Inst%EmitSnowSS ) THEN + CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'NH FYI snow salinity', & + OptValDp=Inst%NSLNT_FYI, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'NH MYI snow salinity', & + OptValDp=Inst%NSLNT_MYI, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'SH FYI snow salinity', & + OptValDp=Inst%SSLNT_FYI, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'SH MYI snow salinity', & + OptValDp=Inst%SSLNT_MYI, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'NH snow age', & + OptValDp=Inst%NAGE, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'SH snow age', & + OptValDp=Inst%SAGE, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'N per snowflake', & + OptValDp=Inst%NP, RC=RC ) + IF ( RC /= HCO_SUCCESS ) RETURN + ELSE + Inst%NSLNT_FYI = 0.1d0 ! default value 0.1 psu for NH FYI snow + Inst%NSLNT_MYI = 0.05d0 ! default value 0.05 psu for NH MYI snow + Inst%SSLNT_FYI = 0.03d0 ! default value 0.03 psu for SH FYI snow + Inst%SSLNT_FYI = 0.015d0 ! default value 0.015 psu for SH MYI snow + Inst%NAGE = 3.0d0 ! default value 3 days snow age in NH + Inst%SAGE = 1.5d0 ! default value 1.5 days snow age in SH + Inst%NP = 5.0d0 ! default value of 5 particles per snowflake + ENDIF + + ! Verbose mode + IF ( HcoState%amIRoot ) THEN + MSG = 'Use sea salt aerosol emissions (extension module)' + CALL HCO_MSG(HcoState%Config%Err,MSG, SEP1='-' ) + IF ( Inst%EmitSnowSS ) THEN + WRITE(MSG,*) ' - Arctic Snow Salinity on FYI (psu): ', Inst%NSLNT_FYI + CALL HCO_MSG(HcoState%Config%Err,MSG) + WRITE(MSG,*) ' - Arctic Snow Salinity on MYI (psu): ', Inst%NSLNT_MYI + CALL HCO_MSG(HcoState%Config%Err,MSG) + WRITE(MSG,*) ' - Antarctic Snow Salinity on FYI (psu): ', Inst%SSLNT_FYI + CALL HCO_MSG(HcoState%Config%Err,MSG) + WRITE(MSG,*) ' - Antarctic Snow Salinity on FYI (psu): ', Inst%SSLNT_MYI + CALL HCO_MSG(HcoState%Config%Err,MSG) + WRITE(MSG,*) ' - Arctic Snow age (days): ', Inst%NAGE + CALL HCO_MSG(HcoState%Config%Err,MSG) + WRITE(MSG,*) ' - Antarctic Snow age(days): ', Inst%SAGE + CALL HCO_MSG(HcoState%Config%Err,MSG) + WRITE(MSG,*) ' - Number of particle per snowflake: ', Inst%NP + CALL HCO_MSG(HcoState%Config%Err,MSG) + ENDIF + ENDIF + ! Get HEMCO species IDs CALL HCO_GetExtHcoID( HcoState, Inst%ExtNr, Inst%HcoIDs, SpcNames, & nSpc, RC ) IF ( RC /= HCO_SUCCESS ) RETURN IF ( nSpc < HcoState%MicroPhys%nBins ) THEN MSG = 'Not enough sea salt emission species set' + !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF + !print*,'Betty start to allocate' + + ALLOCATE ( Inst%SS_DEN ( HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + MSG = 'Cannot allocate SS_DEN' + !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate SS_DEN', RC ) + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%SS_DEN = 2200.d0 + + ! Allocate for blowing snow simulation + IF ( Inst%EmitSnowSS ) THEN + ALLOCATE ( Inst%F_DI_N_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_N_FYI', RC ) + MSG = 'Cannot allocate F_DI_N_FYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DI_N_FYI = 0.0_sp + + ALLOCATE ( Inst%F_DI_N_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_N_MYI', RC ) + MSG = 'Cannot allocate F_DI_N_MYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DI_N_MYI = 0.0_sp + + ALLOCATE ( Inst%F_DN_N_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( 'HcoState%Config%Err, Cannot allocate F_DN_N_FYI', RC ) + MSG = 'Cannot allocate F_DN_N_FYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DN_N_FYI = 0.0_sp + + ALLOCATE ( Inst%F_DN_N_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( 'HcoState%Config%Err, Cannot allocate F_DN_N_MYI', RC ) + MSG = 'Cannot allocate F_DN_N_MYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DN_N_MYI = 0.0_sp + + ALLOCATE ( Inst%F_DI_S_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_S_FYI', RC ) + MSG = 'Cannot allocate F_DI_S_FYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DI_S_FYI = 0.0_sp + + ALLOCATE ( Inst%F_DI_S_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_S_MYI', RC ) + MSG = 'Cannot allocate F_DI_S_MYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DI_S_MYI = 0.0_sp + + ALLOCATE ( Inst%F_DN_S_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DN_S_FYI', RC ) + MSG = 'Cannot allocate F_DN_S_FYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DN_S_FYI = 0.0_sp + + ALLOCATE ( Inst%F_DN_S_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) + IF ( AS/=0 ) THEN + !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DN_S_MYI', RC ) + MSG = 'Cannot allocate F_DN_S_MYI' + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + Inst%F_DN_S_MYI = 0.0_sp + ENDIF + + + !print *, 'Betty still allocating' + ! Allocate TOMAS_DBIN ALLOCATE ( Inst%TOMAS_DBIN( HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate TOMAS_DBIN array (hcox_tomas_jeagle_mod.F90)' + !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF @@ -410,6 +852,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%DRFAC( HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate DRFAC array (hcox_tomas_jeagle_mod.F90)' + !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF @@ -419,6 +862,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) HcoState%NZ, HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate TC1 array (hcox_tomas_jeagle_mod.F90)' + !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ELSE @@ -430,12 +874,117 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) HcoState%NZ, HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate TC2 array (hcox_tomas_jeagle_mod.F90)' + !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ELSE Inst%TC2 = 0d0 ENDIF + !print *,'Betty done allocating' + + !size bins for blowing snow - Huang 6/12/20 + IF ( Inst%EmitSnowSS ) THEN + + DO K = 1, HcoState%MicroPhys%nBins + ! TOMAS dry bin limits (radius) + + R0=0.5d6*((HcoState%MicroPhys%BinBound(K)*6.0d0)/ & + (Inst%SS_DEN( K )*HcoState%Phys%PI))**( 1d0 / 3d0 ) ! in um + R1=0.5d6*((HcoState%MicroPhys%BinBound(K+1)*6.0d0)/ & + (Inst%SS_DEN( K )*HcoState%Phys%PI))**( 1d0 / 3d0 ) ! in um + + !-------------- Define size distribution --------------------- + ! for northern hemisphere FYI +! D_SNOW = 1.0d0 + D_SNOW = 1.0d0 + DO ND = 1, NR_MAX + D_DRY = ( Inst%NSLNT_FYI * RHOICE / (1000.d0 & + * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW + !print*,'Here is Ddry ',D_DRY, R0*2d0 , R1*2d0 + IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN + !---------------------------------------------------------- + ! NOTES: + ! For size distribution + ! define the two-parameter gamma probability density funtion here + ! Yang et al 2008 eq (6) + !---------------------------------------------------------- + ! Midpoint of IRth bin + Inst%F_DI_N_FYI(ND, K) = EXP( - D_SNOW / B_SALT ) & + * D_SNOW**( A_SALT - 1.d0 ) & + / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) + !print*,'Here is F_DI ', ND, K, Inst%F_DI_N_FYI(ND, K) + ELSE + Inst%F_DI_N_FYI(ND, K) = 0d0 + ENDIF + Inst%F_DN_N_FYI(ND, K) = Inst%F_DI_N_FYI(ND,K) / (4d0/3d0 * HcoState%Phys%PI & + * 1.d-18 * Inst%SS_DEN( K ) * (D_DRY/2d0)**3) + D_SNOW = D_SNOW + DDSNOW + + !print*,'Here is F_DN ', ND, K, Inst%F_DN_N_FYI(ND, K) + + ENDDO + + ! for northern hemisphere MYI + D_SNOW = 1.0d0 + DO ND = 1, NR_MAX + D_DRY = ( Inst%NSLNT_MYI * RHOICE / (1000.d0 & + * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW + + IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN + ! Midpoint of IRth bin + Inst%F_DI_N_MYI(ND, K) = EXP( - D_SNOW / B_SALT ) & + * D_SNOW**( A_SALT - 1.d0 ) & + / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) + ELSE + Inst%F_DI_N_MYI(ND, K) = 0d0 + ENDIF + Inst%F_DN_N_MYI(ND, K) = Inst%F_DI_N_MYI(ND,K) / (4d0/3d0 * HcoState%Phys%PI & + * 1.d-18 * Inst%SS_DEN( K ) * (D_DRY/2d0)**3) + + D_SNOW = D_SNOW + DDSNOW + ENDDO + + + ! for southern hemisphere FYI + D_SNOW = 1.0d0 + DO ND = 1, NR_MAX + D_DRY = ( Inst%SSLNT_FYI * RHOICE / (1000.d0 & + * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW + + IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN + ! Midpoint of IRth bin + Inst%F_DI_S_FYI(ND, K) = EXP( - D_SNOW / B_SALT ) & + * D_SNOW**( A_SALT - 1.d0 ) & + / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) + ELSE + Inst%F_DI_S_FYI(ND, K) = 0d0 + ENDIF + Inst%F_DN_S_FYI(ND, K) = Inst%F_DI_S_FYI(ND,K)/ (4d0/3d0 * HcoState%Phys%PI & + * 1.d-18 * Inst%SS_DEN( K ) * (D_DRY/2d0)**3) + D_SNOW = D_SNOW + DDSNOW + ENDDO + + ! for southern hemisphere MYI + D_SNOW = 1.0d0 + DO ND = 1, NR_MAX + D_DRY = ( Inst%SSLNT_MYI * RHOICE / (1000.d0 & + * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW + IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN + ! Midpoint of IRth bin + Inst%F_DI_S_MYI(ND, K) = EXP( - D_SNOW / B_SALT ) & + * D_SNOW**( A_SALT - 1.d0 ) & + / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) + ELSE + Inst%F_DI_S_MYI(ND, K) = 0d0 + ENDIF + Inst%F_DN_S_MYI(ND, K) = Inst%F_DI_S_MYI(ND,K)/ (4d0/3d0 * HcoState%Phys%PI & + * 1.d-18 * Inst%SS_DEN( K ) * (D_DRY/2d0)**3) + D_SNOW = D_SNOW + DDSNOW + ENDDO + ENDDO !K + ENDIF + ! ----- IMPORTANT BINS ONLY CORRECTLY SET UP FOR TOMAS 15 PLEASE ADJUST OTHERS -jkodros (7/21/15) ! ---- 6/24/16 - JKodros - I have updated the DRFAC. They should (hopefully) be ! ---- correct now. DRFAC is the bin width (radius not diameter) for DRY SS @@ -538,6 +1087,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ELSE MSG = 'Adjust TOMAS_Jeagle emiss coeff (TOMAS_COEF) for your model res: SRCSALT30: hcox_TOMAS_jeagle_mod.F90' + !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) ENDIF @@ -554,6 +1104,15 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ExtState%V10M%DoUse = .TRUE. ExtState%FRAC_OF_PBL%DoUse = .TRUE. ExtState%FRCLND%DoUse = .TRUE. + ExtState%FROCEAN%DoUse = .TRUE. + ExtState%FRSEAICE%DoUse = .TRUE. + + ! for blowing snow + IF ( Inst%EmitSnowSS ) THEN + ExtState%USTAR%DoUse = .TRUE. + ExtState%T2M%DoUse = .TRUE. + ExtState%QV2M%DoUse = .TRUE. + ENDIF !======================================================================= ! Leave w/ success @@ -696,6 +1255,9 @@ SUBROUTINE InstCreate ( ExtNr, Instance, Inst, RC ) ! Generic instance initialization ! ---------------------------------------------------------------- + !betty + !print*, 'Betty In instance' + ! Initialize Inst => NULL() @@ -712,6 +1274,17 @@ SUBROUTINE InstCreate ( ExtNr, Instance, Inst, RC ) Inst%Instance = nnInst + 1 Inst%ExtNr = ExtNr + !Init values + Inst%ColdSST = .FALSE. + Inst%EmitSnowSS = .FALSE. + Inst%NSLNT_FYI = 0.0 + Inst%NSLNT_MYI = 0.0 + Inst%SSLNT_FYI = 0.0 + Inst%SSLNT_MYI = 0.0 + Inst%NAGE = 0.0 + Inst%SAGE = 0.0 + Inst%NP = 1.0 + ! Attach to instance list Inst%NextInst => AllInst AllInst => Inst @@ -780,6 +1353,17 @@ SUBROUTINE InstRemove ( Instance ) IF ( ASSOCIATED( Inst%TC2 ) ) DEALLOCATE( Inst%TC2 ) IF ( ALLOCATED ( Inst%HcoIDs ) ) DEALLOCATE( Inst%HcoIDs ) + IF ( ASSOCIATED( Inst%SS_DEN ) ) DEALLOCATE( Inst%SS_DEN ) + IF ( ASSOCIATED( Inst%F_DI_N_FYI ) ) DEALLOCATE( Inst%F_DI_N_FYI ) + IF ( ASSOCIATED( Inst%F_DI_N_MYI ) ) DEALLOCATE( Inst%F_DI_N_MYI ) + IF ( ASSOCIATED( Inst%F_DI_S_FYI ) ) DEALLOCATE( Inst%F_DI_S_FYI ) + IF ( ASSOCIATED( Inst%F_DI_S_MYI ) ) DEALLOCATE( Inst%F_DI_S_MYI ) + IF ( ASSOCIATED( Inst%F_DN_N_FYI ) ) DEALLOCATE( Inst%F_DN_N_FYI ) + IF ( ASSOCIATED( Inst%F_DN_N_MYI ) ) DEALLOCATE( Inst%F_DN_N_MYI ) + IF ( ASSOCIATED( Inst%F_DN_S_FYI ) ) DEALLOCATE( Inst%F_DN_S_FYI ) + IF ( ASSOCIATED( Inst%F_DN_S_MYI ) ) DEALLOCATE( Inst%F_DN_S_MYI ) + IF ( ASSOCIATED( Inst%MULTIICE ) ) DEALLOCATE( Inst%MULTIICE ) + PrevInst%NextInst => Inst%NextInst ELSE AllInst => Inst%NextInst From c0f602c75cce94126029737f4ab1231df6c45767 Mon Sep 17 00:00:00 2001 From: bcroft Date: Mon, 23 May 2022 13:56:00 -0500 Subject: [PATCH 02/23] Updates for TOMAS --- src/Extensions/hcox_tomas_jeagle_mod.F90 | 52 +++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/Extensions/hcox_tomas_jeagle_mod.F90 b/src/Extensions/hcox_tomas_jeagle_mod.F90 index c4989f22..1a687f93 100644 --- a/src/Extensions/hcox_tomas_jeagle_mod.F90 +++ b/src/Extensions/hcox_tomas_jeagle_mod.F90 @@ -67,6 +67,7 @@ MODULE HCOX_TOMAS_Jeagle_Mod INTEGER, ALLOCATABLE :: HcoIDs (: ) ! HEMCO species ID's REAL(dp), POINTER :: TOMAS_DBIN(: ) ! TOMAS bin width REAL(dp), POINTER :: DRFAC (: ) ! TOMAS area? + REAL(dp), POINTER :: OFFLINE_NFAC(: ) ! scale the offline emissions into bins REAL(dp), POINTER :: TC1 (:,:,:,:) ! Aerosol mass REAL(dp), POINTER :: TC2 (:,:,:,:) ! Aerosol number LOGICAL :: ColdSST ! Flag to correct SSA emissions over cold waters @@ -93,6 +94,8 @@ MODULE HCOX_TOMAS_Jeagle_Mod !Number densities REAL(sp), POINTER :: MULTIICE(:,:) => NULL() ! add for blowing snow + !REAL(sp), POINTER :: SALA_OFFLINE(:,:) => NULL() ! is this needed - where is multiice use? + ! REAL(sp), POINTER :: SALC_OFFLINE(:,:) => NULL() ! TYPE(MyInst), POINTER :: NextInst => NULL() END TYPE MyInst @@ -220,6 +223,8 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) CHARACTER(LEN=31) :: FLDNME INTEGER :: NDAYS!, cYYYY, cMM, cDD, K REAL(hp), TARGET :: MULTI(HcoState%NX,HcoState%NY) + REAL(hp), TARGET :: SALA_OFFLINE(HcoState%NX,HcoState%NY) + REAL(hp), TARGET :: SALC_OFFLINE(HcoState%NX,HcoState%NY) REAL(hp), TARGET :: SNOWSALA (HcoState%NX,HcoState%NY) REAL(hp), TARGET :: SNOWSALC (HcoState%NX,HcoState%NY) @@ -264,6 +269,23 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) Inst%TC1 = 0.0_hp Inst%TC2 = 0.0_hp + !!!betty - maybe will need another IF here + CALL HCO_EvalFld ( HcoState, 'SEASALT_SALA', SALA_OFFLINE, RC ) + IF ( RC /= HCO_SUCCESS ) THEN + WRITE(MSG,*) 'Cannot find OFFLINE SALA' + !CALL HCO_ERROR(HcoState%Config%Err, MSG, RC) + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + CALL HCO_EvalFld ( HcoState, 'SEASALT_SALC', SALC_OFFLINE, RC ) + IF ( RC /= HCO_SUCCESS ) THEN + WRITE(MSG,*) 'Cannot find OFFLINE SALC' + !CALL HCO_ERROR(HcoState%Config%Err, MSG, RC) + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + + IF ( Inst%EmitSnowSS ) THEN ! Read in distribution of multi-year sea ice from ! remotely sensed observations of sea ice motion and sea @@ -445,7 +467,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) dfo=1.373*W10M**3.41*rwet**(-1.*A) & !m-2 um-1 s-1 *(1.+0.057*rwet**3.45)*10.**(1.607*exp(-1.*B**2)) - else dfo=0.d0 @@ -456,6 +477,20 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) !dfo=dfo*focean*SCALE ! scale now includes ocean fraction - remove this line dfo=dfo*SCALE ! note: scale now includes ocean fraction + print*,'Original dfo', dfo + + ! test an overwrite with the offline values - use 0.6361 to remove mass from 11-16 um + dfo = 0.6361d0*(SALA_OFFLINE(I,J) + SALC_OFFLINE(I,J)) & + *Inst%OFFLINE_NFAC(k) & + / SQRT( HcoState%MicroPhys%BinBound(K ) * & + HcoState%MicroPhys%BinBound(K+1) ) + + print*, 'New dfo',dfo + + + + + ! Loop thru the boundary layer DO L = 1, HcoState%Nz @@ -857,6 +892,15 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) RETURN ENDIF + ! Allocate TOMAS_A + ALLOCATE ( Inst%OFFLINE_NFAC( HcoState%MicroPhys%nBins ), STAT=RC ) + IF ( RC /= HCO_SUCCESS ) THEN + MSG = 'Cannot allocate OFFLINE_NFAC array (hcox_tomas_jeagle_mod.F90)' + !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) + CALL HCO_ERROR(MSG, RC ) + RETURN + ENDIF + ! JKODROS - ALLOCATE TC1 and TC2 ALLOCATE ( Inst%TC1( HcoState%NX, HcoState%NY,& HcoState%NZ, HcoState%MicroPhys%nBins ), STAT=RC ) @@ -1019,6 +1063,11 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) 1.80413d-02, 2.86387d-02, 4.54612d-02, 7.21651d-02, & 1.14555d-01, 1.81845d-01, 1.06874d+00, 3.39304d+00 /) + Inst%OFFLINE_NFAC= (/2.66827d-05, 5.14210d-05, 1.23134d-04, & + 4.02014d-04, 1.82823d-03, 1.02085d-02, 5.23141d-02, & + 1.72667d-01, 2.86934d-01, 2.32107d-01, 1.09428d-01, & + 4.43300d-02, 2.57428d-02, 6.11951d-02, 2.64302d-03 /) + #elif defined( TOMAS40 ) !----------------------------------------------------------------------- @@ -1349,6 +1398,7 @@ SUBROUTINE InstRemove ( Instance ) IF ( ASSOCIATED( Inst%TOMAS_DBIN ) ) DEALLOCATE( Inst%TOMAS_DBIN ) IF ( ASSOCIATED( Inst%DRFAC ) ) DEALLOCATE( Inst%DRFAC ) + IF ( ASSOCIATED( Inst%OFFLINE_NFAC) ) DEALLOCATE( Inst%OFFLINE_NFAC) IF ( ASSOCIATED( Inst%TC1 ) ) DEALLOCATE( Inst%TC1 ) IF ( ASSOCIATED( Inst%TC2 ) ) DEALLOCATE( Inst%TC2 ) IF ( ALLOCATED ( Inst%HcoIDs ) ) DEALLOCATE( Inst%HcoIDs ) From 462a69677a2f178dcf134edae46b45a76b96f05f Mon Sep 17 00:00:00 2001 From: bcroft Date: Wed, 25 May 2022 11:08:28 -0500 Subject: [PATCH 03/23] Additional code cleaning for TOMAS in HEMCO --- src/Extensions/hcox_tomas_jeagle_mod.F90 | 52 +----------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/src/Extensions/hcox_tomas_jeagle_mod.F90 b/src/Extensions/hcox_tomas_jeagle_mod.F90 index 1a687f93..c4989f22 100644 --- a/src/Extensions/hcox_tomas_jeagle_mod.F90 +++ b/src/Extensions/hcox_tomas_jeagle_mod.F90 @@ -67,7 +67,6 @@ MODULE HCOX_TOMAS_Jeagle_Mod INTEGER, ALLOCATABLE :: HcoIDs (: ) ! HEMCO species ID's REAL(dp), POINTER :: TOMAS_DBIN(: ) ! TOMAS bin width REAL(dp), POINTER :: DRFAC (: ) ! TOMAS area? - REAL(dp), POINTER :: OFFLINE_NFAC(: ) ! scale the offline emissions into bins REAL(dp), POINTER :: TC1 (:,:,:,:) ! Aerosol mass REAL(dp), POINTER :: TC2 (:,:,:,:) ! Aerosol number LOGICAL :: ColdSST ! Flag to correct SSA emissions over cold waters @@ -94,8 +93,6 @@ MODULE HCOX_TOMAS_Jeagle_Mod !Number densities REAL(sp), POINTER :: MULTIICE(:,:) => NULL() ! add for blowing snow - !REAL(sp), POINTER :: SALA_OFFLINE(:,:) => NULL() ! is this needed - where is multiice use? - ! REAL(sp), POINTER :: SALC_OFFLINE(:,:) => NULL() ! TYPE(MyInst), POINTER :: NextInst => NULL() END TYPE MyInst @@ -223,8 +220,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) CHARACTER(LEN=31) :: FLDNME INTEGER :: NDAYS!, cYYYY, cMM, cDD, K REAL(hp), TARGET :: MULTI(HcoState%NX,HcoState%NY) - REAL(hp), TARGET :: SALA_OFFLINE(HcoState%NX,HcoState%NY) - REAL(hp), TARGET :: SALC_OFFLINE(HcoState%NX,HcoState%NY) REAL(hp), TARGET :: SNOWSALA (HcoState%NX,HcoState%NY) REAL(hp), TARGET :: SNOWSALC (HcoState%NX,HcoState%NY) @@ -269,23 +264,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) Inst%TC1 = 0.0_hp Inst%TC2 = 0.0_hp - !!!betty - maybe will need another IF here - CALL HCO_EvalFld ( HcoState, 'SEASALT_SALA', SALA_OFFLINE, RC ) - IF ( RC /= HCO_SUCCESS ) THEN - WRITE(MSG,*) 'Cannot find OFFLINE SALA' - !CALL HCO_ERROR(HcoState%Config%Err, MSG, RC) - CALL HCO_ERROR(MSG, RC ) - RETURN - ENDIF - CALL HCO_EvalFld ( HcoState, 'SEASALT_SALC', SALC_OFFLINE, RC ) - IF ( RC /= HCO_SUCCESS ) THEN - WRITE(MSG,*) 'Cannot find OFFLINE SALC' - !CALL HCO_ERROR(HcoState%Config%Err, MSG, RC) - CALL HCO_ERROR(MSG, RC ) - RETURN - ENDIF - - IF ( Inst%EmitSnowSS ) THEN ! Read in distribution of multi-year sea ice from ! remotely sensed observations of sea ice motion and sea @@ -467,6 +445,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) dfo=1.373*W10M**3.41*rwet**(-1.*A) & !m-2 um-1 s-1 *(1.+0.057*rwet**3.45)*10.**(1.607*exp(-1.*B**2)) + else dfo=0.d0 @@ -477,20 +456,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) !dfo=dfo*focean*SCALE ! scale now includes ocean fraction - remove this line dfo=dfo*SCALE ! note: scale now includes ocean fraction - print*,'Original dfo', dfo - - ! test an overwrite with the offline values - use 0.6361 to remove mass from 11-16 um - dfo = 0.6361d0*(SALA_OFFLINE(I,J) + SALC_OFFLINE(I,J)) & - *Inst%OFFLINE_NFAC(k) & - / SQRT( HcoState%MicroPhys%BinBound(K ) * & - HcoState%MicroPhys%BinBound(K+1) ) - - print*, 'New dfo',dfo - - - - - ! Loop thru the boundary layer DO L = 1, HcoState%Nz @@ -892,15 +857,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) RETURN ENDIF - ! Allocate TOMAS_A - ALLOCATE ( Inst%OFFLINE_NFAC( HcoState%MicroPhys%nBins ), STAT=RC ) - IF ( RC /= HCO_SUCCESS ) THEN - MSG = 'Cannot allocate OFFLINE_NFAC array (hcox_tomas_jeagle_mod.F90)' - !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) - CALL HCO_ERROR(MSG, RC ) - RETURN - ENDIF - ! JKODROS - ALLOCATE TC1 and TC2 ALLOCATE ( Inst%TC1( HcoState%NX, HcoState%NY,& HcoState%NZ, HcoState%MicroPhys%nBins ), STAT=RC ) @@ -1063,11 +1019,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) 1.80413d-02, 2.86387d-02, 4.54612d-02, 7.21651d-02, & 1.14555d-01, 1.81845d-01, 1.06874d+00, 3.39304d+00 /) - Inst%OFFLINE_NFAC= (/2.66827d-05, 5.14210d-05, 1.23134d-04, & - 4.02014d-04, 1.82823d-03, 1.02085d-02, 5.23141d-02, & - 1.72667d-01, 2.86934d-01, 2.32107d-01, 1.09428d-01, & - 4.43300d-02, 2.57428d-02, 6.11951d-02, 2.64302d-03 /) - #elif defined( TOMAS40 ) !----------------------------------------------------------------------- @@ -1398,7 +1349,6 @@ SUBROUTINE InstRemove ( Instance ) IF ( ASSOCIATED( Inst%TOMAS_DBIN ) ) DEALLOCATE( Inst%TOMAS_DBIN ) IF ( ASSOCIATED( Inst%DRFAC ) ) DEALLOCATE( Inst%DRFAC ) - IF ( ASSOCIATED( Inst%OFFLINE_NFAC) ) DEALLOCATE( Inst%OFFLINE_NFAC) IF ( ASSOCIATED( Inst%TC1 ) ) DEALLOCATE( Inst%TC1 ) IF ( ASSOCIATED( Inst%TC2 ) ) DEALLOCATE( Inst%TC2 ) IF ( ALLOCATED ( Inst%HcoIDs ) ) DEALLOCATE( Inst%HcoIDs ) From 8a30947cca920be6ee1a1910b8ce58a902e05167 Mon Sep 17 00:00:00 2001 From: Melissa Sulprizio Date: Fri, 11 Nov 2022 13:05:13 -0500 Subject: [PATCH 04/23] Remove extra variables HCOX_TOMAS_Jeagle_Run preventing code from compiling The MSG variable was defined twice in HCOX_TOMAS_Jeagle_Run. The second occurrence has been removed, along with an unused ERR variable. Signed-off-by: Melissa Sulprizio --- src/Extensions/hcox_tomas_jeagle_mod.F90 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Extensions/hcox_tomas_jeagle_mod.F90 b/src/Extensions/hcox_tomas_jeagle_mod.F90 index ff9eb457..e0fc3764 100644 --- a/src/Extensions/hcox_tomas_jeagle_mod.F90 +++ b/src/Extensions/hcox_tomas_jeagle_mod.F90 @@ -183,7 +183,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) CHARACTER(LEN=255):: MSG, LOC ! New variables for blowing snow (huang, 04/09/20) - REAL*8 :: SNOWSALT REAL*8 :: FROPEN, FRFIRST REAL*8 :: FRICTVEL, WVMR, TEMP @@ -235,10 +234,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! For debugging !INTEGER :: ii=50, jj=10 - ! Error handling - LOGICAL :: ERR - CHARACTER(LEN=255) :: MSG - !================================================================= ! SRCSALT30 begins here! !================================================================= From 315d15e92ea11d24794a1293d43af7ed209e0fb0 Mon Sep 17 00:00:00 2001 From: Melissa Sulprizio Date: Mon, 14 Nov 2022 12:44:57 -0500 Subject: [PATCH 05/23] Remove trailing whitespaces from hcox_tomas_jeagle_mod.F90 There were an excessive amount of trailing whitespaces in hcox_tomas_jeagle_mod.F90 that affected readability of the file. These have now been removed. Signed-off-by: Melissa Sulprizio --- src/Extensions/hcox_tomas_jeagle_mod.F90 | 330 +++++++++++------------ 1 file changed, 165 insertions(+), 165 deletions(-) diff --git a/src/Extensions/hcox_tomas_jeagle_mod.F90 b/src/Extensions/hcox_tomas_jeagle_mod.F90 index e0fc3764..3526cbe6 100644 --- a/src/Extensions/hcox_tomas_jeagle_mod.F90 +++ b/src/Extensions/hcox_tomas_jeagle_mod.F90 @@ -60,7 +60,7 @@ MODULE HCOX_TOMAS_Jeagle_Mod REAL(dp) :: TOMAS_COEF ! Seasalt emiss coeff. !Tracer IDs - LOGICAL :: EmitSnowSS ! Calculate sea salt emission blowing snow + LOGICAL :: EmitSnowSS ! Calculate sea salt emission blowing snow ! Arrays @@ -71,28 +71,28 @@ MODULE HCOX_TOMAS_Jeagle_Mod REAL(dp), POINTER :: TC2 (:,:,:,:) ! Aerosol number LOGICAL :: ColdSST ! Flag to correct SSA emissions over cold waters - ! Scale factors - REAL*8 :: NSLNT_FYI ! North Hemisphere snow salinity on first year ice (FYI) (psu) - REAL*8 :: NSLNT_MYI ! North Hemisphere snow salinity on multiyear ice (MYI) (psu) - REAL*8 :: SSLNT_FYI ! South Hemisphere snow salinity on FYI (psu) - REAL*8 :: SSLNT_MYI ! South Hemisphere snow salinity on MYI (psu) - REAL*8 :: NAGE ! North Hemisphere snow age (days) - REAL*8 :: SAGE ! South Hemisphere snow age (days) - REAL*8 :: NP ! number of particle per snowflake + ! Scale factors + REAL*8 :: NSLNT_FYI ! North Hemisphere snow salinity on first year ice (FYI) (psu) + REAL*8 :: NSLNT_MYI ! North Hemisphere snow salinity on multiyear ice (MYI) (psu) + REAL*8 :: SSLNT_FYI ! South Hemisphere snow salinity on FYI (psu) + REAL*8 :: SSLNT_MYI ! South Hemisphere snow salinity on MYI (psu) + REAL*8 :: NAGE ! North Hemisphere snow age (days) + REAL*8 :: SAGE ! South Hemisphere snow age (days) + REAL*8 :: NP ! number of particle per snowflake !Module variables REAL*8, POINTER :: SS_DEN(:) ! densities - REAL*8, POINTER :: F_DI_N_FYI(:,:) ! add for blowing snow for NH + REAL*8, POINTER :: F_DI_N_FYI(:,:) ! add for blowing snow for NH REAL*8, POINTER :: F_DI_N_MYI(:,:) ! add for blowing snow for NH - REAL*8, POINTER :: F_DI_S_FYI(:,:) ! add for blowing snow for SH - REAL*8, POINTER :: F_DI_S_MYI(:,:) ! add for blowing snow for SH + REAL*8, POINTER :: F_DI_S_FYI(:,:) ! add for blowing snow for SH + REAL*8, POINTER :: F_DI_S_MYI(:,:) ! add for blowing snow for SH REAL*8, POINTER :: F_DN_N_FYI(:,:) ! add for blowing snow for NH - REAL*8, POINTER :: F_DN_N_MYI(:,:) ! add for blowing snow for NH + REAL*8, POINTER :: F_DN_N_MYI(:,:) ! add for blowing snow for NH REAL*8, POINTER :: F_DN_S_FYI(:,:) ! add for blowing snow for SH REAL*8, POINTER :: F_DN_S_MYI(:,:) ! add for blowing snow for SH - !Number densities - REAL(sp), POINTER :: MULTIICE(:,:) => NULL() ! add for blowing snow + !Number densities + REAL(sp), POINTER :: MULTIICE(:,:) => NULL() ! add for blowing snow TYPE(MyInst), POINTER :: NextInst => NULL() END TYPE MyInst @@ -139,31 +139,31 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! ! !REMARKS: ! References -! ============================================================================ -! (1 ) Chin, M., P. Ginoux, S. Kinne, B. Holben, B. Duncan, R. Martin, -! J. Logan, A. Higurashi, and T. Nakajima, "Tropospheric aerosol -! optical thickness from the GOCART model and comparisons with -! satellite and sunphotometers measurements", J. Atmos Sci., 2001. -! (2 ) Gong, S., L. Barrie, and J.-P. Blanchet, "Modeling sea-salt -! aerosols in the atmosphere. 1. Model development", J. Geophys. Res., -! v. 102, 3805-3818, 1997. -! (3 ) Gong, S. L., "A parameterization of sea-salt aerosol source function -! for sub- and super-micron particles", Global Biogeochem. Cy., 17(4), -! 1097, doi:10.1029/2003GB002079, 2003. -! (4 ) Jaegle, L., P.K. Quinn, T.S. Bates, B. Alexander, J.-T. Lin, "Global -! distribution of sea salt aerosols: New constraints from in situ and -! remote sensing observations", Atmos. Chem. Phys., 11, 3137-3157, -! doi:10.5194/acp-11-3137-2011. -! (5 ) Huang, J., Jaeglé, L., "Wintertime enhancements of sea salt aerosol in -! polar regions consistent with a sea ice source from blowing snow." -! Atmos. Chem. Phys. 17, 3699–3712. https://doi.org/10.5194/acp-17-3699-2017, 2017. -! (6 ) Huang, J., Jaeglé, L., Chen, Q., Alexander, B., Sherwen, T., -! Evans, M. J., Theys, N., and Choi, S. "Evaluating the impact of -! blowing snow sea salt aerosol on springtime BrO and O3 in the Arctic, -! Atmos. Chem. Phys. Discuss., https://doi.org/10.5194/acp-2019-1094, 2020. -! (7 ) Tschudi, M., W. N. Meier, J. S. Stewart, C. Fowler, and J. Maslanik. -! "EASE-Grid Sea Ice Age, Version 4." NASA National Snow and Ice Data Center -! Distributed Active Archive Center. doi: https://doi.org/10.5067/UTAV7490FEPB., 2019. +! ============================================================================ +! (1 ) Chin, M., P. Ginoux, S. Kinne, B. Holben, B. Duncan, R. Martin, +! J. Logan, A. Higurashi, and T. Nakajima, "Tropospheric aerosol +! optical thickness from the GOCART model and comparisons with +! satellite and sunphotometers measurements", J. Atmos Sci., 2001. +! (2 ) Gong, S., L. Barrie, and J.-P. Blanchet, "Modeling sea-salt +! aerosols in the atmosphere. 1. Model development", J. Geophys. Res., +! v. 102, 3805-3818, 1997. +! (3 ) Gong, S. L., "A parameterization of sea-salt aerosol source function +! for sub- and super-micron particles", Global Biogeochem. Cy., 17(4), +! 1097, doi:10.1029/2003GB002079, 2003. +! (4 ) Jaegle, L., P.K. Quinn, T.S. Bates, B. Alexander, J.-T. Lin, "Global +! distribution of sea salt aerosols: New constraints from in situ and +! remote sensing observations", Atmos. Chem. Phys., 11, 3137-3157, +! doi:10.5194/acp-11-3137-2011. +! (5 ) Huang, J., Jaeglé, L., "Wintertime enhancements of sea salt aerosol in +! polar regions consistent with a sea ice source from blowing snow." +! Atmos. Chem. Phys. 17, 3699–3712. https://doi.org/10.5194/acp-17-3699-2017, 2017. +! (6 ) Huang, J., Jaeglé, L., Chen, Q., Alexander, B., Sherwen, T., +! Evans, M. J., Theys, N., and Choi, S. "Evaluating the impact of +! blowing snow sea salt aerosol on springtime BrO and O3 in the Arctic, +! Atmos. Chem. Phys. Discuss., https://doi.org/10.5194/acp-2019-1094, 2020. +! (7 ) Tschudi, M., W. N. Meier, J. S. Stewart, C. Fowler, and J. Maslanik. +! "EASE-Grid Sea Ice Age, Version 4." NASA National Snow and Ice Data Center +! Distributed Active Archive Center. doi: https://doi.org/10.5067/UTAV7490FEPB., 2019. ! ! !REVISION HISTORY: ! 01 Oct 2014 - R. Yantosca - Initial version, based on TOMAS SRCSALT30 code @@ -182,7 +182,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) REAL(dp) :: rwet, dfo, B, A, SST, SCALE CHARACTER(LEN=255):: MSG, LOC - ! New variables for blowing snow (huang, 04/09/20) + ! New variables for blowing snow (huang, 04/09/20) REAL*8 :: SNOWSALT REAL*8 :: FROPEN, FRFIRST REAL*8 :: FRICTVEL, WVMR, TEMP @@ -193,13 +193,13 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) REAL*8 :: SLNT, SLNT_FYI, SLNT_MYI REAL*8 :: AGE, ISFROST - ! New parameters for blowing snow (huang, 04/09/20) - REAL*8, PARAMETER :: LS = 2839d3 ! Latent heat of sublimation @ T=-30C (J/kg). - ! Varies very little with Temperature - REAL*8, PARAMETER :: RV = 461.5d0 !J kg-1 K-1 - REAL*8, PARAMETER :: RHONACL = 2160.0d0 !kg/m3 - REAL*8, PARAMETER :: RHOICE = 900.0d0 !kg/m3 - REAL*8, PARAMETER :: K0 = 2.16d-2 !J m-1 s-1 K-1 + ! New parameters for blowing snow (huang, 04/09/20) + REAL*8, PARAMETER :: LS = 2839d3 ! Latent heat of sublimation @ T=-30C (J/kg). + ! Varies very little with Temperature + REAL*8, PARAMETER :: RV = 461.5d0 !J kg-1 K-1 + REAL*8, PARAMETER :: RHONACL = 2160.0d0 !kg/m3 + REAL*8, PARAMETER :: RHOICE = 900.0d0 !kg/m3 + REAL*8, PARAMETER :: K0 = 2.16d-2 !J m-1 s-1 K-1 REAL*8, PARAMETER :: A0 = 3.78407d-1 REAL*8, PARAMETER :: A1 = -8.64089d-2 REAL*8, PARAMETER :: A2 = -1.60570d-2 @@ -210,14 +210,14 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) REAL*8, PARAMETER :: A7 = 1.24600d-2 REAL*8, PARAMETER :: A8 = 1.56862d-3 REAL*8, PARAMETER :: A9 = -2.93002d-4 - REAL*8, PARAMETER :: A_SALT = 2.0d0 !from Mann et al. 2000 - REAL*8, PARAMETER :: B_SALT = 37.5d0 !in um - !REAL*8, PARAMETER :: DDSNOW = 2.0d0 !in um for snow particle interval - REAL*8, PARAMETER :: DDSNOW = 0.1d0 !in um for snow particle interval + REAL*8, PARAMETER :: A_SALT = 2.0d0 !from Mann et al. 2000 + REAL*8, PARAMETER :: B_SALT = 37.5d0 !in um + !REAL*8, PARAMETER :: DDSNOW = 2.0d0 !in um for snow particle interval + REAL*8, PARAMETER :: DDSNOW = 0.1d0 !in um for snow particle interval LOGICAL, SAVE :: FIRST = .TRUE. LOGICAL, SAVE :: FIRSTSAL = .TRUE. CHARACTER(LEN=31) :: FLDNME - INTEGER :: NDAYS!, cYYYY, cMM, cDD, K + INTEGER :: NDAYS!, cYYYY, cMM, cDD, K REAL(hp), TARGET :: MULTI(HcoState%NX,HcoState%NY) REAL(hp), TARGET :: SNOWSALA (HcoState%NX,HcoState%NY) REAL(hp), TARGET :: SNOWSALC (HcoState%NX,HcoState%NY) @@ -263,12 +263,12 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) Inst%TC2 = 0.0_hp IF ( Inst%EmitSnowSS ) THEN - ! Read in distribution of multi-year sea ice from - ! remotely sensed observations of sea ice motion and sea - ! ice extent for the Arctic (Tschudi et al., 2019). For the - ! Antarctic, the multi year sea ice extent is based on the minimum - ! MERRA-2 sea ice extent of the previous summer. - + ! Read in distribution of multi-year sea ice from + ! remotely sensed observations of sea ice motion and sea + ! ice extent for the Arctic (Tschudi et al., 2019). For the + ! Antarctic, the multi year sea ice extent is based on the minimum + ! MERRA-2 sea ice extent of the previous summer. + CALL HCO_EvalFld ( HcoState, 'MULTISEAICE', MULTI, RC ) IF ( RC /= HCO_SUCCESS ) THEN WRITE(MSG,*) 'Cannot find MULTISEAICE data for blowing snow' @@ -300,7 +300,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! Grid box surface area [m2] A_M2 = HcoState%Grid%AREA_M2%Val(I,J) - ! Advance to next grid box if it's not over water or sea ice + ! Advance to next grid box if it's not over water or sea ice IF ( ExtState%FROCEAN%Arr%Val(I,J)<=0d0 .and. & ExtState%FRSEAICE%Arr%Val(I,J)<=0d0 ) CYCLE @@ -322,95 +322,95 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) SCALE = 0.329d0 + 0.0904d0*SST - & 0.00717d0*SST**2d0 + 0.000207d0*SST**3d0 - ! Limit the SST scaling factor to 0.25 over cold SST (below 5C) + ! Limit the SST scaling factor to 0.25 over cold SST (below 5C) IF ( Inst%ColdSST .and. SST<= 5.0d0 ) SCALE = 0.25d0 - ! Apply to only the open ocean fraction of the gridbox (Huang 06/12/20) + ! Apply to only the open ocean fraction of the gridbox (Huang 06/12/20) FROPEN = ExtState%FROCEAN%Arr%Val(I,J)-ExtState%FRSEAICE%Arr%Val(I,J) IF ( FROPEN < 0d0 ) FROPEN = 0d0 - ! Eventually apply wind scaling factor. + ! Eventually apply wind scaling factor. !SCALE = SCALE * Inst%WindScale * FROPEN - SCALE = SCALE * FROPEN + SCALE = SCALE * FROPEN - !---------------------------------------------------------------- - ! huang, 04/09/20: Add blowing snow emissions over sea ice - !---------------------------------------------------------------- + !---------------------------------------------------------------- + ! huang, 04/09/20: Add blowing snow emissions over sea ice + !---------------------------------------------------------------- IF ( Inst%EmitSnowSS ) THEN IF ( ExtState%FRSEAICE%Arr%Val(I,J) > 0d0 )THEN - ! Friction velocity [m/s] + ! Friction velocity [m/s] FRICTVEL = ExtState%USTAR%Arr%Val(I,J) - ! Convert specific humidity [g H2O/kg air] to water vapor mixing ratio [v/v] - ! QV2m is in kg H2O/kg air + ! Convert specific humidity [g H2O/kg air] to water vapor mixing ratio [v/v] + ! QV2m is in kg H2O/kg air WVMR = ExtState%QV2M%Arr%Val(I,J) * 28.973d0 / 18.0d0 - ! Temperature at 2M in grid box (I,J) [K] + ! Temperature at 2M in grid box (I,J) [K] TEMP = ExtState%T2M%Arr%Val(I,J) - ! Surface pressure at grid box (I,J). Convert from [Pa] to [hPa] + ! Surface pressure at grid box (I,J). Convert from [Pa] to [hPa] PRESS = HcoState%Grid%PSFC%Val( I, J ) /100d0 - ! Calculate saturation vapor pressure over ice [in Pa] at temperature - ! TS [K] + ! Calculate saturation vapor pressure over ice [in Pa] at temperature + ! TS [K] P_ICE = 10d0**(-2663.5d0/TEMP+12.537d0) - ! Calculate relative humidity with respect to ice [%] + ! Calculate relative humidity with respect to ice [%] RH_ICE = PRESS * WVMR / (P_ICE*0.01d0) *100.0d0 - ! Limit RH to 100% + ! Limit RH to 100% IF (RH_ICE > 100d0) RH_ICE =100.0d0 - ! Coefficient of Diffusion of water vapor in air [m2/s] - ! Parameterization of Massman, W.J. "A review of teh molecular diffusivities of - ! H2O, CO2, CH4... in air, O2 and N2 near STP" Atmos. Env., 32, 6, 1111-1127, 1998. + ! Coefficient of Diffusion of water vapor in air [m2/s] + ! Parameterization of Massman, W.J. "A review of teh molecular diffusivities of + ! H2O, CO2, CH4... in air, O2 and N2 near STP" Atmos. Env., 32, 6, 1111-1127, 1998. D = 2.178d-5*(1000d0/PRESS)*(TEMP/273.15d0)**1.81 - ! Heat conductivity and vapor diffusion terms [m s/kg] - ! Rogers and Yau "A short course in cloud physics", 1989, Eqn 9.4, with - ! RV = 461.5 [J/kg/K] Individual gas constant for water vapor - ! LS = 2839.0*1d3 [J/kg ] Latent heat of sublimation @ T=-30C - ! K = 2.16d-2 [J/(m s K)] Coeff of thermal conductivity of Air [Table 7.1 Rogers and Yau] + ! Heat conductivity and vapor diffusion terms [m s/kg] + ! Rogers and Yau "A short course in cloud physics", 1989, Eqn 9.4, with + ! RV = 461.5 [J/kg/K] Individual gas constant for water vapor + ! LS = 2839.0*1d3 [J/kg ] Latent heat of sublimation @ T=-30C + ! K = 2.16d-2 [J/(m s K)] Coeff of thermal conductivity of Air [Table 7.1 Rogers and Yau] FK = ( LS / (RV * TEMP ) -1d0 ) * LS / (K0 * TEMP) FD = ( RV * TEMP ) / (D * P_ICE) - ! Variable PSI [m2/s] Equation 11 from Dery and Yau (2001) - ! RHOICE = 900 kg/m3 Density of ice + ! Variable PSI [m2/s] Equation 11 from Dery and Yau (2001) + ! RHOICE = 900 kg/m3 Density of ice PSI = (RH_ICE/100.d0 - 1d0)/(2d0 * RHOICE * (FK + FD)) - ! Convert PSI from m2/s to units of -1x10d-12 m2/s + ! Convert PSI from m2/s to units of -1x10d-12 m2/s PSI = PSI * (-1.0d12) - ! Qs prime [mm/day snow water equivalent] Equation 11 Dery and Yau (2001) + ! Qs prime [mm/day snow water equivalent] Equation 11 Dery and Yau (2001) QSPRIME = A0 + A1*PSI + A2*PSI**2d0 + A3*PSI**3d0 & + A4* W10M + A5*PSI*W10M & + A6*W10M*PSI**2d0 + A7*W10M**2d0 & + A8*PSI*W10M**2d0 + A9*W10M**3d0 IF ( QSPRIME < 0.0d0 ) QSPRIME = 0.0d0 - !APRIM + !APRIM IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) AGE = Inst%SAGE*24.0d0 IF ( HcoState%Grid%YEDGE%Val(I,J) .ge. 0 ) AGE = Inst%NAGE*24.0d0 APRIM = (1.038d0+0.03758d0*AGE-0.00014349d0*AGE**2d0 & + (1.911315d-7*AGE**3d0) )**(-1d0) - ! Threshold wind speed [m/s] + ! Threshold wind speed [m/s] UT = 6.975d0 + 0.0033d0 * (TEMP - 273.15d0 + 27.27d0 )**2.0d0 - !IF (W10M > UT) THEN - ! add RH<100 too + !IF (W10M > UT) THEN + ! add RH<100 too IF (W10M > UT .and. RH_ICE<100d0) THEN QBSALT = 0.385d0*(1.0d0-Ut/W10M)**2.59d0/FRICTVEL QB0 = 0.385d0*(1d0-6.975d0/W10M)**2.59d0/FRICTVEL - ! Snow sublimation rate [kg/m2/s] Equation 1 in Yang et al. (2008) - ! The constant 1.1574d-5 converts mm/day column integrated sublimation rate to kg m-2 s-1 - + ! Snow sublimation rate [kg/m2/s] Equation 1 in Yang et al. (2008) + ! The constant 1.1574d-5 converts mm/day column integrated sublimation rate to kg m-2 s-1 + QS = 1.1574d-5*APRIM*QSPRIME*QBSALT/QB0 ELSE QS = 0d0 ENDIF - !set up the snow salinity + !set up the snow salinity IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) SLNT_FYI = Inst%SSLNT_FYI IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) SLNT_MYI = Inst%SSLNT_MYI IF ( HcoState%Grid%YEDGE%Val(I,J) .ge. 0 ) SLNT_FYI = Inst%NSLNT_FYI IF ( HcoState%Grid%YEDGE%Val(I,J) .ge. 0 ) SLNT_MYI = Inst%NSLNT_MYI - ! Sea ice fraction that is first year + ! Sea ice fraction that is first year FRFIRST = ExtState%FRSEAICE%Arr%Val(I,J) - MULTI(I,J) IF ( FRFIRST < 0d0 ) FRFIRST = 0d0 - ! Apply FYI salinity to FYI seaice fraction and MYI salinity to MYI fraction - !SLNT = SLNT_FYI * FRFIRST + SLNT_MYI * MULTI(I,J) - ! Assume MYI salinity is 50% of FYI - !SLNT = SLNT * FRFIRST + SLNT * 0.5 * MULTI(I,J) - ! Convert snow sublimation rate to sea salt production rate [kg/m2/s] - ! Calculate it separately for FYI and MYI, scaled by their respective sea ice fraction + ! Apply FYI salinity to FYI seaice fraction and MYI salinity to MYI fraction + !SLNT = SLNT_FYI * FRFIRST + SLNT_MYI * MULTI(I,J) + ! Assume MYI salinity is 50% of FYI + !SLNT = SLNT * FRFIRST + SLNT * 0.5 * MULTI(I,J) + ! Convert snow sublimation rate to sea salt production rate [kg/m2/s] + ! Calculate it separately for FYI and MYI, scaled by their respective sea ice fraction QSNOWICE_FYI = QS * SLNT_FYI * FRFIRST / 1000d0 QSNOWICE_MYI = QS * SLNT_MYI * MULTI(I,J) / 1000d0 !print *, 'Bettyhere is QSNOW ',QSNOWICE_FYI,QSNOWICE_MYI, I,J @@ -419,9 +419,9 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) QSNOWICE_MYI = 0.0d0 ENDIF ENDIF - ! End of added blowing snow section + ! End of added blowing snow section - !----------------------------------------------------------------- + !----------------------------------------------------------------- !--------------------------------------------------------------- ! Partition TOMAS_Jeagle emissions w/in the boundary layer @@ -458,43 +458,43 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! Number !betty NUMBER = dfo * FEMIS ! need to move after add blowing snow - ! update seasalt from blowing snow - huang 1/4/18 + ! update seasalt from blowing snow - huang 1/4/18 IF (( Inst%EmitSnowSS )) THEN IF ( HcoState%Grid%YEDGE%Val(I,J) .lt. 0 ) THEN ! Southern Hemisphere - + !if (K > 3 ) THEN - NUMBER = FEMIS* (dfo + & + NUMBER = FEMIS* (dfo + & (( QSNOWICE_FYI * SUM( Inst%F_DN_S_FYI(:,K) ) + & QSNOWICE_MYI * SUM( Inst%F_DN_S_MYI(:,K) ) ) * DDSNOW)) - !NUMBER = FEMIS* (dfo) + FEMIS* ( & + !NUMBER = FEMIS* (dfo) + FEMIS* ( & ! (( QSNOWICE_FYI * SUM( Inst%F_DI_S_FYI(:,K) ) + & ! QSNOWICE_MYI * SUM( Inst%F_DI_S_MYI(:,K) ) ) * DDSNOW)) & ! / (Inst%SS_DEN( K ) * ((Inst%TOMAS_DBIN(k))**3.d0) & ! * HcoState%Phys%PI/6.0d0) - !else - ! NUMBER = FEMIS * dfo + !else + ! NUMBER = FEMIS * dfo !endif !IF (NUMBER2 .GT. 5.e5) THEN ! print *, 'First', NUMBER2,NUMBER, I,J,K,L,FEMIS - !ENDIF + !ENDIF !IF (NUMBER .GT. 5.e5) THEN !!print*,'Betty here are emissions',NUMBER,dfo*FEMIS,K,I,J,L, & ! Inst%F_DN_S_FYI(:,K), DDSNOW, SUM( Inst%F_DN_S_FYI(:,K) ), & ! QSNOWICE_FYI, QSNOWICE_MYI, FEMIS !ENDIF - ELSE - ! Northern Hemisphere - NUMBER = FEMIS* (dfo + & + ELSE + ! Northern Hemisphere + NUMBER = FEMIS* (dfo + & (( QSNOWICE_FYI * SUM( Inst%F_DN_N_FYI(:,K) ) + & QSNOWICE_MYI * SUM( Inst%F_DN_N_MYI(:,K) ) ) * DDSNOW)) - ENDIF + ENDIF ELSE ! only open ocean sea salt NUMBER = dfo * FEMIS ENDIF - + ! Mass MASS = NUMBER & * SQRT( HcoState%MicroPhys%BinBound(K ) * & @@ -619,15 +619,15 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ! Pointers TYPE(MyInst), POINTER :: Inst - ! Local variables for blowing snow - INTEGER :: K, ND, IH !IH for different hemisphere + ! Local variables for blowing snow + INTEGER :: K, ND, IH !IH for different hemisphere REAL*8 :: D_SNOW, D_DRY - REAL*8, PARAMETER :: A_SALT = 2.0d0 !from Mann et al. 2000 - REAL*8, PARAMETER :: B_SALT = 37.5d0 !in um - !REAL*8, PARAMETER :: DDSNOW = 2.0d0 !in um for snow particle interval - REAL*8, PARAMETER :: DDSNOW = 0.1d0 !in um for snow particle interval - REAL*8, PARAMETER :: RHONACL = 2160.0d0 !kg/m3 - REAL*8, PARAMETER :: RHOICE = 900.0d0 !kg/m3 + REAL*8, PARAMETER :: A_SALT = 2.0d0 !from Mann et al. 2000 + REAL*8, PARAMETER :: B_SALT = 37.5d0 !in um + !REAL*8, PARAMETER :: DDSNOW = 2.0d0 !in um for snow particle interval + REAL*8, PARAMETER :: DDSNOW = 0.1d0 !in um for snow particle interval + REAL*8, PARAMETER :: RHONACL = 2160.0d0 !kg/m3 + REAL*8, PARAMETER :: RHOICE = 900.0d0 !kg/m3 !================================================================= ! HCOX_TOMAS_Jeagle_Init begins here! @@ -663,22 +663,22 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ! betty ! print *,'Betty start of options' - ! fix scaling factor over cold water SST (<5 degC) + ! fix scaling factor over cold water SST (<5 degC) CALL GetExtOpt ( HcoState%Config, Inst%ExtNr, 'Reduce SS cold water', & OptValBool=Inst%ColdSST, RC=RC ) IF ( RC /= HCO_SUCCESS ) RETURN - ! Add a SSA source from blowing snow (by J. Huang) + ! Add a SSA source from blowing snow (by J. Huang) CALL GetExtOpt ( HcoState%Config, Inst%ExtNr, 'Blowing Snow SS', & OptValBool=Inst%EmitSnowSS, RC=RC ) IF ( RC /= HCO_SUCCESS ) RETURN - ! Whether or not differentiate snow salinity on FYI and MYI (by J. Huang) - !CALL GetExtOpt ( HcoState%Config, Inst%ExtNr, 'Diff salinity on ice', & - ! OptValBool=Inst%FYIsnow, RC=RC ) - !IF ( RC /= HCO_SUCCESS ) RETURN - ! Add snow salinity (NH and SH), snow age and number of particles - ! per snowflake as external factor from configuration file + ! Whether or not differentiate snow salinity on FYI and MYI (by J. Huang) + !CALL GetExtOpt ( HcoState%Config, Inst%ExtNr, 'Diff salinity on ice', & + ! OptValBool=Inst%FYIsnow, RC=RC ) + !IF ( RC /= HCO_SUCCESS ) RETURN + ! Add snow salinity (NH and SH), snow age and number of particles + ! per snowflake as external factor from configuration file IF ( Inst%EmitSnowSS ) THEN CALL GetExtOpt( HcoState%Config, Inst%ExtNr, 'NH FYI snow salinity', & OptValDp=Inst%NSLNT_FYI, RC=RC ) @@ -702,16 +702,16 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) OptValDp=Inst%NP, RC=RC ) IF ( RC /= HCO_SUCCESS ) RETURN ELSE - Inst%NSLNT_FYI = 0.1d0 ! default value 0.1 psu for NH FYI snow - Inst%NSLNT_MYI = 0.05d0 ! default value 0.05 psu for NH MYI snow - Inst%SSLNT_FYI = 0.03d0 ! default value 0.03 psu for SH FYI snow - Inst%SSLNT_FYI = 0.015d0 ! default value 0.015 psu for SH MYI snow - Inst%NAGE = 3.0d0 ! default value 3 days snow age in NH - Inst%SAGE = 1.5d0 ! default value 1.5 days snow age in SH - Inst%NP = 5.0d0 ! default value of 5 particles per snowflake + Inst%NSLNT_FYI = 0.1d0 ! default value 0.1 psu for NH FYI snow + Inst%NSLNT_MYI = 0.05d0 ! default value 0.05 psu for NH MYI snow + Inst%SSLNT_FYI = 0.03d0 ! default value 0.03 psu for SH FYI snow + Inst%SSLNT_FYI = 0.015d0 ! default value 0.015 psu for SH MYI snow + Inst%NAGE = 3.0d0 ! default value 3 days snow age in NH + Inst%SAGE = 1.5d0 ! default value 1.5 days snow age in SH + Inst%NP = 5.0d0 ! default value of 5 particles per snowflake ENDIF - ! Verbose mode + ! Verbose mode IF ( HcoState%amIRoot ) THEN MSG = 'Use sea salt aerosol emissions (extension module)' CALL HCO_MSG(HcoState%Config%Err,MSG, SEP1='-' ) @@ -731,7 +731,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) WRITE(MSG,*) ' - Number of particle per snowflake: ', Inst%NP CALL HCO_MSG(HcoState%Config%Err,MSG) ENDIF - ENDIF + ENDIF ! Get HEMCO species IDs CALL HCO_GetExtHcoID( HcoState, Inst%ExtNr, Inst%HcoIDs, SpcNames, & @@ -757,7 +757,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ENDIF Inst%SS_DEN = 2200.d0 - ! Allocate for blowing snow simulation + ! Allocate for blowing snow simulation IF ( Inst%EmitSnowSS ) THEN ALLOCATE ( Inst%F_DI_N_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN @@ -879,33 +879,33 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) !print *,'Betty done allocating' - !size bins for blowing snow - Huang 6/12/20 + !size bins for blowing snow - Huang 6/12/20 IF ( Inst%EmitSnowSS ) THEN DO K = 1, HcoState%MicroPhys%nBins ! TOMAS dry bin limits (radius) R0=0.5d6*((HcoState%MicroPhys%BinBound(K)*6.0d0)/ & - (Inst%SS_DEN( K )*HcoState%Phys%PI))**( 1d0 / 3d0 ) ! in um + (Inst%SS_DEN( K )*HcoState%Phys%PI))**( 1d0 / 3d0 ) ! in um R1=0.5d6*((HcoState%MicroPhys%BinBound(K+1)*6.0d0)/ & - (Inst%SS_DEN( K )*HcoState%Phys%PI))**( 1d0 / 3d0 ) ! in um + (Inst%SS_DEN( K )*HcoState%Phys%PI))**( 1d0 / 3d0 ) ! in um - !-------------- Define size distribution --------------------- - ! for northern hemisphere FYI + !-------------- Define size distribution --------------------- + ! for northern hemisphere FYI ! D_SNOW = 1.0d0 D_SNOW = 1.0d0 DO ND = 1, NR_MAX D_DRY = ( Inst%NSLNT_FYI * RHOICE / (1000.d0 & * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW - !print*,'Here is Ddry ',D_DRY, R0*2d0 , R1*2d0 - IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN - !---------------------------------------------------------- - ! NOTES: - ! For size distribution - ! define the two-parameter gamma probability density funtion here - ! Yang et al 2008 eq (6) - !---------------------------------------------------------- - ! Midpoint of IRth bin + !print*,'Here is Ddry ',D_DRY, R0*2d0 , R1*2d0 + IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN + !---------------------------------------------------------- + ! NOTES: + ! For size distribution + ! define the two-parameter gamma probability density funtion here + ! Yang et al 2008 eq (6) + !---------------------------------------------------------- + ! Midpoint of IRth bin Inst%F_DI_N_FYI(ND, K) = EXP( - D_SNOW / B_SALT ) & * D_SNOW**( A_SALT - 1.d0 ) & / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) @@ -921,14 +921,14 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ENDDO - ! for northern hemisphere MYI + ! for northern hemisphere MYI D_SNOW = 1.0d0 DO ND = 1, NR_MAX D_DRY = ( Inst%NSLNT_MYI * RHOICE / (1000.d0 & * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN - ! Midpoint of IRth bin + ! Midpoint of IRth bin Inst%F_DI_N_MYI(ND, K) = EXP( - D_SNOW / B_SALT ) & * D_SNOW**( A_SALT - 1.d0 ) & / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) @@ -942,14 +942,14 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ENDDO - ! for southern hemisphere FYI + ! for southern hemisphere FYI D_SNOW = 1.0d0 DO ND = 1, NR_MAX D_DRY = ( Inst%SSLNT_FYI * RHOICE / (1000.d0 & * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN - ! Midpoint of IRth bin + ! Midpoint of IRth bin Inst%F_DI_S_FYI(ND, K) = EXP( - D_SNOW / B_SALT ) & * D_SNOW**( A_SALT - 1.d0 ) & / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) @@ -961,13 +961,13 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) D_SNOW = D_SNOW + DDSNOW ENDDO - ! for southern hemisphere MYI + ! for southern hemisphere MYI D_SNOW = 1.0d0 DO ND = 1, NR_MAX D_DRY = ( Inst%SSLNT_MYI * RHOICE / (1000.d0 & * Inst%NP * RHONACL ) )**( 1d0 / 3d0 ) * D_SNOW IF (D_DRY .ge. R0*2d0 .and. D_DRY .le. R1*2d0 ) THEN - ! Midpoint of IRth bin + ! Midpoint of IRth bin Inst%F_DI_S_MYI(ND, K) = EXP( - D_SNOW / B_SALT ) & * D_SNOW**( A_SALT - 1.d0 ) & / ( B_SALT**A_SALT * GAMMA( A_SALT ) ) @@ -978,7 +978,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) * 1.d-18 * Inst%SS_DEN( K ) * (D_DRY/2d0)**3) D_SNOW = D_SNOW + DDSNOW ENDDO - ENDDO !K + ENDDO !K ENDIF ! ----- IMPORTANT BINS ONLY CORRECTLY SET UP FOR TOMAS 15 PLEASE ADJUST OTHERS -jkodros (7/21/15) @@ -1103,7 +1103,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ExtState%FROCEAN%DoUse = .TRUE. ExtState%FRSEAICE%DoUse = .TRUE. - ! for blowing snow + ! for blowing snow IF ( Inst%EmitSnowSS ) THEN ExtState%USTAR%DoUse = .TRUE. ExtState%T2M%DoUse = .TRUE. From 227841e79f50a17c166ae6c860593a39af10af93 Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Tue, 7 Mar 2023 17:22:58 -0500 Subject: [PATCH 06/23] Add a script to change the HEMCO version numbers before release .release/changeVersionNumbers.sh - Script that changes the HEMCO version numbers in the relevant locations. Use before releasing a new version. Signed-off-by: Bob Yantosca --- .release/changeVersionNumbers.sh | 72 ++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 .release/changeVersionNumbers.sh diff --git a/.release/changeVersionNumbers.sh b/.release/changeVersionNumbers.sh new file mode 100755 index 00000000..cb75269b --- /dev/null +++ b/.release/changeVersionNumbers.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +#EOC +#------------------------------------------------------------------------------ +# GEOS-Chem Global Chemical Transport Model ! +#------------------------------------------------------------------------------ +#BOP +# +# !MODULE: changeVersionNumbers.sh +# +# !DESCRIPTION: Bash script to change the version numbers in the appropriate +# files in the HEMCO directory structure. Run this before releasing +# a new HEMCO version. +#\\ +#\\ +# !CALLING SEQUENCE: +# $ ./changeVersionNumbers.sh X.Y.Z # X.Y.Z = HEMCO version number +#EOP +#------------------------------------------------------------------------------ +#BOC + +# Function to replace text in a file +function replace() { + sed -i -e "s/${1}/${2}/" "${3}" +} + +#----------------------------------------------------------------------------- + +# Display and error message and exit +function exitWithError() { + echo "Could not update version numbers in ${1}... Exiting!" + exit 1 +} + +#----------------------------------------------------------------------------- + +# Expect 1 arguments, or exit with error +if [[ $# -ne 1 ]]; then + echo "Usage: ./changeVersionNumbers.sh VERSION" + exit 1 +fi + +# New version number +version="${1}" + +# Directories +thisDir=$(pwd -P) +cd .. +rootDir=$(pwd -P) + +# Pattern to match: X.Y.Z +pattern='[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*' + +# List of files to replace +files=( \ + "CMakeLists.txt" \ + "docs/source/conf.py" \ + "src/Core/hco_error_mod.F90" +) + +# Replace version numbers in files +for file in $files[@]; do + replace "${pattern}" "${version}" "${file}" + [[ $? -ne 0 ]] && exitWithError "${file}" + echo "HEMCO version updated to ${version} in ${file}" +done + +# Return to the starting directory +cd "${thisDir}" + +# Exit normally +exit 0 From b2e2dfe2810f94b8af46d17ab9292cc4170318e6 Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Tue, 7 Mar 2023 17:29:49 -0500 Subject: [PATCH 07/23] Fixed syntax error in .release/changeVersionNumbers.sh $files[@] --> ${files[@]} Signed-off-by: Bob Yantosca --- .release/changeVersionNumbers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.release/changeVersionNumbers.sh b/.release/changeVersionNumbers.sh index cb75269b..0a7579f4 100755 --- a/.release/changeVersionNumbers.sh +++ b/.release/changeVersionNumbers.sh @@ -59,7 +59,7 @@ files=( \ ) # Replace version numbers in files -for file in $files[@]; do +for file in ${files[@]}; do replace "${pattern}" "${version}" "${file}" [[ $? -ne 0 ]] && exitWithError "${file}" echo "HEMCO version updated to ${version} in ${file}" From 74d26542be1e37dc131fed34d5d2998018545b0a Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Sat, 14 Oct 2023 16:49:24 -0400 Subject: [PATCH 08/23] Change link to GC website people page in SUPPORT.md SUPPORT.md - Updated old link to the GEOS-Chem people & projects page, which is now at geoschem.github.io/people.html Signed-off-by: Bob Yantosca --- SUPPORT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SUPPORT.md b/SUPPORT.md index 369a2dd0..fa4f5d40 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -13,7 +13,7 @@ We use GitHub issues to support user questions. To ask a question, **[open a new ## What type of support can I expect? -We will be happy to assist you in resolving bugs and technical issues that arise when compiling or running HEMCO. User support and outreach is an important part of our mission to support the [International GEOS-Chem User Community](https://geoschem.github.io/geos-chem-people-projects-map/). +We will be happy to assist you in resolving bugs and technical issues that arise when compiling or running HEMCO. User support and outreach is an important part of our mission to support the [International GEOS-Chem User Community](https://geoschem.github.io/people.html). Even though we can assist in several ways, we cannot possibly do everything. We rely on HEMCO users being resourceful and willing to try to resolve problems on their own to the greatest extent possible. From a8f5d8b0f9750add3e2d5ffac0f45ed05b90e648 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 23 Oct 2023 19:59:34 -0400 Subject: [PATCH 09/23] Update IsModelLevel check for CESM and WRF-GC due to regression in HEMCO 3.7.x in vertical regridding updates. Signed-off-by: Haipeng Lin --- src/Core/hcoio_read_std_mod.F90 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Core/hcoio_read_std_mod.F90 b/src/Core/hcoio_read_std_mod.F90 index 02eb44b9..515bf02d 100644 --- a/src/Core/hcoio_read_std_mod.F90 +++ b/src/Core/hcoio_read_std_mod.F90 @@ -695,11 +695,34 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) ! going to 72 levels. Otherwise, use MESSy (nbalasus, 8/24/2023). IF ( Lct%Dct%Dta%Levels == 0 ) THEN + ! In WRF/CESM, IsModelLevel has a different meaning of "GEOS-Chem levels" + ! because the models in WRF and CESM are user-defined and thus fixed input + ! files would never be on the model level. In this case, a check is added + ! in order to match the file with known GEOS-Chem levels, and if so, the + ! data will be handled later in this file accordingly to be vertically + ! regridded to the runtime model levels using MESSy. + ! This fixes a regression from the vertical regridding fixes in 3.7.1. + ! (hplin, 10/16/23) +#if defined( MODEL_CESM ) || defined( MODEL_WRF ) + ! The meaning of "is model levels" in WRF and CESM are different. + ! Model levels can be changed and thus data is never on the model level. + ! In this case, IsModelLevel means that the data is on standard + ! GEOS-Chem levels, and if so, the data will be handled accordingly + ! using a hard-coded set of GEOS-Chem levels to be interpolated using MESSy. + ! (hplin, 10/15/23) + IF ( TRIM(LevUnit) == "level" .or. TRIM(LevUnit) == "GEOS-Chem level" ) THEN + ! the below check will be obsolete and is unmaintainable, but would be consistent with ModelLev_Check. + ! it is more robust to check for the explicit intention of LevUnit + ! nlev == 47 .or. nlev == 48 .or. nlev == 36 .or. nlev == 72 .or. nlev == 73 ) THEN + IsModelLevel = .true. + ENDIF +#else CALL ModelLev_Check( HcoState, nlev, IsModelLevel, RC ) IF ( RC /= HCO_SUCCESS ) THEN CALL HCO_ERROR( 'ERROR 3', RC, THISLOC=LOC ) RETURN ENDIF +#endif ! Set level indeces to be read lev1 = 1 From b79b47d43ea137494679c8aee490bba292f2869f Mon Sep 17 00:00:00 2001 From: nicholasbalasus Date: Wed, 25 Oct 2023 07:34:06 -0400 Subject: [PATCH 10/23] rename HEMCO_Config.rc.sample to HEMCO_Config.rc --- CHANGELOG.md | 8 +++++++- run/createRunDir.sh | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f96a6b9..54b16d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.8.0] +### Changed + +### Fixed +- Rename `HEMCO_Config.rc.sample` to `HEMCO_Config.rc` in `createRunDir.sh` if sample is used. + ## [3.7.1] - 2023-10-10 ### Changed - Updated version numbers to 3.7.1 @@ -30,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add GEOSIT as an allowable meteorology directory name in HEMCO_Config.rc - Added `.readthedocs.yaml` file to configure ReadTheDocs builds -# Changed +### Changed - `Verbose` is now a `true/false` variable in `run/HEMCO_sa_Config.rc` and `run/HEMCO_Config.rc.sample` - HEMCO warnings are now only generated when `Verbose: true` is found in the HEMCO configuration file (no more numerical levels) - Updated GFED4 emission factors for VOCs to Andreae et al. (2019) diff --git a/run/createRunDir.sh b/run/createRunDir.sh index 8035a1f9..84af3edc 100755 --- a/run/createRunDir.sh +++ b/run/createRunDir.sh @@ -202,6 +202,11 @@ while [ "$valid_path" -eq 0 ]; do if [[ "$hco_config_file" == *".rc"* ]]; then hco_config_dir=$(dirname $hco_config_file) fi + + if [[ "$hco_config_file" == "./HEMCO_Config.rc.sample" ]]; then + mv "./HEMCO_Config.rc.sample" "./HEMCO_Config.rc" + hco_config_file="./HEMCO_Config.rc" + fi done From 7a509dd8817bc0b63d0a49a1d519ef7f8389d00a Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 27 Oct 2023 10:34:10 -0400 Subject: [PATCH 11/23] Add section for unreleased version to changelog Signed-off-by: Lizzie Lundgren --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f96a6b9..34e85cfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [ Unreleased TBD ] - TBD + ## [3.7.1] - 2023-10-10 ### Changed - Updated version numbers to 3.7.1 From 43ec378873294e2cee0ddeccbe9948318f48dd35 Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Fri, 27 Oct 2023 16:37:40 -0400 Subject: [PATCH 12/23] Fix typo "EmissScale" -> "EmisScale" docs/source/hco-ref-guide/hemco-config.rst - Fixed option text "EmissScale" -> "EmisScale" Signed-off-by: Bob Yantosca --- docs/source/hco-ref-guide/hemco-config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/hco-ref-guide/hemco-config.rst b/docs/source/hco-ref-guide/hemco-config.rst index 6bcc4186..876a9b02 100644 --- a/docs/source/hco-ref-guide/hemco-config.rst +++ b/docs/source/hco-ref-guide/hemco-config.rst @@ -231,7 +231,7 @@ year, month, day, or hour, and to scale emissions to a given value: If omitted, the emisison month will be set to the model simulation hour. -.. option:: EmissScale_ +.. option:: EmisScale_ Optional argument to define a uniform scale factor that will be applied across all inventories, categories, hierarchies, and From 92d2632007e9108bc0b062bf6cbb1d04b25ccb76 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 30 Oct 2023 11:05:25 -0400 Subject: [PATCH 13/23] Fix comment formatting --- src/Core/hcoio_read_std_mod.F90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Core/hcoio_read_std_mod.F90 b/src/Core/hcoio_read_std_mod.F90 index 515bf02d..76f35994 100644 --- a/src/Core/hcoio_read_std_mod.F90 +++ b/src/Core/hcoio_read_std_mod.F90 @@ -695,6 +695,8 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) ! going to 72 levels. Otherwise, use MESSy (nbalasus, 8/24/2023). IF ( Lct%Dct%Dta%Levels == 0 ) THEN +#if defined( MODEL_CESM ) || defined( MODEL_WRF ) + ! In WRF/CESM, IsModelLevel has a different meaning of "GEOS-Chem levels" ! because the models in WRF and CESM are user-defined and thus fixed input ! files would never be on the model level. In this case, a check is added @@ -702,8 +704,7 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) ! data will be handled later in this file accordingly to be vertically ! regridded to the runtime model levels using MESSy. ! This fixes a regression from the vertical regridding fixes in 3.7.1. - ! (hplin, 10/16/23) -#if defined( MODEL_CESM ) || defined( MODEL_WRF ) + ! ! The meaning of "is model levels" in WRF and CESM are different. ! Model levels can be changed and thus data is never on the model level. ! In this case, IsModelLevel means that the data is on standard @@ -716,12 +717,15 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) ! nlev == 47 .or. nlev == 48 .or. nlev == 36 .or. nlev == 72 .or. nlev == 73 ) THEN IsModelLevel = .true. ENDIF + #else + CALL ModelLev_Check( HcoState, nlev, IsModelLevel, RC ) IF ( RC /= HCO_SUCCESS ) THEN CALL HCO_ERROR( 'ERROR 3', RC, THISLOC=LOC ) RETURN ENDIF + #endif ! Set level indeces to be read From 9c04d3b505af871ea5fcd15488c15c7fc4e5e039 Mon Sep 17 00:00:00 2001 From: Melissa Sulprizio Date: Mon, 30 Oct 2023 16:20:00 -0400 Subject: [PATCH 14/23] Rename TOMAS species to include a padding zero for bins 1-9 TOMAS species SF6 has conflicts with sulfur hexafluoride (SF6) used in the TransportTracers simulation. To avoid conflicts, we rename all of the TOMAS species for bins 1-9 to use 01-09. This is done for all TOMAS species (NK*, SF*, SS*, ECOB*, ECIL*, OCOB*, OCIL*, AW*, and DUST*). Signed-off-by: Melissa Sulprizio --- src/Extensions/hcox_tomas_dustdead_mod.F | 18 +++---- src/Extensions/hcox_tomas_jeagle_mod.F90 | 66 ++++++++---------------- 2 files changed, 31 insertions(+), 53 deletions(-) diff --git a/src/Extensions/hcox_tomas_dustdead_mod.F b/src/Extensions/hcox_tomas_dustdead_mod.F index 1ad5c977..3c944201 100644 --- a/src/Extensions/hcox_tomas_dustdead_mod.F +++ b/src/Extensions/hcox_tomas_dustdead_mod.F @@ -517,15 +517,15 @@ SUBROUTINE HCOX_TOMAS_DustDead_Run( ExtState, HcoState, RC ) ! Get the proper species name !%%% This is a kludge, do better later %%% - IF ( N==1 ) SpcName = 'NK1' - IF ( N==2 ) SpcName = 'NK2' - IF ( N==3 ) SpcName = 'NK3' - IF ( N==4 ) SpcName = 'NK4' - IF ( N==5 ) SpcName = 'NK5' - IF ( N==6 ) SpcName = 'NK6' - IF ( N==7 ) SpcName = 'NK7' - IF ( N==8 ) SpcName = 'NK8' - IF ( N==9 ) SpcName = 'NK9' + IF ( N==1 ) SpcName = 'NK01' + IF ( N==2 ) SpcName = 'NK02' + IF ( N==3 ) SpcName = 'NK03' + IF ( N==4 ) SpcName = 'NK04' + IF ( N==5 ) SpcName = 'NK05' + IF ( N==6 ) SpcName = 'NK06' + IF ( N==7 ) SpcName = 'NK07' + IF ( N==8 ) SpcName = 'NK08' + IF ( N==9 ) SpcName = 'NK09' IF ( N==10 ) SpcName = 'NK10' IF ( N==11 ) SpcName = 'NK11' IF ( N==12 ) SpcName = 'NK12' diff --git a/src/Extensions/hcox_tomas_jeagle_mod.F90 b/src/Extensions/hcox_tomas_jeagle_mod.F90 index 74686db1..a53a58ad 100644 --- a/src/Extensions/hcox_tomas_jeagle_mod.F90 +++ b/src/Extensions/hcox_tomas_jeagle_mod.F90 @@ -67,8 +67,8 @@ MODULE HCOX_TOMAS_Jeagle_Mod INTEGER, ALLOCATABLE :: HcoIDs (: ) ! HEMCO species ID's REAL(dp), POINTER :: TOMAS_DBIN(: ) ! TOMAS bin width REAL(dp), POINTER :: DRFAC (: ) ! TOMAS area? - REAL(dp), POINTER :: TC1 (:,:,:,:) ! Aerosol mass - REAL(dp), POINTER :: TC2 (:,:,:,:) ! Aerosol number + REAL(dp), POINTER :: TC1 (:,:,:,:) ! Aerosol number + REAL(dp), POINTER :: TC2 (:,:,:,:) ! Aerosol mass LOGICAL :: ColdSST ! Flag to correct SSA emissions over cold waters ! Scale factors @@ -232,7 +232,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) REAL(dp), POINTER :: ptr3D(:,:,:) ! For debugging - !INTEGER :: ii=50, jj=10 + INTEGER :: ii=50, jj=10 !================================================================= ! SRCSALT30 begins here! @@ -272,7 +272,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) CALL HCO_EvalFld ( HcoState, 'MULTISEAICE', MULTI, RC ) IF ( RC /= HCO_SUCCESS ) THEN WRITE(MSG,*) 'Cannot find MULTISEAICE data for blowing snow' - !CALL HCO_ERROR(HcoState%Config%Err, MSG, RC) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF @@ -282,7 +281,7 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! adjusting coeff !### Debug - print*, 'JACK IN HCOX TOMAS Jeagle' + print*, 'IN HCOX_TOMAS_Jeagle_Mod.F90' ! Init ptr3D => NULL() @@ -504,15 +503,11 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ENDIF ENDDO ENDDO - !ELSE ! move initialization to start of loop - ! Inst%TC1(I,J,:,:) = 0d0 - ! Inst%TC2(I,J,:,:) = 0d0 - !ENDIF ENDDO ENDDO !### Debug - !print*, 'JACK SEASALT EMISSIONS AT 50, 10,7: ', TC2(ii,jj,1,7) + !print*, 'Aerosol mass AT 50, 10, 7: ', Inst%TC2(ii,jj,1,7) !print*, 'BINS: ', HcoState%MicroPhys%nBins ! Loop over # of microphysics bins @@ -521,14 +516,13 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) ! Add mass to the HEMCO data structure (jkodros) CALL HCO_EmisAdd( HcoState, Inst%TC2(:,:,:,K), Inst%HcoIDs(K), RC) IF ( RC /= HCO_SUCCESS ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'HCO_EmisAdd error: FLUXSALT', RC ) CALL HCO_ERROR( 'HCO_EmisAdd error: FLUXSALT', RC ) RETURN ENDIF ! Get the proper species name IF ( K<10 ) THEN - WRITE(SpcName,'(A2,I1)') 'NK', K + WRITE(SpcName,'(A3,I1)') 'NK0', K ELSE WRITE(SpcName,'(A2,I2)') 'NK', K ENDIF @@ -537,13 +531,12 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Run( ExtState, HcoState, RC ) HcoID = HCO_GetHcoID( TRIM(SpcName), HcoState ) !### Debug - !print*, 'JACK SEASALT EMISSIONS AT 50, 10,: ', TC1(ii,jj,1,k) - !print*, 'JACK HCO ID: ', HcoID + print*, 'Aerosol number AT 50, 10,: ', Inst%TC1(ii,jj,1,k) + print*, 'HCO ID: ', K, SpcName, HcoID ! Add number to the HEMCO data structure CALL HCO_EmisAdd( HcoState, Inst%TC1(:,:,:,K), HcoID, RC) IF ( RC /= HCO_SUCCESS ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'HCO_EmisAdd error: FLUXSALT', RC ) CALL HCO_ERROR( 'HCO_EmisAdd error: FLUXSALT', RC ) RETURN ENDIF @@ -649,9 +642,9 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) msg = & 'Using HEMCO extension: TOMAS_Jeagle (sea salt emissions for TOMAS)' IF ( HCO_IsVerb( HcoState%Config%Err ) ) THEN - CALL HCO_Msg( HcoState%Config%Err, sep1='-' ) ! with separator + CALL HCO_Msg( HcoState%Config%Err, msg, sep1='-' ) ! with separator ELSE - CALL HCO_Msg( msg, verb=.TRUE. ) ! w/o separator + CALL HCO_Msg( msg, verb=.TRUE. ) ! w/o separator ENDIF ENDIF @@ -659,7 +652,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) Inst => NULL() CALL InstCreate ( ExtNr, ExtState%TOMAS_Jeagle, Inst, RC ) IF ( RC /= HCO_SUCCESS ) THEN - !CALL HCO_ERROR ( HcoState%Config%Err, 'Cannot create TOMAS_Jeagle instance', RC ) CALL HCO_ERROR ( 'Cannot create TOMAS_Jeagle instance', RC ) RETURN ENDIF @@ -755,23 +747,27 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF - - !print*,'Betty start to allocate' + IF ( HcoState%amIRoot ) THEN + MSG = 'Use the following species (Name: HcoID):' + CALL HCO_MSG(HcoState%Config%Err,MSG) + DO N = 1, nSpc + WRITE(MSG,*) TRIM(SpcNames(N)), ':', Inst%HcoIDs(N) + CALL HCO_MSG(HcoState%Config%Err,MSG) + ENDDO + ENDIF ALLOCATE ( Inst%SS_DEN ( HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN MSG = 'Cannot allocate SS_DEN' - !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate SS_DEN', RC ) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF Inst%SS_DEN = 2200.d0 - ! Allocate for blowing snow simulation + ! Allocate for blowing snow simulation IF ( Inst%EmitSnowSS ) THEN ALLOCATE ( Inst%F_DI_N_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_N_FYI', RC ) MSG = 'Cannot allocate F_DI_N_FYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -780,7 +776,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%F_DI_N_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_N_MYI', RC ) MSG = 'Cannot allocate F_DI_N_MYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -789,7 +784,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%F_DN_N_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( 'HcoState%Config%Err, Cannot allocate F_DN_N_FYI', RC ) MSG = 'Cannot allocate F_DN_N_FYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -798,7 +792,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%F_DN_N_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( 'HcoState%Config%Err, Cannot allocate F_DN_N_MYI', RC ) MSG = 'Cannot allocate F_DN_N_MYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -807,7 +800,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%F_DI_S_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_S_FYI', RC ) MSG = 'Cannot allocate F_DI_S_FYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -816,7 +808,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%F_DI_S_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DI_S_MYI', RC ) MSG = 'Cannot allocate F_DI_S_MYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -825,7 +816,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%F_DN_S_FYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DN_S_FYI', RC ) MSG = 'Cannot allocate F_DN_S_FYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -834,7 +824,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%F_DN_S_MYI( NR_MAX, HcoState%MicroPhys%nBins ), STAT=AS ) IF ( AS/=0 ) THEN - !CALL HCO_ERROR( HcoState%Config%Err, 'Cannot allocate F_DN_S_MYI', RC ) MSG = 'Cannot allocate F_DN_S_MYI' CALL HCO_ERROR(MSG, RC ) RETURN @@ -842,14 +831,10 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) Inst%F_DN_S_MYI = 0.0_sp ENDIF - - !print *, 'Betty still allocating' - ! Allocate TOMAS_DBIN ALLOCATE ( Inst%TOMAS_DBIN( HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate TOMAS_DBIN array (hcox_tomas_jeagle_mod.F90)' - !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF @@ -858,38 +843,33 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ALLOCATE ( Inst%DRFAC( HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate DRFAC array (hcox_tomas_jeagle_mod.F90)' - !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ENDIF - ! JKODROS - ALLOCATE TC1 and TC2 + ! Allocate TC1 ALLOCATE ( Inst%TC1( HcoState%NX, HcoState%NY,& HcoState%NZ, HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate TC1 array (hcox_tomas_jeagle_mod.F90)' - !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ELSE Inst%TC1 = 0d0 ENDIF - ! JKODROS - ALLOCATE TC1 and TC2 + ! Allocate TC2 ALLOCATE ( Inst%TC2( HcoState%NX, HcoState%NY,& HcoState%NZ, HcoState%MicroPhys%nBins ), STAT=RC ) IF ( RC /= HCO_SUCCESS ) THEN MSG = 'Cannot allocate TC2 array (hcox_tomas_jeagle_mod.F90)' - !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) RETURN ELSE Inst%TC2 = 0d0 ENDIF - !print *,'Betty done allocating' - - !size bins for blowing snow - Huang 6/12/20 + !size bins for blowing snow - Huang 6/12/20 IF ( Inst%EmitSnowSS ) THEN DO K = 1, HcoState%MicroPhys%nBins @@ -902,7 +882,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) !-------------- Define size distribution --------------------- ! for northern hemisphere FYI -! D_SNOW = 1.0d0 D_SNOW = 1.0d0 DO ND = 1, NR_MAX D_DRY = ( Inst%NSLNT_FYI * RHOICE / (1000.d0 & @@ -1093,7 +1072,6 @@ SUBROUTINE HCOX_TOMAS_Jeagle_Init( HcoState, ExtName, ExtState, RC ) ELSE MSG = 'Adjust TOMAS_Jeagle emiss coeff (TOMAS_COEF) for your model res: SRCSALT30: hcox_TOMAS_jeagle_mod.F90' - !CALL HCO_ERROR(HcoState%Config%Err,MSG, RC ) CALL HCO_ERROR(MSG, RC ) ENDIF From f142caf45526df865eb6a18f0a9839a78207281f Mon Sep 17 00:00:00 2001 From: Melissa Sulprizio Date: Fri, 17 Nov 2023 08:45:04 -0500 Subject: [PATCH 15/23] Increase string length for netCDF variable name The GHGI v2 inventory in CH4 and carbon simulations within GEOS-Chem introduced netCDF varible names that exceeded the current defined string length (50 characters). This value has been increased to 100 to avoid errors. Signed-off-by: Melissa Sulprizio --- CHANGELOG.md | 4 ++++ src/Core/hco_config_mod.F90 | 2 +- src/Core/hco_types_mod.F90 | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f96a6b9..a6cb0989 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +##[ Unreleased 3.7.2] - TBD +### Changed +- Increased netCDF variable string length from 50 to 100 + ## [3.7.1] - 2023-10-10 ### Changed - Updated version numbers to 3.7.1 diff --git a/src/Core/hco_config_mod.F90 b/src/Core/hco_config_mod.F90 index 91d4d503..4ef9f761 100644 --- a/src/Core/hco_config_mod.F90 +++ b/src/Core/hco_config_mod.F90 @@ -635,7 +635,7 @@ SUBROUTINE Config_ReadCont( HcoConfig, IU_HCO, CFDIR, & LOGICAL :: Found CHARACTER(LEN= 63) :: cName CHARACTER(LEN=255) :: srcFile - CHARACTER(LEN= 50) :: srcVar + CHARACTER(LEN=100) :: srcVar CHARACTER(LEN= 31) :: srcTime CHARACTER(LEN= 31) :: TmCycle CHARACTER(LEN= 1) :: WildCard diff --git a/src/Core/hco_types_mod.F90 b/src/Core/hco_types_mod.F90 index 34af66cf..ab990b6d 100644 --- a/src/Core/hco_types_mod.F90 +++ b/src/Core/hco_types_mod.F90 @@ -338,7 +338,7 @@ MODULE HCO_TYPES_MOD !------------------------------------------------------------------------- TYPE :: FileData CHARACTER(LEN=255) :: ncFile ! file path+name - CHARACTER(LEN= 50) :: ncPara ! file parameter + CHARACTER(LEN=100) :: ncPara ! file parameter INTEGER :: ncYrs(2) ! year range INTEGER :: ncMts(2) ! month range INTEGER :: ncDys(2) ! day range From ebaade95440214279ddd0346291d07a14defa89e Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Tue, 21 Nov 2023 13:56:49 -0500 Subject: [PATCH 16/23] Minor updates to changeVersionNumbers.sh script .release/changeVersionNumbers.sh - Add "Harmonized Emissions Component (HEMCO)" to doc header - Place code in the main() routine - Call main and return the status to the shell - Replace tabs with spaces Signed-off-by: Bob Yantosca --- .release/changeVersionNumbers.sh | 84 +++++++++++++++++--------------- CHANGELOG.md | 4 ++ 2 files changed, 50 insertions(+), 38 deletions(-) diff --git a/.release/changeVersionNumbers.sh b/.release/changeVersionNumbers.sh index 0a7579f4..faacc82e 100755 --- a/.release/changeVersionNumbers.sh +++ b/.release/changeVersionNumbers.sh @@ -2,11 +2,11 @@ #EOC #------------------------------------------------------------------------------ -# GEOS-Chem Global Chemical Transport Model ! +# Harmonized Emissions Component (HEMCO) ! #------------------------------------------------------------------------------ #BOP # -# !MODULE: changeVersionNumbers.sh +# !MODULE: changeVersionNumbers.sh # # !DESCRIPTION: Bash script to change the version numbers in the appropriate # files in the HEMCO directory structure. Run this before releasing @@ -34,39 +34,47 @@ function exitWithError() { #----------------------------------------------------------------------------- -# Expect 1 arguments, or exit with error -if [[ $# -ne 1 ]]; then - echo "Usage: ./changeVersionNumbers.sh VERSION" - exit 1 -fi - -# New version number -version="${1}" - -# Directories -thisDir=$(pwd -P) -cd .. -rootDir=$(pwd -P) - -# Pattern to match: X.Y.Z -pattern='[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*' - -# List of files to replace -files=( \ - "CMakeLists.txt" \ - "docs/source/conf.py" \ - "src/Core/hco_error_mod.F90" -) - -# Replace version numbers in files -for file in ${files[@]}; do - replace "${pattern}" "${version}" "${file}" - [[ $? -ne 0 ]] && exitWithError "${file}" - echo "HEMCO version updated to ${version} in ${file}" -done - -# Return to the starting directory -cd "${thisDir}" - -# Exit normally -exit 0 +function main() { + + # Expect 1 arguments, or exit with error + if [[ $# -ne 1 ]]; then + echo "Usage: ./changeVersionNumbers.sh VERSION" + exit 1 + fi + + # New version number + version="${1}" + + # Directories + thisDir=$(pwd -P) + cd .. + rootDir=$(pwd -P) + + # Pattern to match: X.Y.Z + pattern='[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*' + + # List of files to replace + files=( \ + "CMakeLists.txt" \ + "docs/source/conf.py" \ + "src/Core/hco_error_mod.F90" + ) + + # Replace version numbers in files + for file in ${files[@]}; do + replace "${pattern}" "${version}" "${file}" + [[ $? -ne 0 ]] && exitWithError "${file}" + echo "HEMCO version updated to ${version} in ${file}" + done + + # Return to the starting directory + cd "${thisDir}" +} + +#---------------------------------------------------------------------------- + +# Replace version numbers +main() + +# Return status +exit $? diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f96a6b9..a6ffffb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] - TBD +### Added +- Script `.release/changeVersionNumbers.sh` to change version numbers before a new HEMCO release + ## [3.7.1] - 2023-10-10 ### Changed - Updated version numbers to 3.7.1 From 5d36b26aab3b4ab3f0ed741f5ed8b1c2485ef030 Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Tue, 21 Nov 2023 14:06:58 -0500 Subject: [PATCH 17/23] Further fixes in .release/changeVersionNumbers.sh .release/changeVersionNumbers.sh - Add more descriptive function headers - Bug fix: "main()" -> "main" near end of script - Now error check # of arguments outside of main() Signed-off-by: Bob Yantosca --- .release/changeVersionNumbers.sh | 40 ++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/.release/changeVersionNumbers.sh b/.release/changeVersionNumbers.sh index faacc82e..73f619b7 100755 --- a/.release/changeVersionNumbers.sh +++ b/.release/changeVersionNumbers.sh @@ -19,28 +19,38 @@ #------------------------------------------------------------------------------ #BOC -# Function to replace text in a file function replace() { + + #======================================================================== + # Function to replace text in a file via sed. + # + # 1st argument: Search pattern + # 2nd argument: Replacement text + # 3rd argument: File in which to search and replace + #======================================================================== + sed -i -e "s/${1}/${2}/" "${3}" } -#----------------------------------------------------------------------------- - -# Display and error message and exit + function exitWithError() { + + #======================================================================== + # Display and error message and exit + #======================================================================== + echo "Could not update version numbers in ${1}... Exiting!" exit 1 } -#----------------------------------------------------------------------------- function main() { - # Expect 1 arguments, or exit with error - if [[ $# -ne 1 ]]; then - echo "Usage: ./changeVersionNumbers.sh VERSION" - exit 1 - fi + #======================================================================== + # Replaces the version number in the files listed. + # + # 1st argument: New version number to use + #======================================================================== # New version number version="${1}" @@ -71,10 +81,16 @@ function main() { cd "${thisDir}" } -#---------------------------------------------------------------------------- +# --------------------------------------------------------------------------- + +# Expect 1 argument, or exit with error +if [[ $# -ne 1 ]]; then + echo "Usage: ./changeVersionNumbers.sh VERSION" + exit 1 +fi # Replace version numbers -main() +main "${1}" # Return status exit $? From 52731cf4ee738b4f309f1b6cfe79fea707bf1a0a Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Wed, 22 Nov 2023 11:06:22 -0500 Subject: [PATCH 18/23] changeVersionNumbers.sh now changes version numbers in CHANGELOG.md .release/changeVersionNumbers.sh - Modified to also update the version number and the current date in the CHANGELOG.md file. Looks for "Unreleased" in brackets and ignores any text that follows as the string to replace. Signed-off-by: Bob Yantosca --- .release/changeVersionNumbers.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.release/changeVersionNumbers.sh b/.release/changeVersionNumbers.sh index 73f619b7..82f5410a 100755 --- a/.release/changeVersionNumbers.sh +++ b/.release/changeVersionNumbers.sh @@ -55,16 +55,19 @@ function main() { # New version number version="${1}" - # Directories + # Save this directory path and change to root directory thisDir=$(pwd -P) cd .. - rootDir=$(pwd -P) + #======================================================================== + # Update version numbers in various files + #======================================================================== + # Pattern to match: X.Y.Z pattern='[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*' # List of files to replace - files=( \ + files=( \ "CMakeLists.txt" \ "docs/source/conf.py" \ "src/Core/hco_error_mod.F90" @@ -77,6 +80,15 @@ function main() { echo "HEMCO version updated to ${version} in ${file}" done + #======================================================================== + # Update version number and date in CHANGELOG.md + #======================================================================== + + # Pattern to match: "[Unreleased] - TBD" + pattern='\[.*Unreleased.*\].*' + date=$(date -Idate) + replace "${pattern}" "\[${version}\] - ${date}" "CHANGELOG.md" + # Return to the starting directory cd "${thisDir}" } From 316a9121ddacb3fc68d933090bc0305418f56206 Mon Sep 17 00:00:00 2001 From: Melissa Sulprizio Date: Tue, 28 Nov 2023 11:04:14 -0500 Subject: [PATCH 19/23] Turn off emission extensions when EMISSIONS logical is set to false The EMISSIONS logical switch in HEMCO_Config.rc currently only turns off base emissions and not the emission extensions. The emission extension data are bracketed by the logical so those data are not read in. However, because the extensions themselves are still on, they get called in HEMCO and result in the model crashing because the input data can't be found. This is now fixed by adding a check in subroutine ExtSwitch2Buffer (in hco_config_mod.F90) to see if EMISSIONS is set and using that to define a local logical DoEmis. In that same routine, if DoEmis is false then all emission extensions will be defined with Enabled = .FALSE. to avoid calling them during the run stage of HEMCO. Addresses https://github.com/geoschem/HEMCO/issues/249. Signed-off-by: Melissa Sulprizio --- CHANGELOG.md | 1 + src/Core/hco_config_mod.F90 | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05267bbb..e4fd6629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Rename `HEMCO_Config.rc.sample` to `HEMCO_Config.rc` in `createRunDir.sh` if sample is used. +- Added fix to turn off emissions extensions when `EMISSIONS` logical is false ## [3.7.1] - 2023-10-10 ### Changed diff --git a/src/Core/hco_config_mod.F90 b/src/Core/hco_config_mod.F90 index 4ef9f761..1dfca34a 100644 --- a/src/Core/hco_config_mod.F90 +++ b/src/Core/hco_config_mod.F90 @@ -1816,9 +1816,9 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC ) ! ! !USES: ! - USE HCO_CHARPAK_Mod, ONLY : STRREPL, STRSPLIT, TRANLC - USE HCO_EXTLIST_MOD, ONLY : AddExt, AddExtOpt, HCO_GetOpt - USE HCO_EXTLIST_MOD, ONLY : GetExtNr + USE HCO_CHARPAK_Mod, ONLY : STRREPL, STRSPLIT, TRANLC + USE HCO_EXTLIST_MOD, ONLY : AddExt, AddExtOpt, HCO_GetOpt + USE HCO_EXTLIST_MOD, ONLY : GetExtNr, GetExtOpt ! ! !INPUT PARAMETERS: ! @@ -1841,6 +1841,7 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC ) ! INTEGER :: I, N, Idx, ExtNr LOGICAL :: Enabled, NewExt + LOGICAL :: DoEmis, Found, LTMP CHARACTER(LEN=255) :: loc CHARACTER(LEN=512) :: msg CHARACTER(LEN=1023) :: OPTS @@ -1857,6 +1858,10 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC ) loc = 'ExtSwitch2Buffer (hco_config_mod.F90)' ExtNr = -1 + ! Initialize + DoEmis= .TRUE. + Found = .FALSE. + ! Do until exit DO @@ -1890,6 +1895,18 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC ) RETURN ENDIF ENDIF + + ! Check if EMISSIONS setting is found. If so, overwrite DoEmis. + IF ( .not. Found ) THEN + CALL GetExtOpt( HcoConfig, -999, 'EMISSIONS', & + OptValBool=LTMP, FOUND=Found, RC=RC ) + IF ( RC /= HCO_SUCCESS ) THEN + msg = 'Error encountered in "GetExtOpt( EMISSIONS )"!' + CALL HCO_Error( msg, RC, ThisLoc=loc ) + RETURN + ENDIF + IF ( Found ) DoEmis = LTMP + ENDIF CYCLE ENDIF @@ -1942,6 +1959,11 @@ SUBROUTINE ExtSwitch2Buffer( HcoConfig, IU_HCO, EOF, RC ) Enabled = .FALSE. ENDIF + ! Disable extension if EMISSIONS logical is false + IF ( .not. DoEmis ) THEN + Enabled = .FALSE. + ENDIF + ! Register extension name, number and species ! idx is the position of the species names idx = idx+1 From d25147baecfaf4cf9925477bd605058dfef4a0cd Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Fri, 1 Dec 2023 10:21:42 -0500 Subject: [PATCH 20/23] Update version numbers for HEMCO 3.7.2 release Changed version number from 3.7.1 to 3.7.2 in - CHANGELOG.md - CMakeLists.txt - docs/source/conf.py - src/Core/hco_error_mod.F90 Signed-off-by: Bob Yantosca --- CHANGELOG.md | 2 +- CMakeLists.txt | 2 +- docs/source/conf.py | 2 +- src/Core/hco_error_mod.F90 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4fd6629..af65ea23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] - TBD +## [3.7.2] - 2023-12-01 ### Added - Script `.release/changeVersionNumbers.sh` to change version numbers before a new HEMCO release diff --git a/CMakeLists.txt b/CMakeLists.txt index ea235e01..39638d1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # HEMCO/CMakeLists.txt cmake_minimum_required(VERSION 3.5) -project(HEMCO VERSION 3.7.1 LANGUAGES Fortran) +project(HEMCO VERSION 3.7.2 LANGUAGES Fortran) # Reminder: Make sure to also update version in src/Core/hco_error_mod.F90 #----------------------------------------------------------------------------- diff --git a/docs/source/conf.py b/docs/source/conf.py index 325803c6..c7ccc0b0 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ author = 'GEOS-Chem Support Team' # The full version, including alpha/beta/rc tags -release = '3.7.1' +release = '3.7.2' # -- General configuration --------------------------------------------------- diff --git a/src/Core/hco_error_mod.F90 b/src/Core/hco_error_mod.F90 index b242dc1c..7bf556e9 100644 --- a/src/Core/hco_error_mod.F90 +++ b/src/Core/hco_error_mod.F90 @@ -105,7 +105,7 @@ MODULE HCO_Error_Mod #endif ! HEMCO version number. - CHARACTER(LEN=12), PARAMETER, PUBLIC :: HCO_VERSION = '3.7.1' + CHARACTER(LEN=12), PARAMETER, PUBLIC :: HCO_VERSION = '3.7.2' INTERFACE HCO_Error MODULE PROCEDURE HCO_ErrorNoErr From 9d92cc95322361408a4da3500f4a01bd6729e587 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Mon, 11 Dec 2023 13:13:32 -0500 Subject: [PATCH 21/23] Update GEOS-IT meteorology constants file year from 2018 to 1998 This change is due to updates in how GMAO will store GEOS-IT data in the long-term. Signed-off-by: Lizzie Lundgren --- src/Core/hco_extlist_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/hco_extlist_mod.F90 b/src/Core/hco_extlist_mod.F90 index 6c382e54..88f5cb29 100644 --- a/src/Core/hco_extlist_mod.F90 +++ b/src/Core/hco_extlist_mod.F90 @@ -1567,7 +1567,7 @@ SUBROUTINE HCO_SetDefaultToken( CF, RC ) ELSE IF ( TRIM(CF%MetField) == 'GEOSIT' ) THEN DEF_MET_UC = 'GEOSIT' DEF_MET_LC = 'geosit' - DEF_CN_YR = '2018' ! Constant met fld year + DEF_CN_YR = '1998' ! Constant met fld year DEF_NC_VER = 'nc' ! NetCDF extension ENDIF From 861aa5dadfc623275e4060f85be121774d950996 Mon Sep 17 00:00:00 2001 From: nicholasbalasus Date: Thu, 28 Dec 2023 20:27:53 -0500 Subject: [PATCH 22/23] remove month loop in GetIndex2Interp --- src/Core/hcoio_util_mod.F90 | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/Core/hcoio_util_mod.F90 b/src/Core/hcoio_util_mod.F90 index 6c878b01..a29537ae 100644 --- a/src/Core/hcoio_util_mod.F90 +++ b/src/Core/hcoio_util_mod.F90 @@ -1177,27 +1177,6 @@ SUBROUTINE GetIndex2Interp ( HcoState, Lct, & IF ( tidx2 > 0 ) EXIT ENDDO - ! Repeat above but now only modify month. - IF ( tidx2 < 0 ) THEN - tmpYMDhm = availYMDhm(tidx1) - DO - ! Increase by one month - tmpYMDhm = tmpYMDhm + 1.0e6_dp - - ! Exit if we are beyond available dates - IF ( tmpYMDhm > availYMDhm(nTime) ) EXIT - - ! Check if there is a time slice with that date - DO I = tidx1,nTime - IF ( ABS( tmpYMDhm - availYMDhm(I) ) < EPSILON ) THEN - tidx2 = I - EXIT - ENDIF - ENDDO - IF ( tidx2 > 0 ) EXIT - ENDDO - ENDIF - ! Repeat above but now only modify day IF ( tidx2 < 0 ) THEN tmpYMDhm = availYMDhm(tidx1) From c247be4da981bc516c9ced9300f576fe154c4c85 Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Tue, 2 Jan 2024 14:59:25 -0500 Subject: [PATCH 23/23] Added changelog entry for LAI interpolation bug fix CHANGELOG.md - Add entry describing the fix in PR #254 Signed-off-by: Bob Yantosca --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ab1c0e..46930265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased 3.8.0] - TBD +## [Unreleased] - TBD ### Changed - Updated TOMAS_Jeagle sea salt extension ### Fixed - Updated IsModelLevel check for CESM and WRF-GC +- Interpolation error for 8-day MODIS LAI files (removed month loop in `GetIndex2Interp`) ## [3.7.2] - 2023-12-01 ### Added