45 private :: profile_setup_cira86
46 private :: profile_setup_mipas2001
47 private :: readfile_mipas2001
48 private :: profile_read_climatology
49 private :: profile_read_cira86
50 private :: profile_read_mipas2001
51 private :: profile_read_user
52 private :: profile_interp
58 character(len=H_LONG),
private :: profile_cira86_fname =
"cira.nc"
59 character(len=H_LONG),
private :: profile_mipas2001_dir =
"."
60 character(len=H_LONG),
private :: profile_user_fname =
""
61 logical,
private :: atmos_phy_rd_profile_use_h2o = .true.
62 logical,
private :: atmos_phy_rd_profile_use_co2 = .true.
63 logical,
private :: atmos_phy_rd_profile_use_o3 = .true.
64 logical,
private :: atmos_phy_rd_profile_use_n2o = .true.
65 logical,
private :: atmos_phy_rd_profile_use_co = .true.
66 logical,
private :: atmos_phy_rd_profile_use_ch4 = .true.
67 logical,
private :: atmos_phy_rd_profile_use_o2 = .true.
68 logical,
private :: atmos_phy_rd_profile_use_cfc = .true.
69 logical,
private :: debug = .false.
71 integer,
private :: cira_ntime
72 integer,
private :: cira_nplev
73 integer,
private :: cira_nlat
74 real(
rp),
private,
allocatable :: cira_nd (:)
75 real(
rp),
private,
allocatable :: cira_plog(:)
76 real(
rp),
private,
allocatable :: cira_lat (:)
77 real(
rp),
private,
allocatable :: cira_temp(:,:,:)
78 real(
rp),
private,
allocatable :: cira_z (:,:,:)
80 real(
rp),
private,
allocatable :: interp_temp(:)
81 real(
rp),
private,
allocatable :: interp_z (:)
83 integer,
private,
parameter :: mipas_kmax = 121
84 integer,
private,
parameter :: mipas_ntime = 2
85 real(
rp),
private :: mipas_nd (0:mipas_ntime+1)
86 real(
rp),
private :: mipas_lat (5)
87 real(
rp),
private :: mipas_z (mipas_kmax,4)
88 real(
rp),
private :: mipas_pres(mipas_kmax,4)
89 real(
rp),
private :: mipas_temp(mipas_kmax,4)
90 real(
rp),
private :: mipas_gas (mipas_kmax,30,4)
92 integer,
private,
parameter :: i_tropic = 1
93 integer,
private,
parameter :: i_midlat = 2
94 integer,
private,
parameter :: i_polarsum = 3
95 integer,
private,
parameter :: i_polarwin = 4
97 integer,
private,
parameter :: i_n2 = 1
98 integer,
private,
parameter :: i_o2 = 2
99 integer,
private,
parameter :: i_co2 = 3
100 integer,
private,
parameter :: i_o3 = 4
101 integer,
private,
parameter :: i_h2o = 5
102 integer,
private,
parameter :: i_ch4 = 6
103 integer,
private,
parameter :: i_n2o = 7
104 integer,
private,
parameter :: i_hno3 = 8
105 integer,
private,
parameter :: i_co = 9
106 integer,
private,
parameter :: i_no2 = 10
107 integer,
private,
parameter :: i_n2o5 = 11
108 integer,
private,
parameter :: i_clo = 12
109 integer,
private,
parameter :: i_hocl = 13
110 integer,
private,
parameter :: i_clono2 = 14
111 integer,
private,
parameter :: i_no = 15
112 integer,
private,
parameter :: i_hno4 = 16
113 integer,
private,
parameter :: i_hcn = 17
114 integer,
private,
parameter :: i_nh3 = 18
115 integer,
private,
parameter :: i_f11 = 19
116 integer,
private,
parameter :: i_f12 = 20
117 integer,
private,
parameter :: i_f14 = 21
118 integer,
private,
parameter :: i_f22 = 22
119 integer,
private,
parameter :: i_ccl4 = 23
120 integer,
private,
parameter :: i_cof2 = 24
121 integer,
private,
parameter :: i_h2o2 = 25
122 integer,
private,
parameter :: i_c2h2 = 26
123 integer,
private,
parameter :: i_c2h6 = 27
124 integer,
private,
parameter :: i_ocs = 28
125 integer,
private,
parameter :: i_so2 = 29
126 integer,
private,
parameter :: i_sf6 = 30
128 logical,
private :: report_firsttime = .true.
139 character(len=H_LONG) :: atmos_phy_rd_profile_cira86_in_filename
140 character(len=H_LONG) :: atmos_phy_rd_profile_mipas2001_in_basename
141 character(len=H_LONG) :: atmos_phy_rd_profile_user_in_filename
143 namelist / param_atmos_phy_rd_profile / &
145 atmos_phy_rd_profile_cira86_in_filename, &
146 atmos_phy_rd_profile_mipas2001_in_basename, &
147 atmos_phy_rd_profile_user_in_filename, &
148 atmos_phy_rd_profile_use_h2o, &
149 atmos_phy_rd_profile_use_co2, &
150 atmos_phy_rd_profile_use_o3, &
151 atmos_phy_rd_profile_use_n2o, &
152 atmos_phy_rd_profile_use_co, &
153 atmos_phy_rd_profile_use_ch4, &
154 atmos_phy_rd_profile_use_o2, &
155 atmos_phy_rd_profile_use_cfc, &
162 log_info(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Setup'
164 atmos_phy_rd_profile_cira86_in_filename = profile_cira86_fname
165 atmos_phy_rd_profile_mipas2001_in_basename = profile_mipas2001_dir
166 atmos_phy_rd_profile_user_in_filename = profile_user_fname
170 read(
io_fid_conf,nml=param_atmos_phy_rd_profile,iostat=ierr)
173 log_info(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Not found namelist. Default used.'
174 elseif( ierr > 0 )
then
175 log_error(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Not appropriate names in namelist PARAM_ATMOS_PHY_RD_PROFILE. Check!'
178 log_nml(param_atmos_phy_rd_profile)
180 profile_cira86_fname = atmos_phy_rd_profile_cira86_in_filename
181 profile_mipas2001_dir = atmos_phy_rd_profile_mipas2001_in_basename
182 profile_user_fname = atmos_phy_rd_profile_user_in_filename
185 log_info(
"ATMOS_PHY_RD_PROFILE_setup",*)
'Climatological profile for radiation'
189 call profile_setup_cira86
191 call profile_setup_mipas2001
202 if (
allocated( cira_nd ) )
deallocate( cira_nd )
203 if (
allocated( cira_plog ) )
deallocate( cira_plog )
204 if (
allocated( cira_lat ) )
deallocate( cira_lat )
205 if (
allocated( cira_temp ) )
deallocate( cira_temp )
206 if (
allocated( cira_z ) )
deallocate( cira_z )
208 if (
allocated( interp_temp ) )
deallocate( interp_temp )
209 if (
allocated( interp_z ) )
deallocate( interp_z )
216 subroutine profile_setup_cira86
233 integer,
allocatable :: cira_date(:,:)
236 real(
dp) :: subsec = 0.0_dp
237 integer :: offset_year = 0
239 real(
rp),
allocatable :: tmp1d(:)
240 real(
rp),
allocatable :: tmp3d(:,:,:)
246 log_info(
"PROFILE_setup_CIRA86",*)
'Read CIRA86 climatology, filename : ', trim(profile_cira86_fname)
251 aggregate = .false., &
254 call file_get_shape( fid,
"ta", dims(:) )
263 allocate( cira_nd( 0:cira_ntime+1) )
265 allocate( cira_plog(cira_nplev) )
266 allocate( cira_lat(cira_nlat ) )
268 allocate( cira_temp(cira_nplev,cira_nlat,0:cira_ntime+1) )
269 allocate( cira_z(cira_nplev,cira_nlat,0:cira_ntime+1) )
272 allocate( cira_date(6,0:cira_ntime+1) )
274 cira_date(:, 0) = (/ 1985, 12, 15, 12, 0, 0 /)
275 cira_date(:, 1) = (/ 1986, 1, 15, 12, 0, 0 /)
276 cira_date(:, 2) = (/ 1986, 2, 15, 12, 0, 0 /)
277 cira_date(:, 3) = (/ 1986, 3, 15, 12, 0, 0 /)
278 cira_date(:, 4) = (/ 1986, 4, 15, 12, 0, 0 /)
279 cira_date(:, 5) = (/ 1986, 5, 15, 12, 0, 0 /)
280 cira_date(:, 6) = (/ 1986, 6, 15, 12, 0, 0 /)
281 cira_date(:, 7) = (/ 1986, 7, 15, 12, 0, 0 /)
282 cira_date(:, 8) = (/ 1986, 8, 15, 12, 0, 0 /)
283 cira_date(:, 9) = (/ 1986, 9, 15, 12, 0, 0 /)
284 cira_date(:,10) = (/ 1986, 10, 15, 12, 0, 0 /)
285 cira_date(:,11) = (/ 1986, 11, 15, 12, 0, 0 /)
286 cira_date(:,12) = (/ 1986, 12, 15, 12, 0, 0 /)
287 cira_date(:,13) = (/ 1987, 1, 15, 12, 0, 0 /)
289 do t = 0, cira_ntime+1
291 cira_date(:,t), subsec, &
294 cira_nd(t) = real(nday,kind=
rp) + nsec / 86400.0_rp
296 deallocate( cira_date )
299 allocate( tmp1d(cira_nplev) )
301 call file_read( fid,
"plev", tmp1d(:) )
303 cira_plog(n) = log( real(tmp1d(n),kind=
rp) )
308 allocate( tmp1d(cira_nlat) )
310 call file_read( fid,
"latitude", tmp1d(:) )
321 allocate( tmp3d(cira_nlat,cira_nplev,cira_ntime) )
323 call file_read( fid,
"ta", tmp3d(:,:,:) )
327 cira_temp(n,m,t) = real(tmp3d(m,n,t),kind=
rp)
332 cira_temp(:,:,0 ) = cira_temp(:,:,cira_ntime)
333 cira_temp(:,:,cira_ntime+1) = cira_temp(:,:,1 )
339 if( cira_temp(n,m,t) >= 999.9_rp ) cira_temp(n,m,t) = cira_temp(n-1,m,t)
347 call file_read( fid,
"zg", tmp3d(:,:,:) )
351 cira_z(n,m,t) = real(tmp3d(m,n,t),kind=
rp) * 1.e-3_rp
356 cira_z(:,:,0 ) = cira_z(:,:,cira_ntime)
357 cira_z(:,:,cira_ntime+1) = cira_z(:,:,1 )
363 if( cira_z(n,m,t) == 0.999_rp ) cira_z(n,m,t) = cira_z(n-1,m,t)
373 allocate( interp_temp(cira_nplev) )
374 allocate( interp_z(cira_nplev) )
377 end subroutine profile_setup_cira86
381 subroutine profile_setup_mipas2001
390 character(len=H_LONG) :: fname
392 character(len=7),
parameter :: mipas_fname(4) = (/
"equ.atm",
"day.atm",
"sum.atm",
"win.atm"/)
394 integer :: mipas_date(6,0:mipas_ntime+1)
397 real(
dp) :: subsec = 0.0_dp
398 integer :: offset_year = 0
400 character(len=H_LONG) :: dummy
406 log_info(
"PROFILE_setup_MIPAS2001",*)
'Read MIPAS2001 climatology '
408 mipas_date(:, 0) = (/ 2000, 12, 22, 12, 0, 0 /)
409 mipas_date(:, 1) = (/ 2001, 6, 21, 12, 0, 0 /)
410 mipas_date(:, 2) = (/ 2001, 12, 22, 12, 0, 0 /)
411 mipas_date(:, 3) = (/ 2002, 6, 21, 12, 0, 0 /)
413 do t = 0, mipas_ntime+1
415 mipas_date(:,t), subsec, &
418 mipas_nd(t) = real(nday,kind=
rp) + nsec / 86400.0_rp
427 do rgn = i_tropic, i_polarwin
428 call io_get_fname(fname, trim(profile_mipas2001_dir)//
'/'//mipas_fname(rgn))
429 log_info(
"PROFILE_setup_MIPAS2001",*)
'filename : ', trim(fname)
434 form =
'formatted', &
438 if ( ierr /= 0 )
then
439 log_error(
"PROFILE_setup_MIPAS2001",*)
'File not found. check!'
447 call readfile_mipas2001( fid, mipas_z(:,rgn) )
448 call readfile_mipas2001( fid, mipas_pres(:,rgn) )
449 call readfile_mipas2001( fid, mipas_temp(:,rgn) )
451 call readfile_mipas2001( fid, mipas_gas(:,i_n2 ,rgn) )
452 call readfile_mipas2001( fid, mipas_gas(:,i_o2 ,rgn) )
453 call readfile_mipas2001( fid, mipas_gas(:,i_co2 ,rgn) )
454 call readfile_mipas2001( fid, mipas_gas(:,i_o3 ,rgn) )
455 call readfile_mipas2001( fid, mipas_gas(:,i_h2o ,rgn) )
456 call readfile_mipas2001( fid, mipas_gas(:,i_ch4 ,rgn) )
457 call readfile_mipas2001( fid, mipas_gas(:,i_n2o ,rgn) )
458 call readfile_mipas2001( fid, mipas_gas(:,i_hno3 ,rgn) )
459 call readfile_mipas2001( fid, mipas_gas(:,i_co ,rgn) )
460 call readfile_mipas2001( fid, mipas_gas(:,i_no2 ,rgn) )
461 call readfile_mipas2001( fid, mipas_gas(:,i_n2o5 ,rgn) )
462 call readfile_mipas2001( fid, mipas_gas(:,i_clo ,rgn) )
463 call readfile_mipas2001( fid, mipas_gas(:,i_hocl ,rgn) )
464 call readfile_mipas2001( fid, mipas_gas(:,i_clono2,rgn) )
465 call readfile_mipas2001( fid, mipas_gas(:,i_no ,rgn) )
466 call readfile_mipas2001( fid, mipas_gas(:,i_hno4 ,rgn) )
467 call readfile_mipas2001( fid, mipas_gas(:,i_hcn ,rgn) )
468 call readfile_mipas2001( fid, mipas_gas(:,i_nh3 ,rgn) )
469 call readfile_mipas2001( fid, mipas_gas(:,i_f11 ,rgn) )
470 call readfile_mipas2001( fid, mipas_gas(:,i_f12 ,rgn) )
471 call readfile_mipas2001( fid, mipas_gas(:,i_f14 ,rgn) )
472 call readfile_mipas2001( fid, mipas_gas(:,i_f22 ,rgn) )
473 call readfile_mipas2001( fid, mipas_gas(:,i_ccl4 ,rgn) )
474 call readfile_mipas2001( fid, mipas_gas(:,i_cof2 ,rgn) )
475 call readfile_mipas2001( fid, mipas_gas(:,i_h2o2 ,rgn) )
476 call readfile_mipas2001( fid, mipas_gas(:,i_c2h2 ,rgn) )
477 call readfile_mipas2001( fid, mipas_gas(:,i_c2h6 ,rgn) )
478 call readfile_mipas2001( fid, mipas_gas(:,i_ocs ,rgn) )
479 call readfile_mipas2001( fid, mipas_gas(:,i_so2 ,rgn) )
480 call readfile_mipas2001( fid, mipas_gas(:,i_sf6 ,rgn) )
485 end subroutine profile_setup_mipas2001
489 subroutine readfile_mipas2001( &
494 integer,
intent(in) :: fid
495 real(
rp),
intent(out) :: var(121)
497 character(len=H_LONG) :: dummy
498 real(
rp) :: tmp5(5), tmp1
511 var(nstr-1) = tmp5(2)
512 var(nstr-2) = tmp5(3)
513 var(nstr-3) = tmp5(4)
514 var(nstr-4) = tmp5(5)
523 end subroutine readfile_mipas2001
555 integer,
intent(in) :: kmax
556 integer,
intent(in) :: ngas
557 integer,
intent(in) :: ncfc
558 integer,
intent(in) :: naero
559 real(
rp),
intent(in) :: real_lat
560 integer,
intent(in) :: now_date(6)
561 real(
rp),
intent(in) :: zh(kmax+1)
562 real(
rp),
intent(in) :: z (kmax)
563 real(
rp),
intent(out) :: rhodz (kmax)
564 real(
rp),
intent(out) :: pres (kmax)
565 real(
rp),
intent(out) :: presh (kmax+1)
566 real(
rp),
intent(out) :: temp (kmax)
567 real(
rp),
intent(out) :: temph (kmax+1)
568 real(
rp),
intent(out) :: gas (kmax,ngas)
569 real(
rp),
intent(out) :: cfc (kmax,ncfc)
570 real(
rp),
intent(out) :: aerosol_conc(kmax,naero)
571 real(
rp),
intent(out) :: aerosol_radi(kmax,naero)
572 real(
rp),
intent(out) :: cldfrac (kmax)
584 if ( solarins_fixedlatlon )
then
591 if ( solarins_fixeddate )
then
592 if( solarins_date(1) >= 0 ) date(1) = solarins_date(1)
593 if( solarins_date(2) >= 1 ) date(2) = solarins_date(2)
594 if( solarins_date(3) >= 1 ) date(3) = solarins_date(3)
595 if( solarins_date(4) >= 0 ) date(4) = solarins_date(4)
596 if( solarins_date(5) >= 0 ) date(5) = solarins_date(5)
597 if( solarins_date(6) >= 0 ) date(6) = solarins_date(6)
600 call profile_read_climatology( kmax, &
617 call profile_read_user( kmax, &
634 rhodz(k) = ( presh(k+1) - presh(k) ) * 100.0_rp / grav
638 aerosol_conc(:,:) = 0.0_rp
639 aerosol_radi(:,:) = 0.0_rp
642 if ( .NOT. atmos_phy_rd_profile_use_h2o ) gas(:,1) = 0.0_rp
643 if ( .NOT. atmos_phy_rd_profile_use_co2 ) gas(:,2) = 0.0_rp
644 if ( .NOT. atmos_phy_rd_profile_use_o3 ) gas(:,3) = 0.0_rp
645 if ( .NOT. atmos_phy_rd_profile_use_n2o ) gas(:,4) = 0.0_rp
646 if ( .NOT. atmos_phy_rd_profile_use_co ) gas(:,5) = 0.0_rp
647 if ( .NOT. atmos_phy_rd_profile_use_ch4 ) gas(:,6) = 0.0_rp
648 if ( .NOT. atmos_phy_rd_profile_use_o2 ) gas(:,7) = 0.0_rp
649 if ( .NOT. atmos_phy_rd_profile_use_cfc ) cfc(:,:) = 0.0_rp
652 if ( debug .AND. report_firsttime )
then
653 report_firsttime = .false.
656 log_info(
"ATMOS_PHY_RD_PROFILE_read",
'(1x,A)')
'Vertical Coordinate'
657 log_info_cont(
'(1x,A)')
'| -GRID CENTER- -GRID INTERFACE- |'
658 log_info_cont(
'(1x,A)')
'| k z pres temp zh pres temp k |'
659 log_info_cont(
'(1x,A)')
'| [km] [hPa] [K] [km] [hPa] [K] |'
661 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | TOA'
662 log_info_cont(
'(1x,A,I5,F8.3,F10.4,F8.2,A)')
'|',k,z(k),pres(k),temp(k),
' | '
664 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | '
665 log_info_cont(
'(1x,A,I5,F8.3,F10.4,F8.2,A)')
'|',k,z(k),pres(k),temp(k),
' | '
668 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | '
669 log_info_cont(
'(1x,A,I5,F8.3,F10.4,F8.2,A)')
'|',k,z(k),pres(k),temp(k),
' | '
671 log_info_cont(
'(1x,A,F8.3,F10.4,F8.2,I5,A)')
'| ',zh(k),presh(k),temph(k),k,
' | Ground'
672 log_info_cont(
'(1x,A)')
'|================================================================|'
675 log_info_cont(
'(1x,A)')
'|=====================================================================================|'
676 log_info_cont(
'(1x,A)')
'| -Gas concetrations [ppmv]- |'
677 log_info_cont(
'(1x,A)')
'| k z H2O CO2 O3 N2O CO CH4 O2 |'
679 log_info_cont(
'(1x,A,I5,1F9.3,7ES10.3,A)')
'|',k,z(k),gas(k,:),
' | '
681 log_info_cont(
'(1x,A)')
'|=====================================================================================|'
694 subroutine profile_read_climatology( &
711 integer,
intent(in) :: kmax
712 integer,
intent(in) :: ngas
713 integer,
intent(in) :: ncfc
714 integer,
intent(in) :: naero
715 real(
rp),
intent(in) :: lat
716 integer,
intent(in) :: now_date(6)
717 real(
rp),
intent(in) :: zh (kmax+1)
718 real(
rp),
intent(in) :: z (kmax)
719 real(
rp),
intent(out) :: pres (kmax)
720 real(
rp),
intent(out) :: presh(kmax+1)
721 real(
rp),
intent(out) :: temp (kmax)
722 real(
rp),
intent(out) :: temph(kmax+1)
723 real(
rp),
intent(out) :: gas (kmax,ngas)
724 real(
rp),
intent(out) :: cfc (kmax,ncfc)
727 log_info(
"PROFILE_read_climatology",*)
'Update climatological profile for radiation'
729 call profile_read_cira86( kmax, &
739 call profile_read_mipas2001( kmax, &
749 end subroutine profile_read_climatology
753 subroutine profile_read_cira86( &
767 integer,
intent(in) :: kmax
768 real(
rp),
intent(in) :: lat
769 integer,
intent(in) :: now_date(6)
770 real(
rp),
intent(in) :: zh (kmax+1)
771 real(
rp),
intent(in) :: z (kmax)
772 real(
rp),
intent(out) :: presh(kmax+1)
773 real(
rp),
intent(out) :: temph(kmax+1)
774 real(
rp),
intent(out) :: pres (kmax)
775 real(
rp),
intent(out) :: temp (kmax)
777 real(
rp) :: plogh(kmax+1)
778 real(
rp) :: plog (kmax)
780 integer :: now_date_mod(6), nday
783 real(
dp) :: subsec = 0.0_dp
784 integer :: offset_year = 0
787 integer :: indexlat, indexd
788 real(
rp) :: factlat, factd
794 if ( lat < cira_lat(1) )
then
797 elseif( lat >= cira_lat(cira_nlat) )
then
798 indexlat = cira_nlat - 1
801 do n = 1, cira_nlat-1
802 if ( lat >= cira_lat(n ) &
803 .AND. lat < cira_lat(n+1) )
then
805 factlat = ( lat-cira_lat(n) ) / ( cira_lat(n+1)-cira_lat(n) )
811 now_date_mod(2:6) = now_date(2:6)
812 now_date_mod(1) = 1986
815 now_date_mod(:), subsec, &
818 nd = real(nday,kind=
rp) + nsec / 86400.0_rp
821 if ( nd >= cira_nd(t ) &
822 .AND. nd < cira_nd(t+1) )
then
824 factd = ( nd-cira_nd(t) ) / ( cira_nd(t+1)-cira_nd(t) )
828 interp_z(:) = cira_z(:,indexlat ,indexd ) * ( 1.0_rp-factlat ) * ( 1.0_rp-factd ) &
829 + cira_z(:,indexlat+1,indexd ) * ( factlat ) * ( 1.0_rp-factd ) &
830 + cira_z(:,indexlat ,indexd+1) * ( 1.0_rp-factlat ) * ( factd ) &
831 + cira_z(:,indexlat+1,indexd+1) * ( factlat ) * ( factd )
833 interp_temp(:) = cira_temp(:,indexlat ,indexd ) * ( 1.0_rp-factlat ) * ( 1.0_rp-factd ) &
834 + cira_temp(:,indexlat+1,indexd ) * ( factlat ) * ( 1.0_rp-factd ) &
835 + cira_temp(:,indexlat ,indexd+1) * ( 1.0_rp-factlat ) * ( factd ) &
836 + cira_temp(:,indexlat+1,indexd+1) * ( factlat ) * ( factd )
839 nplev_mod = cira_nplev
840 do n = cira_nplev, 1, -1
841 if ( interp_temp(n) == interp_temp(n-1) )
then
842 nplev_mod = nplev_mod-1
853 call profile_interp( nplev_mod, &
854 interp_z(1:nplev_mod), &
855 cira_plog(1:nplev_mod), &
860 presh(:) = exp( plogh(:) )
862 call profile_interp( kmax+1, zh(:), plogh(:), kmax, z(:), plog(:) )
863 pres(:) = exp( plog(:) )
865 call profile_interp( nplev_mod, &
866 interp_z(1:nplev_mod), &
867 interp_temp(1:nplev_mod), &
872 call profile_interp( nplev_mod, &
873 interp_z(1:nplev_mod), &
874 interp_temp(1:nplev_mod), &
880 end subroutine profile_read_cira86
884 subroutine profile_read_mipas2001( &
897 integer,
intent(in) :: kmax
898 integer,
intent(in) :: ngas
899 integer,
intent(in) :: ncfc
900 real(
rp),
intent(in) :: lat
901 integer,
intent(in) :: now_date(6)
902 real(
rp),
intent(in) :: z (kmax)
903 real(
rp),
intent(inout) :: gas(kmax,ngas)
904 real(
rp),
intent(inout) :: cfc(kmax,ncfc)
906 real(
rp) :: interp_gas(mipas_kmax,30)
907 real(
rp) :: interp_z (mipas_kmax)
909 integer :: now_date_mod(6), nday
912 real(
dp) :: subsec = 0.0_dp
913 integer :: offset_year = 0
915 integer :: indexd1, indexd2
916 real(
rp) :: factlat, factd
920 now_date_mod(2:6) = now_date(2:6)
921 now_date_mod(1) = 2001
924 now_date_mod(:), subsec, &
927 nd = real(nday,kind=
rp) + nsec / 86400.0_rp
929 if ( nd >= mipas_nd(0) .AND. nd < mipas_nd(1) )
then
933 factd = ( nd-mipas_nd(0) ) / ( mipas_nd(1)-mipas_nd(0) )
935 elseif( nd >= mipas_nd(1) .AND. nd < mipas_nd(2) )
then
939 factd = ( nd-mipas_nd(1) ) / ( mipas_nd(2)-mipas_nd(1) )
941 elseif( nd >= mipas_nd(2) .AND. nd < mipas_nd(3) )
then
945 factd = ( nd-mipas_nd(2) ) / ( mipas_nd(3)-mipas_nd(2) )
950 if ( lat < mipas_lat(1) )
then
952 interp_gas(:,:) = mipas_gas(:,:,indexd1 ) * ( 1.0_rp-factd ) &
953 + mipas_gas(:,:,indexd2 ) * ( factd )
955 interp_z(:) = mipas_z(:,indexd1 ) * ( 1.0_rp-factd ) &
956 + mipas_z(:,indexd2 ) * ( factd )
958 elseif( lat >= mipas_lat(1) .AND. lat < mipas_lat(2) )
then
960 factlat = ( lat-mipas_lat(1) ) / ( mipas_lat(2)-mipas_lat(1) )
962 interp_gas(:,:) = mipas_gas(:,:,indexd1) * ( 1.0_rp-factd ) * ( 1.0_rp-factlat ) &
963 + mipas_gas(:,:,indexd2) * ( factd ) * ( 1.0_rp-factlat ) &
964 + mipas_gas(:,:,i_midlat) * ( factlat )
966 interp_z(:) = mipas_z(:,indexd1) * ( 1.0_rp-factd ) * ( 1.0_rp-factlat ) &
967 + mipas_z(:,indexd2) * ( factd ) * ( 1.0_rp-factlat ) &
968 + mipas_z(:,i_midlat) * ( factlat )
970 elseif( lat >= mipas_lat(2) .AND. lat < mipas_lat(3) )
then
972 factlat = ( lat-mipas_lat(2) ) / ( mipas_lat(3)-mipas_lat(2) )
974 interp_gas(:,:) = mipas_gas(:,:,i_midlat) * ( 1.0_rp-factlat ) &
975 + mipas_gas(:,:,i_tropic) * ( factlat )
977 interp_z(:) = mipas_z(:,i_midlat) * ( 1.0_rp-factlat ) &
978 + mipas_z(:,i_tropic) * ( factlat )
980 elseif( lat >= mipas_lat(3) .AND. lat < mipas_lat(4) )
then
982 factlat = ( lat-mipas_lat(3) ) / ( mipas_lat(4)-mipas_lat(3) )
984 interp_gas(:,:) = mipas_gas(:,:,i_tropic) * ( 1.0_rp-factlat ) &
985 + mipas_gas(:,:,i_midlat) * ( factlat )
987 interp_z(:) = mipas_z(:,i_tropic) * ( 1.0_rp-factlat ) &
988 + mipas_z(:,i_midlat) * ( factlat )
990 elseif( lat >= mipas_lat(4) .AND. lat < mipas_lat(5) )
then
992 factlat = ( lat-mipas_lat(4) ) / ( mipas_lat(5)-mipas_lat(4) )
994 interp_gas(:,:) = mipas_gas(:,:,i_midlat) * ( 1.0_rp-factlat ) &
995 + mipas_gas(:,:,indexd2) * ( 1.0_rp-factd ) * ( factlat ) &
996 + mipas_gas(:,:,indexd1) * ( factd ) * ( factlat )
998 interp_z(:) = mipas_z(:,i_midlat) * ( 1.0_rp-factlat ) &
999 + mipas_z(:,indexd2) * ( 1.0_rp-factd ) * ( factlat ) &
1000 + mipas_z(:,indexd1) * ( factd ) * ( factlat )
1002 elseif( lat >= mipas_lat(5) )
then
1004 interp_gas(:,:) = mipas_gas(:,:,indexd2) * ( 1.0_rp-factd ) &
1005 + mipas_gas(:,:,indexd1) * ( factd )
1007 interp_z(:) = mipas_z(:,indexd2) * ( 1.0_rp-factd ) &
1008 + mipas_z(:,indexd1) * ( factd )
1015 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_h2o ), kmax, z(:), gas(:,1) )
1016 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_co2 ), kmax, z(:), gas(:,2) )
1017 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_o3 ), kmax, z(:), gas(:,3) )
1018 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_n2o ), kmax, z(:), gas(:,4) )
1019 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_co ), kmax, z(:), gas(:,5) )
1020 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_ch4 ), kmax, z(:), gas(:,6) )
1021 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_o2 ), kmax, z(:), gas(:,7) )
1023 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f11 ), kmax, z(:), cfc(:, 1) )
1024 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f12 ), kmax, z(:), cfc(:, 2) )
1025 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f14 ), kmax, z(:), cfc(:, 4) )
1026 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_f22 ), kmax, z(:), cfc(:, 9) )
1027 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_sf6 ), kmax, z(:), cfc(:,22) )
1028 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_clono2), kmax, z(:), cfc(:,23) )
1029 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_ccl4 ), kmax, z(:), cfc(:,24) )
1030 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_n2o5 ), kmax, z(:), cfc(:,25) )
1031 call profile_interp( mipas_kmax, interp_z(:), interp_gas(:,i_hno4 ), kmax, z(:), cfc(:,27) )
1034 end subroutine profile_read_mipas2001
1038 subroutine profile_interp( imax1, x1, y1, imax2, x2, y2 )
1041 integer,
intent(in) :: imax1
1042 real(
rp),
intent(in) :: x1(imax1)
1043 real(
rp),
intent(in) :: y1(imax1)
1044 integer,
intent(in) :: imax2
1045 real(
rp),
intent(in) :: x2(imax2)
1046 real(
rp),
intent(out) :: y2(imax2)
1058 if ( x2(i2) > x1(1) )
then
1060 fact = ( x1(1) - x2(i2) ) / ( x1(2) - x1(1) )
1062 y2(i2) = y1(1) * ( 1.0_rp-fact ) &
1065 elseif( x2(i2) <= x1(imax1) )
then
1067 fact = ( x1(imax1) - x2(i2) ) / ( x1(imax1) - x1(imax1-1) )
1069 y2(i2) = y1(imax1-1) * ( fact ) &
1070 + y1(imax1 ) * ( 1.0_rp-fact )
1074 if ( x2(i2) <= x1(i1 ) &
1075 .AND. x2(i2) > x1(i1+1) )
then
1077 fact = ( x2(i2) - x1(i1) ) / ( x1(i1+1) - x1(i1) )
1079 y2(i2) = y1(i1 ) * ( 1.0_rp-fact ) &
1080 + y1(i1+1) * ( fact )
1090 end subroutine profile_interp
1100 integer,
intent(in) :: ka, ks, ke
1101 integer,
intent(in) :: kmax, kadd
1102 real(
rp),
intent(in) :: toa
1103 real(
rp),
intent(in) :: cz( ka)
1104 real(
rp),
intent(in) :: fz(0:ka)
1105 real(
rp),
intent(out) :: zh(kmax+1)
1106 real(
rp),
intent(out) :: z (kmax)
1112 if ( kadd > 0 )
then
1114 dz = ( toa - fz(ke)*1.e-3_rp ) / real( kadd, kind=
rp )
1118 zh(k) = zh(k-1) - dz
1120 zh(kadd+1) = fz(ke)*1.e-3_rp
1124 z(k) = 0.5_rp * ( zh(k+1) + zh(k) )
1130 rd_k = kmax - ( k - ks )
1131 zh(rd_k) = fz(k)*1.e-3_rp
1134 rd_k = kmax - ( k - ks )
1135 z(rd_k) = cz(k)*1.e-3_rp
1142 log_info(
"ATMOS_PHY_RD_PROFILE_setup_zgrid",
'(1x,A)')
'Vertical Coordinate'
1143 log_info_cont(
'(1x,A)')
'| -GRID CENTER- -GRID INTERFACE- |'
1144 log_info_cont(
'(1x,A)')
'| RD_k z k CZ FZ k zh RD_k |'
1145 if ( kadd > 0 )
then
1147 log_info_cont(
'(1x,A,F8.3,I5,A)')
'| ',zh(rd_k),rd_k,
' | TOA'
1148 log_info_cont(
'(1x,A,I5,F8.3,A)')
'|',rd_k,z(rd_k),
' | '
1150 log_info_cont(
'(1x,A,F8.3,I5,A)')
'| ',zh(rd_k),rd_k,
' | '
1151 log_info_cont(
'(1x,A,I5,F8.3,A)')
'|',rd_k,z(rd_k),
' | '
1154 log_info_cont(
'(1x,A,F8.3,I5,A)')
'| ',zh(rd_k),rd_k,
' | '
1155 log_info_cont(
'(1x,A,I5,F8.3,A)')
'|',rd_k,z(rd_k),
' | KADD'
1157 k = kmax - rd_k + ks
1158 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k)*1.e-3_rp,k,zh(rd_k),rd_k,
' | '
1159 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'
1162 k = kmax - rd_k + ks
1163 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'
1164 log_info_cont(
'(1x,A,I5,F8.3,I5,F8.3,A)')
'|',rd_k,z(rd_k),k,cz(k)*1.e-3_rp,
' | '
1166 do rd_k = kadd+2, kmax-1
1167 k = kmax - rd_k + ks
1168 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k)*1.e-3_rp,k,zh(rd_k),rd_k,
' | '
1169 log_info_cont(
'(1x,A,I5,F8.3,I5,F8.3,A)')
'|',rd_k,z(rd_k),k,cz(k)*1.e-3_rp,
' | '
1172 k = kmax - rd_k + ks
1173 log_info_cont(
'(1x,A,F8.3,I5,F8.3,I5,A)')
'| ',fz(k),k,zh(rd_k),rd_k,
' | '
1174 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'
1176 k = kmax - rd_k + ks
1177 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'
1178 log_info_cont(
'(1x,A)')
'|=====================================================|'
1187 subroutine profile_read_user( &
1208 integer,
intent(in) :: kmax
1209 integer,
intent(in) :: ngas
1210 integer,
intent(in) :: ncfc
1211 integer,
intent(in) :: naero
1212 real(
rp),
intent(in) :: zh (kmax+1)
1213 real(
rp),
intent(in) :: z (kmax)
1214 real(
rp),
intent(out) :: pres (kmax)
1215 real(
rp),
intent(out) :: presh(kmax+1)
1216 real(
rp),
intent(out) :: temp (kmax)
1217 real(
rp),
intent(out) :: temph(kmax+1)
1218 real(
rp),
intent(out) :: gas (kmax,ngas)
1219 real(
rp),
intent(out) :: cfc (kmax,ncfc)
1221 integer,
parameter :: user_klim = 500
1222 integer :: user_kmax
1223 real(
rp) :: user_z (user_klim)
1224 real(
rp) :: user_pres(user_klim)
1225 real(
rp) :: user_temp(user_klim)
1226 real(
rp) :: user_qv (user_klim)
1227 real(
rp) :: user_o3 (user_klim)
1229 real(
rp),
allocatable :: work_z(:)
1230 real(
rp),
allocatable :: work (:)
1232 real(
rp) :: plog (kmax)
1233 real(
rp) :: plogh(kmax+1)
1235 character(len=H_LONG) :: dummy, fname
1237 integer :: fid, ierr
1241 log_info(
"PROFILE_read_user",*)
'user-defined profile'
1247 log_info(
"PROFILE_read_user",*)
'FILENAME:', trim(fname)
1252 form =
'formatted', &
1256 if ( ierr /= 0 )
then
1257 log_error(
"PROFILE_read_user",*)
'File not found. check!'
1264 read(fid,*,iostat=ierr) user_z(k), user_pres(k), user_temp(k), user_qv(k), user_o3(k)
1265 if ( ierr /= 0 )
exit
1270 allocate( work_z(user_kmax) )
1271 allocate( work(user_kmax) )
1274 work_z(k) = user_z(k) / 1000.0_rp
1275 work(k) = log( user_pres(k)/100.0_rp )
1279 call profile_interp( user_kmax, &
1286 presh(:) = exp( plogh(:) )
1288 call profile_interp( kmax+1, zh(:), plogh(:), kmax, z(:), plog(:) )
1289 pres(:) = exp( plog(:) )
1292 work(k) = user_temp(k)
1295 call profile_interp( user_kmax, &
1302 call profile_interp( user_kmax, &
1310 work(k) = user_qv(k) / mvap * mdry / ppm
1313 call profile_interp( user_kmax, &
1321 work(k) = user_o3(k) / 48.0_rp * mdry / ppm
1324 call profile_interp( user_kmax, &
1332 end subroutine profile_read_user