Skip to content

Commit

Permalink
Includes Mike's fix for coastal ORO issue
Browse files Browse the repository at this point in the history
 Please enter the commit message for your changes. Lines starting
  • Loading branch information
sanatcumar committed Nov 21, 2023
1 parent 2941924 commit eb31490
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions sorc/ocean_merge.fd/merge_lake_ocnmsk.f90
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ program merge_lake_ocnmsk
else
lake_depth(i,j)=0.
end if
! slmsk(i,j) = ceiling(land_frac(i,j)) "ceiling is used for orog smoothing"
slmsk(i,j) = nint(land_frac(i,j)) ! nint got the land pts correct
! slmsk(i,j) = ceiling(land_frac(i,j))! "ceiling is used for orog smoothing"
slmsk(i,j) = nint(land_frac(i,j)) ! nint got the land pts correct
end do
end do

Expand Down
17 changes: 10 additions & 7 deletions sorc/orog_mask_tools.fd/orog.fd/mtnlm7_oclsm.F
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ SUBROUTINE TERSUB(IMN,JMN,IM,JM,NM,NR,NF0,NF1,NW,EFAC,BLAT,
END IF
CALL MAKEMT2(ZAVG,ZSLM,ORO,SLM,VAR,VAR4,GLAT,
& IM,JM,IMN,JMN,geolon_c,geolat_c,lake_frac)
& IM,JM,IMN,JMN,geolon_c,geolat_c,lake_frac,land_frac)
tend=timef()
write(6,*)' MAKEMT2 time= ',tend-tbeg
Expand Down Expand Up @@ -2044,7 +2044,7 @@ END SUBROUTINE MAKE_MASK
!! @param[in] lat_c Latitude on the model grid corner points.
!! @author GFDL Programmer
SUBROUTINE MAKEMT2(ZAVG,ZSLM,ORO,SLM,VAR,VAR4,
1 GLAT,IM,JM,IMN,JMN,lon_c,lat_c,lake_frac)
1 GLAT,IM,JM,IMN,JMN,lon_c,lat_c,lake_frac,land_frac)
implicit none
real, parameter :: D2R = 3.14159265358979/180.
integer, parameter :: MAXSUM=20000000
Expand All @@ -2053,7 +2053,7 @@ SUBROUTINE MAKEMT2(ZAVG,ZSLM,ORO,SLM,VAR,VAR4,
real GLAT(JMN), GLON(IMN)
INTEGER ZAVG(IMN,JMN),ZSLM(IMN,JMN)
real ORO(IM,JM),VAR(IM,JM),VAR4(IM,JM)
real, intent(in) :: SLM(IM,JM), lake_frac(im,jm)
real, intent(in) :: SLM(IM,JM), lake_frac(im,jm),land_frac(im,jm)
integer JST, JEN
real lon_c(IM+1,JM+1), lat_c(IM+1,JM+1)
real LONO(4),LATO(4),LONI,LATI
Expand Down Expand Up @@ -2176,7 +2176,8 @@ SUBROUTINE MAKEMT2(ZAVG,ZSLM,ORO,SLM,VAR,VAR4,
! --- 0 is ocean and 1 is land for slm
! --- Step 1 is to only change SLM after GFS SLM is applied
IF(SLM(I,J).NE.0.) THEN
!IF(SLM(I,J).NE.0.) THEN
IF(SLM(I,J) .NE. 0. .OR. LAND_FRAC(I,J) > 0.) THEN
IF (XLAND > 0) THEN
ORO(I,J)= XL1 / XLAND
ELSE
Expand All @@ -2201,7 +2202,8 @@ SUBROUTINE MAKEMT2(ZAVG,ZSLM,ORO,SLM,VAR,VAR4,
ELSEIF(XNSUM_ALL.GT.1.) THEN
IF(SLM(I,J).NE.0.) THEN
!IF(SLM(I,J).NE.0.) THEN
IF(SLM(I,J) .NE. 0. .OR. LAND_FRAC(I,J) > 0.) THEN
IF (XLAND_ALL > 0) THEN
ORO(I,J)= XL1_ALL / XLAND_ALL
ELSE
Expand Down Expand Up @@ -2231,8 +2233,9 @@ SUBROUTINE MAKEMT2(ZAVG,ZSLM,ORO,SLM,VAR,VAR4,
ENDIF
! set orog to 0 meters at ocean.
IF (LAKE_FRAC(I,J) .EQ. 0. .AND. SLM(I,J) .EQ. 0.)THEN
ORO(I,J) = 0.0
! IF (LAKE_FRAC(I,J) .EQ. 0. .AND. SLM(I,J) .EQ. 0.)THEN
IF (LAKE_FRAC(I,J) .EQ. 0. .AND. LAND_FRAC(I,J) .EQ. 0.)THEN
ORO(I,J) = 0.0
ENDIF
ENDDO
Expand Down
18 changes: 12 additions & 6 deletions ush/fv3gfs_driver_grid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ export lake_cutoff=${lake_cutoff:-0.50} # return 0 if lake_frac < lake_cutoff &
export binary_lake=${binary_lake:-1} # return 1 if lake_frac >= lake_cutoff & add_lake=T

export make_gsl_orog=${make_gsl_orog:-false} # when true, create GSL drag suite orog files.
export vegsoilt_frac=${vegsoilt_frac:-.false.}


if [ $gtype = uniform ]; then
export ocn= ${ocn:-025}
echo "Creating global uniform grid"
elif [ $gtype = stretch ]; then
export stretch_fac=${stretch_fac:-1.5} # Stretching factor for the grid
Expand Down Expand Up @@ -143,10 +146,10 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then
export orog_dir=$TEMP_DIR/$name/orog


if [ $gtype = uniform ]; then
out_dir=$out_dir/C$res.mx$ocn
readme_name=readme.C$res.mx$ocn.txt
#if [ $gtype = uniform ]; then
if declare -p ocn &>/dev/null;then
out_dir=$out_dir/C$res.mx$ocn
readme_name=readme.C$res.mx$ocn.txt
else

out_dir=$out_dir/C$res
Expand Down Expand Up @@ -257,7 +260,7 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then
cp $filter_dir/oro.C${res}.tile${tile}.nc $out_dir/C${res}.mx${ocn}_oro_data.tile${tile}.nc
cp $grid_dir/C${res}_grid.tile${tile}.nc $out_dir/C${res}_grid.tile${tile}.nc
else
cp $filter_dir/oro.C${res}.tile${tile}.nc $out_dir/oro_C${res}.tile${tile}.nc
cp $filter_dir/oro.C${res}.tile${tile}.nc $out_dir/C${res}_oro_data.tile${tile}.nc
cp $grid_dir/C${res}_grid.tile${tile}.nc $out_dir/C${res}_grid.tile${tile}.nc
fi

Expand Down Expand Up @@ -569,6 +572,7 @@ cat <<EOF > $readme_name
The following # was used
https://github.com/sanatcumar/UFS_UTILS/tree/single_step
The following parameters were used
creation date =$(date +%Y-%m-%d)
gtype=$gtype
make_gsl_orog=$make_gsl_orog
vegsoilt_frac=$vegsoilt_frac
Expand All @@ -586,6 +590,7 @@ cat <<EOF > $readme_name
The following # was used
https://github.com/sanatcumar/UFS_UTILS/tree/single_step
The following parameters were used
creation date =$(date +%Y-%m-%d)
gtype=$gtype
vegsoilt_frac=$vegsoilt_frac
veg_type=$veg_type_src
Expand Down Expand Up @@ -614,7 +619,8 @@ cat <<EOF > $readme_name
The following # was used
https://github.com/sanatcumar/UFS_UTILS/tree/single_step
The following parameters were used
gtype=$gtype
creation date =$(date +%Y-%m-%d)
gtype=$gtype
res=-999 # equivalent resolution is computed
vegsoilt_frac=$vegsoilt_frac
veg_type=$veg_type_src
Expand Down

0 comments on commit eb31490

Please sign in to comment.