CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
rrtmgp_aerosol_optics.F90
1
3
5 use machine, only: kind_phys
6 use radiation_tools, only: check_error_msg
7 use rrtmgp_sw_gas_optics, only: sw_gas_props
8 use rrtmgp_lw_gas_optics, only: lw_gas_props
9 use module_radiation_aerosols, only: setaer
10 use netcdf
11
12 implicit none
13
14 public rrtmgp_aerosol_optics_run
15
16contains
17
21 subroutine rrtmgp_aerosol_optics_run(doSWrad, doLWrad, nCol, nLev, nDay, idxday, p_lev, &
22 p_lay, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat, iaermdl, iaerflg, &
23 top_at_1, con_pi, con_rd, con_g, aerodp, aerlw_tau, aerlw_ssa, aerlw_g, aersw_tau, &
24 aersw_ssa, aersw_g, ext550, errmsg, errflg )
25
26 ! Inputs
27 logical, intent(in) :: &
28 doswrad, & ! Logical flag for shortwave radiation call
29 dolwrad, & ! Logical flag for longwave radiation call
30 top_at_1 ! Logical flag for vertical grid direcetion
31 integer, intent(in) :: &
32 ncol, & ! Number of horizontal grid points
33 nday, & ! Number of daylit points
34 nlev, & ! Number of vertical layers
35 iaermdl, & ! Aerosol model scheme flag
36 iaerflg ! Aerosol effects to include
37 integer,intent(in),dimension(:) :: &
38 idxday ! Indices for daylit points.
39 real(kind_phys),intent(in) :: &
40 con_pi, & ! Physical constant (pi)
41 con_rd, & ! Physical constant (gas constant for dry-air)
42 con_g ! Physical constant (gravitational constant)
43 real(kind_phys), dimension(:), intent(in) :: &
44 lon, & ! Longitude
45 lat, & ! Latitude
46 lsmask ! Land/sea/sea-ice mask
47 real(kind_phys), dimension(:,:),intent(in), optional :: &
48 p_lay, & ! Pressure @ layer-centers (Pa)
49 tv_lay, & ! Virtual-temperature @ layer-centers (K)
50 relhum ! Relative-humidity @ layer-centers
51 real(kind_phys), dimension(:,:),intent(in) :: &
52 p_lk ! Exner function @ layer-centers (1)
53 real(kind_phys), dimension(:, :,:),intent(in) :: &
54 tracer ! trace gas concentrations
55 real(kind_phys), dimension(:, :,:),intent(in) :: &
56 aerfld ! aerosol input concentrations
57 real(kind_phys), dimension(:,:),intent(in), optional :: &
58 p_lev ! Pressure @ layer-interfaces (Pa)
59 real (kind=kind_phys), dimension(:,:), intent(out) :: &
60 ext550 ! 3d optical extinction for total aerosol species
61
62 ! Outputs
63 real(kind_phys), dimension(:,:), intent(out) :: &
64 aerodp ! Vertical integrated optical depth for various aerosol species
65 real(kind_phys), dimension(:,:,:), intent(out) :: &
66 aerlw_tau, & ! Longwave aerosol optical depth
67 aerlw_ssa, & ! Longwave aerosol single scattering albedo
68 aerlw_g, & ! Longwave aerosol asymmetry parameter
69 aersw_tau, & ! Shortwave aerosol optical depth
70 aersw_ssa, & ! Shortwave aerosol single scattering albedo
71 aersw_g ! Shortwave aerosol asymmetry parameter
72 integer, intent(out) :: &
73 errflg ! CCPP error flag
74 character(len=*), intent(out) :: &
75 errmsg ! CCPP error message
76
77 ! Local variables
78 real(kind_phys), dimension(nCol, nLev, lw_gas_props%get_nband(), 3) :: &
79 aerosolslw !
80 real(kind_phys), dimension(nCol, nLev, sw_gas_props%get_nband(), 3) :: &
81 aerosolssw, aerosolssw2
82 integer :: iband
83
84 ! Initialize CCPP error handling variables
85 errmsg = ''
86 errflg = 0
87
88 if (.not. (doswrad .or. dolwrad)) return
89
90 ! Call module_radiation_aerosols::setaer(),to setup aerosols property profile
91 call setaer(p_lev*0.01, p_lay*0.01, p_lk, tv_lay, relhum, lsmask, tracer, aerfld, lon, lat, ncol, nlev, &
92 nlev+1, .true., .true., iaermdl, iaerflg, top_at_1, con_pi, con_rd, con_g, aerosolssw2, aerosolslw, &
93 aerodp, ext550, errflg, errmsg)
94
95 ! Shortwave
96 if (doswrad .and. (nday .gt. 0)) then
97 ! Store aerosol optical properties
98 ! SW.
99 ! For RRTMGP SW the bands are now ordered from [IR(band) -> nIR -> UV], in RRTMG the
100 ! band ordering was [nIR -> UV -> IR(band)]
101 aerosolssw(1:ncol,:,1,1) = aerosolssw2(1:ncol,:,sw_gas_props%get_nband(),1)
102 aerosolssw(1:ncol,:,1,2) = aerosolssw2(1:ncol,:,sw_gas_props%get_nband(),2)
103 aerosolssw(1:ncol,:,1,3) = aerosolssw2(1:ncol,:,sw_gas_props%get_nband(),3)
104 aerosolssw(1:ncol,:,2:sw_gas_props%get_nband(),1) = aerosolssw2(1:ncol,:,1:sw_gas_props%get_nband()-1,1)
105 aerosolssw(1:ncol,:,2:sw_gas_props%get_nband(),2) = aerosolssw2(1:ncol,:,1:sw_gas_props%get_nband()-1,2)
106 aerosolssw(1:ncol,:,2:sw_gas_props%get_nband(),3) = aerosolssw2(1:ncol,:,1:sw_gas_props%get_nband()-1,3)
107
108 ! Copy aerosol optical information/
109 aersw_tau = aerosolssw(:,:,:,1)
110 aersw_ssa = aerosolssw(:,:,:,2)
111 aersw_g = aerosolssw(:,:,:,3)
112 endif
113
114 ! Longwave
115 if (dolwrad) then
116 aerlw_tau = aerosolslw(:,:,:,1)
117 aerlw_ssa = aerosolslw(:,:,:,2)
118 aerlw_g = aerosolslw(:,:,:,3)
119 endif
120
121 end subroutine rrtmgp_aerosol_optics_run
122end module rrtmgp_aerosol_optics