24 real(kind=DEFAULT_PRECISION),
dimension(:),
allocatable :: &
29 real(kind=DEFAULT_PRECISION),
dimension(:),
allocatable :: &
34 real(kind=DEFAULT_PRECISION) ::
qlcrit 82 type(model_state_type),
target,
intent(inout) :: current_state
86 if (.not. is_component_enabled(current_state%options_database,
"smagorinsky"))
then 87 call log_master_log(log_error,
"Subgrid model diags requested but subgrid model not enabled - check config")
90 total_points=(current_state%local_grid%size(y_index) * current_state%local_grid%size(x_index))
92 allocate(
uwsg_tot(current_state%local_grid%size(z_index)) &
93 ,
vwsg_tot(current_state%local_grid%size(z_index)) &
94 ,
uusg_tot(current_state%local_grid%size(z_index)) &
95 ,
vvsg_tot(current_state%local_grid%size(z_index)) &
96 ,
wwsg_tot(current_state%local_grid%size(z_index)) &
97 ,
tkesg_tot(current_state%local_grid%size(z_index)) &
98 ,
wtsg_tot(current_state%local_grid%size(z_index)) &
99 ,
th2sg_tot(current_state%local_grid%size(z_index)) &
100 ,
wqsg_tot(current_state%local_grid%size(z_index)) )
103 allocate(
dissipation(current_state%local_grid%size(z_index)))
104 allocate(
epsth(current_state%local_grid%size(z_index)))
105 allocate(
ssq(current_state%local_grid%size(z_index)))
106 allocate(
elamr_sq(current_state%local_grid%size(z_index)))
108 allocate(
subgrid_tke(current_state%local_grid%size(z_index)))
111 if (.not. current_state%passive_q .and. current_state%number_q_fields .gt. 0)
then 112 iqv=get_q_index(standard_q_names%VAPOUR,
'subgrid_profile_diags')
113 iql=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'subgrid_profile_diags')
114 qlcrit=options_get_real(current_state%options_database,
"qlcrit")
120 type(model_state_type),
target,
intent(inout) :: current_state
124 if (current_state%first_timestep_column)
then 136 if (.not. current_state%halo_column)
then 138 do k=1, current_state%local_grid%size(z_index)-1
143 current_state%vis_coefficient%data(k,current_state%column_local_y,current_state%column_local_x-1) * &
144 ( current_state%u%data(k+1,current_state%column_local_y,current_state%column_local_x-1) - &
145 current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1) ) * &
146 current_state%global_grid%configuration%vertical%rdzn(k+1)
148 current_state%vis_coefficient%data(k,current_state%column_local_y,current_state%column_local_x) * &
149 ( current_state%u%data(k+1,current_state%column_local_y,current_state%column_local_x) - &
150 current_state%u%data(k,current_state%column_local_y,current_state%column_local_x) ) * &
151 current_state%global_grid%configuration%vertical%rdzn(k+1)
156 current_state%vis_coefficient%data(k,current_state%column_local_y-1,current_state%column_local_x) * &
157 ( current_state%v%data(k+1,current_state%column_local_y-1,current_state%column_local_x) - &
158 current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x) ) * &
159 current_state%global_grid%configuration%vertical%rdzn(k+1)
161 current_state%vis_coefficient%data(k,current_state%column_local_y,current_state%column_local_x) * &
162 ( current_state%v%data(k+1,current_state%column_local_y,current_state%column_local_x) - &
163 current_state%v%data(k,current_state%column_local_y,current_state%column_local_x) ) * &
164 current_state%global_grid%configuration%vertical%rdzn(k+1)
169 if (current_state%th%active)
then 170 do k=1, current_state%local_grid%size(z_index)-1
172 current_state%diff_coefficient%data(k,current_state%column_local_y,current_state%column_local_x) * &
173 ( current_state%th%data(k+1,current_state%column_local_y,current_state%column_local_x) + &
174 current_state%global_grid%configuration%vertical%thref(k+1) - &
175 current_state%th%data(k,current_state%column_local_y,current_state%column_local_x) - &
176 current_state%global_grid%configuration%vertical%thref(k) ) * &
177 current_state%global_grid%configuration%vertical%rdzn(k+1)
182 if (current_state%th%active .and. .not. current_state%passive_q .and. current_state%number_q_fields .gt. 0)
then 184 do k=1, current_state%local_grid%size(z_index)-1
193 ri_crit = 0.25_default_precision
195 ssq=calculate_half_squared_strain_rate(current_state, current_state%u, current_state%v, current_state%w)
196 richardson_number=calculate_richardson_number(current_state,
ssq, current_state%th, current_state%q)
198 do k=2, current_state%local_grid%size(z_index)-1
202 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) &
205 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) / &
207 current_state%diff_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) / &
208 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) )
213 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) - &
215 current_state%diff_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) )
233 if (current_state%th%active)
then 234 epsth=calculate_thermal_dissipation_rate(current_state, current_state%th)
237 do k=2, current_state%local_grid%size(z_index)-1
253 type(model_state_type),
target,
intent(inout) :: current_state
254 character(len=*),
intent(in) :: name
255 type(component_field_information_type),
intent(out) :: field_information
257 field_information%field_type=component_array_field_type
258 field_information%number_dimensions=1
259 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
260 field_information%data_type=component_double_data_type
262 if (name .eq.
"th2sg_total_local")
then 263 field_information%enabled=current_state%th%active
264 else if (name .eq.
"wqsg_total_local")
then 265 field_information%enabled= (.not.current_state%passive_q) .and. &
266 (current_state%liquid_water_mixing_ratio_index > 0)
269 else if (name .eq.
"i_th2sg_total_local")
then 270 field_information%enabled=current_state%th%active
271 else if (name .eq.
"i_wqsg_total_local")
then 272 field_information%enabled= (.not.current_state%passive_q) .and. &
273 (current_state%liquid_water_mixing_ratio_index > 0)
276 field_information%enabled=.true.
285 type(model_state_type),
target,
intent(inout) :: current_state
286 character(len=*),
intent(in) :: name
287 type(component_field_value_type),
intent(out) :: field_value
291 if (name .eq.
"uwsg_total_local")
then 292 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
293 do k = 1, current_state%local_grid%size(z_index)
294 field_value%real_1d_array(k)=
uwsg_tot(k)
296 else if (name .eq.
"vwsg_total_local")
then 297 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
298 do k = 1, current_state%local_grid%size(z_index)
299 field_value%real_1d_array(k)=
vwsg_tot(k)
301 else if (name .eq.
"uusg_total_local")
then 302 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
303 do k = 1, current_state%local_grid%size(z_index)
304 field_value%real_1d_array(k)=
uusg_tot(k)
306 else if (name .eq.
"vvsg_total_local")
then 307 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
308 do k = 1, current_state%local_grid%size(z_index)
309 field_value%real_1d_array(k)=
vvsg_tot(k)
311 else if (name .eq.
"wwsg_total_local")
then 312 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
313 do k = 1, current_state%local_grid%size(z_index)
314 field_value%real_1d_array(k)=
wwsg_tot(k)
316 else if (name .eq.
"tkesg_total_local")
then 317 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
318 do k = 1, current_state%local_grid%size(z_index)
319 field_value%real_1d_array(k)=
tkesg_tot(k)
321 else if (name .eq.
"wtsg_total_local")
then 322 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
323 do k = 1, current_state%local_grid%size(z_index)
324 field_value%real_1d_array(k)=
wtsg_tot(k)
326 else if (name .eq.
"th2sg_total_local")
then 327 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
328 do k = 1, current_state%local_grid%size(z_index)
329 field_value%real_1d_array(k)=
th2sg_tot(k)
331 else if (name .eq.
"wqsg_total_local")
then 332 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
333 do k = 1, current_state%local_grid%size(z_index)
334 field_value%real_1d_array(k)=
wqsg_tot(k)
338 else if (name .eq.
"i_uwsg_total_local")
then 339 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
340 do k = 1, current_state%local_grid%size(z_index)
341 field_value%real_1d_array(k)=
uwsg_tot(k)
343 else if (name .eq.
"i_vwsg_total_local")
then 344 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
345 do k = 1, current_state%local_grid%size(z_index)
346 field_value%real_1d_array(k)=
vwsg_tot(k)
348 else if (name .eq.
"i_uusg_total_local")
then 349 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
350 do k = 1, current_state%local_grid%size(z_index)
351 field_value%real_1d_array(k)=
uusg_tot(k)
353 else if (name .eq.
"i_vvsg_total_local")
then 354 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
355 do k = 1, current_state%local_grid%size(z_index)
356 field_value%real_1d_array(k)=
vvsg_tot(k)
358 else if (name .eq.
"i_wwsg_total_local")
then 359 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
360 do k = 1, current_state%local_grid%size(z_index)
361 field_value%real_1d_array(k)=
wwsg_tot(k)
363 else if (name .eq.
"i_tkesg_total_local")
then 364 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
365 do k = 1, current_state%local_grid%size(z_index)
366 field_value%real_1d_array(k)=
tkesg_tot(k)
368 else if (name .eq.
"i_wtsg_total_local")
then 369 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
370 do k = 1, current_state%local_grid%size(z_index)
371 field_value%real_1d_array(k)=
wtsg_tot(k)
373 else if (name .eq.
"i_th2sg_total_local")
then 374 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
375 do k = 1, current_state%local_grid%size(z_index)
376 field_value%real_1d_array(k)=
th2sg_tot(k)
378 else if (name .eq.
"i_wqsg_total_local")
then 379 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)))
380 do k = 1, current_state%local_grid%size(z_index)
381 field_value%real_1d_array(k)=
wqsg_tot(k)
integer, parameter, public component_scalar_field_type
real(kind=default_precision), dimension(:), allocatable vwsg_tot
real(kind=default_precision), dimension(:), allocatable wwsg_tot
subroutine field_information_retrieval_callback(current_state, name, field_information)
Field information retrieval callback, this returns information for a specific components published fi...
Wrapper type for the value returned for a published field from a component.
real(kind=default_precision), dimension(:), allocatable dissipation
type(standard_q_names_type), public standard_q_names
real(kind=default_precision) function, dimension(current_state%local_grid%size(z_index)), public calculate_thermal_dissipation_rate(current_state, th)
integer, parameter, public log_error
Only log ERROR messages.
real(kind=default_precision) function, dimension(current_state%local_grid%size(z_index)), public calculate_half_squared_strain_rate(current_state, u, v, w)
Calculates the half squared strain rate on l_w-points which is used in determining the Richardson num...
subroutine initialisation_callback(current_state)
real(kind=default_precision), dimension(:), allocatable epsth
real(kind=default_precision) a2_n
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
integer, parameter, public z_index
Grid index parameters.
Calculates the Smagorinsky eddy viscosity and diffusivity at l_w-points.
Contains common definitions for the data and datatypes used by MONC.
The ModelState which represents the current state of a run.
logical function, public is_component_enabled(options_database, component_name)
Determines whether or not a specific component is registered and enabled.
subroutine, public log_master_log(level, message)
Will log just from the master process.
real(kind=default_precision), dimension(:), allocatable wqsg_tot
real(kind=default_precision), dimension(:), allocatable uwsg_tot
Description of a component.
integer, parameter, public component_array_field_type
real(kind=default_precision) function, dimension(current_state%local_grid%size(z_index)), public calculate_richardson_number(current_state, ssq, th, q)
Calculates the richardson number depending upon the setup of the model and the method selected...
real(kind=default_precision) ath2_n
subroutine field_value_retrieval_callback(current_state, name, field_value)
Field value retrieval callback, this returns the value of a specific published field.
This manages the Q variables and specifically the mapping between names and the index that they are s...
real(kind=default_precision), dimension(:), allocatable elamr_sq
real(kind=default_precision), dimension(:), allocatable wtsg_tot
Interfaces and types that MONC components must specify.
type(component_descriptor_type) function, public subgrid_profile_diagnostics_get_descriptor()
Provides the component descriptor for the core to register.
real(kind=default_precision), dimension(:), allocatable th2sg_tot
real(kind=default_precision), dimension(:), allocatable uusg_tot
integer, parameter, public component_integer_data_type
integer, parameter, public log_warn
Log WARNING and ERROR messages.
real(kind=default_precision), dimension(:), allocatable ssq
real(kind=default_precision) ri_crit
subroutine timestep_callback(current_state)
real(kind=default_precision) qlcrit
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.
real(kind=default_precision), dimension(:), allocatable richardson_number
Functionality to support the different types of grid and abstraction between global grids and local o...
Manages the options database. Contains administration functions and deduce runtime options from the c...
real(kind=default_precision) pr_n
real(kind=default_precision), dimension(:), allocatable vvsg_tot
real(kind=default_precision), dimension(:), allocatable tkesg_tot
real(kind=default_precision), dimension(:), allocatable subgrid_tke
The model state which represents the current state of a run.
integer, parameter, public y_index
integer, parameter, public x_index
integer function, public get_q_index(name, assigning_component)
Add in a new entry into the register if the name does not already exist or return the index of the pr...
integer, parameter, public component_double_data_type