MONC
lw_rad_input_mod.F90
Go to the documentation of this file.
1 ! *****************************COPYRIGHT*******************************
2 ! (C) Crown copyright Met Office. All rights reserved.
3 ! For further details please refer to the file COPYRIGHT.txt
4 ! which you should have received as part of this distribution.
5 ! *****************************COPYRIGHT*******************************
6 ! Input control for lw radiation.
7 
8 ! Description:
9 ! Module containing control as used by the lw radiation code.
10 
11 ! Code Owner: Please refer to the UM file CodeOwners.txt
12 ! This file belongs in section: Radiation Control
13 
14 ! Code Description:
15 ! Language: FORTRAN 90
16 ! This code is written to UMDP
17 
19 
20 !USE lw_control_mod, ONLY: lw_control
22 USE missing_data_mod, ONLY: imdi
23 USE yomhook, ONLY: lhook, dr_hook
24 USE parkind1, ONLY: jprb, jpim
25 USE errormessagelength_mod, ONLY: errormessagelength
26 
27 IMPLICIT NONE
28 
29 !DrHook-related parameters
30 INTEGER(KIND=jpim), PARAMETER, PRIVATE :: zhook_in = 0
31 INTEGER(KIND=jpim), PARAMETER, PRIVATE :: zhook_out = 1
32 
33 ! ----------------------------------------------------------------
34 CONTAINS
35 
36 ! Subroutine to set the input values of the lw control structure.
37 
38 SUBROUTINE lw_input(current_state, lw_control)
39 
40 USE rad_pcf, ONLY: ip_cloud_mix_max, ip_cloud_mix_random, &
41  ip_cloud_triple, ip_cloud_part_corr, ip_cloud_part_corr_cnv, &
42  ip_cloud_mcica, ip_cloud_clear, &
43  ip_solver_homogen_direct, ip_solver_mix_direct_hogan, &
44  ip_solver_triple_hogan, ip_solver_triple_app_scat, &
45  ip_solver_mix_app_scat, ip_solver_no_scat, &
46  ip_cloud_homogen, ip_cloud_ice_water, ip_cloud_conv_strat, &
47  ip_cloud_csiw, &
48  ip_scaling, ip_mcica, &
49  ip_max_rand, ip_exponential_rand, ip_rand, &
50  ip_scatter_approx, ip_no_scatter_abs, ip_no_scatter_ext
51 USE ereport_mod, ONLY: ereport
52 USE def_control, ONLY: strctrl
53 
54 use state_mod, only : model_state_type
57 
58 IMPLICIT NONE
59 
60 type(model_state_type), target, intent(inout) :: current_state
61 
62 TYPE(strctrl), INTENT(INOUT) :: lw_control
63 
64 INTEGER :: j, &
65  errorstatus ! Return code : 0 Normal Exit : >0 Error
66 INTEGER :: namelist_unit
67 
68 REAL(KIND=jprb) :: zhook_handle
69 
70 CHARACTER(LEN=*) :: RoutineName
71 parameter( routinename='lw_rad_input_mod')
72 CHARACTER(LEN=errormessagelength) :: CMessage ! Error message if Errorstatus >0
73 
74 IF (lhook) CALL dr_hook('LW_INPUT',zhook_in,zhook_handle)
75 
76 ! Set default values of control variables.
77 
78 CALL lw_control_default(lw_control)
79 
80  lw_control%spectral_file = &
81  adjustl(options_get_string(current_state%options_database, "spectral_file_lw"))
82  lw_control%i_gas_overlap = &
83  options_get_integer(current_state%options_database, "i_gas_overlap_lw")
84  lw_control%i_cloud_representation = &
85  options_get_integer(current_state%options_database, "i_cloud_representation")
86  lw_control%i_st_water = &
87  options_get_integer(current_state%options_database, "i_water_lw")
88  lw_control%i_st_ice = &
89  options_get_integer(current_state%options_database, "i_ice_lw")
90  lw_control%i_scatter_method = &
91  options_get_integer(current_state%options_database, "i_scatter_method_lw")
92 
93 ! Set i_cloud from combination of i_overlap and i_representation
94 
95  IF (lw_control%i_cloud_representation == ip_cloud_homogen) THEN
96 
97  lw_control%i_solver=ip_solver_homogen_direct
98  IF (lw_control%i_inhom == ip_mcica) THEN
99  ! The code below builds but if options is selected, MONC WILL NOT
100  ! run as other modules required - AH, 26/06/15
101  lw_control%i_cloud=ip_cloud_mcica
102  ELSE
103  IF (lw_control%i_overlap == ip_max_rand) THEN
104  lw_control%i_cloud=ip_cloud_mix_max
105  ELSE IF (lw_control%i_overlap == ip_exponential_rand) THEN
106  lw_control%i_cloud=ip_cloud_part_corr
107  ELSE IF (lw_control%i_overlap == ip_rand) THEN
108  lw_control%i_cloud=ip_cloud_mix_random
109  ELSE
110  errorstatus = 100
111  cmessage = 'The selected cloud overlap is not available'
112  CALL ereport(routinename, errorstatus, cmessage)
113  END IF
114  END IF
115 
116  ELSE IF (lw_control%i_cloud_representation == ip_cloud_ice_water) THEN
117 
118  IF (lw_control%i_inhom == ip_mcica) THEN
119  lw_control%i_cloud=ip_cloud_mcica
120  IF ( (lw_control%i_scatter_method == ip_no_scatter_abs) .OR. &
121  (lw_control%i_scatter_method == ip_no_scatter_ext) ) THEN
122  ! The code below builds but if options is selected, MONC WILL NOT
123  ! run as other modules required - AH, 26/06/15
124  lw_control%i_solver =ip_solver_no_scat
125  lw_control%i_solver_clear=ip_solver_no_scat
126  ELSE
127  lw_control%i_solver=ip_solver_homogen_direct
128  END IF
129  ELSE
130  IF (lw_control%i_scatter_method == ip_scatter_approx) THEN
131  lw_control%i_solver=ip_solver_mix_app_scat
132  ELSE
133  lw_control%i_solver=ip_solver_mix_direct_hogan
134  END IF
135  IF (lw_control%i_overlap == ip_max_rand) THEN
136  lw_control%i_cloud=ip_cloud_mix_max
137  ELSE IF (lw_control%i_overlap == ip_exponential_rand) THEN
138  lw_control%i_cloud=ip_cloud_part_corr
139  ELSE IF (lw_control%i_overlap == ip_rand) THEN
140  lw_control%i_cloud=ip_cloud_mix_random
141  ELSE
142  errorstatus = 100
143  cmessage = 'The selected cloud overlap is not available'
144  CALL ereport(routinename, errorstatus, cmessage)
145  END IF
146  END IF
147 
148  ELSE IF ((lw_control%i_cloud_representation == ip_cloud_conv_strat) .OR. &
149  (lw_control%i_cloud_representation == ip_cloud_csiw)) THEN
150 
151  IF (lw_control%i_inhom == ip_mcica) THEN
152  errorstatus = 100
153  cmessage = 'McICA is not compatible with the selected'// &
154  ' cloud representation'
155  CALL ereport(routinename, errorstatus, cmessage)
156  ELSE
157  IF (lw_control%i_scatter_method == ip_scatter_approx) THEN
158  lw_control%i_solver=ip_solver_triple_app_scat
159  ELSE
160  lw_control%i_solver=ip_solver_triple_hogan
161  END IF
162  IF (lw_control%i_overlap == ip_max_rand) THEN
163  lw_control%i_cloud=ip_cloud_triple
164  ELSE IF (lw_control%i_overlap == ip_exponential_rand) THEN
165  lw_control%i_cloud=ip_cloud_part_corr_cnv
166  ELSE IF (lw_control%i_overlap == ip_rand) THEN
167  lw_control%i_cloud=ip_cloud_mix_random
168  ELSE
169  errorstatus = 100
170  cmessage = 'The selected cloud overlap is not available'
171  CALL ereport(routinename, errorstatus, cmessage)
172  END IF
173  END IF
174 
175  ELSE
176 
177  ! No treatment of cloud for LW radiation
178  lw_control%l_cloud=.false.
179  lw_control%i_cloud=ip_cloud_clear
180  IF ( (lw_control%i_scatter_method == ip_no_scatter_abs) .OR. &
181  (lw_control%i_scatter_method == ip_no_scatter_ext) ) THEN
182  lw_control%i_solver =ip_solver_no_scat
183  lw_control%i_solver_clear=ip_solver_no_scat
184  ELSE
185  lw_control%i_solver=ip_solver_homogen_direct
186  END IF
187  lw_control%l_microphysics=.false.
188  END IF
189 
190 IF (lhook) CALL dr_hook('LW_INPUT',zhook_out,zhook_handle)
191 
192 END SUBROUTINE lw_input
193 
194 END MODULE lw_rad_input_mod
parkind1
Definition: parkind1.F90:7
lw_rad_input_mod::zhook_in
integer(kind=jpim), parameter, private zhook_in
Definition: lw_rad_input_mod.F90:30
lw_control_default_mod
Definition: lw_control_default_mod.F90:16
yomhook
Definition: yomhook.F90:7
lw_control_default_mod::lw_control_default
subroutine lw_control_default(lw_control)
Definition: lw_control_default_mod.F90:21
optionsdatabase_mod::options_get_integer
integer function, public options_get_integer(options_database, key, index)
Retrieves an integer value from the database that matches the provided key.
Definition: optionsdatabase.F90:217
parkind1::jprb
integer, parameter jprb
Definition: parkind1.F90:24
lw_rad_input_mod::zhook_out
integer(kind=jpim), parameter, private zhook_out
Definition: lw_rad_input_mod.F90:31
yomhook::lhook
logical, parameter lhook
Definition: yomhook.F90:22
optionsdatabase_mod::options_get_string
character(len=string_length) function, public options_get_string(options_database, key, index)
Retrieves a string value from the database that matches the provided key.
Definition: optionsdatabase.F90:280
lw_rad_input_mod
Definition: lw_rad_input_mod.F90:18
state_mod::model_state_type
The ModelState which represents the current state of a run.
Definition: state.F90:39
yomhook::dr_hook
subroutine dr_hook(name, code, handle)
Definition: yomhook.F90:27
optionsdatabase_mod::options_get_logical
logical function, public options_get_logical(options_database, key, index)
Retrieves a logical value from the database that matches the provided key.
Definition: optionsdatabase.F90:154
lw_rad_input_mod::lw_input
subroutine lw_input(current_state, lw_control)
Definition: lw_rad_input_mod.F90:39
missing_data_mod::imdi
integer, parameter imdi
Definition: missing_data_mod.F90:32
missing_data_mod
Definition: missing_data_mod.F90:18
parkind1::jpim
integer, parameter jpim
Definition: parkind1.F90:23
optionsdatabase_mod
Manages the options database. Contains administration functions and deduce runtime options from the c...
Definition: optionsdatabase.F90:7
optionsdatabase_mod::options_get_real
real(kind=default_precision) function, public options_get_real(options_database, key, index)
Retrieves a real value from the database that matches the provided key.
Definition: optionsdatabase.F90:91
state_mod
The model state which represents the current state of a run.
Definition: state.F90:2