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