44 private :: profile_setup_cira86
45 private :: profile_setup_mipas2001
46 private :: readfile_mipas2001
47 private :: profile_read_climatology
48 private :: profile_read_cira86
49 private :: profile_read_mipas2001
50 private :: profile_read_user
51 private :: profile_interp
57 character(len=H_LONG),
private :: profile_cira86_fname =
"cira.nc"
58 character(len=H_LONG),
private :: profile_mipas2001_dir =
"."
59 character(len=H_LONG),
private :: profile_user_fname =
""
60 logical,
private :: atmos_phy_rd_profile_use_h2o = .true.
61 logical,
private :: atmos_phy_rd_profile_use_co2 = .true.
62 logical,
private :: atmos_phy_rd_profile_use_o3 = .true.
63 logical,
private :: atmos_phy_rd_profile_use_n2o = .true.
64 logical,
private :: atmos_phy_rd_profile_use_co = .true.
65 logical,
private :: atmos_phy_rd_profile_use_ch4 = .true.
66 logical,
private :: atmos_phy_rd_profile_use_o2 = .true.
67 logical,
private :: atmos_phy_rd_profile_use_cfc = .true.
68 logical,
private :: debug = .false.
70 integer,
private :: cira_ntime
71 integer,
private :: cira_nplev
72 integer,
private :: cira_nlat
73 real(
rp),
private,
allocatable :: cira_nd (:)
74 real(
rp),
private,
allocatable :: cira_plog(:)
75 real(
rp),
private,
allocatable :: cira_lat (:)
76 real(
rp),
private,
allocatable :: cira_temp(:,:,:)
77 real(
rp),
private,
allocatable :: cira_z (:,:,:)
79 real(
rp),
private,
allocatable :: interp_temp(:)
80 real(
rp),
private,
allocatable :: interp_z (:)
82 integer,
private,
parameter :: mipas_kmax = 121
83 integer,
private,
parameter :: mipas_ntime = 2
84 real(
rp),
private :: mipas_nd (0:mipas_ntime+1)
85 real(
rp),
private :: mipas_lat (5)
86 real(
rp),
private :: mipas_z (mipas_kmax,4)
87 real(
rp),
private :: mipas_pres(mipas_kmax,4)
88 real(
rp),
private :: mipas_temp(mipas_kmax,4)
89 real(
rp),
private :: mipas_gas (mipas_kmax,30,4)
91 integer,
private,
parameter :: i_tropic = 1
92 integer,
private,
parameter :: i_midlat = 2
93 integer,
private,
parameter :: i_polarsum = 3
94 integer,
private,
parameter :: i_polarwin = 4
96 integer,
private,
parameter :: i_n2 = 1
97 integer,
private,
parameter :: i_o2 = 2
98 integer,
private,
parameter :: i_co2 = 3
99 integer,
private,
parameter :: i_o3 = 4
100 integer,
private,
parameter :: i_h2o = 5
101 integer,
private,
parameter :: i_ch4 = 6
102 integer,
private,
parameter :: i_n2o = 7
103 integer,
private,
parameter :: i_hno3 = 8
104 integer,
private,
parameter :: i_co = 9
105 integer,
private,
parameter :: i_no2 = 10
106 integer,
private,
parameter :: i_n2o5 = 11
107 integer,
private,
parameter :: i_clo = 12
108 integer,
private,
parameter :: i_hocl = 13
109 integer,
private,
parameter :: i_clono2 = 14
110 integer,
private,
parameter :: i_no = 15
111 integer,
private,
parameter :: i_hno4 = 16
112 integer,
private,
parameter :: i_hcn = 17
113 integer,
private,
parameter :: i_nh3 = 18
114 integer,
private,
parameter :: i_f11 = 19
115 integer,
private,
parameter :: i_f12 = 20
116 integer,
private,
parameter :: i_f14 = 21
117 integer,
private,
parameter :: i_f22 = 22
118 integer,
private,
parameter :: i_ccl4 = 23
119 integer,
private,
parameter :: i_cof2 = 24
120 integer,
private,
parameter :: i_h2o2 = 25
121 integer,
private,
parameter :: i_c2h2 = 26
122 integer,
private,
parameter :: i_c2h6 = 27
123 integer,
private,
parameter :: i_ocs = 28
124 integer,
private,
parameter :: i_so2 = 29
125 integer,
private,
parameter :: i_sf6 = 30
127 logical,
private :: report_firsttime = .true.
138 character(len=H_LONG) :: atmos_phy_rd_profile_cira86_in_filename
139 character(len=H_LONG) :: atmos_phy_rd_profile_mipas2001_in_basename
140 character(len=H_LONG) :: atmos_phy_rd_profile_user_in_filename
142 namelist / param_atmos_phy_rd_profile / &
144 atmos_phy_rd_profile_cira86_in_filename, &
145 atmos_phy_rd_profile_mipas2001_in_basename, &
146 atmos_phy_rd_profile_user_in_filename, &
147 atmos_phy_rd_profile_use_h2o, &
148 atmos_phy_rd_profile_use_co2, &
149 atmos_phy_rd_profile_use_o3, &
150 atmos_phy_rd_profile_use_n2o, &
151 atmos_phy_rd_profile_use_co, &
152 atmos_phy_rd_profile_use_ch4, &
153 atmos_phy_rd_profile_use_o2, &
154 atmos_phy_rd_profile_use_cfc, &
161 log_info(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Setup'
163 atmos_phy_rd_profile_cira86_in_filename = profile_cira86_fname
164 atmos_phy_rd_profile_mipas2001_in_basename = profile_mipas2001_dir
165 atmos_phy_rd_profile_user_in_filename = profile_user_fname
169 read(
io_fid_conf,nml=param_atmos_phy_rd_profile,iostat=ierr)
172 log_info(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Not found namelist. Default used.'
173 elseif( ierr > 0 )
then
174 log_error(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_RD_PROFILE. Check!'
177 log_nml(param_atmos_phy_rd_profile)
179 profile_cira86_fname = atmos_phy_rd_profile_cira86_in_filename
180 profile_mipas2001_dir = atmos_phy_rd_profile_mipas2001_in_basename
181 profile_user_fname = atmos_phy_rd_profile_user_in_filename
184 log_info(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Climatological profile for radiation'
188 call profile_setup_cira86
190 call profile_setup_mipas2001
199 subroutine profile_setup_cira86
216 integer,
allocatable :: cira_date(:,:)
219 real(
dp) :: subsec = 0.0_dp
220 integer :: offset_year = 0
222 real(
rp),
allocatable :: tmp1d(:)
223 real(
rp),
allocatable :: tmp3d(:,:,:)
230 log_info(
"PROFILE_setup_CIRA86",*)
'Read CIRA86 climatology, filename : ', trim(profile_cira86_fname)
232 inquire( file=trim(profile_cira86_fname), exist=exist )
233 if ( .NOT. exist )
then
234 log_error(
"PROFILE_setup_CIRA86",*)
'File not found. check!'
241 aggregate = .false., &
244 call file_get_shape( fid,
"ta", dims(:) )
253 allocate( cira_nd( 0:cira_ntime+1) )
255 allocate( cira_plog(cira_nplev) )
256 allocate( cira_lat(cira_nlat ) )
258 allocate( cira_temp(cira_nplev,cira_nlat,0:cira_ntime+1) )
259 allocate( cira_z(cira_nplev,cira_nlat,0:cira_ntime+1) )
262 allocate( cira_date(6,0:cira_ntime+1) )
264 cira_date(:, 0) = (/ 1985, 12, 15, 12, 0, 0 /)
265 cira_date(:, 1) = (/ 1986, 1, 15, 12, 0, 0 /)
266 cira_date(:, 2) = (/ 1986, 2, 15, 12, 0, 0 /)
267 cira_date(:, 3) = (/ 1986, 3, 15, 12, 0, 0 /)
268 cira_date(:, 4) = (/ 1986, 4, 15, 12, 0, 0 /)
269 cira_date(:, 5) = (/ 1986, 5, 15, 12, 0, 0 /)
270 cira_date(:, 6) = (/ 1986, 6, 15, 12, 0, 0 /)
271 cira_date(:, 7) = (/ 1986, 7, 15, 12, 0, 0 /)
272 cira_date(:, 8) = (/ 1986, 8, 15, 12, 0, 0 /)
273 cira_date(:, 9) = (/ 1986, 9, 15, 12, 0, 0 /)
274 cira_date(:,10) = (/ 1986, 10, 15, 12, 0, 0 /)
275 cira_date(:,11) = (/ 1986, 11, 15, 12, 0, 0 /)
276 cira_date(:,12) = (/ 1986, 12, 15, 12, 0, 0 /)
277 cira_date(:,13) = (/ 1987, 1, 15, 12, 0, 0 /)
279 do t = 0, cira_ntime+1
281 cira_date(:,t), subsec, &
284 cira_nd(t) = real(nday,kind=
rp) + nsec / 86400.0_rp
286 deallocate( cira_date )
289 allocate( tmp1d(cira_nplev) )
291 call file_read( fid,
"plev", tmp1d(:) )
293 cira_plog(n) = log( real(tmp1d(n),kind=
rp) )
298 allocate( tmp1d(cira_nlat) )
300 call file_read( fid,
"latitude", tmp1d(:) )
311 allocate( tmp3d(cira_nlat,cira_nplev,cira_ntime) )
313 call file_read( fid,
"ta", tmp3d(:,:,:) )
317 cira_temp(n,m,t) = real(tmp3d(m,n,t),kind=
rp)
322 cira_temp(:,:,0 ) = cira_temp(:,:,cira_ntime)
323 cira_temp(:,:,cira_ntime+1) = cira_temp(:,:,1 )
329 if( cira_temp(n,m,t) >= 999.9_rp ) cira_temp(n,m,t) = cira_temp(n-1,m,t)
337 call file_read( fid,
"zg", tmp3d(:,:,:) )
341 cira_z(n,m,t) = real(tmp3d(m,n,t),kind=
rp) * 1.e-3_rp
346 cira_z(:,:,0 ) = cira_z(:,:,cira_ntime)
347 cira_z(:,:,cira_ntime+1) = cira_z(:,:,1 )
353 if( cira_z(n,m,t) == 0.999_rp ) cira_z(n,m,t) = cira_z(n-1,m,t)
363 allocate( interp_temp(cira_nplev) )
364 allocate( interp_z(cira_nplev) )
367 end subroutine profile_setup_cira86
371 subroutine profile_setup_mipas2001
380 character(len=H_LONG) :: fname
382 character(len=7),
parameter :: mipas_fname(4) = (/
"equ.atm",
"day.atm",
"sum.atm",
"win.atm"/)
384 integer :: mipas_date(6,0:mipas_ntime+1)
387 real(
dp) :: subsec = 0.0_dp
388 integer :: offset_year = 0
390 character(len=H_LONG) :: dummy
396 log_info(
"PROFILE_setup_MIPAS2001",*)
'Read MIPAS2001 climatology '
398 mipas_date(:, 0) = (/ 2000, 12, 22, 12, 0, 0 /)
399 mipas_date(:, 1) = (/ 2001, 6, 21, 12, 0, 0 /)
400 mipas_date(:, 2) = (/ 2001, 12, 22, 12, 0, 0 /)
401 mipas_date(:, 3) = (/ 2002, 6, 21, 12, 0, 0 /)
403 do t = 0, mipas_ntime+1
405 mipas_date(:,t), subsec, &
408 mipas_nd(t) = real(nday,kind=
rp) + nsec / 86400.0_rp
417 do rgn = i_tropic, i_polarwin
418 fname = trim(profile_mipas2001_dir)//
'/'//mipas_fname(rgn)
419 log_info(
"PROFILE_setup_MIPAS2001",*)
'filename : ', trim(fname)
423 file = trim(fname), &
424 form =
'formatted', &
428 if ( ierr /= 0 )
then
429 log_error(
"PROFILE_setup_MIPAS2001",*)
'File not found. check!'
437 call readfile_mipas2001( fid, mipas_z(:,rgn) )
438 call readfile_mipas2001( fid, mipas_pres(:,rgn) )
439 call readfile_mipas2001( fid, mipas_temp(:,rgn) )
441 call readfile_mipas2001( fid, mipas_gas(:,i_n2 ,rgn) )
442 call readfile_mipas2001( fid, mipas_gas(:,i_o2 ,rgn) )
443 call readfile_mipas2001( fid, mipas_gas(:,i_co2 ,rgn) )
444 call readfile_mipas2001( fid, mipas_gas(:,i_o3 ,rgn) )
445 call readfile_mipas2001( fid, mipas_gas(:,i_h2o ,rgn) )
446 call readfile_mipas2001( fid, mipas_gas(:,i_ch4 ,rgn) )
447 call readfile_mipas2001( fid, mipas_gas(:,i_n2o ,rgn) )
448 call readfile_mipas2001( fid, mipas_gas(:,i_hno3 ,rgn) )
449 call readfile_mipas2001( fid, mipas_gas(:,i_co ,rgn) )
450 call readfile_mipas2001( fid, mipas_gas(:,i_no2 ,rgn) )
451 call readfile_mipas2001( fid, mipas_gas(:,i_n2o5 ,rgn) )
452 call readfile_mipas2001( fid, mipas_gas(:,i_clo ,rgn) )
453 call readfile_mipas2001( fid, mipas_gas(:,i_hocl ,rgn) )
454 call readfile_mipas2001( fid, mipas_gas(:,i_clono2,rgn) )
455 call readfile_mipas2001( fid, mipas_gas(:,i_no ,rgn) )
456 call readfile_mipas2001( fid, mipas_gas(:,i_hno4 ,rgn) )
457 call readfile_mipas2001( fid, mipas_gas(:,i_hcn ,rgn) )
458 call readfile_mipas2001( fid, mipas_gas(:,i_nh3 ,rgn) )
459 call readfile_mipas2001( fid, mipas_gas(:,i_f11 ,rgn) )
460 call readfile_mipas2001( fid, mipas_gas(:,i_f12 ,rgn) )
461 call readfile_mipas2001( fid, mipas_gas(:,i_f14 ,rgn) )
462 call readfile_mipas2001( fid, mipas_gas(:,i_f22 ,rgn) )
463 call readfile_mipas2001( fid, mipas_gas(:,i_ccl4 ,rgn) )
464 call readfile_mipas2001( fid, mipas_gas(:,i_cof2 ,rgn) )
465 call readfile_mipas2001( fid, mipas_gas(:,i_h2o2 ,rgn) )
466 call readfile_mipas2001( fid, mipas_gas(:,i_c2h2 ,rgn) )
467 call readfile_mipas2001( fid, mipas_gas(:,i_c2h6 ,rgn) )
468 call readfile_mipas2001( fid, mipas_gas(:,i_ocs ,rgn) )
469 call readfile_mipas2001( fid, mipas_gas(:,i_so2 ,rgn) )
470 call readfile_mipas2001( fid, mipas_gas(:,i_sf6 ,rgn) )
475 end subroutine profile_setup_mipas2001
479 subroutine readfile_mipas2001( &
484 integer,
intent(in) :: fid
485 real(
rp),
intent(out) :: var(121)
487 character(len=H_LONG) :: dummy
488 real(
rp) :: tmp5(5), tmp1
501 var(nstr-1) = tmp5(2)
502 var(nstr-2) = tmp5(3)
503 var(nstr-3) = tmp5(4)
504 var(nstr-4) = tmp5(5)
513 end subroutine readfile_mipas2001
545 integer,
intent(in) :: kmax
546 integer,
intent(in) :: ngas
547 integer,
intent(in) :: ncfc
548 integer,
intent(in) :: naero
549 real(
rp),
intent(in) :: real_lat
550 integer,
intent(in) :: now_date(6)
551 real(
rp),
intent(in) :: zh(kmax+1)
552 real(
rp),
intent(in) :: z (kmax)
553 real(
rp),
intent(out) :: rhodz (kmax)
554 real(
rp),
intent(out) :: pres (kmax)
555 real(
rp),
intent(out) :: presh (kmax+1)
556 real(
rp),
intent(out) :: temp (kmax)
557 real(
rp),
intent(out) :: temph (kmax+1)
558 real(
rp),
intent(out) :: gas (kmax,ngas)
559 real(
rp),
intent(out) :: cfc (kmax,ncfc)
560 real(
rp),
intent(out) :: aerosol_conc(kmax,naero)
561 real(
rp),
intent(out) :: aerosol_radi(kmax,naero)
562 real(
rp),
intent(out) :: cldfrac (kmax)
572 if ( solarins_fixedlatlon )
then
579 if ( solarins_fixeddate )
then
580 if( solarins_date(1) >= 0 ) date(1) = solarins_date(1)
581 if( solarins_date(2) >= 1 ) date(2) = solarins_date(2)
582 if( solarins_date(3) >= 1 ) date(3) = solarins_date(3)
583 if( solarins_date(4) >= 0 ) date(4) = solarins_date(4)
584 if( solarins_date(5) >= 0 ) date(5) = solarins_date(5)
585 if( solarins_date(6) >= 0 ) date(6) = solarins_date(6)
588 call profile_read_climatology( kmax, &
605 call profile_read_user( kmax, &
622 rhodz(k) = ( presh(k+1) - presh(k) ) * 100.0_rp / grav
626 aerosol_conc(:,:) = 0.0_rp
627 aerosol_radi(:,:) = 0.0_rp
630 if ( .NOT. atmos_phy_rd_profile_use_h2o ) gas(:,1) = 0.0_rp
631 if ( .NOT. atmos_phy_rd_profile_use_co2 ) gas(:,2) = 0.0_rp
632 if ( .NOT. atmos_phy_rd_profile_use_o3 ) gas(:,3) = 0.0_rp
633 if ( .NOT. atmos_phy_rd_profile_use_n2o ) gas(:,4) = 0.0_rp
634 if ( .NOT. atmos_phy_rd_profile_use_co ) gas(:,5) = 0.0_rp
635 if ( .NOT. atmos_phy_rd_profile_use_ch4 ) gas(:,6) = 0.0_rp
636 if ( .NOT. atmos_phy_rd_profile_use_o2 ) gas(:,7) = 0.0_rp
637 if ( .NOT. atmos_phy_rd_profile_use_cfc ) cfc(:,:) = 0.0_rp
640 if ( debug .AND. report_firsttime )
then
641 report_firsttime = .false.
644 log_info(
"ATMOS_PHY_RD_PROFILE_read",
'(1x,A)')
'Vertical Coordinate'
645 log_info_cont(
'(1x,A)')
'| -GRID CENTER- -GRID INTERFACE- |'
646 log_info_cont(
'(1x,A)')
'| k z pres temp zh pres temp k |'
647 log_info_cont(
'(1x,A)')
'| [km] [hPa] [K] [km] [hPa] [K] |'
649 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | TOA'
650 log_info_cont(
'(1x,A,I5,F8.3,F10.4,F8.2,A)')
'|',k,z(k),pres(k),temp(k),
' | '
652 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | '
653 log_info_cont(
'(1x,A,I5,F8.3,F10.4,F8.2,A)')
'|',k,z(k),pres(k),temp(k),
' | '
656 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | '
657 log_info_cont(
'(1x,A,I5,F8.3,F10.4,F8.2,A)')
'|',k,z(k),pres(k),temp(k),
' | '
659 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | Ground'
660 log_info_cont(
'(1x,A)')
'|================================================================|'
663 log_info_cont(
'(1x,A)')
'|=====================================================================================|'
664 log_info_cont(
'(1x,A)')
'| -Gas concetrations [ppmv]- |'
665 log_info_cont(
'(1x,A)')
'| k z H2O CO2 O3 N2O CO CH4 O2 |'
667 log_info_cont(
'(1x,A,I5,1F9.3,7ES10.3,A)')
'|',k,z(k),gas(k,:),
' | '
669 log_info_cont(
'(1x,A)')
'|=====================================================================================|'
678 subroutine profile_read_climatology( &
695 integer,
intent(in) :: kmax
696 integer,
intent(in) :: ngas
697 integer,
intent(in) :: ncfc
698 integer,
intent(in) :: naero
699 real(
rp),
intent(in) :: lat
700 integer,
intent(in) :: now_date(6)
701 real(
rp),
intent(in) :: zh (kmax+1)
702 real(
rp),
intent(in) :: z (kmax)
703 real(
rp),
intent(out) :: pres (kmax)
704 real(
rp),
intent(out) :: presh(kmax+1)
705 real(
rp),
intent(out) :: temp (kmax)
706 real(
rp),
intent(out) :: temph(kmax+1)
707 real(
rp),
intent(out) :: gas (kmax,ngas)
708 real(
rp),
intent(out) :: cfc (kmax,ncfc)
711 log_info(
"PROFILE_read_climatology",*)
'Update climatological profile for radiation'
713 call profile_read_cira86( kmax, &
723 call profile_read_mipas2001( kmax, &
736 end subroutine profile_read_climatology
740 subroutine profile_read_cira86( &
754 integer,
intent(in) :: kmax
755 real(
rp),
intent(in) :: lat
756 integer,
intent(in) :: now_date(6)
757 real(
rp),
intent(in) :: zh (kmax+1)
758 real(
rp),
intent(in) :: z (kmax)
759 real(
rp),
intent(out) :: presh(kmax+1)
760 real(
rp),
intent(out) :: temph(kmax+1)
761 real(
rp),
intent(out) :: pres (kmax)
762 real(
rp),
intent(out) :: temp (kmax)
764 real(
rp) :: plogh(kmax+1)
765 real(
rp) :: plog (kmax)
767 integer :: now_date_mod(6), nday
770 real(
dp) :: subsec = 0.0_dp
771 integer :: offset_year = 0
774 integer :: indexlat, indexd
775 real(
rp) :: factlat, factd
781 if ( lat < cira_lat(1) )
then
784 elseif( lat >= cira_lat(cira_nlat) )
then
785 indexlat = cira_nlat - 1
788 do n = 1, cira_nlat-1
789 if ( lat >= cira_lat(n ) &
790 .AND. lat < cira_lat(n+1) )
then
792 factlat = ( lat-cira_lat(n) ) / ( cira_lat(n+1)-cira_lat(n) )
798 now_date_mod(2:6) = now_date(2:6)
799 now_date_mod(1) = 1986
802 now_date_mod(:), subsec, &
805 nd = real(nday,kind=
rp) + nsec / 86400.0_rp
808 if ( nd >= cira_nd(t ) &
809 .AND. nd < cira_nd(t+1) )
then
811 factd = ( nd-cira_nd(t) ) / ( cira_nd(t+1)-cira_nd(t) )
815 interp_z(:) = cira_z(:,indexlat ,indexd ) * ( 1.0_rp-factlat ) * ( 1.0_rp-factd ) &
816 + cira_z(:,indexlat+1,indexd ) * ( factlat ) * ( 1.0_rp-factd ) &
817 + cira_z(:,indexlat ,indexd+1) * ( 1.0_rp-factlat ) * ( factd ) &
818 + cira_z(:,indexlat+1,indexd+1) * ( factlat ) * ( factd )
820 interp_temp(:) = cira_temp(:,indexlat ,indexd ) * ( 1.0_rp-factlat ) * ( 1.0_rp-factd ) &
821 + cira_temp(:,indexlat+1,indexd ) * ( factlat ) * ( 1.0_rp-factd ) &
822 + cira_temp(:,indexlat ,indexd+1) * ( 1.0_rp-factlat ) * ( factd ) &
823 + cira_temp(:,indexlat+1,indexd+1) * ( factlat ) * ( factd )
826 nplev_mod = cira_nplev
827 do n = cira_nplev, 1, -1
828 if ( interp_temp(n) == interp_temp(n-1) )
then
829 nplev_mod = nplev_mod-1
840 call profile_interp( nplev_mod, &
841 interp_z(1:nplev_mod), &
842 cira_plog(1:nplev_mod), &
847 presh(:) = exp( plogh(:) )
849 call profile_interp( kmax+1, zh(:), plogh(:), kmax, z(:), plog(:) )
850 pres(:) = exp( plog(:) )
852 call profile_interp( nplev_mod, &
853 interp_z(1:nplev_mod), &
854 interp_temp(1:nplev_mod), &
859 call profile_interp( nplev_mod, &
860 interp_z(1:nplev_mod), &
861 interp_temp(1:nplev_mod), &
867 end subroutine profile_read_cira86
871 subroutine profile_read_mipas2001( &
884 integer,
intent(in) :: kmax
885 integer,
intent(in) :: ngas
886 integer,
intent(in) :: ncfc
887 real(
rp),
intent(in) :: lat
888 integer,
intent(in) :: now_date(6)
889 real(
rp),
intent(in) :: z (kmax)
890 real(
rp),
intent(inout) :: gas(kmax,ngas)
891 real(
rp),
intent(inout) :: cfc(kmax,ncfc)
893 real(
rp) :: interp_gas(mipas_kmax,30)
894 real(
rp) :: interp_z (mipas_kmax)
896 integer :: now_date_mod(6), nday
899 real(
dp) :: subsec = 0.0_dp
900 integer :: offset_year = 0
902 integer :: indexd1, indexd2
903 real(
rp) :: factlat, factd
907 now_date_mod(2:6) = now_date(2:6)
908 now_date_mod(1) = 2001
911 now_date_mod(:), subsec, &
914 nd = real(nday,kind=
rp) + nsec / 86400.0_rp
916 if ( nd >= mipas_nd(0) .AND. nd < mipas_nd(1) )
then
920 factd = ( nd-mipas_nd(0) ) / ( mipas_nd(1)-mipas_nd(0) )
922 elseif( nd >= mipas_nd(1) .AND. nd < mipas_nd(2) )
then
926 factd = ( nd-mipas_nd(1) ) / ( mipas_nd(2)-mipas_nd(1) )
928 elseif( nd >= mipas_nd(2) .AND. nd < mipas_nd(3) )
then
932 factd = ( nd-mipas_nd(2) ) / ( mipas_nd(3)-mipas_nd(2) )
937 if ( lat < mipas_lat(1) )
then
939 interp_gas(:,:) = mipas_gas(:,:,indexd1 ) * ( 1.0_rp-factd ) &
940 + mipas_gas(:,:,indexd2 ) * ( factd )
942 interp_z(:) = mipas_z(:,indexd1 ) * ( 1.0_rp-factd ) &
943 + mipas_z(:,indexd2 ) * ( factd )
945 elseif( lat >= mipas_lat(1) .AND. lat < mipas_lat(2) )
then
947 factlat = ( lat-mipas_lat(1) ) / ( mipas_lat(2)-mipas_lat(1) )
949 interp_gas(:,:) = mipas_gas(:,:,indexd1) * ( 1.0_rp-factd ) * ( 1.0_rp-factlat ) &
950 + mipas_gas(:,:,indexd2) * ( factd ) * ( 1.0_rp-factlat ) &
951 + mipas_gas(:,:,i_midlat) * ( factlat )
953 interp_z(:) = mipas_z(:,indexd1) * ( 1.0_rp-factd ) * ( 1.0_rp-factlat ) &
954 + mipas_z(:,indexd2) * ( factd ) * ( 1.0_rp-factlat ) &
955 + mipas_z(:,i_midlat) * ( factlat )
957 elseif( lat >= mipas_lat(2) .AND. lat < mipas_lat(3) )
then
959 factlat = ( lat-mipas_lat(2) ) / ( mipas_lat(3)-mipas_lat(2) )
961 interp_gas(:,:) = mipas_gas(:,:,i_midlat) * ( 1.0_rp-factlat ) &
962 + mipas_gas(:,:,i_tropic) * ( factlat )
964 interp_z(:) = mipas_z(:,i_midlat) * ( 1.0_rp-factlat ) &
965 + mipas_z(:,i_tropic) * ( factlat )
967 elseif( lat >= mipas_lat(3) .AND. lat < mipas_lat(4) )
then
969 factlat = ( lat-mipas_lat(3) ) / ( mipas_lat(4)-mipas_lat(3) )
971 interp_gas(:,:) = mipas_gas(:,:,i_tropic) * ( 1.0_rp-factlat ) &
972 + mipas_gas(:,:,i_midlat) * ( factlat )
974 interp_z(:) = mipas_z(:,i_tropic) * ( 1.0_rp-factlat ) &
975 + mipas_z(:,i_midlat) * ( factlat )
977 elseif( lat >= mipas_lat(4) .AND. lat < mipas_lat(5) )
then
979 factlat = ( lat-mipas_lat(4) ) / ( mipas_lat(5)-mipas_lat(4) )
981 interp_gas(:,:) = mipas_gas(:,:,i_midlat) * ( 1.0_rp-factlat ) &
982 + mipas_gas(:,:,indexd2) * ( 1.0_rp-factd ) * ( factlat ) &
983 + mipas_gas(:,:,indexd1) * ( factd ) * ( factlat )
985 interp_z(:) = mipas_z(:,i_midlat) * ( 1.0_rp-factlat ) &
986 + mipas_z(:,indexd2) * ( 1.0_rp-factd ) * ( factlat ) &
987 + mipas_z(:,indexd1) * ( factd ) * ( factlat )
989 elseif( lat >= mipas_lat(5) )
then
991 interp_gas(:,:) = mipas_gas(:,:,indexd2) * ( 1.0_rp-factd ) &
992 + mipas_gas(:,:,indexd1) * ( factd )
994 interp_z(:) = mipas_z(:,indexd2) * ( 1.0_rp-factd ) &
995 + mipas_z(:,indexd1) * ( factd )
1002 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_h2o ), kmax, z(:), gas(:,1) )
1003 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_co2 ), kmax, z(:), gas(:,2) )
1004 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_o3 ), kmax, z(:), gas(:,3) )
1005 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_n2o ), kmax, z(:), gas(:,4) )
1006 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_co ), kmax, z(:), gas(:,5) )
1007 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_ch4 ), kmax, z(:), gas(:,6) )
1008 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_o2 ), kmax, z(:), gas(:,7) )
1010 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f11 ), kmax, z(:), cfc(:, 1) )
1011 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f12 ), kmax, z(:), cfc(:, 2) )
1012 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f14 ), kmax, z(:), cfc(:, 4) )
1013 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f22 ), kmax, z(:), cfc(:, 9) )
1014 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_sf6 ), kmax, z(:), cfc(:,22) )
1015 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_clono2), kmax, z(:), cfc(:,23) )
1016 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_ccl4 ), kmax, z(:), cfc(:,24) )
1017 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_n2o5 ), kmax, z(:), cfc(:,25) )
1018 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_hno4 ), kmax, z(:), cfc(:,27) )
1021 end subroutine profile_read_mipas2001
1025 subroutine profile_interp( imax1, x1, y1, imax2, x2, y2 )
1028 integer,
intent(in) :: imax1
1029 real(
rp),
intent(in) :: x1(imax1)
1030 real(
rp),
intent(in) :: y1(imax1)
1031 integer,
intent(in) :: imax2
1032 real(
rp),
intent(in) :: x2(imax2)
1033 real(
rp),
intent(out) :: y2(imax2)
1045 if ( x2(i2) > x1(1) )
then
1047 fact = ( x1(1) - x2(i2) ) / ( x1(2) - x1(1) )
1049 y2(i2) = y1(1) * ( 1.0_rp-fact ) &
1052 elseif( x2(i2) <= x1(imax1) )
then
1054 fact = ( x1(imax1) - x2(i2) ) / ( x1(imax1) - x1(imax1-1) )
1056 y2(i2) = y1(imax1-1) * ( fact ) &
1057 + y1(imax1 ) * ( 1.0_rp-fact )
1061 if ( x2(i2) <= x1(i1 ) &
1062 .AND. x2(i2) > x1(i1+1) )
then
1064 fact = ( x2(i2) - x1(i1) ) / ( x1(i1+1) - x1(i1) )
1066 y2(i2) = y1(i1 ) * ( 1.0_rp-fact ) &
1067 + y1(i1+1) * ( fact )
1077 end subroutine profile_interp
1087 integer,
intent(in) :: ka, ks, ke
1088 integer,
intent(in) :: kmax, kadd
1089 real(
rp),
intent(in) :: toa
1090 real(
rp),
intent(in) :: cz( ka)
1091 real(
rp),
intent(in) :: fz(0:ka)
1092 real(
rp),
intent(out) :: zh(kmax+1)
1093 real(
rp),
intent(out) :: z (kmax)
1099 if ( kadd > 0 )
then
1101 dz = ( toa - fz(ke)*1.e-3_rp ) / real( kadd, kind=
rp )
1105 zh(k) = zh(k-1) - dz
1107 zh(kadd+1) = fz(ke)*1.e-3_rp
1111 z(k) = 0.5_rp * ( zh(k+1) + zh(k) )
1117 rd_k = kmax - ( k - ks )
1118 zh(rd_k) = fz(k)*1.e-3_rp
1121 rd_k = kmax - ( k - ks )
1122 z(rd_k) = cz(k)*1.e-3_rp
1129 log_info(
"ATMOS_PHY_RD_PROFILE_setup_zgrid",
'(1x,A)')
'Vertical Coordinate'
1130 log_info_cont(
'(1x,A)')
'| -GRID CENTER- -GRID INTERFACE- |'
1131 log_info_cont(
'(1x,A)')
'| RD_k z k CZ FZ k zh RD_k |'
1132 if ( kadd > 0 )
then
1134 log_info_cont(
'(1x,A,F8.3,I5,A)')
'| ',zh(rd_k),rd_k,
' | TOA'
1135 log_info_cont(
'(1x,A,I5,F8.3,A)')
'|',rd_k,z(rd_k),
' | '
1137 log_info_cont(
'(1x,A,F8.3,I5,A)')
'| ',zh(rd_k),rd_k,
' | '
1138 log_info_cont(
'(1x,A,I5,F8.3,A)')
'|',rd_k,z(rd_k),
' | '
1141 log_info_cont(
'(1x,A,F8.3,I5,A)')
'| ',zh(rd_k),rd_k,
' | '
1142 log_info_cont(
'(1x,A,I5,F8.3,A)')
'|',rd_k,z(rd_k),
' | KADD'
1144 k = kmax - rd_k + ks
1145 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k)*1.e-3_rp,k,zh(rd_k),rd_k,
' | '
1146 log_info_cont(
'(1x,A,I5,F8.3,I5,F8.3,A)')
'|',rd_k,z(rd_k),k,cz(k)*1.e-3_rp,
' | KADD+1=KE'
1149 k = kmax - rd_k + ks
1150 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k)*1.e-3_rp,k,zh(rd_k),rd_k,
' | TOA=KE'
1151 log_info_cont(
'(1x,A,I5,F8.3,I5,F8.3,A)')
'|',rd_k,z(rd_k),k,cz(k)*1.e-3_rp,
' | '
1153 do rd_k = kadd+2, kmax-1
1154 k = kmax - rd_k + ks
1155 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k)*1.e-3_rp,k,zh(rd_k),rd_k,
' | '
1156 log_info_cont(
'(1x,A,I5,F8.3,I5,F8.3,A)')
'|',rd_k,z(rd_k),k,cz(k)*1.e-3_rp,
' | '
1159 k = kmax - rd_k + ks
1160 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k),k,zh(rd_k),rd_k,
' | '
1161 log_info_cont(
'(1x,A,I5,F8.3,I5,F8.3,A)')
'|',rd_k,z(rd_k),k,cz(k)*1.e-3_rp,
' | RD_KMAX=KS'
1163 k = kmax - rd_k + ks
1164 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k)*1.e-3_rp,k,zh(rd_k),rd_k,
' | Ground'
1165 log_info_cont(
'(1x,A)')
'|=====================================================|'
1174 subroutine profile_read_user( &
1195 integer,
intent(in) :: kmax
1196 integer,
intent(in) :: ngas
1197 integer,
intent(in) :: ncfc
1198 integer,
intent(in) :: naero
1199 real(
rp),
intent(in) :: zh (kmax+1)
1200 real(
rp),
intent(in) :: z (kmax)
1201 real(
rp),
intent(out) :: pres (kmax)
1202 real(
rp),
intent(out) :: presh(kmax+1)
1203 real(
rp),
intent(out) :: temp (kmax)
1204 real(
rp),
intent(out) :: temph(kmax+1)
1205 real(
rp),
intent(out) :: gas (kmax,ngas)
1206 real(
rp),
intent(out) :: cfc (kmax,ncfc)
1208 integer,
parameter :: user_klim = 500
1209 integer :: user_kmax
1210 real(
rp) :: user_z (user_klim)
1211 real(
rp) :: user_pres(user_klim)
1212 real(
rp) :: user_temp(user_klim)
1213 real(
rp) :: user_qv (user_klim)
1214 real(
rp) :: user_o3 (user_klim)
1216 real(
rp),
allocatable :: work_z(:)
1217 real(
rp),
allocatable :: work (:)
1219 real(
rp) :: plog (kmax)
1220 real(
rp) :: plogh(kmax+1)
1222 character(len=H_LONG) :: dummy
1224 integer :: fid, ierr
1228 log_info(
"PROFILE_read_user",*)
'user-defined profile'
1233 log_info(
"PROFILE_read_user",*)
'FILENAME:', trim(profile_user_fname)
1237 file = trim(profile_user_fname), &
1238 form =
'formatted', &
1242 if ( ierr /= 0 )
then
1243 log_error(
"PROFILE_read_user",*)
'File not found. check!'
1250 read(fid,*,iostat=ierr) user_z(k), user_pres(k), user_temp(k), user_qv(k), user_o3(k)
1251 if ( ierr /= 0 )
exit
1256 allocate( work_z(user_kmax) )
1257 allocate( work(user_kmax) )
1260 work_z(k) = user_z(k) / 1000.0_rp
1261 work(k) = log( user_pres(k)/100.0_rp )
1265 call profile_interp( user_kmax, &
1272 presh(:) = exp( plogh(:) )
1274 call profile_interp( kmax+1, zh(:), plogh(:), kmax, z(:), plog(:) )
1275 pres(:) = exp( plog(:) )
1278 work(k) = user_temp(k)
1281 call profile_interp( user_kmax, &
1288 call profile_interp( user_kmax, &
1296 work(k) = user_qv(k) / mvap * mdry / ppm
1299 call profile_interp( user_kmax, &
1307 work(k) = user_o3(k) / 48.0_rp * mdry / ppm
1310 call profile_interp( user_kmax, &
1318 end subroutine profile_read_user