10 USE def_spectrum,
ONLY: strspecdata
14 USE def_dimen,
ONLY: strdim
15 USE def_atm,
ONLY: stratm, deallocate_atm
16 USE def_cld,
ONLY: strcld, deallocate_cld, &
17 deallocate_cld_prsc, &
19 USE def_aer,
ONLY: straer, deallocate_aer, &
21 USE def_bound,
ONLY: strbound, deallocate_bound
22 USE def_out,
ONLY: strout, deallocate_out
30 use rad_pcf,
only: ip_solar, ip_infra_red
32 type(model_state_type),
target,
intent(inout) :: current_state
33 TYPE (StrSpecData) :: sw_spectrum
34 TYPE (StrSpecData) :: lw_spectrum
38 TYPE(StrBound) :: bound
46 TYPE(StrOut) :: radout
48 type (str_mcc_profiles),
intent(in) :: mcc
49 type (str_merge_atm),
intent(inout) :: merge_fields
51 type (str_socrates_options),
intent(in) :: socrates_opt
52 type (str_socrates_derived_fields),
intent(inout) :: socrates_derived_fields
55 integer :: target_x_index, target_y_index
61 icol=current_state%column_local_x
62 jcol=current_state%column_local_y
64 target_y_index=jcol-current_state%local_grid%halo_size(
y_index)
65 target_x_index=icol-current_state%local_grid%halo_size(
x_index)
67 k_top = current_state%local_grid%size(
z_index)
70 if (socrates_derived_fields%fraction_lit .ge. 1.0)
then
80 1, mcc%irad_levs, mcc%irad_levs)
86 1 , mcc%irad_levs, socrates_opt, merge_fields)
89 socrates_derived_fields)
92 1 , mcc%irad_levs, mcc%irad_levs, socrates_opt, merge_fields)
97 call radiance_calc(
sw_control, dimen, sw_spectrum, atm, cld, aer, bound, radout)
100 socrates_derived_fields%toa_up_shortwave(target_y_index,target_x_index) = &
101 radout%flux_up(1,0,1)
102 socrates_derived_fields%toa_down_shortwave(target_y_index,target_x_index) = &
103 radout%flux_down(1,0,1)
104 socrates_derived_fields%surface_up_shortwave(target_y_index,target_x_index) = &
105 radout%flux_up(1,mcc%irad_levs,1)
106 socrates_derived_fields%surface_down_shortwave(target_y_index,target_x_index) = &
107 radout%flux_down(1,mcc%irad_levs,1)
109 do k = 1, mcc%irad_levs
110 merge_fields%sw_heat_rate_radlevs(k) = &
112 ((radout%flux_down(1,k-1,1)-radout%flux_up(1,k-1,1)) &
114 - (radout%flux_down(1,k,1)-radout%flux_up(1,k,1)))/ &
115 (merge_fields%mass(k)*
cp)
119 socrates_derived_fields%flux_up_sw(k,target_y_index, target_x_index) = &
120 radout%flux_up(1,mcc%irad_levs+1-k,1)
122 socrates_derived_fields%flux_down_sw(k,target_y_index, target_x_index) = &
123 radout%flux_down(1,mcc%irad_levs+1-k,1)
126 current_state%sth_sw%data(1,jcol, icol) = 0.0
128 current_state%sth_sw%data(2:k_top,jcol, icol) = &
129 merge_fields%sw_heat_rate_radlevs(mcc%irad_levs:mcc%irad_levs+2-k_top:-1)
130 socrates_derived_fields%swrad_hr(:,target_y_index, target_x_index) = &
131 current_state%sth_sw%data(:,jcol, icol)
133 current_state%sth_sw%data(:, jcol, icol) = &
134 current_state%sth_sw%data(:, jcol, icol)* &
135 current_state%global_grid%configuration%vertical%prefrcp(:)
139 socrates_derived_fields%flux_up_sw(k,target_y_index, target_x_index) = &
142 socrates_derived_fields%flux_down_sw(k,target_y_index, target_x_index) = &
145 socrates_derived_fields%toa_up_shortwave(target_y_index,target_x_index) = 0.0
146 socrates_derived_fields%toa_down_shortwave(target_y_index,target_x_index) = 0.0
147 socrates_derived_fields%surface_up_shortwave(target_y_index,target_x_index) = 0.0
148 socrates_derived_fields%surface_down_shortwave(target_y_index,target_x_index) = 0.0
149 current_state%sth_sw%data(:,jcol, icol) = 0.0
150 socrates_derived_fields%swrad_hr(:,target_y_index, target_x_index) = 0.0
154 CALL deallocate_out(radout)
155 CALL deallocate_aer_prsc(aer)
156 CALL deallocate_aer(aer)
158 CALL deallocate_bound(bound)
159 CALL deallocate_cld_prsc(cld)
160 CALL deallocate_cld(cld)
161 call deallocate_atm(atm)
169 1, mcc%irad_levs, mcc%irad_levs)
172 1 , mcc%irad_levs, socrates_opt, merge_fields)
175 socrates_derived_fields)
178 1 , mcc%irad_levs, mcc%irad_levs, socrates_opt, merge_fields)
182 call radiance_calc(
lw_control, dimen, lw_spectrum, atm, cld, aer, bound, radout)
184 socrates_derived_fields%toa_up_longwave(target_y_index,target_x_index) = &
185 radout%flux_up(1,0,1)
186 socrates_derived_fields%surface_up_longwave(target_y_index,target_x_index) = &
187 radout%flux_up(1,mcc%irad_levs,1)
188 socrates_derived_fields%surface_down_longwave(target_y_index,target_x_index) = &
189 radout%flux_down(1,mcc%irad_levs,1)
191 do k = 1, mcc%irad_levs
192 merge_fields%lw_heat_rate_radlevs(k) = &
194 ((radout%flux_down(1,k-1,1)-radout%flux_up(1,k-1,1)) &
196 - (radout%flux_down(1,k,1)-radout%flux_up(1,k,1)))/ &
197 (merge_fields%mass(k)*
cp)
200 current_state%sth_lw%data(1,jcol, icol) = 0.0
202 current_state%sth_lw%data(2:k_top,jcol, icol) = &
203 merge_fields%lw_heat_rate_radlevs(mcc%irad_levs:mcc%irad_levs+2-k_top:-1)
205 current_state%sth_lw%data(:, jcol, icol) = &
206 current_state%sth_lw%data(:, jcol, icol)* &
207 current_state%global_grid%configuration%vertical%prefrcp(:)
209 socrates_derived_fields%lwrad_hr(:,target_y_index, target_x_index) = &
210 current_state%sth_lw%data(:,jcol, icol)
213 socrates_derived_fields%flux_up_lw(k,target_y_index, target_x_index) = &
214 radout%flux_up(1,mcc%irad_levs+1-k,1)
216 socrates_derived_fields%flux_down_lw(k,target_y_index, target_x_index) = &
217 radout%flux_down(1,mcc%irad_levs+1-k,1)
220 socrates_derived_fields%totrad_hr(:,target_y_index, target_x_index) = &
221 socrates_derived_fields%lwrad_hr(:,target_y_index, target_x_index) + &
222 socrates_derived_fields%swrad_hr(:,target_y_index, target_x_index)
224 CALL deallocate_out(radout)
225 CALL deallocate_aer_prsc(aer)
226 CALL deallocate_aer(aer)
227 CALL deallocate_bound(bound)
228 CALL deallocate_cld_prsc(cld)
229 CALL deallocate_cld(cld)
230 CALL deallocate_atm(atm)