75 type(model_state_type),
target,
intent(inout) :: current_state
76 character(len=*),
intent(in) :: name
77 type(component_field_information_type),
intent(out) :: field_information
81 strcomp=index(name,
"simplecloud_3d_local")
82 if (strcomp .ne. 0)
then
83 field_information%field_type=component_array_field_type
84 field_information%number_dimensions=3
85 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
86 field_information%dimension_sizes(2)=current_state%local_grid%size(y_index)
87 field_information%dimension_sizes(3)=current_state%local_grid%size(x_index)
88 field_information%data_type=component_double_data_type
90 if (name .eq.
"tend_th_simplecloud_3d_local")
then
92 else if (name .eq.
"tend_qv_simplecloud_3d_local")
then
94 else if (name .eq.
"tend_ql_simplecloud_3d_local")
then
96 else if (name .eq.
"tend_tabs_simplecloud_3d_local")
then
99 field_information%enabled=.true.
105 strcomp=index(name,
"simplecloud_profile_total_local")
106 if (strcomp .ne. 0)
then
107 field_information%field_type=component_array_field_type
108 field_information%number_dimensions=1
109 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
110 field_information%data_type=component_double_data_type
112 if (name .eq.
"tend_th_simplecloud_profile_total_local")
then
114 else if (name .eq.
"tend_qv_simplecloud_profile_total_local")
then
116 else if (name .eq.
"tend_ql_simplecloud_profile_total_local")
then
118 else if (name .eq.
"tend_tabs_simplecloud_profile_total_local")
then
121 field_information%enabled=.true.
136 type(model_state_type),
target,
intent(inout) :: current_state
137 character(len=*),
intent(in) :: name
138 type(component_field_value_type),
intent(out) :: field_value
141 if (name .eq.
"tend_th_simplecloud_3d_local" .and.
allocated(
tend_3d_th))
then
143 else if (name .eq.
"tend_qv_simplecloud_3d_local" .and.
allocated(
tend_3d_qv))
then
145 else if (name .eq.
"tend_ql_simplecloud_3d_local" .and.
allocated(
tend_3d_ql))
then
147 else if (name .eq.
"tend_tabs_simplecloud_3d_local" .and.
allocated(
tend_3d_tabs))
then
151 else if (name .eq.
"tend_th_simplecloud_profile_total_local" .and.
allocated(
tend_pr_tot_th))
then
153 else if (name .eq.
"tend_qv_simplecloud_profile_total_local" .and.
allocated(
tend_pr_tot_qv))
then
155 else if (name .eq.
"tend_ql_simplecloud_profile_total_local" .and.
allocated(
tend_pr_tot_ql))
then
157 else if (name .eq.
"tend_tabs_simplecloud_profile_total_local" .and.
allocated(
tend_pr_tot_tabs))
then
165 type(model_state_type),
target,
intent(inout) :: current_state
170 if (is_component_enabled(current_state%options_database,
"casim"))
then
171 call log_master_log(log_error,
"Casim and Simplecloud are enabled, this does not work yet. Please disable one")
174 iqv=get_q_index(standard_q_names%VAPOUR,
'simplecloud')
175 iql=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'simplecloud')
179 if (.not.
allocated(current_state%cq))
then
180 allocate(current_state%cq(current_state%number_q_fields))
181 current_state%cq=0.0_default_precision
183 current_state%cq(
iql) = -1.0
185 max_height_cloud=options_get_real(current_state%options_database,
"max_height_cloud")
186 do k=2, current_state%local_grid%size(z_index)-1
187 if (current_state%global_grid%configuration%vertical%zn(k) >
max_height_cloud)
exit
194 l_qdiag = (.not. current_state%passive_q .and. current_state%number_q_fields .gt. 0)
208 allocate(
tend_3d_th(current_state%local_grid%size(z_index), &
209 current_state%local_grid%size(y_index), &
210 current_state%local_grid%size(x_index) ) )
213 allocate(
tend_3d_qv(current_state%local_grid%size(z_index), &
214 current_state%local_grid%size(y_index), &
215 current_state%local_grid%size(x_index) ) )
218 allocate(
tend_3d_ql(current_state%local_grid%size(z_index), &
219 current_state%local_grid%size(y_index), &
220 current_state%local_grid%size(x_index) ) )
223 allocate(
tend_3d_tabs(current_state%local_grid%size(z_index), &
224 current_state%local_grid%size(y_index), &
225 current_state%local_grid%size(x_index) ) )
230 allocate(
tend_pr_tot_th(current_state%local_grid%size(z_index)) )
233 allocate(
tend_pr_tot_qv(current_state%local_grid%size(z_index)) )
236 allocate(
tend_pr_tot_ql(current_state%local_grid%size(z_index)) )
249 type(model_state_type),
target,
intent(inout) :: current_state
268 type(model_state_type),
target,
intent(inout) :: current_state
270 real(DEFAULT_PRECISION) :: TdegK
271 real(DEFAULT_PRECISION) :: Pmb
272 real(DEFAULT_PRECISION) :: exner
273 real(DEFAULT_PRECISION) :: one_over_exner
274 real(DEFAULT_PRECISION) :: qv,qc
275 real(DEFAULT_PRECISION) :: qs
276 real(DEFAULT_PRECISION) :: dqsdT
277 real(DEFAULT_PRECISION) :: qsatfac
278 real(DEFAULT_PRECISION) :: dmass
281 integer :: icol, jcol
283 real(DEFAULT_PRECISION) :: dtm
284 integer :: target_x_index, target_y_index
287 if (current_state%first_timestep_column)
then
303 if (current_state%halo_column)
return
306 dtm = current_state%dtm*2.0
307 if (current_state%field_stepping == forward_stepping) dtm=current_state%dtm
309 icol=current_state%column_local_x
310 jcol=current_state%column_local_y
311 target_y_index=jcol-current_state%local_grid%halo_size(y_index)
312 target_x_index=icol-current_state%local_grid%halo_size(x_index)
320 exner = current_state%global_grid%configuration%vertical%rprefrcp(k)
321 one_over_exner = current_state%global_grid%configuration%vertical%prefrcp(k)
322 pmb = (current_state%global_grid%configuration%vertical%prefn(k)/100.)
324 if (current_state%field_stepping == forward_stepping)
then
325 qv = current_state%q(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
326 qc = current_state%q(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
327 tdegk = (current_state%th%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
328 + current_state%global_grid%configuration%vertical%thref(k))*exner
330 qv = current_state%zq(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
331 qc = current_state%zq(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
332 tdegk = (current_state%zth%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
333 + current_state%global_grid%configuration%vertical%thref(k))*exner
337 qs = qsaturation(tdegk, pmb)
339 if (qv > qs .or. qc >0.0)
then
340 dqsdt = dqwsatdt(qs, tdegk)
342 qsatfac = 1.0/(1.0 + rlvap_over_cp*dqsdt)
344 dmass = max(-qc,(qv-qs)*qsatfac)/dtm
346 current_state%sq(
iqv)%data(k, jcol, icol) = current_state%sq(
iqv)%data(k, jcol, icol) - dmass
347 current_state%sq(
iql)%data(k, jcol, icol) = current_state%sq(
iql)%data(k, jcol, icol) + dmass
349 current_state%sth%data(k, jcol, icol) = current_state%sth%data(k, jcol, icol) &
350 + rlvap_over_cp*dmass*one_over_exner
357 do k=
k_cloudmax+1, current_state%local_grid%size(z_index)
358 if (current_state%scalar_stepping == forward_stepping)
then
359 qv = current_state%q(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
360 qc = current_state%q(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
361 tdegk = (current_state%th%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
362 + current_state%global_grid%configuration%vertical%thref(k))*exner
364 qv = current_state%zq(
iqv)%data(k, jcol, icol) + current_state%sq(
iqv)%data(k, jcol, icol)*dtm
365 qc = current_state%zq(
iql)%data(k, jcol, icol) + current_state%sq(
iql)%data(k, jcol, icol)*dtm
366 tdegk = (current_state%zth%data(k, jcol, icol) + current_state%sth%data(k, jcol, icol)*dtm &
367 + current_state%global_grid%configuration%vertical%thref(k))*exner
372 current_state%sq(
iqv)%data(k, jcol, icol) = current_state%sq(
iqv)%data(k, jcol, icol) - dmass
373 current_state%sq(
iql)%data(k, jcol, icol) = current_state%sq(
iql)%data(k, jcol, icol) + dmass
375 current_state%sth%data(k, jcol, icol) = current_state%sth%data(k, jcol, icol) &
376 + rlvap_over_cp*dmass*one_over_exner
395 type(model_state_type),
target,
intent(in) :: current_state
396 integer,
intent(in) :: cxn, cyn, txn, tyn
400 tend_3d_th(:,tyn,txn)=current_state%sth%data(:,cyn,cxn)
409 tend_3d_tabs(:,tyn,txn)=current_state%sth%data(:,cyn,cxn) * current_state%global_grid%configuration%vertical%rprefrcp(:)
422 type(model_state_type),
target,
intent(inout) :: current_state
423 integer,
intent(in) :: cxn, cyn, txn, tyn
437 current_state%sth%data(:,cyn,cxn) * current_state%global_grid%configuration%vertical%rprefrcp(:) &
463 type(component_field_value_type),
intent(inout) :: field_value
464 real(kind=default_precision),
dimension(:),
optional :: real_1d_field
465 real(kind=default_precision),
dimension(:,:),
optional :: real_2d_field
466 real(kind=default_precision),
dimension(:,:,:),
optional :: real_3d_field
468 if (
present(real_1d_field))
then
469 allocate(field_value%real_1d_array(
size(real_1d_field)), source=real_1d_field)
470 else if (
present(real_2d_field))
then
471 allocate(field_value%real_2d_array(
size(real_2d_field, 1),
size(real_2d_field, 2)), source=real_2d_field)
472 else if (
present(real_3d_field))
then
473 allocate(field_value%real_3d_array(
size(real_3d_field, 1),
size(real_3d_field, 2),
size(real_3d_field, 3)), &
474 source=real_3d_field)