MONC
setfluxlook.F90
Go to the documentation of this file.
4  use grids_mod, only : z_index
8  use saturation_mod, only : qsaturation
9  use collections_mod, only : map_type
11  use netcdf, only : nf90_noerr, nf90_global, nf90_nowrite, nf90_inquire_attribute, nf90_open, nf90_strerror, &
12  nf90_inq_dimid, nf90_inquire_dimension, nf90_inq_varid, nf90_get_var, nf90_inquire, nf90_close, nf90_get_att
16  implicit none
17 
18 #ifndef TEST_MODE
19  private
20 #endif
21 
22  character(len=*), parameter :: &
23  time_key = "time", & !< NetCDF data time key
24  surface_temperatures_key = "surface_temperature", &
25  surface_humidities_key = "surface_humidity", &
26  surface_shf_key = "surface_sensible_heat_flux",&
27  surface_lhf_key = "surface_latent_heat_flux"
28 
29  integer, parameter :: lookup_entries = 80
30  integer, parameter :: max_file_len=200
31  integer, parameter :: max_surface_inputs=50
33 
34  character(MAX_FILE_LEN) :: input_file
35 
36  real(kind=DEFAULT_PRECISION) :: max_change_buoyancy_flux
37  real(kind=DEFAULT_PRECISION), allocatable :: surface_boundary_input_times(:)
38  real(kind=DEFAULT_PRECISION), allocatable :: surface_sensible_heat_flux(:)
39  real(kind=DEFAULT_PRECISION), allocatable :: surface_latent_heat_flux(:)
40  real(kind=DEFAULT_PRECISION), allocatable :: surface_temperatures(:)
41  real(kind=DEFAULT_PRECISION), allocatable :: surface_humidities(:)
42 
43  integer :: iqv ! index for vapour
44 
46 
47 contains
48 
52  setfluxlook_get_descriptor%name="setfluxlook"
53  setfluxlook_get_descriptor%version=0.1
56  end function setfluxlook_get_descriptor
57 
58  subroutine initialisation_callback(current_state)
59  type(model_state_type), intent(inout), target :: current_state
60 
61  current_state%lookup_table_entries=lookup_entries
62  call read_configuration(current_state)
63 
64  if (.not. current_state%passive_q .and. current_state%number_q_fields > 0)then
65  if (.not. allocated(current_state%cq))then
66  allocate(current_state%cq(current_state%number_q_fields))
67  current_state%cq=0.0_default_precision
68  end if
69  iqv = get_q_index(standard_q_names%VAPOUR, 'setfluxlook')
70  current_state%cq(iqv) = ratio_mol_wts-1.0
71  end if
72 
73  if (current_state%use_surface_boundary_conditions)then
74  if (current_state%type_of_surface_boundary_conditions == prescribed_surface_fluxes) then
75  if (current_state%use_time_varying_surface_values) then
76  call set_flux(current_state)
77  else
78  current_state%surface_temperature_flux=surface_sensible_heat_flux(1) &
79  /(current_state%global_grid%configuration%vertical%rho(1)*cp)
80  current_state%surface_vapour_flux = surface_latent_heat_flux(1) &
81  /(current_state%global_grid%configuration%vertical%rho(1)*rlvap)
82  end if
83 
84  current_state%fbuoy=0.
85  if(.not. current_state%passive_th) current_state%fbuoy=&
86  current_state%global_grid%configuration%vertical%buoy_co(1)*current_state%surface_temperature_flux
87  if(.not. current_state%passive_q .and. current_state%number_q_fields > 0)then
88  current_state%fbuoy=current_state%fbuoy+current_state%cq(iqv)*current_state%surface_vapour_flux*g
89  end if
90  call set_look(current_state) ! _set M-O lookup table
91  current_state%theta_surf=0.0_default_precision
92  current_state%surface_vapour_mixing_ratio=0.0_default_precision
93  !
94  else if (current_state%type_of_surface_boundary_conditions == prescribed_surface_values) then
95  !
96  ! Prescribed surface temperatures
97  if (current_state%use_time_varying_surface_values) then
98  call set_flux(current_state)
99  else
100  ! If surface_values are constant then surface_temperatures prescribed in
101  ! config and read in read_configuration but if humidity not set then
102  ! surface vapour (surface_vapour_mixing_ratio) set to saturated value (see read_config)
103  if (current_state%saturated_surface)then
104  current_state%surface_vapour_mixing_ratio = qsaturation(surface_temperatures(1),current_state%surface_pressure*0.01)
105  endif
106 
107  ! The code below copied from set_flux as these values need to be
108  ! set for both time varying and constant surface values
109  ! Set theta_v
110  current_state%theta_surf = surface_temperatures(1)*&
111  (current_state%surface_reference_pressure/current_state%surface_pressure)**r_over_cp
112  current_state%theta_virtual_surf = current_state%theta_surf
113  if (.not. current_state%passive_q .and. current_state%number_q_fields > 0) then
114  current_state%theta_virtual_surf = current_state%theta_surf + &
115  current_state%global_grid%configuration%vertical%thref(2)* &
116  current_state%cq(iqv)*current_state%surface_vapour_mixing_ratio
117  end if
118 
119  ! Finally set up new values of THVSURF dependent constants
120  current_state%cmbc=betam*current_state%global_grid%configuration%vertical%zn(2)*g*&
121  von_karman_constant/current_state%theta_virtual_surf
122  current_state%rcmbc=1.0_default_precision/current_state%cmbc
123  current_state%ellmocon=current_state%theta_virtual_surf/(g*von_karman_constant)
124  end if
125  end if
126  end if
127 
128  end subroutine initialisation_callback
129 
130  subroutine timestep_callback(current_state)
131  type(model_state_type), intent(inout), target :: current_state
132 
133  if (current_state%use_surface_boundary_conditions)then
134  if (current_state%use_time_varying_surface_values)then
135  call set_flux(current_state)
136  call change_look(current_state)
137  end if
138  end if
139  end subroutine timestep_callback
140 
141 
142  subroutine set_look(current_state)
143  type(model_state_type), intent(inout), target :: current_state
144 
145  integer I, ik, iters(current_state%lookup_table_entries) ! Loop counters
146  real(kind=DEFAULT_PRECISION) :: smth, & ! Relaxation parameter for unstable case
147  ob, x1, x0
148 
149  if (current_state%fbuoy .le. 0.0_default_precision) return
150  current_state%velmax=100.0_default_precision
151  current_state%velmin=0.1_default_precision
152  current_state%aloginv=1.0_default_precision/log(current_state%velmax/current_state%velmin)
153  smth=0.1_default_precision ! _relaxation parameter for unstable case
154  do ik=1, current_state%lookup_table_entries
155  current_state%lookup_table_velocity(ik)=current_state%velmin*(current_state%velmax/current_state%velmin)**&
156  (real(ik-1)/real(current_state%lookup_table_entries-1))
157  current_state%lookup_table_ustr(ik)=current_state%lookup_table_velocity(ik)*&
158  current_state%global_grid%configuration%vertical%vk_on_zlogm
159  if (current_state%fbuoy .gt. 0.0_default_precision) then ! _unstable
160  iters(ik)=0
161  do i=1, 30 ! @check how many iterations needed!!
162  iters(ik)=iters(ik)+1
163  ob=-current_state%lookup_table_ustr(ik)**3/(von_karman_constant*current_state%fbuoy)
164  x1=sqrt(sqrt(1.-gammam*(current_state%global_grid%configuration%vertical%zn(2)+z0)/ob))
165  x0=sqrt(sqrt(1.-gammam*z0/ob))
166  current_state%lookup_table_ustr(ik)=(1.-smth)*current_state%lookup_table_ustr(ik) + smth*&
167  (von_karman_constant*current_state%lookup_table_velocity(ik)) / &
168  (current_state%global_grid%configuration%vertical%zlogm-(2.0_default_precision*&
169  log((x1+1.0_default_precision)/(x0+1.0_default_precision)) + log((x1*x1+1.0_default_precision)/&
170  (x0*x0+1.0_default_precision)) + 2.0_default_precision*atan(x0) -2.0_default_precision*atan(x1)))
171  end do
172  end if
173  end do
174  current_state%cneut=current_state%lookup_table_ustr(current_state%lookup_table_entries)/&
175  current_state%lookup_table_velocity(current_state%lookup_table_entries)
176  current_state%cfc=current_state%lookup_table_ustr(1)*current_state%lookup_table_velocity(1)**convective_limit ! _Businger-Dyer
177  end subroutine set_look
178 
179  subroutine change_look(current_state)
180  type(model_state_type), intent(inout), target :: current_state
181 
182  real(kind=DEFAULT_PRECISION):: crelax,& ! Relaxation parameter to move to new USTR
183  dfb,& ! Iterative difference in buoyancy flux
184  rnit,& ! real number of iterations required
185  velnew,&
186  dvelustr(current_state%lookup_table_entries), ob, x1, x0
187  integer n, ik, & ! Loop counters
188  nit ! Number of iterations
189  if (current_state%fbuoynew .le. 0.0_default_precision) then
190  current_state%fbuoy=current_state%fbuoynew
191  return
192  end if
193  if (max_change_buoyancy_flux .gt. 0.0_default_precision) then
194  rnit = abs(current_state%fbuoynew-current_state%fbuoy)/max_change_buoyancy_flux
195  nit = 1+int(rnit)
196  else
197  nit=1
198  end if
199  if (nit .gt. 10 .or. (current_state%fbuoynew .gt. 0.0_default_precision .and. &
200  current_state%fbuoy .le. 0.0_default_precision)) then
201  current_state%fbuoy=current_state%fbuoynew
202  call set_look(current_state)
203  return
204  end if
205  crelax=1./sqrt(real(nit)) ! maybe better with crelax=1.
206  dfb=(current_state%fbuoynew-current_state%fbuoy)/real(nit)
207  do n=1, nit
208  current_state%fbuoy=current_state%fbuoy+dfb
209  do ik=2, current_state%lookup_table_entries-1
210  dvelustr(ik)=log(current_state%lookup_table_velocity(ik+1)/current_state%lookup_table_velocity(ik-1))&
211  /log(current_state%lookup_table_ustr(ik+1)/current_state%lookup_table_ustr(ik-1))
212  end do
213  dvelustr(1)=log(current_state%lookup_table_velocity(2)/current_state%lookup_table_velocity(1))/&
214  log(current_state%lookup_table_ustr(2)/current_state%lookup_table_ustr(1))
215  dvelustr(current_state%lookup_table_entries)=log(current_state%lookup_table_velocity(current_state%lookup_table_entries)/&
216  current_state%lookup_table_velocity(current_state%lookup_table_entries-1))/&
217  log(current_state%lookup_table_ustr(current_state%lookup_table_entries)/&
218  current_state%lookup_table_ustr(current_state%lookup_table_entries-1))
219  do ik=1, current_state%lookup_table_entries
220  ! compute new mean vel. based on old ustar and new fbuoy
221  ob=-current_state%lookup_table_ustr(ik)**3/(von_karman_constant*current_state%fbuoy)
222  x1=sqrt(sqrt(1.-gammam*(current_state%global_grid%configuration%vertical%zn(2)+z0)/ob))
223  x0=sqrt(sqrt(1.-gammam*z0/ob))
224  velnew=(current_state%lookup_table_ustr(ik)/von_karman_constant)*(current_state%global_grid%configuration%vertical%zlogm-&
225  (2.0_default_precision*log((x1+1.0_default_precision)/(x0+1.0_default_precision)) + &
226  log((x1*x1+1.0_default_precision)/(x0*x0+1.0_default_precision)) + 2.0_default_precision*atan(x0) &
227  -2.0_default_precision*atan(x1)))
228  ! relax to new ustar
229  current_state%lookup_table_ustr(ik)=current_state%lookup_table_ustr(ik)/&
230  (velnew/current_state%lookup_table_velocity(ik))**(crelax/dvelustr(ik))
231  end do
232  end do
233  current_state%cneut=current_state%lookup_table_ustr(current_state%lookup_table_entries)/&
234  current_state%lookup_table_velocity(current_state%lookup_table_entries)
235  current_state%cfc=current_state%lookup_table_ustr(1)*current_state%lookup_table_velocity(1)**convective_limit ! _Businger-Dyer
236  current_state%fbuoy=current_state%fbuoynew
237  end subroutine change_look
238 
239  subroutine set_flux(current_state)
240  type(model_state_type), intent(inout), target :: current_state
241 
242  real(kind=DEFAULT_PRECISION) :: surface_temp ! Surface temperature
243 
244  if (current_state%type_of_surface_boundary_conditions == prescribed_surface_fluxes) then ! Prescribed surface fluxes
245 
246  ! Linear interpolation of input data...
247  call interpolate_point_linear_1d(surface_boundary_input_times, &
248  surface_sensible_heat_flux/(current_state%global_grid%configuration%vertical%rho(1)*cp), &
249  current_state%time, current_state%surface_temperature_flux, &
250  extrapolate='constant')
251 
252  call interpolate_point_linear_1d(surface_boundary_input_times, &
253  surface_latent_heat_flux/(current_state%global_grid%configuration%vertical%rho(1)*rlvap), &
254  current_state%time, current_state%surface_vapour_flux, &
255  extrapolate='constant')
256 
257  ! Update buoyancy flux...
258  current_state%fbuoynew=0.0_default_precision
259  if (.not. current_state%passive_th) current_state%fbuoynew=&
260  current_state%global_grid%configuration%vertical%buoy_co(1)*current_state%surface_temperature_flux
261  if (.not. current_state%passive_q) then
262  current_state%fbuoynew=current_state%fbuoynew+current_state%cq(iqv)*current_state%surface_vapour_flux*g
263  end if
264 
265  else if (current_state%type_of_surface_boundary_conditions == prescribed_surface_values) then ! Prescribed surface temperatures
266 
267  ! Linear interpolation of input data...
268  call interpolate_point_linear_1d(surface_boundary_input_times, &
270  current_state%time, surface_temp, &
271  extrapolate='constant')
272 
273 
274  if (current_state%saturated_surface)then
275  current_state%surface_vapour_mixing_ratio = qsaturation(surface_temp,current_state%surface_pressure*0.01)
276  else
277  call interpolate_point_linear_1d(surface_boundary_input_times, &
279  current_state%time, current_state%surface_vapour_mixing_ratio, &
280  extrapolate='constant')
281  end if
282 
283  ! Set theta_v
284  current_state%theta_surf = surface_temp*&
285  (current_state%surface_reference_pressure/current_state%surface_pressure)**r_over_cp
286  current_state%theta_virtual_surf = current_state%theta_surf
287  if (.not. current_state%passive_q) then
288  current_state%theta_virtual_surf = current_state%theta_surf + &
289  current_state%global_grid%configuration%vertical%thref(2)* &
290  current_state%cq(iqv)*current_state%surface_vapour_mixing_ratio
291  end if
292 
293  ! Finally set up new values of THVSURF dependent constants
294  current_state%cmbc=betam*current_state%global_grid%configuration%vertical%zn(2)*g*&
295  von_karman_constant/current_state%theta_virtual_surf
296  current_state%rcmbc=1.0_default_precision/current_state%cmbc
297  current_state%ellmocon=current_state%theta_virtual_surf/(g*von_karman_constant)
298 
299  end if
300 
301  end subroutine set_flux
302 
303  subroutine read_configuration(current_state)
304  type(model_state_type), intent(inout), target :: current_state
305 
306 
307 
308  integer :: ncid, time_dim
309  integer :: number_input_humidities
310 
311 
312  current_state%use_surface_boundary_conditions= &
313  options_get_logical(current_state%options_database, "use_surface_boundary_conditions")
314 
315  if (current_state%use_surface_boundary_conditions)then
316  current_state%type_of_surface_boundary_conditions=options_get_integer(current_state%options_database, &
317  "type_of_surface_boundary_conditions")
318  current_state%use_time_varying_surface_values=options_get_logical(current_state%options_database, &
319  "use_time_varying_surface_values")
320 
321  current_state%saturated_surface = .true. ! We will change this if we find some humidity data
322 
323  input_file=options_get_string(current_state%options_database, "surface_conditions_file")
324  ! Read in the input_file
325  if (trim(input_file)=='' .or. trim(input_file)=='None')then
326  if (current_state%use_time_varying_surface_values)then
329  call options_get_real_array(current_state%options_database, "surface_boundary_input_times", surface_boundary_input_times)
330  end if
331  if (current_state%type_of_surface_boundary_conditions == prescribed_surface_fluxes)then
334  )
337  call options_get_real_array(current_state%options_database, "surface_sensible_heat_flux", surface_sensible_heat_flux)
338  call options_get_real_array(current_state%options_database, "surface_latent_heat_flux", surface_latent_heat_flux)
339  number_input_humidities=0
340  else if (current_state%type_of_surface_boundary_conditions == prescribed_surface_values) then
343  )
346  call options_get_real_array(current_state%options_database, "surface_temperatures", surface_temperatures)
347  call options_get_real_array(current_state%options_database, "surface_humidities", surface_humidities)
348  number_input_humidities=options_get_array_size(current_state%options_database, "surface_humidities")
349  end if
350  else
351  call check_status(nf90_open(path = trim(input_file), mode = nf90_nowrite, ncid = ncid))
352  if (log_get_logging_level() .ge. log_debug) then
353  call log_master_log(log_debug, "Reading in surface boundary conditions from:"//trim(input_file) )
354  end if
355  call read_dimensions(ncid, time_dim)
356  call read_variables(trim(input_file), ncid, time_dim, &
359  if (.not. allocated(surface_humidities))then
360  number_input_humidities=0
361  else
362  number_input_humidities=size(surface_humidities)
363  end if
364  call check_status(nf90_close(ncid))
365  end if
366  if (number_input_humidities>0)current_state%saturated_surface=.false.
367 
368  max_change_buoyancy_flux=options_get_real(current_state%options_database, "max_change_buoyancy_flux")
369  end if
370 
371  ! Allocate lookup_tables
372  allocate(current_state%lookup_table_velocity(current_state%lookup_table_entries), &
373  current_state%lookup_table_ustr(current_state%lookup_table_entries))
374 
375  end subroutine read_configuration
376 
377 ! BELOW COPIED FROM KIDREADER - WOULD BE GOOD TO MAKE THESE UTILITY FUNCTIONS...
378 
382  subroutine read_dimensions(ncid, time_dim)
383  integer, intent(in) :: ncid
384  integer, intent(out) :: time_dim
385  integer :: time_dimid
386 
387  call check_status(nf90_inq_dimid(ncid, time_key, time_dimid))
388 
389  call check_status(nf90_inquire_dimension(ncid, time_dimid, len=time_dim))
390 
391  end subroutine read_dimensions
392 
398  subroutine read_variables(filename, ncid, time_dim, time, surface_temperatures, surface_humidities, &
399  surface_latent_heat_flux, surface_sensible_heat_flux )
400  character(*), intent(in) :: filename
401  integer, intent(in) :: ncid, time_dim
402  real(kind=DEFAULT_PRECISION), dimension(:), allocatable, intent(inout) :: time
403  real(kind=DEFAULT_PRECISION), dimension(:), allocatable, intent(inout) :: surface_temperatures
404  real(kind=DEFAULT_PRECISION), dimension(:), allocatable, intent(inout) :: surface_humidities
405  real(kind=DEFAULT_PRECISION), dimension(:), allocatable, intent(inout) :: surface_latent_heat_flux
406  real(kind=DEFAULT_PRECISION), dimension(:), allocatable, intent(inout) :: surface_sensible_heat_flux
407 
408  integer :: status, variable_id
409 
410  ! Do some checking on the variable contents so that we can deal with different
411  ! variable names or missing variables
412 
413  ! time...
414  status=nf90_inq_varid(ncid, time_key, variable_id)
415  if (status==nf90_noerr)then
416  allocate(time(time_dim))
417  call read_single_variable(ncid, time_key, data1d=time)
418  else
419  call log_log(log_error, "No recognized time variable found in"//trim(filename))
420  end if
421 
422  status=nf90_inq_varid(ncid, surface_temperatures_key, variable_id)
423  if (status==nf90_noerr)then
424  allocate(surface_temperatures(time_dim))
425  call read_single_variable(ncid, surface_temperatures_key, data1d=surface_temperatures)
426  end if
427 
428  status=nf90_inq_varid(ncid, surface_humidities_key, variable_id)
429  if (status==nf90_noerr)then
430  allocate(surface_humidities(time_dim))
431  call read_single_variable(ncid, surface_humidities_key, data1d=surface_humidities)
432  end if
433 
434  status=nf90_inq_varid(ncid, surface_lhf_key, variable_id)
435  if (status==nf90_noerr)then
436  allocate(surface_latent_heat_flux(time_dim))
437  call read_single_variable(ncid, surface_lhf_key, data1d=surface_latent_heat_flux)
438  end if
439 
440  status=nf90_inq_varid(ncid, surface_shf_key, variable_id)
441  if (status==nf90_noerr)then
442  allocate(surface_sensible_heat_flux(time_dim))
443  call read_single_variable(ncid, surface_shf_key, data1d=surface_sensible_heat_flux)
444  end if
445 
446  end subroutine read_variables
447 
453  subroutine read_single_variable(ncid, key, data1d, data3d)
454  integer, intent(in) :: ncid
455  character(len=*), intent(in) :: key
456  real(kind=DEFAULT_PRECISION), dimension(:), intent(inout), optional :: data1d
457  real(kind=DEFAULT_PRECISION), dimension(:,:,:), intent(inout), optional :: data3d
458 
459  integer :: variable_id
460  real(kind=DEFAULT_PRECISION), dimension(:,:,:), allocatable :: sdata
461 
462  call check_status(nf90_inq_varid(ncid, key, variable_id))
463 
464  if (.not. present(data1d) .and. .not. present(data3d)) return
465 
466  if (present(data1d)) then
467  call check_status(nf90_get_var(ncid, variable_id, data1d))
468  else
469  ! 3D will reshape the data to take account of the column-row major C-F transposition
470  allocate(sdata(size(data3d,1),size(data3d,3), size(data3d,2)))
471  call check_status(nf90_get_var(ncid, variable_id, sdata))
472  data3d(:,:,:)=reshape(sdata(:,:,:),(/size(data3d,1),size(data3d,2),size(data3d,3)/))
473  deallocate(sdata)
474  end if
475  end subroutine read_single_variable
476 
477 
480  subroutine check_status(status)
481  integer, intent(in) :: status
482 
483  if (status /= nf90_noerr) then
484  call log_log(log_error, "NetCDF returned error code of "//trim(nf90_strerror(status)))
485  end if
486  end subroutine check_status
487 
488 end module setfluxlook_mod
character(len= *), parameter time_key
NetCDF data time key.
Definition: setfluxlook.F90:22
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...
integer, parameter lookup_entries
Number of entries for MO lookup tables.
Definition: setfluxlook.F90:29
subroutine set_look(current_state)
subroutine change_look(current_state)
type(standard_q_names_type), public standard_q_names
Definition: q_indices.F90:59
character(len= *), parameter surface_humidities_key
NetCDF data surface_humidities.
Definition: setfluxlook.F90:22
integer, parameter max_surface_inputs
Specifies the maximum number of surface inputs through configuration file Inputs through netcdf files...
Definition: setfluxlook.F90:31
integer, parameter, public log_error
Only log ERROR messages.
Definition: logging.F90:11
character(len=string_length) function, public options_get_string(options_database, key, index)
Retrieves a string value from the database that matches the provided key.
subroutine read_dimensions(ncid, time_dim)
Reads the dimensions from the NetCDF file.
character(max_file_len) input_file
Definition: setfluxlook.F90:34
Logging utility.
Definition: logging.F90:2
subroutine initialisation_callback(current_state)
Definition: setfluxlook.F90:59
subroutine interpolate_point_linear_1d(zvals, vals, z, f, extrapolate)
Does a simple 1d linear interpolation to a point.
subroutine read_single_variable(ncid, key, data1d, data3d)
Reads a single variable out of a NetCDF file.
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
character(len= *), parameter surface_lhf_key
NetCDF data surface_latent_heat_flux.
Definition: setfluxlook.F90:22
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
real(kind=default_precision), dimension(:), allocatable surface_latent_heat_flux
Definition: setfluxlook.F90:39
subroutine, public log_master_log(level, message)
Will log just from the master process.
Definition: logging.F90:47
integer, parameter, public log_debug
Log DEBUG, INFO, WARNING and ERROR messages.
Definition: logging.F90:14
integer, parameter, public prescribed_surface_fluxes
Definition: state.F90:15
character(len= *), parameter surface_temperatures_key
NetCDF data surface_temperatures.
Definition: setfluxlook.F90:22
subroutine read_variables(filename, ncid, time_dim, time, surface_temperatures, surface_humidities, surface_latent_heat_flux, surface_sensible_heat_flux)
Reads the variables from the NetCDF KiD model file.
Saturation physics functionality which is used throughout the code.
Definition: saturation.F90:2
character(len= *), parameter surface_shf_key
NetCDF data surface_sensible_heat_flux.
Definition: setfluxlook.F90:22
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
Scientific constant values used throughout simulations. Each has a default value and this can be over...
Map data structure that holds string (length 20 maximum) key value pairs.
Definition: collections.F90:86
This manages the Q variables and specifically the mapping between names and the index that they are s...
Definition: q_indices.F90:2
real(kind=default_precision) max_change_buoyancy_flux
Definition: setfluxlook.F90:36
Interfaces and types that MONC components must specify.
real(kind=default_precision), dimension(:), allocatable surface_sensible_heat_flux
Definition: setfluxlook.F90:38
Collection data structures.
Definition: collections.F90:7
integer, parameter, public log_warn
Log WARNING and ERROR messages.
Definition: logging.F90:12
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
integer, parameter, public prescribed_surface_values
Definition: state.F90:15
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 surface_boundary_input_times
Definition: setfluxlook.F90:37
Functionality to support the different types of grid and abstraction between global grids and local o...
Definition: grids.F90:5
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.
subroutine check_status(status)
Will check a NetCDF status and write to log_log error any decoded statuses.
real(kind=default_precision), dimension(:), allocatable surface_humidities
Definition: setfluxlook.F90:41
subroutine set_flux(current_state)
subroutine, public options_get_real_array(options_database, key, array_data, from, to)
Retrieves an entire (or subset) real array.
The model state which represents the current state of a run.
Definition: state.F90:2
integer function, public log_get_logging_level()
Retrieves the current logging level.
Definition: logging.F90:122
real(kind=default_precision), dimension(:), allocatable surface_temperatures
Definition: setfluxlook.F90:40
integer, parameter max_file_len
Maximum length of surface condition input filename.
Definition: setfluxlook.F90:30
subroutine read_configuration(current_state)
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
subroutine timestep_callback(current_state)
type(component_descriptor_type) function, public setfluxlook_get_descriptor()
Descriptor of this component for registration.
Definition: setfluxlook.F90:52