MONC
gridmanager.F90
Go to the documentation of this file.
1 
3  use datadefn_mod, only : string_length
5  use state_mod, only : model_state_type
16 
17  implicit none
18 
19 #ifndef TEST_MODE
20  private
21 #endif
22 
23  ! 1 = No adjustment
24  ! 2 = ensure P0=PSF by adjusting THREF profile by constant factor
25  ! 3 = ensure P0=PSF by adjusting PSF (not advised)
26  ! 4 = ensure P0=PSF by adjusting PTOP
27  integer, parameter :: anelastic_profile_mode=4
28  real, parameter :: default_spacing = 1.e9
29  real(kind=DEFAULT_PRECISION), dimension(:,:), allocatable :: qinit
30 
32 
33 contains
34 
38  gridmanager_get_descriptor%name="grid_manager"
39  gridmanager_get_descriptor%version=0.1
42  end function gridmanager_get_descriptor
43 
47  subroutine initialise_callback(current_state)
48  type(model_state_type), target, intent(inout) :: current_state
49 
50  integer :: dimensions
51 
52  if (.not. current_state%initialised) then
53  call log_log(log_error, "Must initialise the model state_mod before constructing the grid properties")
54  end if
55 
58  dimensions=1
59  if (current_state%global_grid%active(x_index)) dimensions = dimensions+1
60  if (current_state%global_grid%active(y_index)) dimensions = dimensions+1
61  call log_master_log(log_info, trim(conv_to_string(dimensions))//"D system; z="//&
62  trim(conv_to_string(current_state%global_grid%size(z_index)))//", y="//&
63  trim(conv_to_string(current_state%global_grid%size(y_index)))//", x="//&
64  trim(conv_to_string(current_state%global_grid%size(x_index))))
65  end subroutine initialise_callback
66 
69  subroutine finalise_callback(current_state)
70  type(model_state_type), target, intent(inout) :: current_state
71 
72  type(vertical_grid_configuration_type) :: vertical_grid
73 
74  vertical_grid=current_state%global_grid%configuration%vertical
75 
76  deallocate(vertical_grid%z, vertical_grid%zn, vertical_grid%dz, vertical_grid%dzn, vertical_grid%czb, vertical_grid%cza, &
77  vertical_grid%czg, vertical_grid%czh, vertical_grid%rdz, vertical_grid%rdzn, vertical_grid%tzc1, vertical_grid%tzc2,&
78  vertical_grid%tzd1, vertical_grid%tzd2, vertical_grid%thref, vertical_grid%theta_init, vertical_grid%tref, &
79  vertical_grid%prefn, vertical_grid%pdiff, vertical_grid%prefrcp, vertical_grid%rprefrcp, vertical_grid%rho, &
80  vertical_grid%rhon, vertical_grid%tstarpr, vertical_grid%qsat, vertical_grid%dqsatdt, vertical_grid%qsatfac, &
81  vertical_grid%dthref, vertical_grid%rneutml, vertical_grid%rneutml_sq, vertical_grid%buoy_co, &
82  vertical_grid%u_init, vertical_grid%v_init, vertical_grid%q_init, &
83  vertical_grid%q_rand, vertical_grid%theta_rand, vertical_grid%w_subs, vertical_grid%w_rand, &
84  vertical_grid%q_force, vertical_grid%theta_force, vertical_grid%u_force, vertical_grid%v_force &
85  )
86  end subroutine finalise_callback
87 
90  subroutine initialise_verticalgrid_configuration_type(current_state)
91  type(model_state_type), intent(inout) :: current_state
92 
93  call allocate_vertical_grid_data(current_state%global_grid%configuration%vertical, &
94  current_state%global_grid%size(z_index), current_state%number_q_fields )
95  call set_up_and_smooth_grid(current_state%global_grid%configuration%vertical, &
96  current_state%global_grid%configuration%vertical%kgd, current_state%global_grid%configuration%vertical%hgd, &
97  size(current_state%global_grid%configuration%vertical%kgd), current_state%global_grid%size(z_index), &
98  current_state%global_grid%top(z_index), options_get_integer(current_state%options_database, "nsmth"), &
99  current_state%origional_vertical_grid_setup, current_state%continuation_run)
100  call set_vertical_reference_profile(current_state, current_state%global_grid%configuration%vertical, &
101  current_state%global_grid%size(z_index))
103 
108  subroutine set_vertical_reference_profile(current_state, vertical_grid, kkp)
109  type(model_state_type), intent(inout) :: current_state
110  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
111  integer, intent(in) :: kkp
112 
113  integer :: k
114 
115  call calculate_initial_profiles(current_state, vertical_grid)
116  call set_up_vertical_reference_properties(current_state, vertical_grid, current_state%global_grid%size(z_index))
117  call set_anelastic_pressure(current_state)
118 
119  do k=2,kkp-1
120  ! for diffusion onto p-level from below
121  vertical_grid%czb(k)=(vertical_grid%rho(k-1)/vertical_grid%rhon(k))/(vertical_grid%dz(k)*vertical_grid%dzn(k))
122  ! for diffusion onto p-level from above
123  vertical_grid%cza(k)=(vertical_grid%rho(k)/vertical_grid%rhon(k))/(vertical_grid%dz(k)*vertical_grid%dzn(k+1))
124  vertical_grid%czg(k)=-vertical_grid%czb(k)-vertical_grid%cza(k)
125  if (k .gt. 2) vertical_grid%czh(k)=vertical_grid%czb(k)*vertical_grid%cza(k-1)
126  end do
127  do k=2,kkp-1
128  ! advection onto p-level from below
129  vertical_grid%tzc1(k)=0.25_default_precision*vertical_grid%rdz(k)*vertical_grid%rho(k-1)/vertical_grid%rhon(k)
130  ! advection onto p-level from above
131  vertical_grid%tzc2(k)=0.25_default_precision*vertical_grid%rdz(k)*vertical_grid%rho(k)/vertical_grid%rhon(k)
132  end do
133  do k=2,kkp-1
134  ! advection onto w-level (K) from below
135  vertical_grid%tzd1(k)=0.25_default_precision*vertical_grid%rdzn(k+1)*vertical_grid%rhon(k)/vertical_grid%rho(k)
136  ! advection onto w-level (K) from above
137  vertical_grid%tzd2(k)=0.25_default_precision*vertical_grid%rdzn(k+1)*vertical_grid%rhon(k+1)/vertical_grid%rho(k)
138  end do
139  k=kkp
140  vertical_grid%czb(k)=(vertical_grid%rho(k-1)/vertical_grid%rhon(k))/(vertical_grid%dz(k)*vertical_grid%dzn(k))
141  vertical_grid%cza(k)=0.0_default_precision
142  vertical_grid%czg(k)=-vertical_grid%czb(k)
143  vertical_grid%czh(k)=vertical_grid%czb(k)*vertical_grid%cza(k-1)
144  vertical_grid%tzc2(k)=0.25_default_precision*vertical_grid%rdz(k)*vertical_grid%rho(k)/vertical_grid%rhon(k)
145  vertical_grid%tzc1(k)=0.25_default_precision*vertical_grid%rdz(k)*vertical_grid%rho(k-1)/vertical_grid%rhon(k)
146  vertical_grid%czn=vertical_grid%dzn(2)*0.5_default_precision
147  vertical_grid%zlogm=log(1.0_default_precision+vertical_grid%zn(2)/z0)
148  vertical_grid%zlogth=log((vertical_grid%zn(2)+z0)/z0th)
149  vertical_grid%vk_on_zlogm=von_karman_constant/vertical_grid%zlogm
151  current_state, vertical_grid, current_state%global_grid%size(z_index))
152  call calculate_mixing_length_for_neutral_case(current_state, vertical_grid, current_state%global_grid%size(z_index))
153  call set_buoyancy_coefficient(current_state, vertical_grid, current_state%global_grid%size(z_index))
154  end subroutine set_vertical_reference_profile
155 
160  subroutine calculate_initial_profiles(current_state, vertical_grid)
161  type(model_state_type), intent(inout) :: current_state
162  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
163 
164  integer :: nq_init ! The number of q fields to initialize
165  integer :: nzq ! The number of input levels for q_init
166  integer :: i,j,n ! loop counters
167  integer :: iq ! temporary q varible index
168 
169  real(kind=DEFAULT_PRECISION), dimension(:,:), allocatable :: f_init_pl_q ! Initial node values for q variables
170  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: z_init_pl_q ! Initial node height values for q variables
171  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: f_init_pl_theta ! Initial node values for theta variable
172  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: z_init_pl_theta ! Initial node height values for theta variable
173  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: f_init_pl_u ! Initial node values for u variable
174  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: z_init_pl_u ! Initial node height values for u variable
175  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: f_init_pl_v ! Initial node values for v variable
176  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: z_init_pl_v ! Initial node height values for v variable
177 
178  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: f_thref ! Initial node values for thref
179  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: z_thref ! Initial node height values for thref
180 
181  logical :: l_init_pl_u ! if .true. then initialize u field
182  logical :: l_init_pl_v ! if .true. then initialize v field
183  logical :: l_init_pl_theta ! if .true. then initialize theta field
184  logical :: l_init_pl_q ! if .true. then initialize q fields
185  logical :: l_thref ! if .true. then initialize thref profile (overrides thref0)
186  logical :: l_matchthref ! if .true. then initialize thref to be the same as theta_init
187 
188  character(len=STRING_LENGTH), dimension(:), allocatable :: names_init_pl_q ! names of q variables to initialize
189 
190  real(kind=DEFAULT_PRECISION), allocatable :: f_init_pl_q_tmp(:) !temporary 1D storage of initial q field
191  real(kind=DEFAULT_PRECISION), allocatable :: zgrid(:) ! z grid to use in interpolation
192 
193  real(kind=DEFAULT_PRECISION) :: zztop ! top of the domain
194 
195  allocate(zgrid(current_state%local_grid%local_domain_end_index(z_index)))
196 
197  zztop = current_state%global_grid%top(z_index)
198 
199  ! Initialize everything to zero. This won't make sense for theta.
200  vertical_grid%q_init = 0.0_default_precision
201  vertical_grid%u_init = 0.0_default_precision
202  vertical_grid%v_init = 0.0_default_precision
203  vertical_grid%theta_init = 0.0_default_precision
204 
205  l_init_pl_theta=options_get_logical(current_state%options_database, "l_init_pl_theta")
206  l_init_pl_q=options_get_logical(current_state%options_database, "l_init_pl_q")
207  if (l_init_pl_q) then
208  allocate(names_init_pl_q(options_get_array_size(current_state%options_database, "names_init_pl_q")))
209  call options_get_string_array(current_state%options_database, "names_init_pl_q", names_init_pl_q)
210  end if
211  l_init_pl_u=options_get_logical(current_state%options_database, "l_init_pl_u")
212  l_init_pl_v=options_get_logical(current_state%options_database, "l_init_pl_v")
213 
214  l_thref=options_get_logical(current_state%options_database, "l_thref")
215  l_matchthref=options_get_logical(current_state%options_database, "l_matchthref")
216 
217  if (l_thref)then
218  if (.not. l_matchthref)then
219  allocate(z_thref(options_get_array_size(current_state%options_database, "z_thref")), &
220  f_thref(options_get_array_size(current_state%options_database, "f_thref")))
221  call options_get_real_array(current_state%options_database, "z_thref", z_thref)
222  call options_get_real_array(current_state%options_database, "f_thref", f_thref)
223  call check_top(zztop, z_thref(size(z_thref)), 'z_thref')
224  zgrid=current_state%global_grid%configuration%vertical%zn(:)
225  call piecewise_linear_1d(z_thref(1:size(z_thref)), f_thref(1:size(f_thref)), zgrid, &
226  current_state%global_grid%configuration%vertical%thref)
227  deallocate(z_thref, f_thref)
228  end if
229  else
230  current_state%global_grid%configuration%vertical%thref(:)=current_state%thref0
231  end if
232 
233  if (l_init_pl_theta)then
234  allocate(z_init_pl_theta(options_get_array_size(current_state%options_database, "z_init_pl_theta")), &
235  f_init_pl_theta(options_get_array_size(current_state%options_database, "f_init_pl_theta")))
236  call options_get_real_array(current_state%options_database, "z_init_pl_theta", z_init_pl_theta)
237  call options_get_real_array(current_state%options_database, "f_init_pl_theta", f_init_pl_theta)
238  call check_top(zztop, z_init_pl_theta(size(z_init_pl_theta)), 'z_init_pl_theta')
239  zgrid=current_state%global_grid%configuration%vertical%zn(:)
240  call piecewise_linear_1d(z_init_pl_theta(1:size(z_init_pl_theta)), f_init_pl_theta(1:size(f_init_pl_theta)), zgrid, &
241  current_state%global_grid%configuration%vertical%theta_init)
242  if (l_matchthref) then
243  if(.not. current_state%use_anelastic_equations) then
244  call log_master_log(log_error, "Non-anelastic equation set and l_maththref are incompatible")
245  end if
246  current_state%global_grid%configuration%vertical%thref = current_state%global_grid%configuration%vertical%theta_init
247  end if
248  if (.not. current_state%continuation_run) then
249  do i=current_state%local_grid%local_domain_start_index(x_index), current_state%local_grid%local_domain_end_index(x_index)
250  do j=current_state%local_grid%local_domain_start_index(y_index), current_state%local_grid%local_domain_end_index(y_index)
251  current_state%th%data(:,j,i) = current_state%global_grid%configuration%vertical%theta_init(:) - &
252  current_state%global_grid%configuration%vertical%thref(:)
253  end do
254  end do
255  end if
256  deallocate(z_init_pl_theta, f_init_pl_theta)
257  end if
258 
259  if (l_init_pl_u)then
260  allocate(z_init_pl_u(options_get_array_size(current_state%options_database, "z_init_pl_u")), &
261  f_init_pl_u(options_get_array_size(current_state%options_database, "f_init_pl_u")))
262  call options_get_real_array(current_state%options_database, "z_init_pl_u", z_init_pl_u)
263  call options_get_real_array(current_state%options_database, "f_init_pl_u", f_init_pl_u)
264  call check_top(zztop, z_init_pl_u(size(z_init_pl_u)), 'z_init_pl_u')
265  zgrid=current_state%global_grid%configuration%vertical%zn(:)
266  call piecewise_linear_1d(z_init_pl_u(1:size(z_init_pl_u)), f_init_pl_u(1:size(f_init_pl_u)), &
267  zgrid, current_state%global_grid%configuration%vertical%u_init)
268  if (.not. current_state%continuation_run) then
269  do i=current_state%local_grid%local_domain_start_index(x_index), current_state%local_grid%local_domain_end_index(x_index)
270  do j=current_state%local_grid%local_domain_start_index(y_index), current_state%local_grid%local_domain_end_index(y_index)
271  current_state%u%data(:,j,i) = current_state%global_grid%configuration%vertical%u_init(:)
272  end do
273  end do
274  end if
275  deallocate(z_init_pl_u, f_init_pl_u)
276  end if
277 
278  if (l_init_pl_v)then
279  allocate(z_init_pl_v(options_get_array_size(current_state%options_database, "z_init_pl_v")), &
280  f_init_pl_v(options_get_array_size(current_state%options_database, "f_init_pl_v")))
281  call options_get_real_array(current_state%options_database, "z_init_pl_v", z_init_pl_v)
282  call options_get_real_array(current_state%options_database, "f_init_pl_v", f_init_pl_v)
283  call check_top(zztop, z_init_pl_v(size(z_init_pl_v)), 'z_init_pl_v')
284  zgrid=current_state%global_grid%configuration%vertical%zn(:)
285  call piecewise_linear_1d(z_init_pl_v(1:size(z_init_pl_v)), f_init_pl_v(1:size(f_init_pl_v)), &
286  zgrid, current_state%global_grid%configuration%vertical%v_init)
287  if (.not. current_state%continuation_run) then
288  do i=current_state%local_grid%local_domain_start_index(x_index), current_state%local_grid%local_domain_end_index(x_index)
289  do j=current_state%local_grid%local_domain_start_index(y_index), current_state%local_grid%local_domain_end_index(y_index)
290  current_state%v%data(:,j,i) = current_state%global_grid%configuration%vertical%v_init(:)
291  end do
292  end do
293  end if
294  deallocate(z_init_pl_v, f_init_pl_v)
295  end if
296 
297  if (l_init_pl_q)then
298  nq_init=size(names_init_pl_q)
299  allocate(z_init_pl_q(options_get_array_size(current_state%options_database, "z_init_pl_q")))
300  call options_get_real_array(current_state%options_database, "z_init_pl_q", z_init_pl_q)
301  nzq=size(z_init_pl_q)
302  call check_top(zztop, z_init_pl_q(nzq), 'z_init_pl_q')
303  zgrid=current_state%global_grid%configuration%vertical%zn(:)
304  allocate(f_init_pl_q_tmp(nq_init*nzq))
305  call options_get_real_array(current_state%options_database, "f_init_pl_q", f_init_pl_q_tmp)
306  allocate(f_init_pl_q(nzq, nq_init))
307  f_init_pl_q(1:nzq, 1:nq_init)=reshape(f_init_pl_q_tmp, (/nzq, nq_init/))
308  do n=1, nq_init
309  iq=get_q_index(trim(names_init_pl_q(n)), 'piecewise_initialization')
310  call piecewise_linear_1d(z_init_pl_q(1:nzq), f_init_pl_q(1:nzq,n), zgrid, &
311  current_state%global_grid%configuration%vertical%q_init(:,iq))
312  if (.not. current_state%continuation_run) then
313  do i=current_state%local_grid%local_domain_start_index(x_index), &
314  current_state%local_grid%local_domain_end_index(x_index)
315  do j=current_state%local_grid%local_domain_start_index(y_index), &
316  current_state%local_grid%local_domain_end_index(y_index)
317  current_state%q(iq)%data(:,j,i) = current_state%global_grid%configuration%vertical%q_init(:, iq)
318  end do
319  end do
320  end if
321  end do
322  deallocate(f_init_pl_q_tmp, z_init_pl_q, f_init_pl_q, names_init_pl_q)
323  end if
324  deallocate(zgrid)
325  end subroutine calculate_initial_profiles
326 
331  subroutine calculate_mixing_length_for_neutral_case(current_state, vertical_grid, kkp)
332  type(model_state_type), intent(inout) :: current_state
333  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
334  integer, intent(in) :: kkp
335 
336  integer :: k
337 
338  do k=2, kkp-1
339  vertical_grid%rneutml(k)=sqrt(1.0_default_precision/(1.0_default_precision/(von_karman_constant*&
340  (vertical_grid%z(k)+z0))**2+1.0_default_precision/current_state%rmlmax**2) )
341  vertical_grid%rneutml_sq(k)=vertical_grid%rneutml(k)*vertical_grid%rneutml(k)
342  end do
344 
349  subroutine set_buoyancy_coefficient(current_state, vertical_grid, kkp)
350  type(model_state_type), intent(inout), target :: current_state
351  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
352  integer, intent(in) :: kkp
353 
354  integer :: k
355 
356  if (.not. current_state%passive_th) then
357  if(current_state%use_anelastic_equations)then
358  do k=1, kkp-1
359  vertical_grid%buoy_co(k)=cp*(vertical_grid%prefn(k)**r_over_cp-vertical_grid%prefn(k+1)**r_over_cp)/&
360  ((current_state%surface_reference_pressure**r_over_cp)*vertical_grid%dzn(k+1))
361  end do
362  else
363  vertical_grid%buoy_co(1:kkp-1)=g/current_state%thref0 ! _Boussinesq
364  end if
365  ! Dummy value at top level
366  vertical_grid%buoy_co(kkp)=0.
367  else
368  vertical_grid%buoy_co(:)=0.
369  end if
370  end subroutine set_buoyancy_coefficient
371 
376  subroutine setup_reference_state_liquid_water_temperature_and_saturation(current_state, vertical_grid, kkp)
377  type(model_state_type), intent(inout) :: current_state
378  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
379  integer, intent(in) :: kkp
380 
381  real(kind=DEFAULT_PRECISION) :: delta_t=1.0_default_precision, qlinit, tinit, qsatin, dqsatdtin, dsatfacin
382  integer :: iter, k
383 
384  do k=1,kkp
385  vertical_grid%tref(k)=vertical_grid%thref(k)*(vertical_grid%prefn(k)/current_state%surface_reference_pressure)**r_over_cp
386  vertical_grid%tstarpr(k)=0.0_default_precision
387  end do
388  if (current_state%th%active) then
389  ! PREFRCP is used and hence calculated if theta is active
390  do k = 1,kkp
391  vertical_grid%prefrcp(k)=(current_state%surface_reference_pressure/vertical_grid%prefn(k))**r_over_cp
392  vertical_grid%rprefrcp(k)=1.0_default_precision/vertical_grid%prefrcp(k)
393  ! Denotion between setup run and chain run in LEM - need to consider here too
394  vertical_grid%qsat(k)=qsaturation(vertical_grid%tref(k), 0.01_default_precision*vertical_grid%prefn(k))
395  vertical_grid%dqsatdt(k)=(qsaturation(vertical_grid%tref(k)+delta_t, 0.01_default_precision*vertical_grid%prefn(k)) -&
396  qsaturation(vertical_grid%tref(k)-delta_t, 0.01_default_precision*vertical_grid%prefn(k)))/&
397  (2.0_default_precision*delta_t)
398  vertical_grid%qsatfac(k)=1.0_default_precision/(1.0_default_precision+rlvap_over_cp*vertical_grid%dqsatdt(k))
399  end do
400  if (current_state%calculate_th_and_q_init) then
401  do k=1,kkp
402  ! !Note that at this point THETA_INIT and QINIT(IQ=1) are still
403  ! !theta_l and q_t, as read in from configuration.
404  ! ! start from input QL profile
405  qlinit=qinit(k, current_state%liquid_water_mixing_ratio_index)
406  do iter=1,5
407  ! ! calculate T and thence new q_l from Taylor expansion
408  ! ! keeping theta_l and q_t fixed
409  ! ! Note theta_l = theta - (L/c_p)*q_l here
410  tinit = vertical_grid%theta_init(k)*vertical_grid%rprefrcp(k) + rlvap_over_cp*qlinit
411  qsatin = qsaturation(tinit, 0.01_default_precision*vertical_grid%prefn(k))
412  dqsatdtin = dqwsatdt(qsatin, tinit)
413  dsatfacin=( 1.0_default_precision/(1.0_default_precision + rlvap_over_cp*dqsatdtin*vertical_grid%rprefrcp(k)))
414  qlinit=max(0.0_default_precision, (qinit(k, current_state%water_vapour_mixing_ratio_index)-&
415  (qsatin+dqsatdtin*(vertical_grid%theta_init(k)*vertical_grid%rprefrcp(k)-tinit) ))*dsatfacin)
416  end do
417  qinit(k, current_state%liquid_water_mixing_ratio_index)=qlinit
418  qinit(k, current_state%water_vapour_mixing_ratio_index)=qinit(k,current_state%water_vapour_mixing_ratio_index)-qlinit
419  vertical_grid%theta_init(k)=vertical_grid%theta_init(k)+rlvap_over_cp*qlinit
420 
421  ! Denotion between setup run and chain run in LEM - need to consider here too
422  vertical_grid%tstarpr(k)= tinit-vertical_grid%tref(k)
423  vertical_grid%qsat(k)=qsatin
424  vertical_grid%dqsatdt(k)=dqsatdtin
425  vertical_grid%qsatfac(k)= ( 1.0_default_precision/ ( 1.0_default_precision + rlvap_over_cp*dqsatdtin ) )
426  end do
427  endif
428  end if
430 
435  subroutine set_up_vertical_reference_properties(current_state, vertical_grid, kkp)
436  type(model_state_type), intent(inout) :: current_state
437  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
438  integer, intent(in) :: kkp
439 
440  integer :: k
441 
442  do k=1,kkp
443 ! vertical_grid%thref(k)=current_state%thref0
444 ! vertical_grid%theta_init(k)=vertical_grid%thref(k) ! In LEM this can also be set from configuration (TODO)
445  vertical_grid%prefn(k)=0.0_default_precision
446  vertical_grid%pdiff(k)=0.0_default_precision
447  vertical_grid%rho(k)=current_state%rhobous
448  vertical_grid%rhon(k)=current_state%rhobous
449  end do
450  do k=1,kkp-1
451  vertical_grid%dthref(k)=vertical_grid%thref(k+1)-vertical_grid%thref(k)
452  end do
453  vertical_grid%dthref(kkp)=0.0_default_precision
455 
464  subroutine set_up_and_smooth_grid(vertical_grid, kgd, hgd, ninitp, kkp, zztop, nsmth, origional_setup, continuation_run)
465  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
466  integer, dimension(:), intent(in) :: kgd
467  real(kind=DEFAULT_PRECISION), dimension(:), intent(in) :: hgd
468  integer, intent(in) :: ninitp, kkp, nsmth
469  real(kind=DEFAULT_PRECISION),intent(in) :: zztop
470  logical, intent(in) :: origional_setup, continuation_run
471 
472  integer :: k
473 
474  if (.not. continuation_run) then
475  if (origional_setup) then
476  call original_vertical_grid_setup(vertical_grid, kgd, hgd, ninitp, kkp, zztop, nsmth)
477  else
478  call new_vertical_grid_setup(vertical_grid, kgd, kkp, zztop)
479  end if
480  end if
481 
482  ! Regardless of the vertical grid computation method, set the level deltas
483  do k=2,kkp
484  vertical_grid%dz(k)=vertical_grid%z(k)-vertical_grid%z(k-1)
485  vertical_grid%dzn(k)= vertical_grid%zn(k)-vertical_grid%zn(k-1)
486  vertical_grid%rdz(k)=1./vertical_grid%dz(k)
487  vertical_grid%rdzn(k)=1./vertical_grid%dzn(k)
488  end do
489  vertical_grid%dzn(1)=0.d0
490  end subroutine set_up_and_smooth_grid
491 
499  subroutine original_vertical_grid_setup(vertical_grid, kgd, hgd, ninitp, kkp, zztop, nsmth)
500  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
501  integer, dimension(:), intent(in) :: kgd
502  real(kind=DEFAULT_PRECISION), dimension(:), intent(in) :: hgd
503  integer, intent(in) :: ninitp, kkp, nsmth
504  real(kind=DEFAULT_PRECISION), intent(in) :: zztop
505 
506  integer :: n, k
507 
508  call create_linear_grid(vertical_grid, kgd, hgd, ninitp, kkp, zztop)
509  ! Smooth grid
510  vertical_grid%z(1)=0.0_default_precision
511  vertical_grid%z(kkp)=zztop
512  do n=1,nsmth
513  do k=2,kkp
514  vertical_grid%zn(k)=0.5_default_precision*(vertical_grid%z(k)+vertical_grid%z(k-1))
515  end do
516  do k=2,kkp-1
517  vertical_grid%z(k)=0.5_default_precision*(vertical_grid%zn(k)+vertical_grid%zn(k+1))
518  end do
519  end do
520  ! Fourth order interpolation
521  do k=3,kkp-1
522  vertical_grid%zn(k)=0.0625_default_precision*(9.0_default_precision*&
523  (vertical_grid%z(k-1)+vertical_grid%z(k))-vertical_grid%z(k+1)-vertical_grid%z(k-2))
524  end do
525  vertical_grid%zn(2)=0.5_default_precision*(vertical_grid%z(1)+vertical_grid%z(2))
526  vertical_grid%zn(1)=-vertical_grid%zn(2)
527  vertical_grid%zn(kkp)=0.5_default_precision*(vertical_grid%z(kkp-1)+vertical_grid%z(kkp))
528  end subroutine original_vertical_grid_setup
529 
535  subroutine new_vertical_grid_setup(vertical_grid, kgd, kkp, zztop)
536  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
537  integer, dimension(:), intent(in) :: kgd
538  integer, intent(in) :: kkp
539  real(kind=DEFAULT_PRECISION), intent(in) :: zztop
540 
541  real(kind=DEFAULT_PRECISION) :: a(2*kkp), r1, d1, dd, d0, a0
542  logical :: first_gt=.true.
543  integer :: k, k0
544 
545  r1=1.10_default_precision
546  d1=10.0_default_precision
547 
548  dd=0.5_default_precision*d1
549  d0=dd
550  a(1)=-dd
551  a(2)=0.0_default_precision
552  do k=3, kkp*2
553  if (d0 .gt. dd .or. k==3) then
554  a(k)=a(k-1)+dd
555  if (.not. (dd .gt. 25.0_default_precision .and. a(k) .lt. 2000.0_default_precision)) then
556  if (a(k) .lt. 2000.0_default_precision) then
557  dd=dd*r1
558  else
559  dd=dd*(1.0_default_precision+(r1-1.0_default_precision)/1.5_default_precision)
560  end if
561  end if
562  d0=(zztop-a(k))/real(kkp*2-k, kind=default_precision)
563  else
564  if (first_gt) then
565  k0=k
566  a0=a(k-1)+d0
567  first_gt=.false.
568  end if
569  a(k)=a0+real(k-k0, kind=default_precision)*d0
570  end if
571  end do
572 
573  do k=1, kkp
574  vertical_grid%z(k)=a(k*2)
575  vertical_grid%zn(k)=a(2*k-1)
576  end do
577  end subroutine new_vertical_grid_setup
578 
589  subroutine create_linear_grid(vertical_grid, kgd, hgd, ninitp, kkp, zztop)
590  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
591  integer, dimension(:), intent(in) :: kgd
592  real(kind=DEFAULT_PRECISION), dimension(:), intent(in) :: hgd
593  integer, intent(in) :: ninitp, kkp
594  real(kind=DEFAULT_PRECISION), intent(in) :: zztop
595 
596  integer :: kmax, k, i
597  real(kind=DEFAULT_PRECISION) :: zmax
598 
599  vertical_grid%z(1) = 0.0_default_precision
600  kmax=kgd(1)
601  zmax=0.0_default_precision
602  if (kgd(1) .gt. 1) then
603  do k=1,kgd(1)
604  ! Loop up to first division point
605  vertical_grid%z(k)=real(k-1, kind=default_precision)*hgd(1)/real(kgd(1)-1, kind=default_precision)
606  end do
607  do i=2,ninitp
608  if(kgd(i) .gt. 0) then
609  kmax=kgd(i)
610  zmax=hgd(i)
611 
612  do k=kgd(i-1)+1,kgd(i)
613  vertical_grid%z(k)=hgd(i-1)+(hgd(i)-hgd(i-1))*real(k-kgd(i-1), kind=default_precision)&
614  /real(kgd(i)-kgd(i-1), kind=default_precision)
615  end do
616  end if
617  end do
618  end if
619  if(kmax .lt. kkp)then
620  do k=kmax,kkp
621  ! Handle any points above the kth max division
622  vertical_grid%z(k)=zmax+(zztop-zmax)*real(k-kmax, kind=default_precision)/real(kkp-kmax, kind=default_precision)
623  end do
624  end if
625  end subroutine create_linear_grid
626 
631  subroutine allocate_vertical_grid_data(vertical_grid, n, nq)
632  type(vertical_grid_configuration_type), intent(inout) :: vertical_grid
633  integer, intent(in) :: n
634  integer, intent(in) :: nq
635 
636  allocate(vertical_grid%dz(n), vertical_grid%dzn(n),&
637  vertical_grid%czb(n), vertical_grid%cza(n), vertical_grid%czg(n), vertical_grid%czh(n),&
638  vertical_grid%rdz(n), vertical_grid%rdzn(n), vertical_grid%tzc1(n), vertical_grid%tzc2(n),&
639  vertical_grid%tzd1(n), vertical_grid%tzd2(n), vertical_grid%theta_init(n), &
640  vertical_grid%tref(n), vertical_grid%prefn(n), vertical_grid%pdiff(n), vertical_grid%prefrcp(n), &
641  vertical_grid%rprefrcp(n), vertical_grid%rho(n), vertical_grid%rhon(n), vertical_grid%tstarpr(n), &
642  vertical_grid%qsat(n), vertical_grid%dqsatdt(n), vertical_grid%qsatfac(n), vertical_grid%dthref(n), &
643  vertical_grid%rneutml(n), vertical_grid%rneutml_sq(n), vertical_grid%buoy_co(n), &
644  vertical_grid%u_init(n), vertical_grid%v_init(n), vertical_grid%theta_rand(n), vertical_grid%w_rand(n), &
645  vertical_grid%w_subs(n), vertical_grid%u_force(n), vertical_grid%v_force(n), vertical_grid%theta_force(n))
646 
647  if (.not. allocated(vertical_grid%thref)) allocate(vertical_grid%thref(n))
648  if (.not. allocated(vertical_grid%z)) allocate(vertical_grid%z(n))
649  if (.not. allocated(vertical_grid%zn)) allocate(vertical_grid%zn(n))
650 
651  allocate(vertical_grid%q_rand(n,nq), vertical_grid%q_init(n,nq), vertical_grid%q_force(n,nq))
652  end subroutine allocate_vertical_grid_data
653 
656  subroutine initialise_horizontalgrid_configuration_types(current_state)
657  type(model_state_type), intent(inout) :: current_state
658 
659  current_state%global_grid%configuration%horizontal%dx = merge(real(current_state%global_grid%resolution(X_INDEX)), &
660  DEFAULT_SPACING, current_state%global_grid%active(x_index))
661  current_state%global_grid%configuration%horizontal%dy = merge(real(current_state%global_grid%resolution(Y_INDEX)), &
662  DEFAULT_SPACING, current_state%global_grid%active(y_index))
663 
664  current_state%global_grid%configuration%horizontal%cx=1./current_state%global_grid%configuration%horizontal%dx
665  current_state%global_grid%configuration%horizontal%cy=1./current_state%global_grid%configuration%horizontal%dy
666  current_state%global_grid%configuration%horizontal%cx2=current_state%global_grid%configuration%horizontal%cx ** 2
667  current_state%global_grid%configuration%horizontal%cy2=current_state%global_grid%configuration%horizontal%cy ** 2
668  current_state%global_grid%configuration%horizontal%cxy=current_state%global_grid%configuration%horizontal%cx * &
669  current_state%global_grid%configuration%horizontal%cy
670  current_state%global_grid%configuration%horizontal%tcx=&
671  0.25_default_precision/current_state%global_grid%configuration%horizontal%dx
672  current_state%global_grid%configuration%horizontal%tcy=&
673  0.25_default_precision/current_state%global_grid%configuration%horizontal%dy
675 
681  subroutine set_anelastic_pressure(current_state)
682  type(model_state_type), intent(inout) :: current_state
683 
684  if (current_state%use_anelastic_equations) then
686  else
687  if (current_state%passive_th) then
688  current_state%global_grid%configuration%vertical%prefn=0.0_default_precision
689  else
690  call compute_anelastic_pressure_profile_only(current_state)
691  end if
692  current_state%global_grid%configuration%vertical%rho=current_state%rhobous
693  current_state%global_grid%configuration%vertical%rhon=current_state%rhobous
694  current_state%global_grid%configuration%vertical%pdiff=0.0_default_precision
695  end if
696  end subroutine set_anelastic_pressure
697 
700  subroutine compute_anelastic_pressure_profile_only(current_state)
701  type(model_state_type), intent(inout) :: current_state
702 
703  integer :: ipass, k
704  real(kind=DEFAULT_PRECISION) :: p0 &!pressure at z=0 adjustments made after 1st iteration so P0=PSF after 2nd iteration
705  , ptop &!pressure at z=ZN(KKP)
706  , thprof(current_state%local_grid%size(z_index))
707 
708 
709  ! TODO: NOTE - we are mocking in thprof at the moment, this should be read from a configuration and used here instead
710  thprof=0.0_default_precision
711  ptop=0.0_default_precision
712  current_state%global_grid%configuration%vertical%pdiff(current_state%local_grid%size(z_index))=0.0_default_precision
713 
714  do ipass=1,2 ! _after first pass adjust PTOP
715  current_state%global_grid%configuration%vertical%prefn(current_state%local_grid%size(z_index))=&
716  (ptop/current_state%surface_reference_pressure)**r_over_cp
717  do k=current_state%local_grid%size(z_index)-1,1,-1
718  current_state%global_grid%configuration%vertical%pdiff(k)=g*&
719  current_state%global_grid%configuration%vertical%dzn(k+1)/(0.5_default_precision*cp*&
720  (current_state%global_grid%configuration%vertical%thref(k)+&
721  current_state%global_grid%configuration%vertical%thref(k+1)))
722  end do
723  do k=current_state%local_grid%size(z_index)-1,1,-1
724  current_state%global_grid%configuration%vertical%prefn(k)=&
725  current_state%global_grid%configuration%vertical%prefn(k+1)+&
726  current_state%global_grid%configuration%vertical%pdiff(k)
727  end do
728  do k=current_state%local_grid%size(z_index),1,-1
729  current_state%global_grid%configuration%vertical%prefn(k)=current_state%surface_reference_pressure*&
730  current_state%global_grid%configuration%vertical%prefn(k)**(1.0_default_precision/r_over_cp)
731  end do
732  p0=0.5_default_precision*(current_state%global_grid%configuration%vertical%prefn(1)+&
733  current_state%global_grid%configuration%vertical%prefn(2))
734  if (ipass .eq. 1) then
735  ptop=current_state%surface_pressure**r_over_cp+ptop**r_over_cp-p0**r_over_cp
736  if (ptop .le. 0.0_default_precision .and. current_state%parallel%my_rank==0) then
737  call log_log(log_error, "Negative ptop in setup of anelastic. Need a warmer THREF or different setup options")
738  end if
739  ptop=ptop**(1.0_default_precision/r_over_cp)
740  end if
741  end do
743 
746  subroutine compute_anelastic_pressure_profile_and_density(current_state)
747  type(model_state_type), intent(inout) :: current_state
748 
749  integer :: ipass, k
750  real(kind=DEFAULT_PRECISION) :: p0 &!pressure at z=0 adjustments made after 1st iteration so P0=PSF after 2nd iteration
751  , ptop &!pressure at z=ZN(KKP)
752  , thfactor !factor for multiplying TH profile (if IADJANELP=2)
753 
754  ptop=0.0_default_precision
755  current_state%global_grid%configuration%vertical%pdiff(current_state%local_grid%size(z_index))=0.0_default_precision
756  do ipass=1,2 ! _after first pass, may adjust basic states
757  if (ipass .eq. 1 .or. anelastic_profile_mode .gt. 1) then
758  current_state%global_grid%configuration%vertical%prefn(current_state%local_grid%size(z_index))=&
759  (ptop/current_state%surface_reference_pressure)**r_over_cp
760  do k=current_state%local_grid%size(z_index)-1,1,-1
761  current_state%global_grid%configuration%vertical%pdiff(k)=g*&
762  current_state%global_grid%configuration%vertical%dzn(k+1)/(0.5_default_precision*cp*&
763  (current_state%global_grid%configuration%vertical%thref(k)+&
764  current_state%global_grid%configuration%vertical%thref(k+1)))
765  end do
766  do k=current_state%local_grid%size(z_index)-1,1,-1
767  current_state%global_grid%configuration%vertical%prefn(k)=&
768  current_state%global_grid%configuration%vertical%prefn(k+1)+&
769  current_state%global_grid%configuration%vertical%pdiff(k)
770  end do
771  do k=current_state%local_grid%size(z_index),1,-1
772  current_state%global_grid%configuration%vertical%prefn(k)=current_state%surface_reference_pressure*&
773  current_state%global_grid%configuration%vertical%prefn(k)**(1.0_default_precision/r_over_cp)
774  end do
775  end if
776  p0=0.5_default_precision*(current_state%global_grid%configuration%vertical%prefn(1)+&
777  current_state%global_grid%configuration%vertical%prefn(2))
778  ! !-------------------------------------------------------------
779  ! ! _If IADJANELP>1 we adjust the basic states to ensure P0=PSF,
780  ! ! as follows:
781  ! ! IADJANELP=2 adjust THREF profile by constant factor
782  ! ! IADJANELP=3 adjust PSF
783  ! ! IADJANELP=4 adjust PTOP
784  ! ! _Option 3 tends to give rather large changes in PSF, so
785  ! ! I prefer 2 or 4 for most purposes
786  ! !-------------------------------------------------------------
787  if (ipass .eq. 1 .and. anelastic_profile_mode .eq. 2) then
788  ! ! _adjust THREF profile by constant factor to enforce
789  ! ! P0 = (fixed) PSF
790  thfactor=((p0/current_state%surface_reference_pressure)**r_over_cp-(ptop/current_state%surface_reference_pressure)**&
791  r_over_cp)/((current_state%surface_pressure/current_state%surface_reference_pressure)**r_over_cp-&
792  (ptop/current_state%surface_reference_pressure)**r_over_cp)
793  do k=1,current_state%local_grid%size(z_index)
794  current_state%global_grid%configuration%vertical%thref(k)=&
795  current_state%global_grid%configuration%vertical%thref(k)*thfactor
796  end do
797  end if
798  if (ipass .eq. 1 .and. anelastic_profile_mode .eq. 4) then
799  ! ! _adjust PTOP so that P0 = (fixed) PSF
800  ptop=current_state%surface_pressure**r_over_cp+ptop**r_over_cp-p0**r_over_cp
801  if (ptop .le. 0.0_default_precision .and. current_state%parallel%my_rank==0) then
802  call log_log(log_error, "Negative ptop in setup of anelastic. Need a warmer THREF or different setup options")
803  end if
804  ptop=ptop**(1.0_default_precision/r_over_cp)
805  end if
806  end do
807  ! !---------------------------------------
808  ! ! _Finally compute density from pressure
809  ! !---------------------------------------
810  do k=1,current_state%local_grid%size(z_index)
811  current_state%global_grid%configuration%vertical%rhon(k)=current_state%global_grid%configuration%vertical%prefn(k)&
812  /(r*current_state%global_grid%configuration%vertical%thref(k)*&
813  (current_state%global_grid%configuration%vertical%prefn(k)/current_state%surface_reference_pressure)**r_over_cp)
814  end do
815  do k=1,current_state%local_grid%size(z_index)-1
816  current_state%global_grid%configuration%vertical%rho(k)=sqrt(current_state%global_grid%configuration%vertical%rhon(k)*&
817  current_state%global_grid%configuration%vertical%rhon(k+1))
818  end do
819  current_state%global_grid%configuration%vertical%rho(current_state%local_grid%size(z_index))=&
820  current_state%global_grid%configuration%vertical%rhon(current_state%local_grid%size(z_index))**2/&
821  current_state%global_grid%configuration%vertical%rhon(current_state%local_grid%size(z_index)-1)
823 
824 
825  subroutine check_top(zztop, z, info)
826  real(kind=DEFAULT_PRECISION), intent(in) :: zztop
827  real(kind=DEFAULT_PRECISION), intent(in) :: z
828  character(*), intent(in) :: info
829 
830  if (z<zztop)then
831  call log_master_log(log_error, "Top of input profile is below the top of the domain:"//trim(info))
832  end if
833 
834  end subroutine check_top
835 
836 end module gridmanager_mod
subroutine initialise_verticalgrid_configuration_type(current_state)
Will initialise the vertical grid configuration.
Definition: gridmanager.F90:91
real(kind=default_precision), public z0th
integer function, public options_get_array_size(options_database, key)
Gets the size of the array held in the options database corresponding to a specific key...
subroutine set_vertical_reference_profile(current_state, vertical_grid, kkp)
Sets up the vertical grid reference profile at each point.
subroutine set_buoyancy_coefficient(current_state, vertical_grid, kkp)
Sets the buoyancy coefficient from the grid configuration and configuration.
type(standard_q_names_type), public standard_q_names
Definition: q_indices.F90:59
real(kind=default_precision), public r_over_cp
subroutine original_vertical_grid_setup(vertical_grid, kgd, hgd, ninitp, kkp, zztop, nsmth)
The original vertical grid setup and smoothing as per the LEM.
subroutine initialise_callback(current_state)
Called during initialisation and will initialise the horizontal and vertical grid configurations Note...
Definition: gridmanager.F90:48
type(component_descriptor_type) function, public gridmanager_get_descriptor()
Provides the descriptor back to the caller and is used in component registration. ...
Definition: gridmanager.F90:38
real(kind=default_precision), public cp
integer, parameter, public log_error
Only log ERROR messages.
Definition: logging.F90:11
Logging utility.
Definition: logging.F90:2
subroutine calculate_mixing_length_for_neutral_case(current_state, vertical_grid, kkp)
Calculates the mixing length for the neutral case.
real(kind=default_precision) function, public dqwsatdt(saturation_mixing_ratio, temperature)
Calculated the rate of change with temperature of saturation mixing ratio over liquid water...
Definition: saturation.F90:33
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17
integer, parameter, public z_index
Grid index parameters.
Definition: grids.F90:14
subroutine setup_reference_state_liquid_water_temperature_and_saturation(current_state, vertical_grid, kkp)
Setting up reference state liquid water temperature and saturation mixing ratio on main levels...
real(kind=default_precision), public g
subroutine allocate_vertical_grid_data(vertical_grid, n, nq)
Allocates the data required for the vertical grid configuration.
Manages the grid based upon the model state_mod.
Definition: gridmanager.F90:2
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
The ModelState which represents the current state of a run.
Definition: state.F90:39
subroutine, public log_master_log(level, message)
Will log just from the master process.
Definition: logging.F90:47
Conversion between common inbuilt FORTRAN data types.
Definition: conversions.F90:5
subroutine initialise_horizontalgrid_configuration_types(current_state)
Initialises the horizontal grid configurations.
real(kind=default_precision), public z0
Converts data types to strings.
Definition: conversions.F90:36
Saturation physics functionality which is used throughout the code.
Definition: saturation.F90:2
subroutine compute_anelastic_pressure_profile_and_density(current_state)
Computes the anelastic pressure and density - if we are using Anelastic approximation.
real(kind=default_precision), public von_karman_constant
The configuration of the grid vertically.
Definition: grids.F90:28
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
Definition: logging.F90:75
subroutine set_up_vertical_reference_properties(current_state, vertical_grid, kkp)
Sets up the reference properties for the vertical grid at each point.
Scientific constant values used throughout simulations. Each has a default value and this can be over...
This manages the Q variables and specifically the mapping between names and the index that they are s...
Definition: q_indices.F90:2
subroutine compute_anelastic_pressure_profile_only(current_state)
Computes the anelastic pressure only - if we are using Boussinesq approximation.
Interfaces and types that MONC components must specify.
subroutine piecewise_linear_1d(zvals, vals, zgrid, field)
Does a simple 1d piecewise linear interpolation.
integer, parameter anelastic_profile_mode
Definition: gridmanager.F90:27
subroutine set_anelastic_pressure(current_state)
Set reference profile of potential temperature for the Boussinesq/Anelastic approximation Note that t...
subroutine, public options_get_logical_array(options_database, key, array_data, from, to)
Retrieves an entire (or subset) logical array.
integer, parameter, public string_length
Default length of strings.
Definition: datadefn.F90:10
subroutine calculate_initial_profiles(current_state, vertical_grid)
Calculates the initial profiles for U, V, TH & Q if required.
subroutine create_linear_grid(vertical_grid, kgd, hgd, ninitp, kkp, zztop)
Creates the linear vertical grid based upon the configuration properties.
subroutine finalise_callback(current_state)
Called as MONC exits, for good practice this will deallocate the memory used for the grids...
Definition: gridmanager.F90:70
subroutine set_up_and_smooth_grid(vertical_grid, kgd, hgd, ninitp, kkp, zztop, nsmth, origional_setup, continuation_run)
Sets up and smooths the vertical grid. This is based upon the grid configuration already read in...
real(kind=default_precision) function, public qsaturation(temperature, pressure)
Function to return the saturation mixing ratio over water based on tetans formular QS=3...
Definition: saturation.F90:22
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...
Definition: grids.F90:5
real(kind=default_precision), dimension(:,:), allocatable qinit
Definition: gridmanager.F90:29
integer function, public options_get_integer(options_database, key, index)
Retrieves an integer value from the database that matches the provided key.
Manages the options database. Contains administration functions and deduce runtime options from the c...
integer, parameter, public log_info
Log INFO, WARNING and ERROR messages.
Definition: logging.F90:13
logical function, public options_get_logical(options_database, key, index)
Retrieves a logical value from the database that matches the provided key.
real, parameter default_spacing
The default spacing used if no grid is active in a specific dimension.
Definition: gridmanager.F90:28
real(kind=default_precision), public r
subroutine, public options_get_string_array(options_database, key, array_data, from, to)
Retrieves an entire (or subset) string array.
subroutine check_top(zztop, z, info)
subroutine, public options_get_real_array(options_database, key, array_data, from, to)
Retrieves an entire (or subset) real array.
subroutine new_vertical_grid_setup(vertical_grid, kgd, kkp, zztop)
The newer vertical grid setup routine.
real(kind=default_precision), public rlvap_over_cp
The model state which represents the current state of a run.
Definition: state.F90:2
integer, parameter, public y_index
Definition: grids.F90:14
integer, parameter, public x_index
Definition: grids.F90:14
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...
Definition: q_indices.F90:112