18 real(kind=DEFAULT_PRECISION),
dimension(:),
allocatable ::
tempfac 19 real(kind=DEFAULT_PRECISION) ::
qlcrit 20 real(kind=DEFAULT_PRECISION),
dimension(:,:),
allocatable ::
vwp,
lwp,
wmax,
wmin, &
55 type(model_state_type),
target,
intent(inout) :: current_state
58 integer :: y_size_local, x_size_local
61 qlcrit=options_get_real(current_state%options_database,
"qlcrit")
63 y_size_local = current_state%local_grid%size(y_index)
64 x_size_local = current_state%local_grid%size(x_index)
69 allocate(
vwp(y_size_local, x_size_local),
lwp(y_size_local, x_size_local), &
70 wmax(y_size_local, x_size_local),
wmin(y_size_local, x_size_local), &
71 qlmax(y_size_local, x_size_local),
hqlmax(y_size_local, x_size_local), &
72 cltop(y_size_local, x_size_local),
clbas(y_size_local, x_size_local), &
73 senhf(y_size_local, x_size_local),
lathf(y_size_local, x_size_local))
75 allocate(
tempfac(current_state%local_grid%size(z_index)))
77 do k=2, current_state%local_grid%size(z_index)
78 tempfac(k)=current_state%global_grid%configuration%vertical%dz(k)*&
79 current_state%global_grid%configuration%vertical%rhon(k)
85 type(model_state_type),
target,
intent(inout) :: current_state
88 integer :: current_y_index, current_x_index, target_x_index, target_y_index
90 current_y_index=current_state%column_local_y
91 current_x_index=current_state%column_local_x
92 target_y_index=current_y_index-current_state%local_grid%halo_size(y_index)
93 target_x_index=current_x_index-current_state%local_grid%halo_size(x_index)
95 if (current_state%first_timestep_column)
then 118 if (.not. current_state%halo_column)
then 119 if (current_state%number_q_fields .gt. 0)
then 123 if (current_state%liquid_water_mixing_ratio_index .gt. 0 .and. &
124 current_state%number_q_fields .ge. current_state%liquid_water_mixing_ratio_index)
then 125 qlmax(target_y_index, target_x_index) = &
126 maxval(current_state%q(current_state%liquid_water_mixing_ratio_index)%data &
127 (:,current_y_index, current_x_index))
136 do k = 2, current_state%local_grid%size(z_index)
137 if (current_state%q(current_state%liquid_water_mixing_ratio_index)%data(k, &
138 current_y_index, current_x_index) .gt.
qlcrit)
then 139 cltop(target_y_index, target_x_index) = &
140 current_state%global_grid%configuration%vertical%zn(k)
142 if (current_state%q(current_state%liquid_water_mixing_ratio_index)%data( &
143 current_state%local_grid%size(z_index)+1-k, current_y_index, current_x_index) .gt. &
145 clbas(target_y_index, target_x_index)= &
146 current_state%global_grid%configuration%vertical%zn(current_state%local_grid%size(z_index)+1-k)
152 if (current_state%water_vapour_mixing_ratio_index .gt. 0 .and. &
153 current_state%number_q_fields .ge. current_state%water_vapour_mixing_ratio_index)
then 154 do k = 2, current_state%local_grid%size(z_index)
155 vwp(target_y_index, target_x_index)=
vwp(target_y_index, target_x_index) &
156 +
tempfac(k)*current_state%q(current_state%water_vapour_mixing_ratio_index)%data(k, &
157 current_y_index, current_x_index)
158 lwp(target_y_index, target_x_index)=
lwp(target_y_index, target_x_index) &
159 +
tempfac(k)*current_state%q(current_state%liquid_water_mixing_ratio_index)%data(k, &
160 current_y_index, current_x_index)
166 if (current_state%use_surface_boundary_conditions)
then 167 if (current_state%water_vapour_mixing_ratio_index .gt. 0 .and. &
168 current_state%number_q_fields .ge. current_state%water_vapour_mixing_ratio_index)
then 169 lathf(target_y_index, target_x_index)= (current_state%diff_coefficient%data(1, current_y_index, current_x_index) * &
170 current_state%global_grid%configuration%vertical%rdzn(2) * &
171 (current_state%q(current_state%water_vapour_mixing_ratio_index)%data(1,current_y_index,current_x_index) - &
172 current_state%q(current_state%water_vapour_mixing_ratio_index)%data(2,current_y_index,current_x_index))) &
173 * rlvap * current_state%global_grid%configuration%vertical%rhon(1)
176 if (current_state%th%active)
then 177 senhf(target_y_index, target_x_index)=(current_state%diff_coefficient%data(1, current_y_index, current_x_index) &
178 * current_state%global_grid%configuration%vertical%rdzn(2) &
179 * (current_state%th%data(1, current_y_index, current_x_index) &
180 - current_state%th%data(2, current_y_index, current_x_index) &
181 - current_state%global_grid%configuration%vertical%dthref(1))) &
182 * current_state%global_grid%configuration%vertical%rhon(1)*cp
185 wmax(target_y_index, target_x_index)=maxval(current_state%w%data(:, current_y_index, current_x_index))
186 wmin(target_y_index, target_x_index)=minval(current_state%w%data(:, current_y_index, current_x_index))
195 type(model_state_type),
target,
intent(inout) :: current_state
196 character(len=*),
intent(in) :: name
197 type(component_field_information_type),
intent(out) :: field_information
199 field_information%field_type=component_array_field_type
200 field_information%number_dimensions=2
201 field_information%dimension_sizes(1)=current_state%local_grid%size(y_index)
202 field_information%dimension_sizes(2)=current_state%local_grid%size(x_index)
203 field_information%data_type=component_double_data_type
205 if (name .eq.
"senhf_local")
then 206 field_information%enabled=current_state%use_surface_boundary_conditions .and. current_state%th%active
207 else if (name .eq.
"lathf_local")
then 208 field_information%enabled=current_state%use_surface_boundary_conditions .and. &
209 current_state%water_vapour_mixing_ratio_index .gt. 0 .and. &
210 current_state%number_q_fields .ge. current_state%water_vapour_mixing_ratio_index
211 else if (name .eq.
"cltop_local" .or. name .eq.
"clbas_local")
then 212 field_information%enabled=current_state%number_q_fields .gt. 0
213 else if (name .eq.
"qlmax_local")
then 214 field_information%enabled=current_state%number_q_fields .gt. 0 .and. current_state%liquid_water_mixing_ratio_index .gt. 0 &
215 .and. current_state%number_q_fields .ge. current_state%liquid_water_mixing_ratio_index
216 else if (name .eq.
"vwp_local" .or. name .eq.
"lwp_local")
then 217 field_information%enabled=current_state%number_q_fields .gt. 0 .and. current_state%water_vapour_mixing_ratio_index .gt. 0 &
218 .and. current_state%number_q_fields .ge. current_state%water_vapour_mixing_ratio_index
220 field_information%enabled=.true.
230 type(model_state_type),
target,
intent(inout) :: current_state
231 character(len=*),
intent(in) :: name
232 type(component_field_value_type),
intent(out) :: field_value
236 if (name .eq.
"wmax_local")
then 237 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
238 current_state%local_grid%size(x_index)))
239 field_value%real_2d_array(:,:)=
wmax(:,:)
240 else if (name .eq.
"wmin_local")
then 241 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
242 current_state%local_grid%size(x_index)))
243 field_value%real_2d_array(:,:)=
wmin(:,:)
244 else if (name .eq.
"qlmax_local")
then 245 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
246 current_state%local_grid%size(x_index)))
247 field_value%real_2d_array(:,:)=
qlmax(:,:)
252 else if (name .eq.
"cltop_local")
then 253 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
254 current_state%local_grid%size(x_index)))
255 field_value%real_2d_array(:,:)=
cltop(:,:)
256 else if (name .eq.
"clbas_local")
then 257 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
258 current_state%local_grid%size(x_index)))
259 field_value%real_2d_array(:,:)=
clbas(:,:)
260 else if (name .eq.
"vwp_local")
then 261 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
262 current_state%local_grid%size(x_index)))
263 field_value%real_2d_array(:,:)=
vwp(:,:)
264 else if (name .eq.
"lwp_local")
then 265 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
266 current_state%local_grid%size(x_index)))
267 field_value%real_2d_array(:,:)=
lwp(:,:)
268 else if (name .eq.
"senhf_local")
then 269 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
270 current_state%local_grid%size(x_index)))
271 field_value%real_2d_array(:,:)=
senhf(:,:)
272 else if (name .eq.
"lathf_local")
then 273 allocate(field_value%real_2d_array(current_state%local_grid%size(y_index), &
274 current_state%local_grid%size(x_index)))
275 field_value%real_2d_array(:,:)=
lathf(:,:)
integer, parameter, public component_scalar_field_type
subroutine field_value_retrieval_callback(current_state, name, field_value)
Field value retrieval callback, this returns the value of a specific published field.
Wrapper type for the value returned for a published field from a component.
real(kind=default_precision), dimension(:,:), allocatable senhf
real(kind=default_precision), public cp
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.
subroutine initialisation_callback(current_state)
type(component_descriptor_type) function, public scalar_diagnostics_get_descriptor()
Provides the component descriptor for the core to register.
real(kind=default_precision), dimension(:,:), allocatable lathf
Contains common definitions for the data and datatypes used by MONC.
The ModelState which represents the current state of a run.
real(kind=default_precision), dimension(:,:), allocatable hqlmax
real(kind=default_precision), dimension(:,:), allocatable clbas
Description of a component.
subroutine timestep_callback(current_state)
real(kind=default_precision), dimension(:,:), allocatable qlmax
integer, parameter, public component_array_field_type
real(kind=default_precision), dimension(:,:), allocatable wmin
real(kind=default_precision), dimension(:,:), allocatable lwp
real(kind=default_precision), dimension(:), allocatable tempfac
Scientific constant values used throughout simulations. Each has a default value and this can be over...
real(kind=default_precision), dimension(:,:), allocatable cltop
real(kind=default_precision), dimension(:,:), allocatable wmax
Interfaces and types that MONC components must specify.
integer, parameter, public component_integer_data_type
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.
Functionality to support the different types of grid and abstraction between global grids and local o...
real(kind=default_precision) qlcrit
Manages the options database. Contains administration functions and deduce runtime options from the c...
subroutine field_information_retrieval_callback(current_state, name, field_information)
Field information retrieval callback, this returns information for a specific components published fi...
real(kind=default_precision), public rlvap
The model state which represents the current state of a run.
integer, parameter, public y_index
real(kind=default_precision), dimension(:,:), allocatable vwp
integer, parameter, public x_index
integer, parameter, public component_double_data_type