MONC
Functions/Subroutines | Variables
setfluxlook_mod Module Reference

Functions/Subroutines

type(component_descriptor_type) function, public setfluxlook_get_descriptor ()
 Descriptor of this component for registration. More...
 
subroutine initialisation_callback (current_state)
 
subroutine timestep_callback (current_state)
 
subroutine set_look (current_state)
 
subroutine change_look (current_state)
 
subroutine set_flux (current_state)
 
subroutine read_configuration (current_state)
 
subroutine read_dimensions (ncid, time_dim)
 Reads the dimensions from the NetCDF file. More...
 
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. More...
 
subroutine read_single_variable (ncid, key, data1d, data3d)
 Reads a single variable out of a NetCDF file. More...
 
subroutine check_status (status)
 Will check a NetCDF status and write to log_log error any decoded statuses. More...
 

Variables

character(len= *), parameter time_key = "time"
 NetCDF data time key. More...
 
character(len= *), parameter surface_temperatures_key = "surface_temperature"
 NetCDF data surface_temperatures. More...
 
character(len= *), parameter surface_humidities_key = "surface_humidity"
 NetCDF data surface_humidities. More...
 
character(len= *), parameter surface_shf_key = "surface_sensible_heat_flux"
 NetCDF data surface_sensible_heat_flux. More...
 
character(len= *), parameter surface_lhf_key = "surface_latent_heat_flux"
 NetCDF data surface_latent_heat_flux. More...
 
integer, parameter lookup_entries = 80
 Number of entries for MO lookup tables. More...
 
integer, parameter max_file_len =200
 Maximum length of surface condition input filename. More...
 
integer, parameter max_surface_inputs =50
 Specifies the maximum number of surface inputs through configuration file Inputs through netcdf files are not limitted by this. More...
 
character(max_file_leninput_file
 
real(kind=default_precision) max_change_buoyancy_flux
 
real(kind=default_precision), dimension(:), allocatable surface_boundary_input_times
 
real(kind=default_precision), dimension(:), allocatable surface_sensible_heat_flux
 
real(kind=default_precision), dimension(:), allocatable surface_latent_heat_flux
 
real(kind=default_precision), dimension(:), allocatable surface_temperatures
 
real(kind=default_precision), dimension(:), allocatable surface_humidities
 
integer iqv
 

Function/Subroutine Documentation

◆ change_look()

subroutine setfluxlook_mod::change_look ( type(model_state_type), intent(inout), target  current_state)
private

Definition at line 180 of file setfluxlook.F90.

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_status()

subroutine setfluxlook_mod::check_status ( integer, intent(in)  status)
private

Will check a NetCDF status and write to log_log error any decoded statuses.

Parameters
statusThe NetCDF status flag

Definition at line 481 of file setfluxlook.F90.

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
Here is the caller graph for this function:

◆ initialisation_callback()

subroutine setfluxlook_mod::initialisation_callback ( type(model_state_type), intent(inout), target  current_state)
private

Definition at line 59 of file setfluxlook.F90.

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 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_configuration()

subroutine setfluxlook_mod::read_configuration ( type(model_state_type), intent(inout), target  current_state)
private

Definition at line 304 of file setfluxlook.F90.

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
327  allocate(surface_boundary_input_times(max_surface_inputs))
328  surface_boundary_input_times=0.0
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
332  allocate(surface_sensible_heat_flux(max_surface_inputs), &
333  surface_latent_heat_flux(max_surface_inputs) &
334  )
335  surface_sensible_heat_flux=0.0
336  surface_latent_heat_flux=0.0
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
341  allocate(surface_temperatures(max_surface_inputs), &
342  surface_humidities(max_surface_inputs) &
343  )
344  surface_temperatures=0.0
345  surface_humidities=0.0
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, &
357  surface_boundary_input_times, surface_temperatures, surface_humidities, &
358  surface_latent_heat_flux, surface_sensible_heat_flux)
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 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_dimensions()

subroutine setfluxlook_mod::read_dimensions ( integer, intent(in)  ncid,
integer, intent(out)  time_dim 
)
private

Reads the dimensions from the NetCDF file.

Parameters
ncidThe NetCDF file id
time_dimNumber of elements in the time dimension

Definition at line 383 of file setfluxlook.F90.

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 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_single_variable()

subroutine setfluxlook_mod::read_single_variable ( integer, intent(in)  ncid,
character(len=*), intent(in)  key,
real(kind=default_precision), dimension(:), intent(inout), optional  data1d,
real(kind=default_precision), dimension(:,:,:), intent(inout), optional  data3d 
)
private

Reads a single variable out of a NetCDF file.

Parameters
ncidThe NetCDF file id
keyThe variable key (name) to access
data1dOptional one dimensional data to read into
data3dOptional three dimensional data to read into

Definition at line 454 of file setfluxlook.F90.

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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_variables()

subroutine setfluxlook_mod::read_variables ( character(*), intent(in)  filename,
integer, intent(in)  ncid,
integer, intent(in)  time_dim,
real(kind=default_precision), dimension(:), intent(inout), allocatable  time,
real(kind=default_precision), dimension(:), intent(inout), allocatable  surface_temperatures,
real(kind=default_precision), dimension(:), intent(inout), allocatable  surface_humidities,
real(kind=default_precision), dimension(:), intent(inout), allocatable  surface_latent_heat_flux,
real(kind=default_precision), dimension(:), intent(inout), allocatable  surface_sensible_heat_flux 
)
private

Reads the variables from the NetCDF KiD model file.

Parameters
ncidThe id of the NetCDF file
time_dimThe number of elements in the time dimension
timeThe time data field that is to be read
surface_temperaturessurface temperatures (K)

Definition at line 400 of file setfluxlook.F90.

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 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_flux()

subroutine setfluxlook_mod::set_flux ( type(model_state_type), intent(inout), target  current_state)
private

Definition at line 240 of file setfluxlook.F90.

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, &
269  surface_temperatures, &
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, &
278  surface_humidities, &
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 
Here is the caller graph for this function:

◆ set_look()

subroutine setfluxlook_mod::set_look ( type(model_state_type), intent(inout), target  current_state)
private

Definition at line 143 of file setfluxlook.F90.

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
Here is the caller graph for this function:

◆ setfluxlook_get_descriptor()

type(component_descriptor_type) function, public setfluxlook_mod::setfluxlook_get_descriptor ( )

Descriptor of this component for registration.

Returns
The diverr component descriptor

Definition at line 52 of file setfluxlook.F90.

52  setfluxlook_get_descriptor%name="setfluxlook"
53  setfluxlook_get_descriptor%version=0.1
54  setfluxlook_get_descriptor%initialisation=>initialisation_callback
55  setfluxlook_get_descriptor%timestep=>timestep_callback
Here is the call graph for this function:

◆ timestep_callback()

subroutine setfluxlook_mod::timestep_callback ( type(model_state_type), intent(inout), target  current_state)
private

Definition at line 131 of file setfluxlook.F90.

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
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ input_file

character(max_file_len) setfluxlook_mod::input_file
private

Definition at line 34 of file setfluxlook.F90.

34  character(MAX_FILE_LEN) :: input_file

◆ iqv

integer setfluxlook_mod::iqv
private

Definition at line 43 of file setfluxlook.F90.

43  integer :: iqv ! index for vapour

◆ lookup_entries

integer, parameter setfluxlook_mod::lookup_entries = 80
private

Number of entries for MO lookup tables.

Definition at line 29 of file setfluxlook.F90.

29  integer, parameter :: lookup_entries = 80

◆ max_change_buoyancy_flux

real(kind=default_precision) setfluxlook_mod::max_change_buoyancy_flux
private

Definition at line 36 of file setfluxlook.F90.

36  real(kind=DEFAULT_PRECISION) :: max_change_buoyancy_flux

◆ max_file_len

integer, parameter setfluxlook_mod::max_file_len =200
private

Maximum length of surface condition input filename.

Definition at line 30 of file setfluxlook.F90.

30  integer, parameter :: max_file_len=200

◆ max_surface_inputs

integer, parameter setfluxlook_mod::max_surface_inputs =50
private

Specifies the maximum number of surface inputs through configuration file Inputs through netcdf files are not limitted by this.

Definition at line 31 of file setfluxlook.F90.

31  integer, parameter :: max_surface_inputs=50

◆ surface_boundary_input_times

real(kind=default_precision), dimension(:), allocatable setfluxlook_mod::surface_boundary_input_times
private

Definition at line 37 of file setfluxlook.F90.

37  real(kind=DEFAULT_PRECISION), allocatable :: surface_boundary_input_times(:)

◆ surface_humidities

real(kind=default_precision), dimension(:), allocatable setfluxlook_mod::surface_humidities
private

Definition at line 41 of file setfluxlook.F90.

41  real(kind=DEFAULT_PRECISION), allocatable :: surface_humidities(:)

◆ surface_humidities_key

character(len=*), parameter setfluxlook_mod::surface_humidities_key = "surface_humidity"
private

NetCDF data surface_humidities.

Definition at line 22 of file setfluxlook.F90.

◆ surface_latent_heat_flux

real(kind=default_precision), dimension(:), allocatable setfluxlook_mod::surface_latent_heat_flux
private

Definition at line 39 of file setfluxlook.F90.

39  real(kind=DEFAULT_PRECISION), allocatable :: surface_latent_heat_flux(:)

◆ surface_lhf_key

character(len=*), parameter setfluxlook_mod::surface_lhf_key = "surface_latent_heat_flux"
private

NetCDF data surface_latent_heat_flux.

Definition at line 22 of file setfluxlook.F90.

◆ surface_sensible_heat_flux

real(kind=default_precision), dimension(:), allocatable setfluxlook_mod::surface_sensible_heat_flux
private

Definition at line 38 of file setfluxlook.F90.

38  real(kind=DEFAULT_PRECISION), allocatable :: surface_sensible_heat_flux(:)

◆ surface_shf_key

character(len=*), parameter setfluxlook_mod::surface_shf_key = "surface_sensible_heat_flux"
private

NetCDF data surface_sensible_heat_flux.

Definition at line 22 of file setfluxlook.F90.

◆ surface_temperatures

real(kind=default_precision), dimension(:), allocatable setfluxlook_mod::surface_temperatures
private

Definition at line 40 of file setfluxlook.F90.

40  real(kind=DEFAULT_PRECISION), allocatable :: surface_temperatures(:)

◆ surface_temperatures_key

character(len=*), parameter setfluxlook_mod::surface_temperatures_key = "surface_temperature"
private

NetCDF data surface_temperatures.

Definition at line 22 of file setfluxlook.F90.

◆ time_key

character(len=*), parameter setfluxlook_mod::time_key = "time"
private

NetCDF data time key.

Definition at line 22 of file setfluxlook.F90.

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"