#include #include subroutine rampnl_ghg( year ) c Initialize the ramp options that are controlled by namelist input. implicit none c----------------------------------------------------------------------- #include c----------------------------------------------------------------------- c Input args. integer year ! Ramped gases fixed at this year c----------------------------------------------------------------------- rampYear_ghg = year fixYear_ghg = .false. if ( year .gt. 0 ) then fixYear_ghg = .true. write(6,*) 'RAMP_GHG: Ramped gases being fixed at year ', $ rampYear_ghg end if return end c############################################################################## subroutine ramp_ghg C----------------------------------------------------------------------- C C Computes trace gas volume mixing ratios via interpolation of C yearly input data. C C----------------------------------------------------------------------- #include C----------------------------------------------------------------------- #include C----------------------------------------------------------------------- #include C----------------------------------------------------------------------- #include C----------------------------------------------------------------------- #include C----------------------------------------------------------------------- #include C---------------------------Local variables----------------------------- integer n ! loop variable integer yrmodel ! model year integer nyrm ! year index integer nyrp ! year index real doymodel ! model day of year real doydatam ! day of year for input data yrdata(nyrm) real doydatap ! day or year for input data yrdata(nyrp) real deltat ! delta time real fact1, fact2 ! time interpolation factors real cfcscl ! cfc scale factor for f11 c c --------------------------------------------------------------------- c if (ramp_write) then write(6,*) ramp_type ramp_write = .false. endif c c determine index into input data c if ( fixYear_ghg ) then yrmodel = rampYear_ghg else yrmodel = mcdate/10000 end if nyrm = yrmodel - yrdata(1) + 1 nyrp = nyrm + 1 c c if current date is before yrdata(1), quit c if (nyrm .lt. 1) then write(6,*)'RAMP_GHG: data time index is out of bounds' write(6,*)'nyrm = ',nyrm,' nyrp= ',nyrp, ' mcdate= ', mcdate call endrun endif c c if current date later than yrdata(ntim), just use ntim values c if want to use just use ntim values - uncomment the following lines c below and comment the call to endrun and previous write c if (nyrp .gt. ntim) then write(6,*)'RAMP: error - current date is past the end of ', $ ' valid sulfate scale factor data' call endrun c write(6,*)'RAMP_GHG: using ghg data for ',yrdata(ntim) c co2vmr = co2(ntim)*1.e-06 c ch4vmr = ch4(ntim)*1.e-09 c n2ovmr = n2o(ntim)*1.e-09 c f11vmr = f11(ntim)*1.e-12*(1.+cfcscl) c f12vmr = f12(ntim)*1.e-12 c co2mmr = rmwco2 * co2vmr c return endif c c determine time interpolation factors, check sanity c of interpolation factors to within 32-bit roundoff c assume that day of year is 1 for all input data c doymodel = yrmodel*365. + calday doydatam = yrdata(nyrm)*365. + 1. doydatap = yrdata(nyrp)*365. + 1. deltat = doydatap - doydatam fact1 = (doydatap - doymodel)/deltat fact2 = (doymodel - doydatam)/deltat if (abs(fact1+fact2-1.).gt.1.e-6 .or. $ fact1.gt.1.000001 .or. fact1.lt.-1.e-6 .or. $ fact2.gt.1.000001 .or. fact2.lt.-1.e-6) then write(6,*)'RAMP_GHG: Bad fact1 and/or fact2=',fact1,fact2 call endrun end if c c do time interpolation: c co2 in ppmv c n2o,ch4 in ppbv c f11,f12 in pptv c co2vmr = (co2(nyrm)*fact1 + co2(nyrp)*fact2)*1.e-06 ch4vmr = (ch4(nyrm)*fact1 + ch4(nyrp)*fact2)*1.e-09 n2ovmr = (n2o(nyrm)*fact1 + n2o(nyrp)*fact2)*1.e-09 cfcscl = (adj(nyrm)*fact1 + adj(nyrp)*fact2) f11vmr = (f11(nyrm)*fact1 + f11(nyrp)*fact2)*1.e-12*(1.+cfcscl) f12vmr = (f12(nyrm)*fact1 + f12(nyrp)*fact2)*1.e-12 co2mmr = rmwco2 * co2vmr c c output statements of ramping c write(6,'(a,f8.2,6(1pe22.14))') 'calday1 = ',calday $ ,co2vmr/1.e-06 $ ,ch4vmr/1.e-09 $ ,n2ovmr/1.e-09 write(6,'(a,f8.2,6(1pe22.14))') 'calday2 = ',calday $ ,cfcscl $ ,(f11(nyrm)*fact1 + f11(nyrp)*fact2) $ ,f12vmr/1.e-12 return end