MONC
Functions/Subroutines
set_cld.F90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine set_cld (control, atm, dimen, spectrum, cld, n_profile, n_layer, nclds, socrates_opt, merge_fields)
 

Function/Subroutine Documentation

◆ set_cld()

subroutine set_cld ( type(strctrl), intent(in)  control,
type(stratm), intent(in)  atm,
type(strdim), intent(in)  dimen,
type (strspecdata), intent(in)  spectrum,
type(strcld), intent(out)  cld,
integer, intent(in)  n_profile,
integer, intent(in)  n_layer,
integer, intent(in)  nclds,
type (str_socrates_options), intent(in)  socrates_opt,
type (str_merge_atm), intent(in)  merge_fields 
)

Definition at line 10 of file set_cld.F90.

18 
19 USE rad_pcf
20 USE def_control, ONLY: strctrl
21 USE def_atm, ONLY: stratm
22 USE def_spectrum, ONLY: strspecdata
23 USE def_dimen, ONLY: strdim
24 USE def_cld, ONLY: strcld, allocate_cld, allocate_cld_prsc
25 ! monc-socrates couple structures
28 
29 ! Monc specific modules
31 use logging_mod, only : log_info, log_warn, log_error, &
34 use science_constants_mod, only : pi
35 
36 IMPLICIT NONE
37 
38 ! Control options:
39 TYPE(StrCtrl), INTENT(IN) :: control
40 
41 ! Atmospheric properties:
42 TYPE(StrAtm), INTENT(IN) :: atm
43 
44 ! Dimensions:
45 TYPE(StrDim), INTENT(IN) :: dimen
46 
47 ! Spectral data:
48 TYPE (StrSpecData), INTENT(IN) :: spectrum
49 
50 ! Cloud data:
51 TYPE(StrCld), INTENT(OUT) :: cld
52 
53 ! McClatchey profiles plus monc profiles, flipped
54 type (str_merge_atm), intent(in) :: merge_fields
55 
56 ! MONC options read from configuration
57 type (str_socrates_options), intent(in) :: socrates_opt
58 
59 ! declaration same as that in socrates_init on UM trunk
60 REAL :: &
61  condensed_min_dim(dimen%nd_cloud_component) &
62 ! Minimum dimensions of condensed components
63  , condensed_max_dim(dimen%nd_cloud_component)
64 
65 ! local variables:
66 INTEGER :: &
67  i, j, l &
68 ! loop variable
69  , i_scheme
70 ! parametrization scheme
71 
72 INTEGER, intent(in) :: &
73  n_profile &
74  ! NUMBER OF PROFILES
75  , n_layer &
76  ! Number of layers seen by the radiation code
77  , nclds
78  ! NUMBER OF CLOUDY LEVELS
79 
80 ! Parameters for the aggregate parametrization.
81 REAL, PARAMETER :: a0_agg_cold = 7.5094588e-04
82 REAL, PARAMETER :: b0_agg_cold = 5.0830326e-07
83 REAL, PARAMETER :: a0_agg_warm = 1.3505403e-04
84 REAL, PARAMETER :: b0_agg_warm = 2.6517429e-05
85 REAL, PARAMETER :: t_switch = 216.208
86 REAL, PARAMETER :: t0_agg = 279.5
87 REAL, PARAMETER :: s0_agg = 0.05
88 
89 ! Coefficients for effective size of ice crystal from Sun scheme
90 REAL, PARAMETER :: a1_s=45.9866
91 REAL, PARAMETER :: a2_s=0.2214
92 REAL, PARAMETER :: a3_s=0.7957
93 REAL, PARAMETER :: a4_s=0.2535
94 REAL, PARAMETER :: a5_s=83.15
95 REAL, PARAMETER :: a6_s=1.2351
96 REAL, PARAMETER :: a7_s=0.0105
97 ! Latitude threshold for division of ice crystal correction
98 REAL, PARAMETER :: a8_s=30.0
99 
100 ! Parameters for Baran's diagnostic parameterisation of effective size.
101 ! m and n are the slope and intercept (positive sign), and max and min the
102 ! maximum and minimum values. Values for parameterisation expressed in
103 ! units of metres.
104 REAL, PARAMETER :: m_ice_baran = 1.868e-6
105 REAL, PARAMETER :: n_ice_baran = 353.613e-6
106 REAL, PARAMETER :: min_ice_baran = 7.0e-6
107 REAL, PARAMETER :: max_ice_baran = 156.631e-6
108 
109 ! Variables for liquid re calculation
110 REAL :: beta
111 
112 ! Functions called:
113 INTEGER, EXTERNAL :: set_n_cloud_parameter
114 ! Function to find number of parameters for clouds
115 
116 call allocate_cld(cld, dimen, spectrum)
117 call allocate_cld_prsc(cld, dimen, spectrum)
118 
119 ! Select parametrization for water in stratiform clouds:
120 IF ( (control%i_st_water <= spectrum%dim%nd_drop_type) .AND. &
121  (spectrum%drop%l_drop_type(control%i_st_water)) ) THEN
122  i_scheme=spectrum%drop%i_drop_parm(control%i_st_water)
123  cld%i_condensed_param(ip_clcmp_st_water)=i_scheme
124  cld%condensed_n_phf(ip_clcmp_st_water)= &
125  spectrum%drop%n_phf(control%i_st_water)
126  condensed_min_dim(ip_clcmp_st_water) &
127  =spectrum%drop%parm_min_dim(control%i_st_water)
128  condensed_max_dim(ip_clcmp_st_water) &
129  =spectrum%drop%parm_max_dim(control%i_st_water)
130 ELSE
131  call log_master_log &
132  (log_error, "Socrates error: no data exist for type of selected droplet - STOP")
133 END IF
134 
135 DO i=1, spectrum%basic%n_band
136  ! DEPENDS ON: set_n_cloud_parameter
137  DO j=1, set_n_cloud_parameter(i_scheme &
138  , ip_clcmp_st_water, cld%condensed_n_phf(ip_clcmp_st_water))
139  cld%condensed_param_list(j, ip_clcmp_st_water, i) &
140  =spectrum%drop%parm_list(j, i, control%i_st_water)
141  END DO
142 END DO
143 
144 ! Select parametrization for ice in stratiform clouds:
145 IF ( (control%i_st_ice <= spectrum%dim%nd_ice_type) .AND. &
146  (spectrum%ice%l_ice_type(control%i_st_ice)) ) THEN
147  i_scheme=spectrum%ice%i_ice_parm(control%i_st_ice)
148  cld%i_condensed_param(ip_clcmp_st_ice)=i_scheme
149  cld%condensed_n_phf(ip_clcmp_st_ice)= &
150  spectrum%ice%n_phf(control%i_st_ice)
151  condensed_min_dim(ip_clcmp_st_ice) &
152  =spectrum%ice%parm_min_dim(control%i_st_ice)
153  condensed_max_dim(ip_clcmp_st_ice) &
154  =spectrum%ice%parm_max_dim(control%i_st_ice)
155 ELSE
156  call log_master_log &
157  (log_error, "Socrates error: no data exist for type of ice crystal - STOP")
158 END IF
159 
160 DO i=1, spectrum%basic%n_band
161  ! DEPENDS ON: set_n_cloud_parameter
162  DO j=1, set_n_cloud_parameter(i_scheme &
163  , ip_clcmp_st_ice, cld%condensed_n_phf(ip_clcmp_st_ice))
164  cld%condensed_param_list(j, ip_clcmp_st_ice, i) &
165  = spectrum%ice%parm_list(j, i, control%i_st_ice)
166  END DO
167 END DO
168 
169 IF (socrates_opt%cloud_representation == ip_cloud_ice_water) THEN
170 
171  cld%n_cloud_type=2
172 
173  ! Here the clouds are split into two separate types.
174  ! The partitioning between ice and water is regarded as
175  ! determining the areas within the grid_box covered by
176  ! ice or water cloud, rather than as determining the in-cloud
177  ! mixing ratios. The grid-box mean ice water contents may
178  ! be predicted by the ice microphysics scheme or may be
179  ! determined as a function of the temperature (LSP_FOCWWIL).
180 
181  ! Set the components within the clouds. Here we have two
182  ! components: stratiform ice and water.
183  cld%n_condensed=2
184  cld%type_condensed(1)=ip_clcmp_st_water
185  cld%type_condensed(2)=ip_clcmp_st_ice
186 
187  !DO j=1, n_layer
188  ! DO l=1, n_profile
189  ! cld%condensed_mix_ratio(l, j, ip_clcmp_cnv_water)=0.0e+00
190  ! cld%condensed_mix_ratio(l, j, ip_clcmp_cnv_ice)=0.0e+00
191  ! END DO
192  !END DO
193 
194  ! Stratiform clouds:
195  ! Note: n_layer is the merge_field index and using merge_field so cloud arrays are
196  ! the correct way for the radiation, i.e. k=0 is TOA k=n_layer is surface
197  DO j = 1, n_layer
198  DO l=1, n_profile
199  ! calculate the total_water (ice + water)
200 
201  ! Add the merged fields here
202  IF (merge_fields%total_cloud_fraction(j) > &
203  epsilon(merge_fields%total_cloud_fraction(j))) THEN
204  cld%condensed_mix_ratio(l, j, ip_clcmp_st_water) = &
205  ( merge_fields%ql_n(j) + merge_fields%qi_n(j) )/ &
206  merge_fields%total_cloud_fraction(j)
207  ELSE
208  cld%condensed_mix_ratio(l, j, ip_clcmp_st_water) = 0.0
209  END IF
210  cld%condensed_mix_ratio(l, j, ip_clcmp_st_ice) = &
211  cld%condensed_mix_ratio(l, j, ip_clcmp_st_water)
212  END DO
213  END DO
214  !
215  ! Cloud fractions:
216  !
217  DO j = 1, n_layer
218  DO l=1, n_profile
219  cld%w_cloud(l, j) = merge_fields%total_cloud_fraction(j)
220  ! Partition clouds using the ratio of cloud water contents done
221  ! in merge fields, so set using the merged fields here.
222  cld%frac_cloud(l, j, ip_cloud_type_sw) = merge_fields%liquid_cloud_fraction(j)
223  cld%frac_cloud(l, j, ip_cloud_type_si) = merge_fields%ice_cloud_fraction(j)
224  END DO ! L (N_PROFILE)
225  END DO ! I (N_LAYER)
226 
227  if (socrates_opt%l_fix_re) then
228  DO j = 1, n_layer
229  DO l=1, n_profile
230  cld%condensed_dim_char(l, j, ip_clcmp_cnv_water) = 0.0_default_precision
231  ! AH - convert fixed re from microns to metres
232  cld%condensed_dim_char(l, j, ip_clcmp_st_water) = socrates_opt%fixed_cloud_re * 1.e-6
233  enddo
234  enddo
235  endif
236 
237  if (socrates_opt%l_use_ndrop) then
238  IF (socrates_opt%l_use_liu_spec) THEN
239 !!$ DO j = 1, n_layer
240 !!$ ! Find the total mixing ratio of water substance in the cloud.
241 !!$ DO l=1, n_profile
242 !!$
243 !!$ ! Apply Liu spectral dispersion
244 !!$ beta = aparam &
245 !!$ *((MAX(eps,cld%condensed_mix_ratio(l, j, ip_clcmp_st_water)*atm%density(l,j)*1.0e-3 &
246 !!$ /(merge_fields%cloudnumber_n(j)*1e-06))**(bparam))
247 !!$
248 !!$ cld%condensed_dim_char(l, j, ip_clcmp_cnv_water) = 0.0_DEFAULT_PRECISION
249 !!$ cld%condensed_dim_char(l, j, ip_clcmp_st_water) = MAX(0.0_DEFAULT_PRECISION, &
250 !!$ 3.0_DEFAULT_PRECISION*cld%condensed_mix_ratio(l, j, ip_clcmp_st_water)*atm%density(l, j) &
251 !!$ /(4.0_DEFAULT_PRECISION*pi*socrates_opt%rho_water* &
252 !!$ (beta**(-3.0))*merge_fields%cloudnumber_n(j))) &
253 !!$ **(1.0_DEFAULT_PRECISION/3.0_DEFAULT_PRECISION)
254 !!$ END DO
255 !!$ END DO
256  ELSE
257  ! We only need to find land across n_profile
258  DO j=1, n_layer
259  ! Find the total mixing ratio of water substance in the cloud.
260  DO l=1, n_profile
261  cld%condensed_dim_char(l, j, ip_clcmp_cnv_water) = 0.0_default_precision
262  cld%condensed_dim_char(l, j, ip_clcmp_st_water) = max(0.0_default_precision, &
263  3.0_default_precision*cld%condensed_mix_ratio(l, j, ip_clcmp_st_water) &
264  *atm%density(l, j)/(4.0_default_precision*pi*socrates_opt%rho_water* &
265  socrates_opt%kparam*merge_fields%cloudnumber_n(j)) &
266  **(1.0_default_precision/3.0_default_precision))
267  END DO
268  END DO
269  END IF
270  END if
271 endif
272 
273  ! Constrain the sizes of droplets to lie within the range of
274  ! validity of the parametrization scheme.
275 DO j=1, n_layer
276  DO l=1, n_profile
277  cld%condensed_dim_char(l, j, ip_clcmp_st_water) &
278  =max(condensed_min_dim(ip_clcmp_st_water) &
279  , min(condensed_max_dim(ip_clcmp_st_water) &
280  , cld%condensed_dim_char(l, j, ip_clcmp_st_water)))
281  cld%condensed_dim_char(l, j, ip_clcmp_cnv_water) &
282  =max(condensed_min_dim(ip_clcmp_cnv_water) &
283  , min(condensed_max_dim(ip_clcmp_cnv_water) &
284  , cld%condensed_dim_char(l, j, ip_clcmp_cnv_water)))
285 
286  cld%condensed_dim_char(l, j, ip_clcmp_st_ice) = 0.0
287  END DO
288 
289 END DO
290 
291 ! SET THE CHARACTERISTIC DIMENSIONS OF ICE CRYSTALS:
292 
293 ! ICE CRYSTALS IN STRATIFORM CLOUDS:
294 
295 SELECT CASE (cld%i_condensed_param(ip_clcmp_st_ice))
296 
297 CASE (ip_ice_agg_de, ip_ice_agg_de_sun)
298 
299  ! Aggregate parametrization based on effective dimension.
300  ! In the initial form, the same approach is used for stratiform
301  ! and convective cloud.
302 
303  ! The fit provided here is based on Stephan Havemann's fit of
304  ! Dge with temperature, consistent with David Mitchell's treatment
305  ! of the variation of the size distribution with temperature. The
306  ! parametrization of the optical properties is based on De
307  ! (=(3/2)volume/projected area), whereas Stephan's fit gives Dge
308  ! (=(2*SQRT(3)/3)*volume/projected area), which explains the
309  ! conversion factor. The fit to Dge is in two sections, because
310  ! Mitchell's relationship predicts a cusp at 216.208 K. Limits
311  ! of 8 and 124 microns are imposed on Dge: these are based on this
312  ! relationship and should be reviewed if it is changed. Note also
313  ! that the relationship given here is for polycrystals only.
314  DO i=1, n_layer
315  DO l=1, n_profile
316  ! Preliminary calculation of Dge.
317  IF (atm%t(l, i) < t_switch) THEN
318  cld%condensed_dim_char(l, i, ip_clcmp_st_ice) &
319  = a0_agg_cold*exp(s0_agg*(atm%t(l, i)-t0_agg))+b0_agg_cold
320  ELSE
321  cld%condensed_dim_char(l, i, ip_clcmp_st_ice) &
322  = a0_agg_warm*exp(s0_agg*(atm%t(l, i)-t0_agg))+b0_agg_warm
323  END IF
324  ! Limit and convert to De.
325  cld%condensed_dim_char(l, i, ip_clcmp_st_ice) &
326  = (3.0/2.0)*(3.0/(2.0*sqrt(3.0)))* &
327  min(1.24e-04, max(8.0e-06, &
328  cld%condensed_dim_char(l, i, ip_clcmp_st_ice)))
329  END DO
330  END DO
331 
332 END SELECT ! I_CONDENSED_PARAM(IP_CLCMP_ST_ICE)
333 !
334 ! CONSTRAIN THE SIZES OF ICE CRYSTALS TO LIE WITHIN THE RANGE
335 ! OF VALIDITY OF THE PARAMETRIZATION SCHEME.
336 DO i=1, n_layer
337  DO l=1, n_profile
338  cld%condensed_dim_char(l, i, ip_clcmp_st_ice) &
339  =max(condensed_min_dim(ip_clcmp_st_ice) &
340  , min(condensed_max_dim(ip_clcmp_st_ice) &
341  , cld%condensed_dim_char(l, i, ip_clcmp_st_ice)))
342  cld%condensed_dim_char(l, i, ip_clcmp_cnv_ice) &
343  =max(condensed_min_dim(ip_clcmp_cnv_ice) &
344  , min(condensed_max_dim(ip_clcmp_cnv_ice) &
345  , cld%condensed_dim_char(l, i, ip_clcmp_cnv_ice)))
346  END DO
347 END DO
348 
349 
Here is the call graph for this function:
Here is the caller graph for this function:
logging_mod::log_error
integer, parameter, public log_error
Only log ERROR messages.
Definition: logging.F90:11
logging_mod::log_warn
integer, parameter, public log_warn
Log WARNING and ERROR messages.
Definition: logging.F90:12
logging_mod::log_info
integer, parameter, public log_info
Log INFO, WARNING and ERROR messages.
Definition: logging.F90:13
logging_mod::log_log
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
Definition: logging.F90:75
logging_mod::log_get_logging_level
integer function, public log_get_logging_level()
Retrieves the current logging level.
Definition: logging.F90:122
logging_mod::log_debug
integer, parameter, public log_debug
Log DEBUG, INFO, WARNING and ERROR messages.
Definition: logging.F90:14
def_merge_atm::str_merge_atm
Definition: def_merge_atm.F90:10
science_constants_mod
Scientific constant values used throughout simulations. Each has a default value and this can be over...
Definition: scienceconstants.F90:3
def_socrates_options::str_socrates_options
Definition: def_socrates_options.F90:7
logging_mod
Logging utility.
Definition: logging.F90:2
datadefn_mod
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
logging_mod::log_master_log
subroutine, public log_master_log(level, message)
Will log just from the master process.
Definition: logging.F90:47
def_socrates_options
Definition: def_socrates_options.F90:1
def_merge_atm
Definition: def_merge_atm.F90:1
science_constants_mod::pi
real(kind=default_precision), public pi
Definition: scienceconstants.F90:13
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