From dfbd8c9688fcdeececd09f6320c8367711c179c1 Mon Sep 17 00:00:00 2001 From: "Michael S. Long" Date: Mon, 30 Sep 2024 13:55:09 -0400 Subject: [PATCH 1/4] Expand the RRTMG long-wave code to add two functionalitie: 1) allow 3D CO2 fields 2) enable diagnosis of specific RAT radiative impact MSL --- GEOSirrad_GridComp/GEOS_IrradGridComp.F90 | 477 +++++++++++++++++++++- 1 file changed, 467 insertions(+), 10 deletions(-) diff --git a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 index 40531b1..31ebcae 100644 --- a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 +++ b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 @@ -189,6 +189,11 @@ subroutine SetServices ( GC, RC ) character*2 :: bb character*9 :: wvn_rng ! xxxx-yyyy +! <<>> MSL + integer :: i,n + character(len=ESMF_MAXSTR) :: gen_str !i.e. generic_string variable <<>> MSL + character(len=ESMF_MAXSTR), allocatable :: nameRATS(:) + !============================================================================= ! Get my name and set-up traceback handle @@ -451,6 +456,26 @@ subroutine SetServices ( GC, RC ) DATATYPE = MAPL_StateItem, & RESTART = MAPL_RestartSkip, __RC__ ) +! If CO2 is provided as a RAT, import a CO2 field <<>> MSL +!--------------------------------------------------------- + ! Using DT below since it is already declared, and avoids adding an additional var - MSL + call ESMF_ConfigGetAttribute(CF, DT, Label='CO2:', default=-1.0, RC=STATUS) + VERIFY_(STATUS) + + ! If using 3-D CO2, set up the import + if (DT.eq.-2.0) then + call MAPL_AddImportSpec(GC, & + SHORT_NAME = 'CO2', & + LONG_NAME = 'carbondioxide_concentration', & + UNITS = 'pppv', & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationCenter, & + AVERAGING_INTERVAL = ACCUMINT, & + REFRESH_INTERVAL = MY_STEP, & + RC=STATUS ) + VERIFY_(STATUS) + endif + ! !EXPORT STATE: call MAPL_AddExportSpec(GC, & @@ -841,6 +866,7 @@ subroutine SetServices ( GC, RC ) LONG_NAME = 'sensitivity_of_net_downward_longwave_flux_in_air_to_surface_temperature',& UNITS = 'W m-2 K-1', & DIMS = MAPL_DimsHorzVert, & + add2export = .true., & VLOCATION = MAPL_VLocationEdge, __RC__ ) call MAPL_AddInternalSpec(GC, & @@ -923,6 +949,171 @@ subroutine SetServices ( GC, RC ) end do end if +! Settings for RATS-specific radiation diagnostics +! -- these will cause RRTMG_LW to be called multiple times toggling the named species +! on/off. Outputs the specific radiative impacts of that species (e.g. CO2) +! -- the code below simply adds the diagnostic exports +! -- Need to test if a given input has an import. Not sure how to do this within SetServices. In +! case it's possible, this code block is placed -after- all the imports are added so the +! imports can be queried. +! <<>> MSL +!-------------------------------------------------------------------------------------- + call ESMF_ConfigFindLabel(CF, 'RATS_DIAGNOSTICS:', RC=STATUS) ! Use STATUS to test if label was found + + ! No error thrown. Just go around this if nothing learnable from config. + IF (STATUS .eq. ESMF_SUCCESS) THEN ! if the label was found... + + ! Get number of words in config line + n = ESMF_ConfigGetLen(CF,label='RATS_DIAGNOSTICS:',RC=STATUS) + VERIFY_(STATUS) + + allocate(nameRATS(n), STAT=STATUS) + VERIFY_(STATUS) + + ! Put the cursor at the label + call ESMF_ConfigFindLabel(CF, 'RATS_DIAGNOSTICS:', RC=STATUS) + VERIFY_(STATUS) + + ! Loop over RATS in list + DO i=1,n + call ESMF_ConfigGetAttribute(CF,gen_str,RC=STATUS) + VERIFY_(STATUS) + + nameRATS(i) = trim(gen_str) + + ! Test if label 'gen_str' has an import + ! Otherwise throw error. (This could be done in GEOS_Physics GC) + ! <> MSL + ! O3 CO2 CH4 N2O CFC11 CFC12 CFC22 CCl4 + + ENDDO + + DO i=1,n + ! Can't read the CF list in the loop above if MAPL_AddExportSpec() is + ! called within it. Not sure why. So... + + ! Create exports for this RAT + ! -- OLR + ! gen_str = 'OLR_'//trim(gen_str) + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'dOLR_'//trim(nameRATS(i)), & + LONG_NAME = 'chg_in_upwell_LW_flx_at_toa_from_'//trim(nameRATS(i)), & + UNITS = 'W m-2', & + DIMS = MAPL_DimsHorzOnly, & + VLOCATION = MAPL_VLocationNone, RC=STATUS ) + VERIFY_(STATUS) + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'dLWS_'//trim(nameRATS(i)), & + LONG_NAME = 'chg_in_surface_absorbed_LW_rad_from_'//trim(nameRATS(i)), & + UNITS = 'W m-2', & + DIMS = MAPL_DimsHorzOnly, & + VLOCATION = MAPL_VLocationNone, RC=STATUS ) + VERIFY_(STATUS) + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'dFLNS_'//trim(nameRATS(i)), & + LONG_NAME = 'chg_in_sfc_net_downward_LW_flux_from_'//trim(nameRATS(i)),& + UNITS = 'W m-2', & + DIMS = MAPL_DimsHorzOnly, & + VLOCATION = MAPL_VLocationNone, RC=STATUS ) + VERIFY_(STATUS) + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'dSFCEM_'//trim(nameRATS(i)), & + LONG_NAME = 'LW_flux_emitted_from_sfc_from_'//trim(nameRATS(i)), & + UNITS = 'W m-2', & + DIMS = MAPL_DimsHorzOnly, & + VLOCATION = MAPL_VLocationNone, RC=STATUS ) + VERIFY_(STATUS) + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'NETTRAP_'//trim(nameRATS(i)), & + LONG_NAME = 'Net_Heat_trapping_due_to_'//trim(nameRATS(i)),& + UNITS = 'W m-2', & + DIMS = MAPL_DimsHorzOnly, & + VLOCATION = MAPL_VLocationNone, RC=STATUS ) + VERIFY_(STATUS) + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'COLTRAP_'//trim(nameRATS(i)), & + LONG_NAME = 'Heat_trapping_due_to_'//trim(nameRATS(i)), & + UNITS = 'W m-2', & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationCenter, RC=STATUS ) + VERIFY_(STATUS) + + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'FLX_'//trim(nameRATS(i)), & + LONG_NAME = 'net_downward_longwave_flux_in_air_due_to'//trim(nameRATS(i)), & + UNITS = 'W m-2', & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationEdge, __RC__ ) + + call MAPL_AddInternalSpec(GC, & + SHORT_NAME = 'DFDTS_'//trim(nameRATS(i)), & + LONG_NAME = 'sensitivity_of_net_downward_longwave_flux_in_air_to_surface_temperature_due_to'//trim(nameRATS(i)),& + UNITS = 'W m-2 K-1', & + DIMS = MAPL_DimsHorzVert, & + add2export = .true., & + VLOCATION = MAPL_VLocationEdge, __RC__ ) + + ENDDO + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'CO2_FIXED', & + LONG_NAME = 'lol', & + UNITS = 'mol/mol', & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationCenter, RC=STATUS ) + VERIFY_(STATUS) + call MAPL_AddExportSpec(GC, & + SHORT_NAME = 'DELT', & + LONG_NAME = 'change in surface temperature in RRTMG', & + UNITS = 'K', & + DIMS = MAPL_DimsHorzOnly, & + VLOCATION = MAPL_VLocationCenter, RC=STATUS ) + VERIFY_(STATUS) + if (allocated(nameRATS)) deallocate(nameRATS, STAT=STATUS) + VERIFY_(STATUS) +! end rats code <<>> MSL + + ! Add necessary internal fields + call MAPL_AddInternalSpec(GC, & + SHORT_NAME = 'FLXU_RAT', & + LONG_NAME = 'upward_longwave_flux_in_air', & + UNITS = 'W m-2', & + UNGRIDDED_DIMS = (/N/), & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationEdge, __RC__ ) + + call MAPL_AddInternalSpec(GC, & + SHORT_NAME = 'FLXD_RAT', & + LONG_NAME = 'upward_longwave_flux_in_air', & + UNITS = 'W m-2', & + UNGRIDDED_DIMS = (/N/), & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationEdge, __RC__ ) + + call MAPL_AddInternalSpec(GC, & + SHORT_NAME = 'FLX_RAT', & + LONG_NAME = 'net_downward_longwave_flux_in_air', & + UNITS = 'W m-2', & + UNGRIDDED_DIMS = (/N/), & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationEdge, __RC__ ) + + call MAPL_AddInternalSpec(GC, & + SHORT_NAME = 'DFDTS_RAT', & + LONG_NAME = 'sensitivity_of_net_downward_longwave_flux_in_air_to_surface_temperature', & + UNITS = 'W m-2 K-1', & + UNGRIDDED_DIMS = (/N/), & + DIMS = MAPL_DimsHorzVert, & + VLOCATION = MAPL_VLocationEdge, __RC__ ) + + call MAPL_AddInternalSpec(GC, & + SHORT_NAME = 'SFCEM_RAT', & + LONG_NAME = 'longwave_flux_emitted_from_surface', & + UNITS = 'W m-2', & + UNGRIDDED_DIMS = (/N/), & + DIMS = MAPL_DimsHorzOnly, & + VLOCATION = MAPL_VLocationNone, __RC__ ) + ENDIF + !EOS ! Set the Profiling timers @@ -1053,6 +1244,18 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) integer :: ibnd character*2 :: bb +! For RATS <<>> MSL + type (ESMF_Config) :: CF + logical, save :: first = .true. ! I don't wanna do this, but there's no Initialize() method. This prevents repeating unneeded ops + integer, save :: nRATS ! Number of active RATs to toggle + character(len=6), dimension(8) :: RATNAMES = (/'O3 ','N2O ','CFC11 ','CFC12 ','CH4 ','HCFC22','H2O ','CO2 '/) + character(len=128) :: gen_str + character(len=128), allocatable, save :: nameRATS(:) ! Current toggles read from AGCM.rc + real, allocatable, dimension(:,:) :: TMP_R + real, allocatable, dimension(:,:,:) :: UFLXRAT, DFLXRAT, DUFLX_DT_RAT + real, pointer, dimension(:,:,:) :: SFCEM_INT_RAT + real, pointer, dimension(:,:,:,:) :: DFDTS_RAT, FLX_INT_RAT, FLXU_INT_RAT, FLXD_INT_RAT + !============================================================================= ! Begin... @@ -1061,7 +1264,7 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) ! ----------------------------------------------------------- Iam = "Run" - call ESMF_GridCompGet( GC, name=COMP_NAME, GRID=ESMFGRID, RC=STATUS ) + call ESMF_GridCompGet( GC, name=COMP_NAME, GRID=ESMFGRID, CONFIG=CF, RC=STATUS ) VERIFY_(STATUS) Iam = trim(COMP_NAME) // Iam @@ -1274,7 +1477,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) integer, parameter :: KRAIN = 3 integer, parameter :: KSNOW = 4 - real :: CO2 + real :: CO2_FIXED real :: TAUCRIT ! pressure separating low and middle clouds real :: PRS_LOW_MID ! pressure separating low and middle clouds @@ -1285,6 +1488,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) character(len=ESMF_MAXSTR), pointer :: AEROSOLS(:) integer :: i, j, K, L, YY, DOY, ibinary + integer :: N !<<>> MSL real, dimension (IM,JM) :: T2M ! fractional cover of sub-grid regions real, dimension (IM,JM,NS) :: FS ! fractional cover of sub-grid regions @@ -1491,6 +1695,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) real, pointer, dimension(:,:,:) :: RI, RL, RR, RS, FCLD_IN real, pointer, dimension(:,:,:,:) :: RAERO real, pointer, dimension(:,:,:) :: QAERO + real, pointer, dimension(:,:,:) :: CO2_3d, tmp_3d ! <<>> MSL ! pointers to exports !-------------------- @@ -1565,17 +1770,77 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! Get trace gases concentrations by volume (pppv) from configuration !------------------------------------------------------------------- - call MAPL_GetResource (MAPL, CO2, 'CO2:', __RC__) + call MAPL_GetResource (MAPL, CO2_FIXED, 'CO2:', __RC__) + + ! <<>> MSL + if(CO2_FIXED.eq.-2.0) then ! 3D CO2 + if (USE_CHOU) then ! No 3D CO2 if USE_CHOU + CO2_FIXED = -1.0 + else + call MAPL_GetPointer(IMPORT, CO2_3d, 'CO2', RC=STATUS); VERIFY_(STATUS) + call ESMF_ClockGet(CLOCK, currTIME=CURRENTTIME, RC=STATUS) + VERIFY_(STATUS) + call ESMF_TimeGet (CURRENTTIME, YY=YY, DayOfYear=DOY, RC=STATUS) + VERIFY_(STATUS) + CO2_FIXED = GETCO2(YY,DOY) + call MAPL_GetPointer(EXPORT, tmp_3d, 'CO2_FIXED', NotFoundOK=.true., RC=STATUS) + if (associated(tmp_3d)) then + tmp_3d = CO2_FIXED + tmp_3d => null() + endif + endif + endif - if (CO2 < 0.) then - call ESMF_ClockGet (CLOCK, currTIME=CURRENTTIME, __RC__) - call ESMF_TimeGet (CURRENTTIME, YY=YY, DayOfYear=DOY, __RC__) - CO2 = GETCO2 (YY,DOY) + if(CO2_FIXED.eq.-1.0) then + call ESMF_ClockGet(CLOCK, currTIME=CURRENTTIME, RC=STATUS) + VERIFY_(STATUS) + call ESMF_TimeGet (CURRENTTIME, YY=YY, DayOfYear=DOY, RC=STATUS) + VERIFY_(STATUS) + CO2_FIXED = GETCO2(YY,DOY) endif call MAPL_GetResource (MAPL, PRS_LOW_MID, 'PRS_LOW_MID_CLOUDS:', DEFAULT=70000., __RC__) call MAPL_GetResource (MAPL, PRS_MID_HIGH, 'PRS_MID_HIGH_CLOUDS:', DEFAULT=40000., __RC__) +! Set up the RATS toggles <<>> MSL +! -- these fields will be turn on/off to eval flux impacts +! -- ideally, we could query the exports to find if any actually -need- computing +! because if not (e.g. CO2 is listed as a RAT_DIAG, but HISTORY.rc has +! no diagnostic output for that RAT), there's no need to run an additional RRTMG_LW(). +! -- This is done every call to Run(), when it really only needs to be done once +!---------------------------------------------------------------------------------------- + IF (first) then + + call ESMF_ConfigFindLabel(CF, 'RATS_DIAGNOSTICS:', RC=STATUS) ! Use STATUS to test if label was found + + nRATS = 0 ! Default, no RAT diags + + ! No error thrown. Just go around this if nothing learnable from config. + IF (STATUS .eq. ESMF_SUCCESS) THEN ! if the label was found... + + ! Get number of words in config line + nRATS = ESMF_ConfigGetLen(CF,label='RATS_DIAGNOSTICS:',RC=STATUS) + VERIFY_(STATUS) + + allocate(nameRATS(nRATS), STAT=STATUS) + VERIFY_(STATUS) + + ! Put the cursor at the label + call ESMF_ConfigFindLabel(CF, 'RATS_DIAGNOSTICS:', RC=STATUS) + VERIFY_(STATUS) + + DO i=1,nRATS + call ESMF_ConfigGetAttribute(CF,gen_str,RC=STATUS) + VERIFY_(STATUS) + nameRATS(i) = trim(gen_str) + ENDDO + + ! Only allocate this if needed + allocate(TMP_R(IM*JM,LM),__STAT__) + ENDIF + first = .false. ! Don't repeat this. + ENDIF ! first + ! Prepare for aerosol optics calculations ! --------------------------------------- @@ -1809,7 +2074,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) call MAPL_TimerOn(MAPL,"---IRRAD_RUN",__RC__) call IRRAD( IM*JM, LM, PLE, & - T, Q, O3, T2M, CO2, & + T, Q, O3, T2M, CO2_FIXED, & TRACE, N2O, CH4, CFC11, CFC12, HCFC22, & CWC, FCLD, LCLDMH, LCLDLM, REFF, & NS, FS, TG, EG, TV, EV, RV, & @@ -1845,7 +2110,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! "constant" gases TEST_(gas_concs%set_vmr('n2' , real(N2 ,kind=wp))) TEST_(gas_concs%set_vmr('o2' , real(O2 ,kind=wp))) - TEST_(gas_concs%set_vmr('co2', real(CO2,kind=wp))) + if (.not. associated(CO2_3d)) TEST_(gas_concs%set_vmr('co2', real(CO2_FIXED,kind=wp))) ! <<>> MSL TEST_(gas_concs%set_vmr('co' , real(CO ,kind=wp))) ! variable gases ! (ozone converted from mass mixing ratio, water vapor from specific humidity) @@ -1853,6 +2118,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) TEST_(gas_concs%set_vmr('n2o', real(reshape(N2O ,(/ncol,LM/)),kind=wp))) TEST_(gas_concs%set_vmr('o3' , real(reshape(O3 *(MAPL_AIRMW/MAPL_O3MW ),(/ncol,LM/)),kind=wp))) TEST_(gas_concs%set_vmr('h2o', real(reshape(Q/(1.-Q)*(MAPL_AIRMW/MAPL_H2OMW),(/ncol,LM/)),kind=wp))) + if (associated(CO2_3d)) TEST_(gas_concs%set_vmr('co2', real(reshape(CO2_3d ,(/ncol,LM/)),kind=wp))) !<<>> MSL ! access RRTMGP internal state from the GC call ESMF_UserCompGetInternalState(GC, 'RRTMGP_state', wrap, status) @@ -2974,7 +3240,11 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) O3_R (IJ,K) = O3(I,J,LV) * (MAPL_AIRMW/MAPL_O3MW) CH4_R (IJ,K) = CH4(I,J,LV) N2O_R (IJ,K) = N2O(I,J,LV) - CO2_R (IJ,K) = CO2 + if (associated(CO2_3d)) then ! <<>> MSL + CO2_R (IJ,k) = CO2_3d(I,J,LV) + else + CO2_R (IJ,k) = CO2_FIXED + endif O2_R (IJ,K) = O2 CCL4_R (IJ,K) = CCL4 CFC11_R(IJ,K) = CFC11(I,J,LV) @@ -3045,6 +3315,88 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) call MAPL_TimerOn(MAPL,"---RRTMG_RUN",RC=STATUS) VERIFY_(STATUS) + if (nRATS .gt. 0) then !<<>> MSL + allocate(UFLXRAT(IM*JM,LM+1,nRATS), __STAT__) + allocate(DFLXRAT(IM*JM,LM+1,nRATS), __STAT__) + allocate(DUFLX_DT_RAT(IM*JM,LM+1,nRATS), __STAT__) +! allocate(DFDTS_RAT(IM,JM,LM+1,nRATS), __STAT__) +! allocate(FLXU_INT_RAT(IM,JM,LM+1,nRATS), __STAT__) +! allocate(FLXD_INT_RAT(IM,JM,LM+1,nRATS), __STAT__) +! allocate(FLX_INT_RAT(IM,JM,LM+1,nRATS) , __STAT__) + call MAPL_GetPointer(INTERNAL, DFDTS_RAT, 'DFDTS_RAT', RC=STATUS) + call MAPL_GetPointer(INTERNAL, FLX_INT_RAT, 'FLX_RAT', RC=STATUS) + call MAPL_GetPointer(INTERNAL, FLXU_INT_RAT, 'FLXU_RAT', RC=STATUS) + call MAPL_GetPointer(INTERNAL, FLXD_INT_RAT, 'FLXD_RAT', RC=STATUS) + call MAPL_GetPointer(INTERNAL, SFCEM_INT_RAT, 'SFCEM_RAT', RC=STATUS) + endif + + ! Begin analysis for RATS-specific rad diagnostics + do n = 1,nRATS !<<>> MSL + + ! Zero out the correct RAT gas field + ! O3 CO2 CH4 N2O CFC11 CFC12 CFC22 CCl4 + select case(nameRATS(n)) + case('H2O') + TMP_R = Q_R + Q_R = 0.e0 + case('O3') + TMP_R = O3_R + O3_R = 0.e0 + case('CO2') + TMP_R = CO2_R +! CO2_R = CO2_FIXED! Testing + CO2_R = 0.e0 +! CO2_R = CO2_R-1d-6 + case('CH4') + TMP_R = CH4_R + CH4_R = 0.e0 + case('N2O') + TMP_R = N2O_R + N2O_R = 0.e0 + case('CFC11') + TMP_R = CFC11_R + CFC11_R = 0.e0 + case('CFC12') + TMP_R = CFC12_R + CFC12_R = 0.e0 + case('HCFC22_R') + TMP_R = CFC22_R + CFC22_R = 0.e0 + end select + + ! Call the long wave code with a given RAT set to zero + call RRTMG_LW (IM*JM, LM, PARTITION_SIZE, TS_DERIVS, & + PL_R, PLE_R, T_R, TLEV_R, TSFC, EMISS, & + Q_R, O3_R, CO2_R, CH4_R, N2O_R, O2_R, & + CFC11_R, CFC12_R, CFC22_R, CCL4_R, & + FCLD_R, CICEWP, CLIQWP, REICE, RELIQ, ICEFLGLW, LIQFLGLW, & + TAUAER, ZM_R, ALAT, DOY, LCLDLM, LCLDMH, CLEARCOUNTS, & + UFLXRAT(:,:,n), DFLXRAT(:,:,n), UFLXC, DFLXC, DUFLX_DT_RAT(:,:,n), DUFLXC_DTS, & + BAND_OUTPUT, OLRBRG, DOLRBRG_DTS) + + ! Make sure to set the RAT gas column back to correct vals + select case(nameRATS(n)) + case('H2O') + Q_R = TMP_R + case('O3') + O3_R = TMP_R + case('CO2') + CO2_R = TMP_R + case('CH4') + CH4_R = TMP_R + case('N2O') + N2O_R = TMP_R + case('CFC11') + CFC11_R = TMP_R + case('CFC12') + CFC12_R = TMP_R + case('HCFC22') + CFC22_R = TMP_R + end select + + enddo + ! <<>> end RATS analysis + call RRTMG_LW (IM*JM, LM, PARTITION_SIZE, TS_DERIVS, & PL_R, PLE_R, T_R, TLEV_R, TSFC, EMISS, & Q_R, O3_R, CO2_R, CH4_R, N2O_R, O2_R, & @@ -3096,6 +3448,16 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! (Note: All bands use the same emissivity) SFCEM_INT(I,J) = -( UFLX(IJ,1) - DFLX(IJ,1)*(1.-EMIS(I,J)) ) + if (nRATS .gt. 0) then !<<>> MSL + do k=0,LM + LV = LM-k+1 + FLXU_INT_RAT(i,j,k,:) =-UFLXRAT (IJ,LV,:) + FLXD_INT_RAT(i,j,k,:) = DFLXRAT (IJ,LV,:) + DFDTS_RAT (i,j,k,:) =-DUFLX_DT_RAT(IJ,LV,:) + enddo + SFCEM_INT_RAT(i,j,:) = UFLXRAT(IJ,1,:) - DFLXRAT(IJ,1,:)*(1.0-EMISS(IJ,1)) + endif + enddo ! IM enddo ! JM @@ -3177,6 +3539,9 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! Earlier surface emitted positive downwards per Chou-Suarez. SFCEM_INT = -SFCEM_INT + ! RATS Diagnostic <<>> MSL + if (nRATS .gt. 0) FLX_INT_RAT = FLXD_INT_RAT + FLXU_INT_RAT + ! Save surface temperature in internal state !------------------------------------------- @@ -3256,6 +3621,7 @@ subroutine Update_Flx(IM,JM,LM,RC) real, dimension(IM,JM) :: DELT integer :: K + integer :: N !<<>> MSL integer :: LEV_LOW_MID integer :: LEV_MID_HIGH real :: PRS_LOW_MID ! pressure separating low and middle clouds @@ -3309,6 +3675,10 @@ subroutine Update_Flx(IM,JM,LM,RC) real, allocatable, dimension(:,:) :: DUMTT, OLRB + ! RATS diagnostics <<>> MSL + real, pointer, dimension(:,: ) :: RAT_2D, EMIS + real, pointer, dimension(:,:,:) :: RAT_3D + ! Begin... !---------- @@ -3592,6 +3962,93 @@ subroutine Update_Flx(IM,JM,LM,RC) if(associated(SFCEM0 )) SFCEM0 = SFCEM_INT - DFDTS(:,:,LM) * DELT if(associated(TSREFF )) TSREFF = TSINST + ! Process RAT diagnostics <<>> MSL + if (nRATS .gt. 0) then + call MAPL_GetPointer(INTERNAL, DFDTS_RAT, 'DFDTS_RAT', RC=STATUS) + call MAPL_GetPointer(INTERNAL, FLX_INT_RAT, 'FLX_RAT', RC=STATUS) + call MAPL_GetPointer(INTERNAL, SFCEM_INT_RAT, 'SFCEM_RAT', RC=STATUS) + call MAPL_GetPointer(INTERNAL, FLXU_INT_RAT, 'FLXU_RAT', RC=STATUS) + call MAPL_GetPointer(IMPORT, EMIS, 'EMIS', RC=STATUS); VERIFY_(STATUS) + do n=1,nRATS + ! OLR +!<<>> if (MAPL_am_I_root()) then +!<<>> write(*,*) '<<>> alloc? ', allocated(nameRATS), ' n: ', n, ' nRATS: ', nRATS +!<<>> if (allocated(nameRATS)) write(*,*) '<<>> nameRATS: ', trim(nameRATS(n)) +!<<>> endif + gen_str = 'dOLR_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_2d)) then + RAT_2d = -( FLX_INT_RAT(:,:,0,n) ) + RAT_2d = (-( FLX_INT(:,:, 0))) - RAT_2d + RAT_2d => null() + endif + gen_str = 'dLWS_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_2d)) then + RAT_2d = (FLX_INT(:,:,LM) + SFCEM_INT)-(FLX_INT_RAT(:,:,LM,n) + SFCEM_INT_RAT(:,:,n)) + RAT_2d => null() + endif + gen_str = 'dFLNS_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_2d)) then + RAT_2d = (FLX_INT(:,:,LM)) - (FLX_INT_RAT(:,:,LM,n)) + RAT_2d => null() + endif + gen_str = 'dSFCEM_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_2d)) then + RAT_2d = SFCEM_INT! - DFDTS(:,:,LM) * DELT + RAT_2d = RAT_2d - (SFCEM_INT_RAT(:,:,n))! - DFDTS_RAT(:,:,LM,n) * DELT) + RAT_2d => null() + endif + gen_str = 'NETTRAP_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_2d)) then + RAT_2d = (FLX_INT(:,:,LM)) - & ! Net DOWNWARD flux + (FLX_INT(:,:, 0)) + RAT_2d = RAT_2d - & + ((FLX_INT_RAT(:,:,LM,n)) - & ! Net DOWNWARD flux without RAT at index "n" + (FLX_INT_RAT(:,:, 0,n))) + RAT_2d => null() + endif + gen_str = 'COLTRAP_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc +! call MAPL_GetPointer(IMPORT, AREA, 'AREA', RC=STATUS); VERIFY_(STATUS) ! Uncomment for AREA + call MAPL_GetPointer(EXPORT, RAT_3d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_3d)) then + do K = 1, LM + RAT_3d(:,:,K) = & + (FLX_INT(:,:,K )) - & + (FLX_INT(:,:,K-1)) +! RAT_3d(:,:,K) = AREA(:,:) * ( & ! Uncomment this and comment the line below to multiply by area + RAT_3d(:,:,K) = ( & ! Comment this and uncomment the line above to multiply by area + RAT_3d(:,:,K) - & + ((FLX_INT_RAT(:,:,K ,n)) - & + (FLX_INT_RAT(:,:,K-1,n)))) + enddo + RAT_3d => null() +! AREA => null() ! Uncomment for AREA + endif + gen_str = 'FLX_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_3d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_3d)) then + RAT_3d = FLX_INT(:,:,:) - FLX_INT_RAT(:,:,:,n) + RAT_3d => null() + endif + gen_str = 'DFDTS_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_3d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_3d)) then + RAT_3d = DFDTS(:,:,:) - DFDTS_RAT(:,:,:,n) + RAT_3d => null() + endif + gen_str = 'DELT' !nameRATS is the list of active RAT toggles read from AGCM.rc + call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. + if (associated(RAT_2d)) then + RAT_2d = DELT + RAT_2d => null() + endif + enddo + endif + ! All done !----------- deallocate( DUMTT ) From 2e58da358150f1bf7f7c1801f197eb0300b8fdcc Mon Sep 17 00:00:00 2001 From: "Michael S. Long" Date: Thu, 3 Oct 2024 11:57:43 -0400 Subject: [PATCH 2/4] Fix in case there are no RATS_DIAGNOSTICS: listed MSL --- GEOSirrad_GridComp/GEOS_IrradGridComp.F90 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 index 31ebcae..bc5be5f 100644 --- a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 +++ b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 @@ -960,8 +960,13 @@ subroutine SetServices ( GC, RC ) !-------------------------------------------------------------------------------------- call ESMF_ConfigFindLabel(CF, 'RATS_DIAGNOSTICS:', RC=STATUS) ! Use STATUS to test if label was found + IF (STATUS .eq. ESMF_SUCCESS) THEN + n = ESMF_ConfigGetLen(CF,label='RATS_DIAGNOSTICS:',RC=STATUS) + VERIFY_(STATUS) + ENDIF + ! No error thrown. Just go around this if nothing learnable from config. - IF (STATUS .eq. ESMF_SUCCESS) THEN ! if the label was found... + IF (STATUS .eq. ESMF_SUCCESS .and. n .ne. 0 ) THEN ! if the label was found... ! Get number of words in config line n = ESMF_ConfigGetLen(CF,label='RATS_DIAGNOSTICS:',RC=STATUS) @@ -3346,7 +3351,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) TMP_R = CO2_R ! CO2_R = CO2_FIXED! Testing CO2_R = 0.e0 -! CO2_R = CO2_R-1d-6 +! CO2_R = CO2_R*0.99e0 case('CH4') TMP_R = CH4_R CH4_R = 0.e0 From f26f9cdcd9efc0b52b245cf7b04aa11a61eb33f9 Mon Sep 17 00:00:00 2001 From: "Michael S. Long" Date: Mon, 7 Oct 2024 16:34:00 -0400 Subject: [PATCH 3/4] Update to accomodate various AGCM.rc settings. MSL --- GEOSirrad_GridComp/GEOS_IrradGridComp.F90 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 index bc5be5f..4e1c280 100644 --- a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 +++ b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 @@ -464,6 +464,16 @@ subroutine SetServices ( GC, RC ) ! If using 3-D CO2, set up the import if (DT.eq.-2.0) then + call ESMF_ConfigFindLabel( CF,'CO2_PROVIDER',rc=RC ) + n = ESMF_ConfigGetLen(CF,label='CO2_PROVIDER',rc=status) + call ESMF_ConfigFindLabel( CF,'CO2_PROVIDER',rc=RC ) ! Godda reset! + call ESMF_ConfigGetAttribute(CF, gen_str, Label='CO2_PROVIDER', default='none', RC=STATUS) + ! If CO2: is invalid, raise an error + if (n .le. 0 .or. ESMF_UtilStringLowerCase(trim(gen_str)) .eq. 'none') then + gen_str = 'In AGCM.rc, cannot set CO2: to -2 and not give a valid CO2_PROVIDER' + __raise__(MAPL_RC_ERROR, gen_str) + endif + call MAPL_AddImportSpec(GC, & SHORT_NAME = 'CO2', & LONG_NAME = 'carbondioxide_concentration', & From b03c6c42d0e4df5fd8b6e0045411ba8b45694592 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Thu, 10 Oct 2024 14:08:53 -0400 Subject: [PATCH 4/4] Nullify pointers --- GEOSirrad_GridComp/GEOS_IrradGridComp.F90 | 69 ++++++++++++----------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 index 4e1c280..1e04757 100644 --- a/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 +++ b/GEOSirrad_GridComp/GEOS_IrradGridComp.F90 @@ -461,7 +461,7 @@ subroutine SetServices ( GC, RC ) ! Using DT below since it is already declared, and avoids adding an additional var - MSL call ESMF_ConfigGetAttribute(CF, DT, Label='CO2:', default=-1.0, RC=STATUS) VERIFY_(STATUS) - + ! If using 3-D CO2, set up the import if (DT.eq.-2.0) then call ESMF_ConfigFindLabel( CF,'CO2_PROVIDER',rc=RC ) @@ -473,7 +473,7 @@ subroutine SetServices ( GC, RC ) gen_str = 'In AGCM.rc, cannot set CO2: to -2 and not give a valid CO2_PROVIDER' __raise__(MAPL_RC_ERROR, gen_str) endif - + call MAPL_AddImportSpec(GC, & SHORT_NAME = 'CO2', & LONG_NAME = 'carbondioxide_concentration', & @@ -970,11 +970,11 @@ subroutine SetServices ( GC, RC ) !-------------------------------------------------------------------------------------- call ESMF_ConfigFindLabel(CF, 'RATS_DIAGNOSTICS:', RC=STATUS) ! Use STATUS to test if label was found - IF (STATUS .eq. ESMF_SUCCESS) THEN + IF (STATUS .eq. ESMF_SUCCESS) THEN n = ESMF_ConfigGetLen(CF,label='RATS_DIAGNOSTICS:',RC=STATUS) VERIFY_(STATUS) ENDIF - + ! No error thrown. Just go around this if nothing learnable from config. IF (STATUS .eq. ESMF_SUCCESS .and. n .ne. 0 ) THEN ! if the label was found... @@ -993,7 +993,7 @@ subroutine SetServices ( GC, RC ) DO i=1,n call ESMF_ConfigGetAttribute(CF,gen_str,RC=STATUS) VERIFY_(STATUS) - + nameRATS(i) = trim(gen_str) ! Test if label 'gen_str' has an import @@ -1095,7 +1095,7 @@ subroutine SetServices ( GC, RC ) UNGRIDDED_DIMS = (/N/), & DIMS = MAPL_DimsHorzVert, & VLOCATION = MAPL_VLocationEdge, __RC__ ) - + call MAPL_AddInternalSpec(GC, & SHORT_NAME = 'FLXD_RAT', & LONG_NAME = 'upward_longwave_flux_in_air', & @@ -1103,7 +1103,7 @@ subroutine SetServices ( GC, RC ) UNGRIDDED_DIMS = (/N/), & DIMS = MAPL_DimsHorzVert, & VLOCATION = MAPL_VLocationEdge, __RC__ ) - + call MAPL_AddInternalSpec(GC, & SHORT_NAME = 'FLX_RAT', & LONG_NAME = 'net_downward_longwave_flux_in_air', & @@ -1309,7 +1309,7 @@ subroutine RUN ( GC, IMPORT, EXPORT, CLOCK, RC ) USE_RRTMGP, USE_RRTMG, USE_CHOU, __RC__) call choose_solar_scheme (MAPL, & USE_RRTMGP_SORAD, USE_RRTMG_SORAD, USE_CHOU_SORAD, __RC__) - + ! Set number of IRRAD bands if (USE_RRTMGP) then NB_IRRAD = NB_RRTMGP @@ -1471,7 +1471,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) use cloud_condensate_inhomogeneity, only: condensate_inhomogeneous, zcw_lookup use cloud_subcol_gen, only : & correlation_length_cloud_fraction, correlation_length_condensate - + integer, intent(IN ) :: IM, JM, LM real, dimension(IM,JM), intent(IN ) :: LATS, LONS integer, optional, intent(OUT) :: RC @@ -1528,9 +1528,9 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! 3d pointer arrays to be associated with several 4d arrays for RRTMGP blocking. ! Collapses first two horizontal dimensions of these 4d arrays. OK since the - ! latter arrays are not MAPL and so can be assumed contiguous. + ! latter arrays are not MAPL and so can be assumed contiguous. real, dimension(:,:,:), pointer :: TAUA_3d, SSAA_3d, ASYA_3d - real, dimension(:,:,:), pointer :: CWC_3d, REFF_3d + real, dimension(:,:,:), pointer :: CWC_3d, REFF_3d ! type(C_PTR) :: cptr ! = c_loc(var), but done implicitly with c_loc below @@ -1710,7 +1710,8 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) real, pointer, dimension(:,:,:) :: RI, RL, RR, RS, FCLD_IN real, pointer, dimension(:,:,:,:) :: RAERO real, pointer, dimension(:,:,:) :: QAERO - real, pointer, dimension(:,:,:) :: CO2_3d, tmp_3d ! <<>> MSL + real, pointer, dimension(:,:,:) :: CO2_3d => null() ! <<>> MSL + real, pointer, dimension(:,:,:) :: tmp_3d => null() ! <<>> MSL ! pointers to exports !-------------------- @@ -1776,8 +1777,8 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) RH = Q/GEOS_QSAT(T,PL,PASCALS=.true.) ! make a copy of 'FCLD' so can optionally change it without changing import state - FCLD = FCLD_IN - + FCLD = FCLD_IN + ! Option to force binary clouds for LW call MAPL_GetResource(MAPL,ibinary,"RADLW_BINARY_CLOUDS:",DEFAULT=0,__RC__) if (ibinary /= 0) where (FCLD > 0.) FCLD = 1. @@ -1825,11 +1826,11 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! -- This is done every call to Run(), when it really only needs to be done once !---------------------------------------------------------------------------------------- IF (first) then - + call ESMF_ConfigFindLabel(CF, 'RATS_DIAGNOSTICS:', RC=STATUS) ! Use STATUS to test if label was found - + nRATS = 0 ! Default, no RAT diags - + ! No error thrown. Just go around this if nothing learnable from config. IF (STATUS .eq. ESMF_SUCCESS) THEN ! if the label was found... @@ -2223,7 +2224,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! (do before any KLUGE to top pressure so optical paths wont be affected) ! (also better to use these unKLUGED pressure intervals in t_lev calculation) dp_wp = p_lev(:,2:LM+1) - p_lev(:,1:LM) - + ! pmn: pressure KLUGE ! Because currently k_dist%press_ref_min ~ 1.005 > GEOS-5 ptop of 1.0 Pa. ! Find better solution, perhaps getting AER to add a higher top. @@ -2387,7 +2388,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) ! ======================================================================================= ! IMPORTANT: Specify the type (#streams) of the LW RT calculations in clean_optical_props ! ======================================================================================= - ! While the cloud optics file currently provides two-stream properties, as does the + ! While the cloud optics file currently provides two-stream properties, as does the ! aerosol system, we may choose any number of streams for the actual RT calculations by ! the appropriate instantiation of clean_optical_props here. The increment() statements ! below implicitly convert all component optical properties to this number of streams. @@ -2580,7 +2581,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) seeds(3) = 0 ! get a view of cloud inputs with collapsed horizontal dimensions - call c_f_pointer(c_loc(CWC), CWC_3d, [IM*JM,LM,4]) + call c_f_pointer(c_loc(CWC), CWC_3d, [IM*JM,LM,4]) call c_f_pointer(c_loc(REFF),REFF_3d,[IM*JM,LM,4]) end if ! need_cloud_optical_props @@ -2783,7 +2784,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) if (need_cloud_optical_props) then call MAPL_TimerOn(MAPL,"--RRTMGP_CLOUD_OPTICS",__RC__) - + ! Make band in-cloud optical props from cloud_optics and mean in-cloud cloud water paths. ! These can be scaled later to account for sub-gridscale condensate inhomogeneity. error_msg = cloud_optics%cloud_optics( & @@ -2795,11 +2796,11 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) cloud_optics%get_min_radius_ice()), cloud_optics%get_max_radius_ice()), & cloud_props_bnd) TEST_(error_msg) - + call MAPL_TimerOff(MAPL,"--RRTMGP_CLOUD_OPTICS",__RC__) - + call MAPL_TimerOn(MAPL,"---RRTMGP_MCICA",__RC__) - + ! exponential inter-layer correlations ! [alpha|rcorr](k) is correlation between layers k and k+1 ! dzmid(k) is separation between midpoints of layers k and k+1 @@ -2814,7 +2815,7 @@ subroutine LW_Driver(IM,JM,LM,LATS,LONS,RC) rcorr(:,ilay) = exp(-abs(dzmid(colS:colE,ilay))/real(rdl(colS:colE),kind=wp)) enddo endif - endif + endif ! Generate McICA random numbers for block. ! Perhaps later this can be parallelized? @@ -3988,7 +3989,7 @@ subroutine Update_Flx(IM,JM,LM,RC) ! OLR !<<>> if (MAPL_am_I_root()) then !<<>> write(*,*) '<<>> alloc? ', allocated(nameRATS), ' n: ', n, ' nRATS: ', nRATS -!<<>> if (allocated(nameRATS)) write(*,*) '<<>> nameRATS: ', trim(nameRATS(n)) +!<<>> if (allocated(nameRATS)) write(*,*) '<<>> nameRATS: ', trim(nameRATS(n)) !<<>> endif gen_str = 'dOLR_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. @@ -4006,7 +4007,7 @@ subroutine Update_Flx(IM,JM,LM,RC) gen_str = 'dFLNS_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. if (associated(RAT_2d)) then - RAT_2d = (FLX_INT(:,:,LM)) - (FLX_INT_RAT(:,:,LM,n)) + RAT_2d = (FLX_INT(:,:,LM)) - (FLX_INT_RAT(:,:,LM,n)) RAT_2d => null() endif gen_str = 'dSFCEM_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc @@ -4018,10 +4019,10 @@ subroutine Update_Flx(IM,JM,LM,RC) endif gen_str = 'NETTRAP_'//trim(nameRATS(n)) !nameRATS is the list of active RAT toggles read from AGCM.rc call MAPL_GetPointer(EXPORT, RAT_2d, trim(gen_str), RC=STATUS) ! Don't verify. - if (associated(RAT_2d)) then + if (associated(RAT_2d)) then RAT_2d = (FLX_INT(:,:,LM)) - & ! Net DOWNWARD flux (FLX_INT(:,:, 0)) - RAT_2d = RAT_2d - & + RAT_2d = RAT_2d - & ((FLX_INT_RAT(:,:,LM,n)) - & ! Net DOWNWARD flux without RAT at index "n" (FLX_INT_RAT(:,:, 0,n))) RAT_2d => null() @@ -4251,10 +4252,10 @@ subroutine choose_solar_scheme (MAPL, & USE_RRTMG = RFLAG /= 0. USE_CHOU = .not.USE_RRTMG end if - + _RETURN(_SUCCESS) end subroutine choose_solar_scheme - + subroutine choose_irrad_scheme (MAPL, & USE_RRTMGP, USE_RRTMG, USE_CHOU, & RC) @@ -4262,10 +4263,10 @@ subroutine choose_irrad_scheme (MAPL, & type (MAPL_MetaComp), pointer, intent(in) :: MAPL logical, intent(out) :: USE_RRTMGP, USE_RRTMG, USE_CHOU integer, optional, intent(out) :: RC ! return code - + real :: RFLAG - integer :: STATUS - + integer :: STATUS + USE_RRTMGP = .false. USE_RRTMG = .false. USE_CHOU = .false.