MONC
Functions/Subroutines
set_dimen.F90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine set_dimen (control, dimen, spectrum, n_points, model_levels, cloud_levels)
 

Function/Subroutine Documentation

◆ set_dimen()

subroutine set_dimen ( type(strctrl), intent(in)  control,
type(strdim), intent(inout)  dimen,
type (strspecdata), intent(in)  spectrum,
integer, intent(in)  n_points,
integer, intent(in)  model_levels,
integer, intent(in)  cloud_levels 
)

Definition at line 14 of file set_dimen.F90.

16 
17 !!!NEED TO WORK OUT THE GRID FROM MERGE DATA + MODEL LEVELS in CURRENT_STATE
18 
19 USE rad_pcf
20 USE def_control, ONLY: strctrl
21 USE def_dimen, ONLY: strdim
22 USE def_spectrum, ONLY: strspecdata
23 USE ereport_mod, ONLY: ereport
24 USE errormessagelength_mod, ONLY: errormessagelength
25 
26 
27 IMPLICIT NONE
28 
29 
30 ! Control options:
31  TYPE(StrCtrl), INTENT(IN) :: control
32 
33 ! Dimensions:
34  TYPE(StrDim), INTENT(INOUT) :: dimen
35 
36 ! Spectral data:
37  TYPE (StrSpecData), INTENT(IN) :: spectrum
38 
39 INTEGER, INTENT(IN) :: n_points
40 ! Number of grid points to operate on
41 !! MONC: both variables below are irad_levs from the
42 !! def_mcc_profiles.F90 (type)
43 INTEGER, INTENT(IN) :: model_levels
44 ! Number of theta levels in the model
45 INTEGER, INTENT(IN) :: cloud_levels
46 ! Number of potentially cloudy layers in the model
47 
48 INTEGER :: ierr = i_normal
49 CHARACTER (LEN=*), PARAMETER :: RoutineName = 'set_dimen'
50 CHARACTER (LEN=errormessagelength) :: cmessage
51 
52 ! Grid dimensions
53 ! (On some architectures an odd size is preferred to avoid memory
54 ! bank conflicts).
55 dimen%nd_profile = 2*(n_points/2)+1
56 dimen%nd_layer = model_levels
57 
58 ! Cloud
59 dimen%nd_cloud_type = 4
60 dimen%nd_cloud_component = 4
61 dimen%nd_cloud_representation = 4
62 SELECT CASE(control%i_cloud)
63 CASE (ip_cloud_column_max)
64  dimen%nd_column = 3 * cloud_levels + 2
65 CASE DEFAULT
66  dimen%nd_column = 1
67 END SELECT
68 dimen%nd_subcol_gen = 1
69 dimen%nd_subcol_req = 1
70 
71 dimen%id_cloud_top = dimen%nd_layer + 1 - cloud_levels
72 IF (control%l_cloud) THEN
73  dimen%nd_layer_clr = dimen%id_cloud_top - 1
74 ELSE
75  dimen%nd_layer_clr = dimen%nd_layer
76 END IF
77 
78 ! Aerosol
79 dimen%nd_aerosol_mode = 1
80 
81 ! Arrays for prescribed optical properties (not used here)
82 dimen%nd_profile_aerosol_prsc = 1
83 dimen%nd_profile_cloud_prsc = 1
84 dimen%nd_opt_level_aerosol_prsc = 1
85 dimen%nd_opt_level_cloud_prsc = 1
86 
87 
88 ! Tiled surface.
89 dimen%nd_point_tile = max(1,n_points)
90 dimen%nd_tile = 2
91 
92 
93 ! Solver dependent dimensions
94 IF (control%i_angular_integration == ip_two_stream) THEN
95 
96  dimen%nd_viewing_level = 1
97  dimen%nd_radiance_profile = 1
98  dimen%nd_j_profile = 1
99  dimen%nd_direction = 1
100  dimen%nd_brdf_basis_fnc = 2
101  dimen%nd_brdf_trunc = 1
102  dimen%nd_flux_profile = dimen%nd_profile
103  dimen%nd_channel = 1
104 
105  dimen%nd_2sg_profile = dimen%nd_profile
106  dimen%nd_source_coeff = 2
107  dimen%nd_max_order = 1
108  dimen%nd_sph_coeff = 1
109 
110  SELECT CASE(control%i_solver)
111 
112  CASE(ip_solver_mix_app_scat, ip_solver_mix_direct, ip_solver_mix_direct_hogan)
113  dimen%nd_overlap_coeff=8
114  dimen%nd_region=2
115 
116  CASE(ip_solver_triple_app_scat, ip_solver_triple, ip_solver_triple_hogan)
117  dimen%nd_overlap_coeff=18
118  dimen%nd_region=3
119 
120  CASE DEFAULT
121  dimen%nd_overlap_coeff=1
122  dimen%nd_region=2
123 
124  END SELECT
125 
126 ELSE IF (control%i_angular_integration == ip_spherical_harmonic) THEN
127 
128  dimen%nd_direction = 1
129  dimen%nd_brdf_basis_fnc = 2
130  dimen%nd_radiance_profile = dimen%nd_profile
131  dimen%nd_j_profile = 1
132 
133  IF (control%i_sph_mode == ip_sph_mode_flux) THEN
134  dimen%nd_viewing_level = model_levels+1
135  dimen%nd_brdf_trunc = 1
136  dimen%nd_flux_profile = dimen%nd_profile
137 
138  ! When calculating fluxes all spectral bands are mapped into a
139  ! single output channel.
140  dimen%nd_channel = 1
141  ELSE
142  dimen%nd_viewing_level = 1
143  dimen%nd_brdf_trunc = 1
144  dimen%nd_flux_profile = 1
145 
146  ! We assume for now that each band in the spectral file
147  ! corresponds to a particular channel.
148  dimen%nd_channel = spectrum%basic%n_band
149  END IF
150 
151  dimen%nd_2sg_profile = 1
152  dimen%nd_source_coeff = 1
153  dimen%nd_overlap_coeff = 1
154  dimen%nd_region = 1
155  dimen%nd_max_order = control%ls_global_trunc + 2
156  IF (control%i_truncation == ip_trunc_triangular) THEN
157  dimen%nd_sph_coeff = &
158  (control%ls_global_trunc+3)*(control%ls_global_trunc+4)/2
159  ELSE IF (control%i_truncation == ip_trunc_azim_sym) THEN
160  dimen%nd_sph_coeff = control%ls_global_trunc+2
161  ELSE
162  cmessage = 'Illegal truncation'
163  ierr=i_err_fatal
164  GO TO 9999
165  END IF
166 
167 END IF
168 
169 
170 9999 CONTINUE
171 ! Check error condition
172 IF (ierr /= i_normal) THEN
173  CALL ereport(routinename, ierr, cmessage)
174 END IF
175 
Here is the caller graph for this function: