diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh index 656afcf33..b1b35d23b 100755 --- a/driver_scripts/driver_grid.orion.sh +++ b/driver_scripts/driver_grid.orion.sh @@ -5,9 +5,10 @@ #SBATCH --open-mode=truncate #SBATCH -o log.fv3_grid_driver #SBATCH -e log.fv3_grid_driver -#SBATCH --nodes=2 --ntasks-per-node=15 -#SBATCH -q debug -#SBATCH -t 00:30:00 +#SBATCH --nodes=6 --ntasks-per-node=12 +#SBATCH --partition=bigmem +#SBATCH -q batch +#SBATCH -t 04:30:00 #----------------------------------------------------------------------- # Driver script to create a cubic-sphere based model grid on Orion. diff --git a/sorc/sfc_climo_gen.fd/driver.F90 b/sorc/sfc_climo_gen.fd/driver.F90 index 520cc99d8..4ab6ba5f5 100644 --- a/sorc/sfc_climo_gen.fd/driver.F90 +++ b/sorc/sfc_climo_gen.fd/driver.F90 @@ -183,6 +183,18 @@ program driver call source_grid_cleanup endif + + ! Stem Area Index + + if (trim(input_stem_area_index_file) /= "NULL") then + call define_source_grid(localpet, npets, input_stem_area_index_file) + method=ESMF_REGRIDMETHOD_BILINEAR + if (trim(stem_area_index_method)=="conserve") method=ESMF_REGRIDMETHOD_CONSERVE + call interp(localpet, method, input_stem_area_index_file) + call source_grid_cleanup + endif + + call model_grid_cleanup print*,"- CALL ESMF_finalize" diff --git a/sorc/sfc_climo_gen.fd/interp.F90 b/sorc/sfc_climo_gen.fd/interp.F90 index 877930724..e3795a637 100644 --- a/sorc/sfc_climo_gen.fd/interp.F90 +++ b/sorc/sfc_climo_gen.fd/interp.F90 @@ -31,7 +31,7 @@ subroutine interp(localpet, method, input_file) integer :: varid, record integer :: tile_num, pt_loc_this_tile integer :: isrctermprocessing - + double precision :: scale integer(esmf_kind_i4), allocatable :: mask_mdl_one_tile(:,:) integer(esmf_kind_i4), pointer :: unmapped_ptr(:) @@ -110,7 +110,13 @@ subroutine interp(localpet, method, input_file) status = nf90_inq_varid(ncid, field_names(n), varid) call netcdf_err(status, "IN ROUTINE INTERP READING FIELD ID") status = nf90_get_var(ncid, varid, data_src_global, start=(/1,1,t/), count=(/i_src,j_src,1/)) + call netcdf_err(status, "IN ROUTINE INTERP READING FIELD") + status=nf90_get_att(ncid, varid, 'scale_factor', scale) + if (status == 0) then + call scale_data(data_src_global,i_src,j_src,scale) + endif + endif print*,"- CALL FieldScatter FOR SOURCE GRID DATA." @@ -194,7 +200,7 @@ subroutine interp(localpet, method, input_file) if (.not. fract_vegsoil_type) then select case (trim(field_names(n))) - case ('substrate_temperature','vegetation_greenness','leaf_area_index','slope_type','soil_type','soil_color') + case ('substrate_temperature','vegetation_greenness','leaf_area_index','slope_type','soil_type','soil_color','stem_area_index') if (localpet == 0) then allocate(vegt_mdl_one_tile(i_mdl,j_mdl)) else @@ -227,7 +233,7 @@ subroutine interp(localpet, method, input_file) if (.not. fract_vegsoil_type) then select case (trim(field_names(n))) - case ('substrate_temperature','vegetation_greenness','leaf_area_index','slope_type','soil_type','soil_color') + case('substrate_temperature','vegetation_greenness','leaf_area_index','slope_type','soil_type','soil_color','stem_area_index') print*,"- CALL FieldGather FOR MODEL GRID VEG TYPE." call ESMF_FieldGather(vegt_field_mdl, vegt_mdl_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -240,7 +246,7 @@ subroutine interp(localpet, method, input_file) call search (data_mdl_one_tile, mask_mdl_one_tile, i_mdl, j_mdl, tile, field_names(n)) if (.not. fract_vegsoil_type) then select case (field_names(n)) - case ('substrate_temperature','vegetation_greenness','leaf_area_index','slope_type','soil_type','soil_color') + case('substrate_temperature','vegetation_greenness','leaf_area_index','slope_type','soil_type','soil_color','stem_area_index') call adjust_for_landice (data_mdl_one_tile, vegt_mdl_one_tile, i_mdl, j_mdl, field_names(n)) end select endif @@ -257,6 +263,7 @@ subroutine interp(localpet, method, input_file) endif endif + enddo OUTPUT_LOOP if (allocated(vegt_mdl_one_tile)) deallocate(vegt_mdl_one_tile) @@ -306,6 +313,7 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch) integer :: i, j, ierr real :: landice_value + select case (field_ch) case ('substrate_temperature') ! soil substrate temp @@ -335,6 +343,15 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch) endif enddo enddo + case ('stem_area_index') ! stem area index + landice_value = 0.0 ! bare ground + do j = 1, jdim + do i = 1, idim + if (nint(vegt(i,j)) == landice) then + field(i,j) = landice_value + endif + enddo + enddo case ('slope_type') ! slope type landice_value = 9.0 do j = 1, jdim @@ -372,3 +389,39 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch) end select end subroutine adjust_for_landice + + + + +!> use Scale to fix the data to the correct value +!! +!! @param[inout] field to scale. +!! @param[in] idim i dimension of model tile. +!! @param[in] jdim j dimension of model tile. +!! @param[in] scale factor to scale the field. +!! @author George Gayno NCEP/EMC +!! @author Sanath Kumar NCEP/EMC +!! +subroutine scale_data(field,idim,jdim,scale) + + use esmf + use mpi + + implicit none + integer, intent(in) :: idim, jdim + integer :: i, j + real(esmf_kind_r4), intent(inout) :: field(idim,jdim) + double precision :: scale + + do j = 1, jdim + do i = 1, idim + field(i,j) = field(i,j)*scale + + enddo + enddo + end subroutine scale_data + + + + + diff --git a/sorc/sfc_climo_gen.fd/output.f90 b/sorc/sfc_climo_gen.fd/output.f90 index 7df8c18b7..08fb52448 100644 --- a/sorc/sfc_climo_gen.fd/output.f90 +++ b/sorc/sfc_climo_gen.fd/output.f90 @@ -60,6 +60,9 @@ subroutine output(data_one_tile, lat_one_tile, lon_one_tile, i_mdl, j_mdl, & case ('leaf_area_index') out_file = "./leaf_area_index." // grid_tiles(tile) // ".nc" out_file_with_halo = "./leaf_area_index." // grid_tiles(tile) // ".halo.nc" + case ('stem_area_index') + out_file = "./stem_area_index." // grid_tiles(tile) // ".nc" + out_file_with_halo = "./stem_area_index." // grid_tiles(tile) // ".halo.nc" case ('visible_black_sky_albedo', 'visible_white_sky_albedo', 'near_IR_black_sky_albedo', 'near_IR_white_sky_albedo') out_file = "./snowfree_albedo." // grid_tiles(tile) // ".nc" out_file_with_halo = "./snowfree_albedo." // grid_tiles(tile) // ".halo.nc" diff --git a/sorc/sfc_climo_gen.fd/program_setup.f90 b/sorc/sfc_climo_gen.fd/program_setup.f90 index 6c1a9068c..60b9da4ba 100644 --- a/sorc/sfc_climo_gen.fd/program_setup.f90 +++ b/sorc/sfc_climo_gen.fd/program_setup.f90 @@ -21,6 +21,7 @@ module program_setup private character(len=500), public :: input_leaf_area_index_file = "NULL" !< File containing input leaf area index data. + character(len=500), public :: input_stem_area_index_file = "NULL" !< File containing input stem area index data. character(len=500), public :: input_facsf_file = "NULL" !< File containing input fractional !! coverage data for strong zenith angle !! dependent albedo. @@ -38,6 +39,8 @@ module program_setup character(len=50), public :: leaf_area_index_method='bilinear' !< Interpolation method for leaf area index. !! Conservative or bilinear (default). + character(len=50), public :: stem_area_index_method='bilinear' !< Interpolation method for stem area index. + !! Conservative or bilinear (default). character(len=50), public :: maximum_snow_albedo_method='bilinear' !< Interpolation method for max snow albedo. !! Conservative or bilinear (default). character(len=50), public :: snowfree_albedo_method='bilinear' !< Interpolation method for snowfree albedo. @@ -73,10 +76,12 @@ subroutine read_setup_namelist(localpet) namelist /config/ input_facsf_file, input_substrate_temperature_file, & input_maximum_snow_albedo_file, input_snowfree_albedo_file, & input_slope_type_file, input_soil_type_file, input_soil_color_file,& - input_leaf_area_index_file, input_vegetation_type_file, & + input_leaf_area_index_file,input_stem_area_index_file,& + input_vegetation_type_file, & input_vegetation_greenness_file, mosaic_file_mdl, & orog_dir_mdl, orog_files_mdl, halo, & vegetation_greenness_method, leaf_area_index_method, & + stem_area_index_method, & maximum_snow_albedo_method, snowfree_albedo_method, & fract_vegsoil_type diff --git a/sorc/sfc_climo_gen.fd/search.f90 b/sorc/sfc_climo_gen.fd/search.f90 index 0de2b5817..bf1f572f3 100644 --- a/sorc/sfc_climo_gen.fd/search.f90 +++ b/sorc/sfc_climo_gen.fd/search.f90 @@ -55,6 +55,8 @@ subroutine search (field, mask, idim, jdim, tile, field_name) default_value = 0.5 case ('leaf_area_index') ! leaf area index default_value = 1.0 + case ('stem_area_index') ! stem area index + default_value = 0.0 case ('visible_black_sky_albedo') ! visible black sky albedo default_value = 0.1 case ('visible_white_sky_albedo') ! visible white sky albedo diff --git a/sorc/sfc_climo_gen.fd/source_grid.F90 b/sorc/sfc_climo_gen.fd/source_grid.F90 index 31f0b00e0..23b63725b 100644 --- a/sorc/sfc_climo_gen.fd/source_grid.F90 +++ b/sorc/sfc_climo_gen.fd/source_grid.F90 @@ -214,9 +214,11 @@ subroutine define_source_grid(localpet, npets, input_file) call netcdf_err(status, "READING FIELD 1 ID") status=nf90_get_att(ncid, varid, 'missing_value', missing) call netcdf_err(status, "READING MISSING VALUE") - status = nf90_close(ncid) + + + !-------------------------------------------------------------------------- ! Create ESMF grid object for the source data grid. Check if ! data is periodic in the east/west direction. diff --git a/ush/fv3gfs_driver_grid.sh b/ush/fv3gfs_driver_grid.sh index 7330e3c59..584c6fee6 100755 --- a/ush/fv3gfs_driver_grid.sh +++ b/ush/fv3gfs_driver_grid.sh @@ -593,6 +593,8 @@ The following parameters were used lake_data_srce=$lake_data_srce binary_lake=$binary_lake lake_cutoff=$lake_cutoff + input_leaf_area_index_file=$input_leaf_area_index_file + stem_leaf_area_index_file=$input_stem_area_index_file EOF elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then diff --git a/ush/sfc_climo_gen.sh b/ush/sfc_climo_gen.sh index ccab7f24a..9f097c9ee 100755 --- a/ush/sfc_climo_gen.sh +++ b/ush/sfc_climo_gen.sh @@ -85,12 +85,16 @@ input_soil_color_file="${input_sfc_climo_dir}/soil_color.clm.0.05.nc" input_vegetation_type_file="${VEG_TYPE_FILE}" input_vegetation_greenness_file="${input_sfc_climo_dir}/vegetation_greenness.0.144.nc" mosaic_file_mdl="$mosaic_file" +input_leaf_area_index_file="${input_leaf_area_index_file}" +input_stem_area_index_file="${input_stem_area_index_file}" orog_dir_mdl="$FIX_FV3" orog_files_mdl=$the_orog_files halo=$HALO maximum_snow_albedo_method="bilinear" snowfree_albedo_method="bilinear" vegetation_greenness_method="bilinear" +leaf_area_index_method="conserve" +stem_area_index_method="conserve" fract_vegsoil_type=${vegsoilt_frac} / EOF