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