MONC
Functions/Subroutines | Variables
socrates_couple_mod Module Reference

This module sets up the logicals and parameters for the edward-slingo code from the UM. It also calls the shortwave and longwave ES code and outputs the heating rates and fluxes. More...

Functions/Subroutines

type(component_descriptor_type) function, public socrates_couple_get_descriptor ()
 Provides the descriptor back to the caller and is used in component registration. More...
 
subroutine initialisation_callback (current_state)
 The initialisation callback sets up the prescribed longwave fluxes and the exponential decay factor. More...
 
subroutine timestep_callback (current_state)
 Called for each column per timestep this will apply a forcing term to the aerosol fields. More...
 
subroutine finalisation_callback (current_state)
 
subroutine field_information_retrieval_callback (current_state, name, field_information)
 Field information retrieval callback, this returns information for a specific components published field. More...
 
subroutine field_value_retrieval_callback (current_state, name, field_value)
 Field value retrieval callback, this returns the value of a specific published field. More...
 

Variables

integer k_top
 
integer x_local
 
integer y_local
 
integer x_nohalos
 
integer y_nohalos
 
real(kind=default_precision), dimension(:), allocatable density_factor
 
real(kind=default_precision), dimension(:), allocatable radiation_factor
 
type(strspecdata), save sw_spectrum
 
type(strspecdata), save lw_spectrum
 
type(str_mcc_profilesmcc
 
type(str_merge_atmmerge_fields
 
type(str_socrates_optionssocrates_opt
 
type(str_socrates_derived_fieldssocrates_derived_fields
 

Detailed Description

This module sets up the logicals and parameters for the edward-slingo code from the UM. It also calls the shortwave and longwave ES code and outputs the heating rates and fluxes.

Dummy stub when not compiling in socrates.

Function/Subroutine Documentation

◆ field_information_retrieval_callback()

subroutine socrates_couple_mod::field_information_retrieval_callback ( type(model_state_type), intent(inout), target  current_state,
character(len=*), intent(in)  name,
type(component_field_information_type), intent(out)  field_information 
)

Field information retrieval callback, this returns information for a specific components published field.

Parameters
current_stateCurrent model state
nameThe name of the field to retrieve information for
field_informationPopulated with information about the field

Definition at line 407 of file socrates_couple.F90.

408  type(model_state_type), target, intent(inout) :: current_state
409  character(len=*), intent(in) :: name
410  type(component_field_information_type), intent(out) :: field_information
411 
412  if ( name .eq. "flux_up_shortwave" .or. name .eq. "flux_down_shortwave" .or. &
413  name .eq. "flux_up_longwave" .or. name .eq. "flux_down_longwave" .or. &
414  name .eq. "shortwave_heating_rate" .or. name .eq. "longwave_heating_rate" &
415  .or. name .eq. "total_radiative_heating_rate") then
416  field_information%field_type=component_array_field_type
417  field_information%number_dimensions=3
418  field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
419  field_information%dimension_sizes(2)=current_state%local_grid%size(y_index)
420  field_information%dimension_sizes(3)=current_state%local_grid%size(x_index)
421  field_information%data_type=component_double_data_type
422  else
423  field_information%field_type=component_array_field_type
424  field_information%number_dimensions=2
425  field_information%dimension_sizes(1)=current_state%local_grid%size(y_index)
426  field_information%dimension_sizes(2)=current_state%local_grid%size(x_index)
427  field_information%data_type=component_double_data_type
428  endif
429 
430  field_information%enabled=.true.
431 
Here is the caller graph for this function:

◆ field_value_retrieval_callback()

subroutine socrates_couple_mod::field_value_retrieval_callback ( type(model_state_type), intent(inout), target  current_state,
character(len=*), intent(in)  name,
type(component_field_value_type), intent(out)  field_value 
)

Field value retrieval callback, this returns the value of a specific published field.

Parameters
current_stateCurrent model state
nameThe name of the field to retrieve the value for
field_valuePopulated with the value of the field

Definition at line 438 of file socrates_couple.F90.

439  type(model_state_type), target, intent(inout) :: current_state
440  character(len=*), intent(in) :: name
441  type(component_field_value_type), intent(out) :: field_value
442 
443  integer :: k
444 
445  ! 3D radiative flux and heating rates
446  if (name .eq. "flux_up_shortwave") then
447  allocate(field_value%real_3d_array(current_state%local_grid%size(z_index), &
448  current_state%local_grid%size(y_index), &
449  current_state%local_grid%size(x_index)))
450  field_value%real_3d_array(:,:,:) = socrates_derived_fields%flux_up_sw(:,:,:)
451  else if (name .eq. "flux_down_shortwave") then
452  allocate(field_value%real_3d_array(current_state%local_grid%size(z_index), &
453  current_state%local_grid%size(y_index), &
454  current_state%local_grid%size(x_index)))
455  field_value%real_3d_array(:,:,:) = socrates_derived_fields%flux_down_sw(:,:,:)
456  else if (name .eq. "flux_up_longwave") then
457  allocate(field_value%real_3d_array(current_state%local_grid%size(z_index), &
458  current_state%local_grid%size(y_index), &
459  current_state%local_grid%size(x_index)))
460  field_value%real_3d_array(:,:,:) = socrates_derived_fields%flux_up_lw(:,:,:)
461  else if (name .eq. "flux_down_longwave") then
462  allocate(field_value%real_3d_array(current_state%local_grid%size(z_index), &
463  current_state%local_grid%size(y_index), &
464  current_state%local_grid%size(x_index)))
465  field_value%real_3d_array(:,:,:) = socrates_derived_fields%flux_down_lw(:,:,:)
466  else if (name .eq. "shortwave_heating_rate") then
467  allocate(field_value%real_3d_array(current_state%local_grid%size(z_index), &
468  current_state%local_grid%size(y_index), &
469  current_state%local_grid%size(x_index)))
470  field_value%real_3d_array(:,:,:) = socrates_derived_fields%swrad_hr(:,:,:)
471  else if (name .eq. "longwave_heating_rate") then
472  allocate(field_value%real_3d_array(current_state%local_grid%size(z_index), &
473  current_state%local_grid%size(y_index), &
474  current_state%local_grid%size(x_index)))
475  field_value%real_3d_array(:,:,:) = socrates_derived_fields%lwrad_hr(:,:,:)
476  else if (name .eq. "total_radiative_heating_rate") then
477  allocate(field_value%real_3d_array(current_state%local_grid%size(z_index), &
478  current_state%local_grid%size(y_index), &
479  current_state%local_grid%size(x_index)))
480  field_value%real_3d_array(:,:,:) = socrates_derived_fields%totrad_hr(:,:,:)
481  !
482  ! 2D radiative fluxes
483  else if (name .eq. "toa_up_longwave") then
484  allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
485  current_state%local_grid%size(x_index)))
486  field_value%real_2d_array(:,:) = socrates_derived_fields%toa_up_longwave(:,:)
487  else if (name .eq. "surface_down_longwave") then
488  allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
489  current_state%local_grid%size(x_index)))
490  field_value%real_2d_array(:,:) = socrates_derived_fields%surface_down_longwave(:,:)
491  else if (name .eq. "surface_up_longwave") then
492  allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
493  current_state%local_grid%size(x_index)))
494  field_value%real_2d_array(:,:) = socrates_derived_fields%surface_up_longwave(:,:)
495  else if (name .eq. "toa_up_shortwave") then
496  allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
497  current_state%local_grid%size(x_index)))
498  field_value%real_2d_array(:,:) = socrates_derived_fields%toa_up_shortwave(:,:)
499  else if (name .eq. "toa_down_shortwave") then
500  allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
501  current_state%local_grid%size(x_index)))
502  field_value%real_2d_array(:,:) = socrates_derived_fields%toa_down_shortwave(:,:)
503  else if (name .eq. "surface_down_shortwave") then
504  allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
505  current_state%local_grid%size(x_index)))
506  field_value%real_2d_array(:,:) = socrates_derived_fields%surface_down_shortwave(:,:)
507  else if (name .eq. "surface_up_shortwave") then
508  allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
509  current_state%local_grid%size(x_index)))
510  field_value%real_2d_array(:,:) = socrates_derived_fields%surface_up_shortwave(:,:)
511  end if
512 
Here is the caller graph for this function:

◆ finalisation_callback()

subroutine socrates_couple_mod::finalisation_callback ( type(model_state_type), intent(inout), target  current_state)

Definition at line 394 of file socrates_couple.F90.

395 
396  type(model_state_type), target, intent(inout) :: current_state
397 
398 ! deallocate(merge_fields%t, merge_fields%qv, &
399 ! ql_socrates, qi_socrates)
400 
Here is the caller graph for this function:

◆ initialisation_callback()

subroutine socrates_couple_mod::initialisation_callback ( type(model_state_type), intent(inout), target  current_state)

The initialisation callback sets up the prescribed longwave fluxes and the exponential decay factor.

Parameters
current_stateThe current model state

Definition at line 94 of file socrates_couple.F90.

95  type(model_state_type), target, intent(inout) :: current_state
96 
97  integer :: k ! look counter
98 
99  k_top=current_state%local_grid%size(z_index) + current_state%local_grid%halo_size(z_index) * 2
100  y_local=current_state%local_grid%size(y_index) + current_state%local_grid%halo_size(y_index) * 2
101  x_local=current_state%local_grid%size(x_index) + current_state%local_grid%halo_size(x_index) * 2
102 
103  y_nohalos=current_state%local_grid%size(y_index)
104  x_nohalos=current_state%local_grid%size(x_index)
105 
106  !if (.not. current_state%continuation_run) then
107  ! Allocated the longwave and shortwave heating rates.They need to be added to
108  ! the dump
109  ! allocate(current_state%sth_lw%data(k_top, y_local, x_local))
110  ! allocate(current_state%sth_sw%data(k_top, y_local, x_local))
111  ! current_state%sth_lw%data(:,:,:) = 0.0
112  ! current_state%sth_sw%data(:,:,:) = 0.0
113  ! Allocate downward surface fluxes
114  ! allocate(current_state%sw_down_surf(y_local, x_local))
115  ! allocate(current_state%lw_down_surf(y_local, x_local))
116  ! current_state%sw_down_surf(:, :) = 0.0
117  ! current_state%lw_down_surf(:, :) = 0.0
118  !endif
119 
120  ! allocate the density and radiation factor needed for heating rates
121  allocate(socrates_derived_fields%density_factor(k_top))
122  allocate(socrates_derived_fields%radiation_factor(k_top))
123  !
124  ! allocate the fluxes, which do not need to be dumped
125  allocate(socrates_derived_fields%flux_up_sw(k_top,y_nohalos,x_nohalos))
126  allocate(socrates_derived_fields%flux_down_sw(k_top,y_nohalos,x_nohalos))
127  allocate(socrates_derived_fields%flux_up_lw(k_top,y_nohalos,x_nohalos))
128  allocate(socrates_derived_fields%flux_down_lw(k_top,y_nohalos,x_nohalos))
129  allocate(socrates_derived_fields%flux_net_sw(k_top,y_nohalos,x_nohalos))
130  allocate(socrates_derived_fields%flux_net_lw(k_top,y_nohalos,x_nohalos))
131  !
132  ! allocate the surface and TOA fields which are used for diagnostics
133  allocate(socrates_derived_fields%toa_up_longwave(y_nohalos,x_nohalos))
134  allocate(socrates_derived_fields%toa_down_shortwave(y_nohalos,x_nohalos))
135  allocate(socrates_derived_fields%toa_up_shortwave(y_nohalos,x_nohalos))
136  allocate(socrates_derived_fields%surface_up_longwave(y_nohalos,x_nohalos))
137  allocate(socrates_derived_fields%surface_down_longwave(y_nohalos,x_nohalos))
138  allocate(socrates_derived_fields%surface_down_shortwave(y_nohalos,x_nohalos))
139  allocate(socrates_derived_fields%surface_up_shortwave(y_nohalos,x_nohalos))
140  !
141  ! allocate radiative heating rates for diagnostics
142  allocate(socrates_derived_fields%swrad_hr(k_top, y_nohalos,x_nohalos))
143  allocate(socrates_derived_fields%lwrad_hr(k_top, y_nohalos,x_nohalos))
144  allocate(socrates_derived_fields%totrad_hr(k_top, y_nohalos,x_nohalos))
145 
146  ! initialise allocated variables to 0 for safety
147  socrates_derived_fields%flux_up_sw(:,:,:) = 0.0
148  socrates_derived_fields%flux_down_sw(:,:,:) = 0.0
149  socrates_derived_fields%flux_up_lw(:,:,:) = 0.0
150  socrates_derived_fields%flux_down_lw(:,:,:) = 0.0
151  socrates_derived_fields%flux_net_sw(:,:,:) = 0.0
152  socrates_derived_fields%flux_net_lw(:,:,:) = 0.0
153  socrates_derived_fields%toa_up_longwave(:,:) = 0.0
154  socrates_derived_fields%toa_down_shortwave(:,:) = 0.0
155  socrates_derived_fields%toa_up_shortwave(:,:) = 0.0
156  socrates_derived_fields%surface_up_longwave(:,:) = 0.0
157  socrates_derived_fields%surface_down_longwave(:,:) = 0.0
158  socrates_derived_fields%surface_down_shortwave(:,:) = 0.0
159  socrates_derived_fields%surface_up_shortwave(:,:) = 0.0
160  socrates_derived_fields%swrad_hr(:,:,:) = 0.0
161  socrates_derived_fields%lwrad_hr(:,:,:) = 0.0
162  socrates_derived_fields%totrad_hr(:,:,:) = 0.0
163 
164  ! derive density and radiation factor for heating rate calculation
165  socrates_derived_fields%density_factor(1) = 0.0
166  do k = 2, k_top
167  socrates_derived_fields%density_factor(k) = &
168  current_state%global_grid%configuration%vertical%rhon(k)* &
169  current_state%global_grid%configuration%vertical%dz(k)
170  enddo
171  socrates_derived_fields%density_factor(1) = socrates_derived_fields%density_factor(2)
172 
173  socrates_derived_fields%radiation_factor(2:k_top) = &
174  1.0/(socrates_derived_fields%density_factor(2:k_top)*cp)
175  socrates_derived_fields%radiation_factor(1) = socrates_derived_fields%radiation_factor(2)
176 
177  call set_and_test_socrates_monc_options(current_state, socrates_opt)
178 
179  ! set up the switches and names for Edwards-Slingo code
180  call sw_input(current_state)
181  ! DEPENDS ON: read_spectrum
182  call read_spectrum( sw_control%spectral_file, &
183  sw_spectrum )
184  ! DEPENDS ON: compress_spectrum
185  CALL compress_spectrum( sw_control, sw_spectrum )
186 
187  call lw_input(current_state, lw_control)
188  call read_spectrum( lw_control%spectral_file, &
189  lw_spectrum )
190  CALL compress_spectrum( lw_control, lw_spectrum )
191 
192  ! Read the mcc_profile
193  call read_mcclatchey_profiles(current_state, mcc)
194  !
195  ! Calculate the number of radiation levels with
196  ! mcc_levs combined to monc model levels
197  call calculate_radiation_levels(current_state, mcc)
198  !
199  ! allocate fields to pass to socrates
200  call allocate_merge_data_fields(current_state, merge_fields, mcc)
201 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ socrates_couple_get_descriptor()

type(component_descriptor_type) function, public socrates_couple_mod::socrates_couple_get_descriptor

Provides the descriptor back to the caller and is used in component registration.

Returns
The termination check component descriptor

Definition at line 62 of file socrates_couple.F90.

63  socrates_couple_get_descriptor%name="socrates_couple"
64  socrates_couple_get_descriptor%version=0.1
65  socrates_couple_get_descriptor%initialisation=>initialisation_callback
66  socrates_couple_get_descriptor%timestep=>timestep_callback
67  socrates_couple_get_descriptor%finalisation=>finalisation_callback
68 
69  socrates_couple_get_descriptor%field_value_retrieval=>field_value_retrieval_callback
70  socrates_couple_get_descriptor%field_information_retrieval=>field_information_retrieval_callback
71 
72  allocate(socrates_couple_get_descriptor%published_fields(14))
73 
74  socrates_couple_get_descriptor%published_fields(1)="flux_up_shortwave"
75  socrates_couple_get_descriptor%published_fields(2)="flux_down_shortwave"
76  socrates_couple_get_descriptor%published_fields(3)="flux_up_longwave"
77  socrates_couple_get_descriptor%published_fields(4)="flux_down_longwave"
78  socrates_couple_get_descriptor%published_fields(5)="toa_up_longwave"
79  socrates_couple_get_descriptor%published_fields(6)="surface_down_longwave"
80  socrates_couple_get_descriptor%published_fields(7)="surface_up_longwave"
81  socrates_couple_get_descriptor%published_fields(8)="toa_down_shortwave"
82  socrates_couple_get_descriptor%published_fields(9)="toa_up_shortwave"
83  socrates_couple_get_descriptor%published_fields(10)="surface_down_shortwave"
84  socrates_couple_get_descriptor%published_fields(11)="surface_up_shortwave"
85  socrates_couple_get_descriptor%published_fields(12)="shortwave_heating_rate"
86  socrates_couple_get_descriptor%published_fields(13)="longwave_heating_rate"
87  socrates_couple_get_descriptor%published_fields(14)="total_radiative_heating_rate"
88 
Here is the call graph for this function:

◆ timestep_callback()

subroutine socrates_couple_mod::timestep_callback ( type(model_state_type), intent(inout), target  current_state)

Called for each column per timestep this will apply a forcing term to the aerosol fields.

Parameters
current_stateThe current model state

Definition at line 207 of file socrates_couple.F90.

208  type(model_state_type), target, intent(inout) :: current_state
209 
210  real(DEFAULT_PRECISION), parameter :: &
211  snotset = -9999. ! A value of sec_out meaing darkness
212  real(DEFAULT_PRECISION) :: local_dtm ! Local timestep variable
213  integer :: icol, jcol ! Shorthand column indices
214  integer :: target_x_index, target_y_index
215 
216  integer :: k ! look counter
217 
218  ! No need to do radiation calculations in the halos or on the first timestep
219  !
220  if (current_state%halo_column .or. current_state%timestep < 2) return
221 
222  local_dtm = current_state%dtm*2.0
223  if (current_state%field_stepping == forward_stepping) local_dtm=current_state%dtm
224 
225  ! work out column indexes from MONC (these include the halo)
226  icol=current_state%column_local_x
227  jcol=current_state%column_local_y
228  ! work out a target index for radiation arrays (no halo)
229  target_y_index=jcol-current_state%local_grid%halo_size(y_index)
230  target_x_index=icol-current_state%local_grid%halo_size(x_index)
231 
232  ! Test whether it is a radiation calc timestep on the first non-halo column
233  ! If it is, then calc all year, day, time in hours and timestep.
234  ! Note: all socrates time control variables are declared in the socrates_opt
235  ! or socrates_derived_fields structure, except rad_last_time, which is
236  ! in current_state.
237  if (current_state%first_nonhalo_timestep_column) then
238  !i) 1 call radiation on timestep 2 to initialise the heating rates
239  !ii) if rad_int_time less than or equal to 0.0, SOCRATES called on every timestep
240  if (socrates_opt%rad_int_time <= 0.0 .or. current_state%timestep == 2 ) then
241  socrates_opt%l_rad_calc = .true.
242  else
243  socrates_opt%l_rad_calc = &
244  ((current_state%time - &
245  (current_state%rad_last_time + socrates_opt%rad_int_time)) > 0.0)
246  endif
247  endif
248 
249  if (socrates_opt%l_rad_calc) then
250  if (current_state%first_nonhalo_timestep_column) then
251  call log_master_log &
252  (log_info, "Socrates called, time ="//trim(conv_to_string(current_state%time))//&
253  " rad_int_time="//trim(conv_to_string(socrates_opt%rad_int_time))//&
254  " local dtm="//trim(conv_to_string(local_dtm)))
255  call log_master_log &
256  (log_info, "methane ="//trim(conv_to_string(socrates_opt%ch4_mmr))//&
257  " l_ch4="//trim(conv_to_string(lw_control%l_ch4)))
258 
259  ! Do not really like this but update the rad_time_hours and
260  ! rad_day here using time.
261  socrates_opt%rad_day = socrates_opt%rad_start_day + &
262  int((socrates_opt%rad_start_time + (current_state%time/3600.0))/24.0)
263  socrates_opt%rad_time_hours = &
264  (socrates_opt%rad_start_time + ((current_state%time+local_dtm)/3600.0)) &
265  - (24.0*(socrates_opt%rad_day-socrates_opt%rad_start_day))
266  ! set the radiation timestep
267  if (socrates_opt%rad_int_time == 0) then
268  socrates_derived_fields%dt_secs = local_dtm
269  else
270  socrates_derived_fields%dt_secs = socrates_opt%rad_int_time
271  endif
272  ! Finally, if we will calculate radiative fluxes on this timestep update the last
273  ! radiative timetep to this one.
274  current_state%rad_last_time = current_state%time
275  endif
276 
277  ! set surface temperature. Based on LEM, but needs some thought to capture
278  ! atmospheric surface and actual surface. Here they are the same
279  ! which may lead to too much emission (depending on profile)
280  !
281  if (current_state%use_surface_boundary_conditions) then
282  if (current_state%type_of_surface_boundary_conditions == prescribed_surface_values) then
283  socrates_derived_fields%srf_temperature = &
284  current_state%theta_surf / &
285  ((current_state%surface_reference_pressure/current_state%surface_pressure)**r_over_cp)
286  elseif (current_state%type_of_surface_boundary_conditions == prescribed_surface_fluxes) then
287  !THIS IS NOT CORRECT - SHOULD WORK OUT TEMP FROM FLUXES
288  socrates_derived_fields%srf_temperature = &
289  (current_state%th%data(2, jcol, icol) &
290  + current_state%global_grid%configuration%vertical%thref(2)) &
291  * current_state%global_grid%configuration%vertical%rprefrcp(2)
292  end if
293  !else if(DO SOMETHING WITH JULES OUTPUT WHEN AVAILABLE)
294  else
295  socrates_derived_fields%srf_temperature = &
296  (current_state%th%data(2, jcol, icol) &
297  + current_state%global_grid%configuration%vertical%thref(2)) &
298  * current_state%global_grid%configuration%vertical%rprefrcp(2)
299  end if
300 
301  ! merge_data takes t,qv, ql, qi and then returns t_socrates, qv_socrates
302  ! ql_socrates, qi_socrates (all declared at head of module so no need
303  ! to pass as arguments
304  !
305  call merge_data(current_state, socrates_opt, socrates_derived_fields, merge_fields, mcc )
306  !
307  ! intialise variables for rad_calc just to be on safe side
308  socrates_derived_fields%sindec = 0.0
309  socrates_derived_fields%scs = 1.0
310  socrates_derived_fields%fraction_lit = 0.0
311  socrates_derived_fields%cosz = snotset
312 
313  if (socrates_opt%l_solar_fixed) then
314  socrates_derived_fields%sol_const = socrates_opt%solar_fixed
315  socrates_derived_fields%sec_out = socrates_opt%sec_fixed
316  socrates_derived_fields%fraction_lit = 1.0
317  else
318  ! this routine uses the rad_start_day, rad_start_year, and l_360
319  ! to work out position of sun. Returns sindec and scs to use in
320  ! solar angle calculation
321  call solar_pos_calculation(socrates_opt, socrates_derived_fields)
322  !
323  ! set the solar constant by scaling default constant by scs from
324  ! solar_pos_calculation
325  socrates_derived_fields%sol_const= &
326  socrates_opt%default_solar_constant * &
327  socrates_derived_fields%scs
328 
329  ! calulates the solar angle, fraction_lit and cos of zenith angle
330  call solar_angle_calculation(socrates_opt, socrates_derived_fields)
331  !
332  ! set fraction_lit to 1 or 0 depending, i.e. grid is lit or not, there
333  ! is no partial lighting
334  if (socrates_derived_fields%fraction_lit .ne. 0.0) then
335  socrates_derived_fields%fraction_lit = 1.0
336  socrates_derived_fields%sec_out = &
337  1./socrates_derived_fields%cosz
338  else
339  ! seems a silly value to set sec_out to check as it will break
340  ! the variable albedo calc
341  socrates_derived_fields%sec_out = snotset
342  endif
343  endif
344  !
345  ! Set surface albedo for rad_calc
346  !
347  if (socrates_derived_fields%fraction_lit .ne. 0.0) then
348  if (socrates_opt%l_variable_srf_albedo) then
349  stop
350 !!$ ! albfac1=0.026 albfac2=1.7 albfac3=0.065
351 !!$ ! albfac4=0.15 albfac5=0.1 albfac6=0.5
352 !!$ ! albfac7=1.0 alb2_var=0.06
353 !!$ cosz = 1./sec_out
354 !!$ albedoin1 = albfac1/(cosz**albfac2 + albfac3)
355 !!$ & + albfac4*(cosz - albfac5)*
356 !!$ & (cosz - albfac6)*(cosz - albfac7)
357 !!$ albedoin2 = alb2_var
358  else
359  socrates_derived_fields%albedoin1 = socrates_opt%surface_albedo
360  socrates_derived_fields%albedoin2 = socrates_opt%surface_albedo
361  endif
362  endif
363 
364  ! AH - after all this testing check whether solar is required. If
365  ! no solar then set fraction_lit = 0.0
366  if (socrates_opt%l_no_solar) then
367  socrates_derived_fields%fraction_lit = 0.0
368  endif
369 
370  call rad_ctl(current_state, sw_spectrum, lw_spectrum, &
371  mcc, socrates_opt, merge_fields, socrates_derived_fields)
372 
373  ! This is needed for JULES coupling. Including irrespective of JULES enabled
374  ! assign downward fluxes at the surface
375  !current_state%sw_down_surf(jcol, icol) = &
376  ! socrates_derived_fields%flux_down_sw(1, target_y_index, target_x_index)
377  !current_state%lw_down_surf(jcol, icol) = &
378  ! socrates_derived_fields%flux_down_lw(1, target_y_index, target_x_index)
379 
380  endif
381 
382  ! update the current_state sth
383  ! AH - temporary code to check bit comparison of socrates_couple
384  !current_state%sth_lw%data(:, jcol, icol) = 0.0
385  !current_state%sth_sw%data(:, jcol, icol) = 0.0
386  ! AH - end temporary code
387  current_state%sth%data(:, jcol, icol) = &
388  current_state%sth%data(:, jcol, icol) + &
389  current_state%sth_lw%data(:, jcol, icol) + &
390  current_state%sth_sw%data(:, jcol, icol)
391 
Here is the caller graph for this function:

Variable Documentation

◆ density_factor

real(kind=default_precision), dimension(:), allocatable socrates_couple_mod::density_factor

Definition at line 47 of file socrates_couple.F90.

47  real(kind=default_precision), allocatable :: density_factor(:), radiation_factor(:)

◆ k_top

integer socrates_couple_mod::k_top

Definition at line 44 of file socrates_couple.F90.

44  integer :: k_top, x_local, y_local, x_nohalos, y_nohalos

◆ lw_spectrum

type (strspecdata), save socrates_couple_mod::lw_spectrum

Definition at line 50 of file socrates_couple.F90.

50  TYPE (StrSpecData), SAVE :: lw_spectrum

◆ mcc

type (str_mcc_profiles) socrates_couple_mod::mcc

Definition at line 52 of file socrates_couple.F90.

52  type (str_mcc_profiles) :: mcc

◆ merge_fields

type (str_merge_atm) socrates_couple_mod::merge_fields

Definition at line 53 of file socrates_couple.F90.

53  type (str_merge_atm) :: merge_fields

◆ radiation_factor

real(kind=default_precision), dimension(:), allocatable socrates_couple_mod::radiation_factor

Definition at line 47 of file socrates_couple.F90.

◆ socrates_derived_fields

type (str_socrates_derived_fields) socrates_couple_mod::socrates_derived_fields

Definition at line 55 of file socrates_couple.F90.

55  type (str_socrates_derived_fields) :: socrates_derived_fields

◆ socrates_opt

type (str_socrates_options) socrates_couple_mod::socrates_opt

Definition at line 54 of file socrates_couple.F90.

54  type (str_socrates_options) :: socrates_opt

◆ sw_spectrum

type (strspecdata), save socrates_couple_mod::sw_spectrum

Definition at line 49 of file socrates_couple.F90.

49  TYPE (StrSpecData), SAVE :: sw_spectrum

◆ x_local

integer socrates_couple_mod::x_local

Definition at line 44 of file socrates_couple.F90.

◆ x_nohalos

integer socrates_couple_mod::x_nohalos

Definition at line 44 of file socrates_couple.F90.

◆ y_local

integer socrates_couple_mod::y_local

Definition at line 44 of file socrates_couple.F90.

◆ y_nohalos

integer socrates_couple_mod::y_nohalos

Definition at line 44 of file socrates_couple.F90.

grids_mod::x_index
integer, parameter, public x_index
Definition: grids.F90:14
grids_mod::y_index
integer, parameter, public y_index
Definition: grids.F90:14
logging_mod::log_info
integer, parameter, public log_info
Log INFO, WARNING and ERROR messages.
Definition: logging.F90:13
science_constants_mod::cp
real(kind=default_precision), public cp
Definition: scienceconstants.F90:13
lw_control_mod::lw_control
type(strctrl), save lw_control
Definition: lw_control_mod.F90:19
compress_spectrum
subroutine compress_spectrum(con, spec)
Definition: compress_spectrum.F90:10
grids_mod::z_index
integer, parameter, public z_index
Grid index parameters.
Definition: grids.F90:14
sw_control_mod::sw_control
type(strctrl), save sw_control
Definition: sw_control_mod.F90:19
lw_rad_input_mod::lw_input
subroutine lw_input(current_state, lw_control)
Definition: lw_rad_input_mod.F90:39
logging_mod::log_master_log
subroutine, public log_master_log(level, message)
Will log just from the master process.
Definition: logging.F90:47
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17