112 & kind_phys, kind_io4
113 use funcphys
, only : fpkapx
115 use ozne_def
, only : jmr => latsozc, loz => levozc, &
116 & blte => blatc, dlte=> dphiozc, &
118 use module_iounitdef
, only : nio3clm, nico2cn
125 character(40),
parameter :: &
126 & VTAGGAS=
'NCEP-Radiation_gases v5.1 Nov 2012 ' 140 real (kind=kind_phys),
parameter ::
resco2=15.0
142 real (kind=kind_phys),
parameter ::
prsco2=788.0
168 real (kind=kind_phys),
allocatable ::
pkstr(:),
o3r(:,:,:)
170 real (kind=kind_phys) ::
facoz = 0.0
270 integer,
intent(in) :: me
275 real (kind=kind_phys),
dimension(IMXCO2,JMXCO2) :: co2dat
276 real (kind=kind_phys) :: co2g1, co2g2
277 real (kind=kind_phys) :: pstr(loz)
278 real (kind=kind_io4) :: o3clim4(jmr,loz,12), pstr4(loz)
280 integer :: imond(12), ilat(jmr,12)
281 integer :: i, j, k, iyr, imo
282 logical :: file_exist, lextpl
283 character :: cline*100, cform*8
284 data cform /
'(24f7.2)' /
288 if ( me == 0 ) print *,
vtaggas 297 print *,
' - Using interactive ozone distribution' 300 if ( timeozc /= 12 )
then 301 print *,
' - Using climatology ozone distribution' 302 print *,
' timeozc=',timeozc,
' is not monthly mean', &
303 &
' - job aborting in subroutin gas_init!!!' 307 allocate (
pkstr(loz),
o3r(jmr,loz,12))
310 if ( loz == 17 )
then 312 read (nio3clm,15) pstr4(k)
318 read (nio3clm,16) imond(imo), ilat(j,imo), &
319 & (o3clim4(j,k,imo),k=1,10)
320 16
format(i2,i4,10f6.2)
321 read (nio3clm,20) (o3clim4(j,k,imo),k=11,loz)
328 read (nio3clm) pstr4(k)
333 read (nio3clm) (o3clim4(j,k,imo),j=1,jmr)
341 o3r(j,k,imo) = o3clim4(j,k,imo) * 1.655e-6
351 print *,
' - Using climatology ozone distribution' 352 print *,
' Found ozone data for levels pstr=', &
358 pkstr(k) = fpkapx(pstr(k)*100.0)
366 lab_ico2 :
if (
ico2flg == 0 )
then 369 print *,
' - Using prescribed co2 global mean value=', &
375 lab_ictm :
if (
ictmflg == -1 )
then 378 if ( .not. file_exist )
then 379 print *,
' Can not find user CO2 data file: ',
co2usr_file, &
380 &
' - Stopped in subroutine gas_init !!' 384 open(nico2cn,file=
co2usr_file,form=
'formatted',status=
'old')
386 read (nico2cn, 25) iyr, cline, co2g1, co2g2
387 25
format(i4,a94,f7.2,16x,f5.2)
392 print *,
' - Using co2 global annual mean value from', &
394 print *, iyr,cline(1:94),co2g1,
' GROWTH RATE =', co2g2
400 read (nico2cn,cform) co2dat
411 print *,
' - Using co2 monthly 2-d data from user', &
413 print *, iyr,cline(1:94),co2g1,
' GROWTH RATE =', co2g2
415 print *,
' CHECK: Sample of selected months of CO2 data' 417 print *,
' Month =',imo
422 print *,
' ICO2=',
ico2flg,
' is not a valid selection', &
423 &
' - Stoped in subroutine gas_init!!!' 434 print *,
' - Using observed co2 global annual mean value' 440 print *,
' - Using observed co2 monthly 2-d data' 443 print *,
' ICO2=',
ico2flg,
' is not a valid selection', &
444 &
' - Stoped in subroutine gas_init!!!' 450 if ( .not. file_exist )
then 452 print *,
' Can not find seasonal cycle CO2 data: ', &
453 &
co2cyc_file,
' - Stopped in subroutine gas_init !!' 464 read (nico2cn, 35) cline, co2g1, co2g2
465 35
format(a98,f7.2,16x,f5.2)
466 read (nico2cn,cform) co2dat
469 print *,
' - Superimpose seasonal cycle to mean CO2 data' 470 print *,
' Opened CO2 climatology seasonal cycle data',&
476 read (nico2cn,45) cline,
gco2cyc(imo)
481 read (nico2cn,cform) co2dat
537 & ( iyear, imon, iday, ihour, loz1st, ldoco2, me )
599 integer,
intent(in) :: iyear, imon, iday, ihour, me
601 logical,
intent(in) :: loz1st, ldoco2
606 real (kind=kind_phys),
dimension(IMXCO2,JMXCO2) :: co2dat, co2ann
607 real (kind=kind_phys) :: co2g1, co2g2, rate
609 integer :: i, id, j, l, iyr, imo, iyr1, iyr2, jyr, idyr
610 integer,
save :: mdays(13), midmon=15, midm=15, midp=45
612 data mdays / 31,28,31,30,31,30,31,31,30,31,30,31,30 /
614 logical :: file_exist, lextpl, change
615 character :: cline*100, cform*8, cfile1*26
616 data cform /
'(24f7.2)' /
623 midmon = mdays(imon)/2 + 1
624 change = loz1st .or. ( (iday==midmon) .and. (ihour==0) )
627 if ( iday < midmon )
then 628 k1oz = mod(imon+10, 12) + 1
629 midm = mdays(
k1oz)/2 + 1
631 midp = mdays(
k1oz) + midmon
635 k2oz = mod(imon, 12) + 1
636 midp = mdays(
k2oz)/2 + 1 + mdays(
k1oz)
640 if (iday < midmon)
then 641 id = iday + mdays(
k1oz)
646 facoz = float(id - midm) / float(midp - midm)
653 if ( .not. ldoco2 )
return 659 lextpl = ( mod(
ictmflg,10) == 1 )
661 if ( idyr == 0 ) idyr = iyear
667 if (
kyrsav == iyear )
return 678 print *,
' Requested CO2 data year',iyear,
' earlier than', &
680 print *,
' Which is the earliest monthly observation', &
682 print *,
' Thus, historical global mean data is used' 688 if ( .not. file_exist )
then 689 print *,
' Requested co2 data file "',
co2gbl_file, &
690 &
'" not found - Stopped in subroutine gas_update!!' 694 open (nico2cn,file=
co2gbl_file,form=
'formatted',status=
'old')
697 read (nico2cn, 24) iyr1, iyr2, cline
698 24
format(i4,4x,i4,a48)
705 if ( idyr < iyr1 )
then 713 lab_dowhile1 :
do while ( i >= iyr1 )
716 read (nico2cn, *) jyr, co2g1, co2g2
718 if ( i == iyr .and. iyr == jyr )
then 719 co2_glb = (co2g1+co2g2) * 0.5e-6
729 if ( me == 0 ) print *,
' Co2 data for year',iyear, &
746 write(cfile1(19:22),34) idyr
751 inquire (file=cfile1, exist=file_exist)
752 if ( .not. file_exist )
then 754 lab_if_ictm :
if (
ictmflg > 10 )
then 756 print *,
' Specified co2 data for year',idyr, &
757 &
' not found !! Need to change namelist ICTM !!' 758 print *,
' *** Stopped in subroutine gas_update !!' 763 print *,
' Requested co2 data for year',idyr, &
764 &
' not found, check for other available data set' 767 lab_dowhile2 :
do while ( iyr >=
minyear )
769 write(cfile1(19:22),34) iyr
771 inquire (file=cfile1, exist=file_exist)
773 print *,
' Looking for CO2 file ',cfile1
776 if ( file_exist )
then 781 if ( .not. file_exist )
then 783 print *,
' Can not find co2 data source file' 784 print *,
' *** Stopped in subroutine gas_update !!' 794 open (nico2cn,file=cfile1,form=
'formatted',status=
'old')
796 read (nico2cn, 36) iyr, cline, co2g1, co2g2
797 36
format(i4,a94,f7.2,16x,f5.2)
800 print *,
' Opened co2 data file: ',cfile1
801 print *, iyr, cline(1:94), co2g1,
' GROWTH RATE =', co2g2
808 rate = 2.00 * (iyear - iyr)
813 co2_glb = (co2g1 + rate) * 1.0e-6
815 print *,
' Global annual mean CO2 data for year', &
823 print *,
' CHECK: Monthly deviations of climatology ', &
824 &
'to be superimposed on global annual mean' 831 read (nico2cn,cform) co2dat
836 co2ann(i,j) = co2ann(i,j) + co2dat(i,j)
843 co2ann(i,j) = co2ann(i,j) * 1.0e-6 / float(12)
856 print *,
' CHECK: Sample of 2-d annual mean of CO2 ', &
857 &
'data used for year:',iyear
859 print *,
' CHECK: AFTER adding seasonal cycle, Sample ', &
860 &
'of selected months of CO2 data for year:',iyear
862 print *,
' Month =',imo
872 read (nico2cn,cform) co2dat
877 co2vmr_sav(i,j,imo) = (co2dat(i,j) + rate) * 1.0e-6
883 print *,
' CHECK: Sample of selected months of CO2 ', &
884 &
'data used for year:',iyear
886 print *,
' Month =',imo
935 & ( plvl, xlon, xlat, &
996 integer,
intent(in) :: IMAX, LMAX
997 real (kind=kind_phys),
intent(in) :: plvl(:,:), xlon(:), xlat(:)
1000 real (kind=kind_phys),
intent(out) :: gasdat(:,:,:)
1003 integer :: i, k, ilat, ilon
1005 real (kind=kind_phys) :: xlon1, xlat1, tmp
1044 if ( xlon1 < 0.0 ) xlon1 = xlon1 +
con_pi 1045 xlat1 =
hfpi - xlat(i)
1048 ilon = min(
imxco2, int( xlon1*tmp + 1 ))
1049 ilat = min(
jmxco2, int( xlat1*tmp + 1 ))
1053 if ( plvl(i,k) >=
prsco2 )
then 1061 if ( plvl(i,k+1) >=
prsco2 )
then 1121 integer,
intent(in) :: IMAX, LM
1123 real (kind=kind_phys),
intent(in) :: prslk(:,:), xlat(:)
1126 real (kind=kind_phys),
intent(out) :: o3mmr(:,:)
1129 real (kind=kind_phys) :: o3i(imax,loz), wk1(imax), deglat, elte, &
1130 & tem, tem1, tem2, tem3, tem4, temp
1132 integer :: i, j, k, l, j1, j2, ll
1136 elte = blte + (jmr-1)*dlte
1139 deglat = xlat(i) *
raddeg 1142 if (deglat > blte .and. deglat < elte)
then 1143 tem1 = (deglat - blte) / dlte + 1
1147 elseif (deglat <= blte)
then 1151 elseif (deglat >= elte)
then 1167 if (
ivflip == 1) ll = lm -l + 1
1170 wk1(i) = prslk(i,ll)
1177 if (wk1(i) >
pkstr(k) .and. wk1(i) <=
pkstr(k+1))
then 1178 tem = (
pkstr(k+1) - wk1(i)) * temp
1179 o3mmr(i,ll) = tem * o3i(i,k) + (1.0 - tem) * o3i(i,k+1)
1185 if (wk1(i) >
pkstr(loz)) o3mmr(i,ll) = o3i(i,loz)
1186 if (wk1(i) <
pkstr(1)) o3mmr(i,ll) = o3i(i,1)
real(kind=kind_phys), dimension(:), allocatable pkstr
real(kind=kind_phys), parameter ch4vmr_def
real(kind=kind_phys), parameter n2ovmr_def
subroutine, public gas_init
This subroutine sets up ozone, co2, etc. parameters. if climatology ozone then read in monthly ozone ...
integer, save ioznflg
ozone dta source control flag
real(kind=kind_phys), parameter co2vmr_def
real(kind=kind_phys), parameter o2vmr_def
integer, parameter imxco2
input co2 dat lon points
character, save co2usr_file
external co2 user defined data table
integer, parameter, public nf_vgas
number of gas species
character, save co2gbl_file
external co2 global annual mean data table
real(kind=kind_phys), parameter hfpi
real(kind=kind_phys), parameter raddeg
subroutine, public gas_update
This subroutine reads in 2-d monthly co2 data set for a specified year. data are in a 15 degree lat/l...
This module contains some the most frequently used math and physics constants for gcm models...
real(kind=kind_phys), parameter f12vmr_def
character(40), parameter vtaggas
subroutine, public getgases
This subroutine sets up global distribution of radiation absorbing gases in volume mixing ratio...
This module defines commonly used control variables/parameters in physics related programs...
integer, save ico2flg
co2 data source control flag
real(kind=kind_phys), dimension(12) gco2cyc
real(kind=kind_phys), dimension(:,:,:), allocatable o3r
character, save co2dat_file
external co2 2d monthly obsv data table
real(kind=kind_phys), parameter f113vmr_def
integer, save ivflip
vertical profile indexing flag
real(kind=kind_phys) co2_glb
real(kind=kind_phys), parameter covmr_def
character, save co2cyc_file
external co2 clim monthly cycle data table
real(kind=kind_phys), dimension(:,:,:), allocatable co2vmr_sav
integer, parameter jmxco2
input co2 data lat points
real(kind=kind_phys), parameter resco2
real(kind=kind_phys), parameter prsco2
real(kind=kind_phys), dimension(:,:,:), allocatable co2cyc_sav
integer, parameter minyear
earlist year 2-d co2 data available
real(kind=kind_phys), parameter con_pi
real(kind=kind_phys), parameter f11vmr_def
subroutine, public getozn
This subroutine sets up climatological ozone profile for radiation calculation this code is originall...
This module sets up ozone climatological profiles and other constant gas profiles, such as co2, ch4, n2o, o2, and those of cfc gases. All data are entered as mixing ratio by volume, except ozone which is mass mixing ratio (g/g).
real(kind=kind_phys), parameter f22vmr_def
real(kind=kind_phys) facoz
integer, save ictmflg
external data time/date control flag
real(kind=kind_phys), parameter cl4vmr_def