316 type(model_state_type),
intent(inout),
target :: current_state
320 integer :: ncid, time_dim
321 integer :: number_input_humidities
324 current_state%use_surface_boundary_conditions= &
327 if (current_state%use_surface_boundary_conditions)
then
328 current_state%type_of_surface_boundary_conditions=
options_get_integer(current_state%options_database, &
329 "type_of_surface_boundary_conditions")
330 current_state%use_time_varying_surface_values=
options_get_logical(current_state%options_database, &
331 "use_time_varying_surface_values")
333 current_state%saturated_surface = .true.
335 input_file=
options_get_string(current_state%options_database,
"surface_conditions_file")
337 if (trim(input_file)==
'' .or. trim(input_file)==
'None')
then
338 if (current_state%use_time_varying_surface_values)
then
339 allocate(surface_boundary_input_times(max_surface_inputs))
340 surface_boundary_input_times=0.0
341 call options_get_real_array(current_state%options_database,
"surface_boundary_input_times", surface_boundary_input_times)
343 if (current_state%type_of_surface_boundary_conditions == prescribed_surface_fluxes)
then
344 allocate(surface_sensible_heat_flux(max_surface_inputs), &
345 surface_latent_heat_flux(max_surface_inputs) &
347 surface_sensible_heat_flux=0.0
348 surface_latent_heat_flux=0.0
349 call options_get_real_array(current_state%options_database,
"surface_sensible_heat_flux", surface_sensible_heat_flux)
350 call options_get_real_array(current_state%options_database,
"surface_latent_heat_flux", surface_latent_heat_flux)
351 number_input_humidities=0
352 else if (current_state%type_of_surface_boundary_conditions == prescribed_surface_values)
then
353 allocate(surface_temperatures(max_surface_inputs), &
354 surface_humidities(max_surface_inputs) &
356 surface_temperatures=0.0
357 surface_humidities=0.0
358 call options_get_real_array(current_state%options_database,
"surface_temperatures", surface_temperatures)
359 units_surface_temp=
options_get_string(current_state%options_database,
"units_surface_temp")
361 call options_get_real_array(current_state%options_database,
"surface_humidities", surface_humidities)
362 number_input_humidities=options_get_array_size(current_state%options_database,
"surface_humidities")
365 call check_status(nf90_open(path = trim(input_file), mode = nf90_nowrite, ncid = ncid))
369 call read_dimensions(ncid, time_dim)
370 call read_variables(trim(input_file), ncid, time_dim, &
371 surface_boundary_input_times, surface_temperatures, surface_humidities, &
372 surface_latent_heat_flux, surface_sensible_heat_flux)
373 if (.not.
allocated(surface_humidities))
then
374 number_input_humidities=0
376 number_input_humidities=
size(surface_humidities)
378 call check_status(nf90_close(ncid))
380 if (number_input_humidities>0)current_state%saturated_surface=.false.
382 max_change_buoyancy_flux=
options_get_real(current_state%options_database,
"max_change_buoyancy_flux")
386 allocate(current_state%lookup_table_velocity(current_state%lookup_table_entries), &
387 current_state%lookup_table_ustr(current_state%lookup_table_entries))