#include #include subroutine rampnl_scon( 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_scon = year fixYear_scon = .false. if ( year .gt. 0 ) then fixYear_scon = .true. write(6,*) 'RAMP_SCON: Ramped gases being fixed at year ', $ rampYear_scon end if return end c############################################################################## subroutine ramp_scon C----------------------------------------------------------------------- C C Computes ramping of solar constant C 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 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_scon ) then yrmodel = rampYear_scon else yrmodel = mcdate/10000 end if nyrm = yrmodel - yrdata(1) + 1 nyrp = nyrm + 1 c c if current date is before 1870, quit c if (nyrm .lt. 1) then write(6,*)'RAMP_SCON: 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 ntim, just use ntim values c if (nyrp .gt. ntim) then scon = sconst(ntim) 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_SCON: Bad fact1 and/or fact2=',fact1,fact2 call endrun end if c c do time interpolation: c scon = (sconst(nyrm)*fact1 + sconst(nyrp)*fact2) return end