chgres_cube  1.7.0
 All Data Structures Files Functions Variables
program_setup.F90
Go to the documentation of this file.
1 
4 
9  module program_setup
10 
11  implicit none
12 
13  private
14 
15  character(len=500), public :: varmap_file = "NULL"
16  character(len=500), public :: atm_files_input_grid(6) = "NULL"
20  character(len=500), public :: atm_core_files_input_grid(7) = "NULL"
21  character(len=500), public :: atm_tracer_files_input_grid(6) = "NULL"
22  character(len=500), public :: data_dir_input_grid = "NULL"
23  character(len=500), public :: fix_dir_target_grid = "NULL"
24  character(len=500), public :: mosaic_file_input_grid = "NULL"
25  character(len=500), public :: mosaic_file_target_grid = "NULL"
26  character(len=500), public :: nst_files_input_grid = "NULL"
27  character(len=500), public :: grib2_file_input_grid = "NULL"
28  character(len=500), public :: geogrid_file_input_grid = "NULL"
31  character(len=500), public :: orog_dir_input_grid = "NULL"
32  character(len=500), public :: orog_files_input_grid(6) = "NULL"
33  character(len=500), public :: orog_dir_target_grid = "NULL"
34  character(len=500), public :: orog_files_target_grid(6) = "NULL"
35  character(len=500), public :: sfc_files_input_grid(6) = "NULL"
36  character(len=500), public :: vcoord_file_target_grid = "NULL"
37  character(len=500), public :: thomp_mp_climo_file= "NULL"
38  character(len=6), public :: cres_target_grid = "NULL"
39  character(len=500), public :: atm_weight_file="NULL"
40  character(len=25), public :: input_type="restart"
54  character(len=20), public :: external_model="GFS"
55 
56  integer, parameter, public :: max_tracers=100
57  integer, public :: num_tracers
58  integer, public :: num_tracers_input
59 
60  logical, allocatable, public :: read_from_input(:)
62 
63  character(len=20), public :: tracers(max_tracers)="NULL"
69  character(len=20), public :: tracers_input(max_tracers)="NULL"
74  character(len=20), allocatable, public :: missing_var_methods(:)
76  character(len=20), allocatable, public :: chgres_var_names(:)
78  character(len=20), allocatable, public :: field_var_names(:)
79 
80 
81  integer, public :: cycle_year = -999
82  integer, public :: cycle_mon = -999
83  integer, public :: cycle_day = -999
84  integer, public :: cycle_hour = -999
85  integer, public :: regional = 0
87  integer, public :: halo_bndy = 0
88  integer, public :: halo_blend = 0
89  integer, public :: nsoill_out = 4
90 
91  logical, public :: convert_atm = .false.
92  logical, public :: convert_nst = .false.
93  logical, public :: convert_sfc = .false.
94  logical, public :: wam_cold_start = .false.
95 
96  ! Options for replacing vegetation/soil type, veg fraction, and lai with data from the grib2 file
97  ! Default is to use climatology instead
98  logical, public :: vgtyp_from_climo = .true.
102  logical, public :: sotyp_from_climo = .true.
107  logical, public :: vgfrc_from_climo = .true.
111 
112  logical, public :: minmax_vgfrc_from_climo = .true.
116  logical, public :: lai_from_climo = .true.
119  logical, public :: tg3_from_soil = .false.
122  logical, public :: use_thomp_mp_climo=.false.
123 
124  real, allocatable, public :: drysmc_input(:)
125  real, allocatable, public :: drysmc_target(:)
126  real, allocatable, public :: maxsmc_input(:)
127  real, allocatable, public :: maxsmc_target(:)
128  real, allocatable, public :: refsmc_input(:)
129  real, allocatable, public :: refsmc_target(:)
130  real, allocatable, public :: wltsmc_input(:)
131  real, allocatable, public :: wltsmc_target(:)
132  real, allocatable, public :: bb_target(:)
133  real, allocatable, public :: satpsi_target(:)
134  real, allocatable, public :: missing_var_values(:)
136 
137 
138  public :: read_setup_namelist
139  public :: calc_soil_params_driver
140  public :: read_varmap
141  public :: get_var_cond
142 
143  contains
144 
150  subroutine read_setup_namelist(filename)
151  implicit none
152 
153  character(len=*), intent(in), optional :: filename
154  character(:), allocatable :: filename_to_use
155 
156 
157  integer :: is, ie, ierr
158 
159 
160  namelist /config/ varmap_file, &
161  mosaic_file_target_grid, &
162  fix_dir_target_grid, &
163  orog_dir_target_grid, &
164  orog_files_target_grid, &
165  mosaic_file_input_grid, &
166  orog_dir_input_grid, &
167  orog_files_input_grid, &
168  nst_files_input_grid, &
169  sfc_files_input_grid, &
170  atm_files_input_grid, &
171  atm_core_files_input_grid, &
172  atm_tracer_files_input_grid, &
173  grib2_file_input_grid, &
174  geogrid_file_input_grid, &
175  data_dir_input_grid, &
176  vcoord_file_target_grid, &
177  cycle_year, cycle_mon, cycle_day, &
178  cycle_hour, convert_atm, &
179  convert_nst, convert_sfc, &
180  wam_cold_start, &
181  vgtyp_from_climo, &
182  sotyp_from_climo, &
183  vgfrc_from_climo, &
184  minmax_vgfrc_from_climo, &
185  lai_from_climo, tg3_from_soil, &
186  regional, input_type, &
187  external_model, &
188  atm_weight_file, tracers, &
189  tracers_input, &
190  halo_bndy, &
191  halo_blend, &
192  nsoill_out, &
193  thomp_mp_climo_file
194 
195  print*,"- READ SETUP NAMELIST"
196 
197  if (present(filename)) then
198  filename_to_use = filename
199  else
200  filename_to_use = "./fort.41"
201  endif
202 
203  open(41, file=filename_to_use, iostat=ierr)
204  if (ierr /= 0) call error_handler("OPENING SETUP NAMELIST.", ierr)
205  read(41, nml=config, iostat=ierr)
206  if (ierr /= 0) call error_handler("READING SETUP NAMELIST.", ierr)
207  close (41)
208 
209  call to_lower(input_type)
210 
211  orog_dir_target_grid = trim(orog_dir_target_grid) // '/'
212  orog_dir_input_grid = trim(orog_dir_input_grid) // '/'
213 
214 !-------------------------------------------------------------------------
215 ! Determine CRES of target grid from the name of the mosaic file.
216 !-------------------------------------------------------------------------
217 
218  is = index(mosaic_file_target_grid, "/", .true.)
219  ie = index(mosaic_file_target_grid, "mosaic") - 1
220 
221  if (is == 0 .or. ie == 0) then
222  call error_handler("CANT DETERMINE CRES FROM MOSAIC FILE.", 1)
223  endif
224 
225  cres_target_grid = mosaic_file_target_grid(is+1:ie-1)
226 
227  if (.not. convert_sfc .and. .not. convert_atm) then
228  call error_handler("MUST CONVERT EITHER AN ATM OR SFC FILE.", 1)
229  endif
230 
231 !-------------------------------------------------------------------------
232 ! Flag for processing stand-alone regional grid. When '1',
233 ! remove halo from atmospheric and surface data and output
234 ! atmospheric lateral boundary condition file. When '2',
235 ! create lateral boundary file only. When '0' (the default),
236 ! process normally as a global grid.
237 !-------------------------------------------------------------------------
238 
239  if (regional > 0) then
240  print*,"- PROCESSING A REGIONAL NEST WITH A BOUNDARY HALO OF ",halo_bndy
241  print*,"- PROCESSING A REGIONAL NEST WITH A BLENDING HALO OF ",halo_blend
242  else
243  halo_bndy = 0
244  halo_blend = 0
245  endif
246 
247  num_tracers = 0
248  do is = 1, max_tracers
249  if (trim(tracers(is)) == "NULL") exit
250  num_tracers = num_tracers + 1
251  print*,"- TRACER NAME IN OUTPUT FILE ", trim(tracers(is))
252  enddo
253 
254  num_tracers_input = 0
255  do is = 1, max_tracers
256  if (trim(tracers_input(is)) == "NULL") exit
257  num_tracers_input = num_tracers_input + 1
258  print*,"- TRACER NAME IN INPUT FILE ", trim(tracers_input(is))
259  enddo
260 
261 !-------------------------------------------------------------------------
262 ! Ensure spo, spo2, and spo3 in tracers list if wam ic is on
263 !-------------------------------------------------------------------------
264 
265  if( wam_cold_start ) then
266  ierr=3
267  do is = 1, num_tracers
268  if(trim(tracers(is)) == "spo" ) ierr = ierr - 1
269  if(trim(tracers(is)) == "spo2" ) ierr = ierr - 1
270  if(trim(tracers(is)) == "spo3" ) ierr = ierr - 1
271  enddo
272  if (ierr /= 0) then
273  print*,"-ERROR: spo, spo2, and spo3 should be in tracers namelist"
274  call error_handler("WAM TRACER NAMELIST.", ierr)
275  endif
276  print*,"- WAM COLDSTART OPTION IS TURNED ON."
277  endif
278 
279 !-------------------------------------------------------------------------
280 ! Ensure program recognizes the input data type.
281 !-------------------------------------------------------------------------
282 
283  select case (trim(input_type))
284  case ("restart")
285  print*,'- INPUT DATA FROM FV3 TILED RESTART FILES.'
286  case ("history")
287  print*,'- INPUT DATA FROM FV3 TILED HISTORY FILES.'
288  case ("gaussian_nemsio")
289  print*,'- INPUT DATA FROM FV3 GAUSSIAN NEMSIO FILE.'
290  case ("gfs_gaussian_nemsio")
291  print*,'- INPUT DATA FROM SPECTRAL GFS GAUSSIAN NEMSIO FILE.'
292  case ("gfs_sigio")
293  print*,'- INPUT DATA FROM SPECTRAL GFS SIGIO/SFCIO FILE.'
294  case ("gaussian_netcdf")
295  print*,'- INPUT DATA FROM FV3 GAUSSIAN NETCDF FILE.'
296  case ("grib2")
297  print*,'- INPUT DATA FROM A GRIB2 FILE'
298  case default
299  call error_handler("UNRECOGNIZED INPUT DATA TYPE.", 1)
300  end select
301 
302 !-------------------------------------------------------------------------
303 ! Ensure proper file variable provided for grib2 input
304 !-------------------------------------------------------------------------
305 
306  if (trim(input_type) == "grib2") then
307  if (trim(grib2_file_input_grid) == "NULL" .or. trim(grib2_file_input_grid) == "") then
308  call error_handler("FOR GRIB2 DATA, PLEASE PROVIDE GRIB2_FILE_INPUT_GRID", 1)
309  endif
310  endif
311 
312  !-------------------------------------------------------------------------
313 ! For grib2 input, warn about possibly unsupported external model types
314 !-------------------------------------------------------------------------
315 
316  if (trim(input_type) == "grib2") then
317  if (.not. any((/character(4)::"GFS","NAM","RAP","HRRR"/)==trim(external_model))) then
318  call error_handler( "KNOWN SUPPORTED external_model INPUTS ARE GFS, NAM, RAP, AND HRRR. " // &
319  "IF YOU WISH TO PROCESS GRIB2 DATA FROM ANOTHER MODEL, YOU MAY ATTEMPT TO DO SO AT YOUR OWN RISK. " // &
320  "ONE WAY TO DO THIS IS PROVIDE NAM FOR external_model AS IT IS A RELATIVELY STRAIGHT-" // &
321  "FORWARD REGIONAL GRIB2 FILE. YOU MAY ALSO COMMENT OUT THIS ERROR MESSAGE IN " // &
322  "program_setup.f90 LINE 389. NO GUARANTEE IS PROVIDED THAT THE CODE WILL WORK OR "// &
323  "THAT THE RESULTING DATA WILL BE CORRECT OR WORK WITH THE ATMOSPHERIC MODEL.", 1)
324  endif
325  endif
326 
327 !-------------------------------------------------------------------------
328 ! For grib2 hrrr input without geogrid file input, warn that soil moisture interpolation
329 ! will be less accurate
330 !-------------------------------------------------------------------------
331 
332  if (trim(input_type) == "grib2" .and. trim(external_model)=="HRRR") then
333  if (trim(geogrid_file_input_grid) == "NULL" .or. trim(grib2_file_input_grid) == "") then
334  print*, "HRRR DATA DOES NOT CONTAIN SOIL TYPE INFORMATION. WITHOUT &
335  GEOGRID_FILE_INPUT_GRID SPECIFIED, SOIL MOISTURE INTERPOLATION MAY BE LESS &
336  ACCURATE. "
337  endif
338  endif
339 
340  if (trim(thomp_mp_climo_file) /= "NULL") then
341  use_thomp_mp_climo=.true.
342  print*,"- WILL PROCESS CLIMO THOMPSON MP TRACERS FROM FILE: ", trim(thomp_mp_climo_file)
343  endif
344 
345  return
346 
347  end subroutine read_setup_namelist
348 
373 subroutine read_varmap
374 
375  implicit none
376 
377  integer :: istat, k, nvars
378  character(len=500) :: line
379  character(len=20),allocatable :: var_type(:)
380 
381  if (trim(input_type) == "grib2") then
382 
383  print*,"OPEN VARIABLE MAPPING FILE: ", trim(varmap_file)
384  open(14, file=trim(varmap_file), form='formatted', iostat=istat)
385  if (istat /= 0) then
386  call error_handler("OPENING VARIABLE MAPPING FILE", istat)
387  endif
388 
389  num_tracers_input = 0
390  nvars = 0
391 
392  !Loop over lines of file to count the number of variables
393  do
394  read(14, '(A)', iostat=istat) line !chgres_var_names_tmp(k)!, field_var_names(k) , &
395  ! missing_var_methods(k), missing_var_values(k), var_type(k)
396  if (istat/=0) exit
397  if ( trim(line) .eq. '' ) cycle
398  nvars = nvars+1
399  enddo
400  if ( nvars == 0) call error_handler("VARMAP FILE IS EMPTY.", -1)
401 
402  allocate(chgres_var_names(nvars))
403  allocate(field_var_names(nvars))
404  allocate(missing_var_methods(nvars))
405  allocate(missing_var_values(nvars))
406  allocate(read_from_input(nvars))
407  allocate(var_type(nvars))
408 
409  read_from_input(:) = .true.
410  rewind(14)
411  do k = 1,nvars
412  read(14, *, iostat=istat) chgres_var_names(k), field_var_names(k) , &
413  missing_var_methods(k), missing_var_values(k), var_type(k)
414  if (istat /= 0) call error_handler("READING VARIABLE MAPPING FILE", istat)
415  if(trim(var_type(k))=='T') then
416  num_tracers_input = num_tracers_input + 1
417  tracers_input(num_tracers_input)=chgres_var_names(k)
418  if ((trim(chgres_var_names(k)) == "ice_aero" .or. trim(chgres_var_names(k)) == "liq_aero") .and. &
419  trim(thomp_mp_climo_file) .ne. "NULL" .and. trim(input_type) == "grib2") then
420  call error_handler("VARMAP TABLE CONTAINS TRACER ENTRIES FOR THOMPSON AEROSOLS liq_aero or "// &
421  "ice_aero. REMOVE THESE ENTRIES OR REMOVE THE NAMELIST ENTRY FOR "// &
422  "thomp_mp_climo_file AND TRY AGAIN.",1)
423  endif
424  endif
425  enddo
426  close(14)
427  num_tracers = num_tracers_input
428  endif
429 end subroutine read_varmap
430 
443 subroutine get_var_cond(var_name,this_miss_var_method,this_miss_var_value, &
444  this_field_var_name, loc)
445  use esmf
446 
447  implicit none
448  character(len=20), intent(in) :: var_name
449 
450  character(len=20), optional, intent(out) :: this_miss_var_method, &
451  this_field_var_name
452  real(esmf_kind_r4), optional, intent(out):: this_miss_var_value
453 
454  integer, optional, intent(out) :: loc
455 
456  integer :: i, tmp(size(missing_var_methods))
457 
458  i=0
459 
460  tmp(:)=0
461  where(chgres_var_names==var_name) tmp=1
462 
463  i = maxloc(merge(1.,0.,chgres_var_names == var_name),dim=1) !findloc(chgres_var_names,var_name)
464  print*, i
465  if (maxval(tmp).eq.0) then
466  print*, "WARNING: NO ENTRY FOR ", trim(var_name), " IN VARMAP TABLE. WILL SKIP " // &
467  "VARIABLE IF NOT FOUND IN EXTERNAL MODEL FILE"
468 
469  if(present(this_miss_var_method)) this_miss_var_method = "skip"
470  if(present(this_miss_var_value)) this_miss_var_value = -9999.9_esmf_kind_r4
471  if(present(this_field_var_name)) this_field_var_name = "NULL"
472  if(present(loc)) loc = 9999
473  else
474  if(present(this_miss_var_method)) this_miss_var_method = missing_var_methods(i)
475  if(present(this_miss_var_value)) this_miss_var_value = missing_var_values(i)
476  if(present(this_field_var_name)) this_field_var_name = field_var_names(i)
477  if(present(loc)) loc = i
478  endif
479 
480 end subroutine get_var_cond
481 
515  subroutine calc_soil_params_driver(localpet)
516 
517  implicit none
518 
519  integer, intent(in) :: localpet
520 
521  integer, parameter :: num_statsgo = 16
522  real, parameter :: smlow_statsgo = 0.5
523  real, parameter :: smhigh_statsgo = 6.0
524 
525 ! zobler soil type used by spectral gfs prior to June 2017.
526  integer, parameter :: num_zobler = 9
527  real, parameter :: smlow_zobler = 0.5
528  real, parameter :: smhigh_zobler = 6.0
529 
530  integer :: num_soil_cats
531 
532  real :: bb_statsgo(num_statsgo)
533  real :: maxsmc_statsgo(num_statsgo)
534  real :: satdk_statsgo(num_statsgo)
535  real :: satpsi_statsgo(num_statsgo)
536 
537  real :: bb_zobler(num_zobler)
538  real :: maxsmc_zobler(num_zobler)
539  real :: satdk_zobler(num_zobler)
540  real :: satpsi_zobler(num_zobler)
541 
542  real, allocatable :: bb(:)
543  real :: smlow, smhigh
544  real, allocatable :: satdk(:)
545  real, allocatable :: satpsi(:)
546  real, allocatable :: satdw(:)
547 
548 ! using stasgo table
549  data bb_statsgo /4.05, 4.26, 4.74, 5.33, 5.33, 5.25, &
550  6.77, 8.72, 8.17, 10.73, 10.39, 11.55, &
551  5.25, -9.99, 4.05, 4.26/
552 
553  data maxsmc_statsgo /0.395, 0.421, 0.434, 0.476, 0.476, 0.439, &
554  0.404, 0.464, 0.465, 0.406, 0.468, 0.457, &
555  0.464, -9.99, 0.200, 0.421/
556 
557  data satdk_statsgo /1.7600e-4, 1.4078e-5, 5.2304e-6, 2.8089e-6, 2.8089e-6, &
558  3.3770e-6, 4.4518e-6, 2.0348e-6, 2.4464e-6, 7.2199e-6, &
559  1.3444e-6, 9.7384e-7, 3.3770e-6, -9.99, 1.4078e-5, &
560  1.4078e-5/
561 
562  data satpsi_statsgo /0.0350, 0.0363, 0.1413, 0.7586, 0.7586, 0.3548, &
563  0.1349, 0.6166, 0.2630, 0.0977, 0.3236, 0.4677, &
564  0.3548, -9.99, 0.0350, 0.0363/
565 
566  data bb_zobler /4.26, 8.72, 11.55, 4.74, 10.73, 8.17, &
567  6.77, 5.25, 4.26/
568 
569  data maxsmc_zobler /0.421, 0.464, 0.468, 0.434, 0.406, 0.465, &
570  0.404, 0.439, 0.421/
571 
572  data satdk_zobler /1.41e-5, 0.20e-5, 0.10e-5, 0.52e-5, 0.72e-5, &
573  0.25e-5, 0.45e-5, 0.34e-5, 1.41e-5/
574 
575  data satpsi_zobler /0.040, 0.620, 0.470, 0.140, 0.100, 0.260, &
576  0.140, 0.360, 0.040/
577 
578 !-------------------------------------------------------------------------
579 ! Compute soil parameters for the input grid.
580 !-------------------------------------------------------------------------
581 
582  select case (trim(input_type))
583  case ("gfs_sigio")
584  print*,'- INPUT GRID USED ZOBLER SOIL TYPES.'
585  num_soil_cats = num_zobler
586  case default
587  print*,'- INPUT GRID USED STATSGO SOIL TYPES.'
588  num_soil_cats = num_statsgo
589  end select
590 
591  allocate(maxsmc_input(num_soil_cats))
592  allocate(wltsmc_input(num_soil_cats))
593  allocate(drysmc_input(num_soil_cats))
594  allocate(refsmc_input(num_soil_cats))
595  allocate(bb(num_soil_cats))
596  allocate(satdk(num_soil_cats))
597  allocate(satpsi(num_soil_cats))
598  allocate(satdw(num_soil_cats))
599 
600  select case (trim(input_type))
601  case ("gfs_sigio")
602  smlow = smlow_zobler
603  smhigh = smhigh_zobler
604  maxsmc_input = maxsmc_zobler
605  bb = bb_zobler
606  satdk = satdk_zobler
607  satpsi = satpsi_zobler
608  case default
609  smlow = smlow_statsgo
610  smhigh = smhigh_statsgo
611  maxsmc_input = maxsmc_statsgo
612  bb = bb_statsgo
613  satdk = satdk_statsgo
614  satpsi = satpsi_statsgo
615  end select
616 
617  call calc_soil_params(num_soil_cats, smlow, smhigh, satdk, maxsmc_input, &
618  bb, satpsi, satdw, refsmc_input, drysmc_input, wltsmc_input)
619 
620  deallocate(bb, satdk, satpsi, satdw)
621 
622  if (localpet == 0) print*,'maxsmc input grid ',maxsmc_input
623  if (localpet == 0) print*,'wltsmc input grid ',wltsmc_input
624 
625 !-------------------------------------------------------------------------
626 ! Compute soil parameters for the target grid.
627 !-------------------------------------------------------------------------
628 
629  print*,'- TARGET GRID USEING STATSGO SOIL TYPES.'
630 
631  num_soil_cats = num_statsgo
632 
633  allocate(maxsmc_target(num_soil_cats))
634  allocate(wltsmc_target(num_soil_cats))
635  allocate(drysmc_target(num_soil_cats))
636  allocate(refsmc_target(num_soil_cats))
637  allocate(bb_target(num_soil_cats))
638  allocate(satpsi_target(num_soil_cats))
639  allocate(satdk(num_soil_cats))
640  allocate(satdw(num_soil_cats))
641 
642  smlow = smlow_statsgo
643  smhigh = smhigh_statsgo
644  maxsmc_target = maxsmc_statsgo
645  bb_target = bb_statsgo
646  satdk = satdk_statsgo
647  satpsi_target = satpsi_statsgo
648 
649  call calc_soil_params(num_soil_cats, smlow, smhigh, satdk, maxsmc_target, &
650  bb_target, satpsi_target, satdw, refsmc_target, drysmc_target, wltsmc_target)
651 
652  deallocate(satdk, satdw)
653 
654  if (localpet == 0) print*,'maxsmc target grid ',maxsmc_target
655  if (localpet == 0) print*,'wltsmc input grid ',wltsmc_target
656 
657  end subroutine calc_soil_params_driver
658 
675  subroutine calc_soil_params(num_soil_cats, smlow, smhigh, satdk, &
676  maxsmc, bb, satpsi, satdw, refsmc, drysmc, wltsmc)
677 
678  implicit none
679 
680  integer, intent(in) :: num_soil_cats
681 
682  real, intent(in) :: smlow, smhigh
683  real, intent(in) :: bb(num_soil_cats)
684  real, intent(in) :: maxsmc(num_soil_cats)
685  real, intent(in) :: satdk(num_soil_cats)
686  real, intent(in) :: satpsi(num_soil_cats)
687 
688  real, intent(out) :: satdw(num_soil_cats)
689  real, intent(out) :: refsmc(num_soil_cats)
690  real, intent(out) :: drysmc(num_soil_cats)
691  real, intent(out) :: wltsmc(num_soil_cats)
692 
693  integer :: i
694 
695  real :: refsmc1
696  real :: wltsmc1
697 
698  satdw = 0.0
699  refsmc = 0.0
700  wltsmc = 0.0
701  drysmc = 0.0
702 
703  do i = 1, num_soil_cats
704 
705  if (maxsmc(i) > 0.0) then
706 
707  satdw(i) = bb(i)*satdk(i)*(satpsi(i)/maxsmc(i))
708  refsmc1 = maxsmc(i)*(5.79e-9/satdk(i)) **(1.0/(2.0*bb(i)+3.0))
709  refsmc(i) = refsmc1 + (maxsmc(i)-refsmc1) / smhigh
710  wltsmc1 = maxsmc(i) * (200.0/satpsi(i))**(-1.0/bb(i))
711  wltsmc(i) = wltsmc1 - smlow * wltsmc1
712 
713 !----------------------------------------------------------------------
714 ! CURRENT VERSION DRYSMC VALUES THAT EQUATE TO WLTSMC.
715 ! FUTURE VERSION COULD LET DRYSMC BE INDEPENDENTLY SET VIA NAMELIST.
716 !----------------------------------------------------------------------
717 
718  drysmc(i) = wltsmc(i)
719 
720  end if
721 
722  END DO
723 
724  end subroutine calc_soil_params
725 
726  end module program_setup
subroutine, public calc_soil_params_driver(localpet)
Driver routine to compute soil parameters for each soil type.
subroutine to_lower(strIn)
Convert from upper to lowercase.
Definition: utils.F90:84
subroutine, public read_setup_namelist(filename)
Reads program configuration namelist.
subroutine error_handler(string, rc)
General error handler.
Definition: utils.F90:9
This module contains code to read the setup namelist file, handle the varmap file for GRIB2 data...
subroutine, public read_varmap
Reads the variable mapping table, which is required for initializing with GRIB2 data.
subroutine, public get_var_cond(var_name, this_miss_var_method, this_miss_var_value, this_field_var_name, loc)
Search the variable mapping table to find conditions for handling missing variables.
subroutine calc_soil_params(num_soil_cats, smlow, smhigh, satdk, maxsmc, bb, satpsi, satdw, refsmc, drysmc, wltsmc)
Compute soil parameters.