Skip to content

Commit

Permalink
feature/rm_nemsutils: Merge branch 'develop' into feature/rm_nemsutils
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Sep 18, 2020
2 parents d6d0346 + 230b35c commit 619cbbc
Show file tree
Hide file tree
Showing 34 changed files with 891 additions and 174 deletions.
6 changes: 3 additions & 3 deletions driver_scripts/driver_grid.cray.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# 7) For "regional_esg" grids, set center lat/lon of grid,
# - "target_lat/lon" - the i/j dimensions - "i/jdim", the
# x/y grid spacing - "delx/y", and halo.
# 8) Set working directory - TMPDIR - and path to the repository
# 8) Set working directory - TEMP_DIR - and path to the repository
# clone - home_dir.
# 9) Submit script: "cat $script | bsub".
# 10) All files will be placed in "out_dir".
Expand Down Expand Up @@ -106,12 +106,12 @@ fi
#-----------------------------------------------------------------------
# Check paths.
# home_dir - location of repository.
# TMPDIR - working directory.
# TEMP_DIR - working directory.
# out_dir - where files will be placed upon completion.
#-----------------------------------------------------------------------

export home_dir=$LS_SUBCWD/..
export TMPDIR=/gpfs/hps3/stmp/$LOGNAME/fv3_grid.$gtype
export TEMP_DIR=/gpfs/hps3/stmp/$LOGNAME/fv3_grid.$gtype
export out_dir=/gpfs/hps3/stmp/$LOGNAME/my_grids

#-----------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions driver_scripts/driver_grid.dell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
# 7) For "regional_esg" grids, set center lat/lon of grid,
# - "target_lat/lon" - the i/j dimensions - "i/jdim", the
# x/y grid spacing - "delx/y", and halo.
# 8) Set working directory - TMPDIR - and path to the repository
# 8) Set working directory - TEMP_DIR - and path to the repository
# clone - home_dir.
# 9) Submit script: "cat $script | bsub".
# 10) All files will be placed in "out_dir".
Expand Down Expand Up @@ -108,12 +108,12 @@ fi
#-----------------------------------------------------------------------
# Check paths.
# home_dir - location of repository.
# TMPDIR - working directory.
# TEMP_DIR - working directory.
# out_dir - where files will be placed upon completion.
#-----------------------------------------------------------------------

export home_dir=$LS_SUBCWD/..
export TMPDIR=/gpfs/dell1/stmp/$LOGNAME/fv3_grid.$gtype
export TEMP_DIR=/gpfs/dell1/stmp/$LOGNAME/fv3_grid.$gtype
export out_dir=/gpfs/dell1/stmp/$LOGNAME/my_grids

#-----------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions driver_scripts/driver_grid.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# 7) For "regional_esg" grids, set center lat/lon of grid,
# - "target_lat/lon" - the i/j dimensions - "i/jdim", the
# x/y grid spacing - "delx/y", and halo.
# 8) Set working directory - TMPDIR - and path to the repository
# 8) Set working directory - TEMP_DIR - and path to the repository
# clone - home_dir.
# 9) Submit script: "sbatch $script".
# 10) All files will be placed in "out_dir".
Expand Down Expand Up @@ -108,12 +108,12 @@ fi
#-----------------------------------------------------------------------
# Check paths.
# home_dir - location of repository.
# TMPDIR - working directory.
# TEMP_DIR - working directory.
# out_dir - where files will be placed upon completion.
#-----------------------------------------------------------------------

export home_dir=$SLURM_SUBMIT_DIR/..
export TMPDIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/fv3_grid.$gtype
export TEMP_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/fv3_grid.$gtype
export out_dir=/scratch2/NCEPDEV/stmp1/$LOGNAME/my_grids

#-----------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions driver_scripts/driver_grid.jet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# 7) For "regional_esg" grids, set center lat/lon of grid,
# - "target_lat/lon" - the i/j dimensions - "i/jdim", the
# x/y grid spacing - "delx/y", and halo.
# 8) Set working directory - TMPDIR - and path to the repository
# 8) Set working directory - TEMP_DIR - and path to the repository
# clone - home_dir.
# 9) Submit script: "sbatch $script".
# 10) All files will be placed in "out_dir".
Expand Down Expand Up @@ -109,12 +109,12 @@ fi
#-----------------------------------------------------------------------
# Check paths.
# home_dir - location of repository.
# TMPDIR - working directory.
# TEMP_DIR - working directory.
# out_dir - where files will be placed upon completion.
#-----------------------------------------------------------------------

export home_dir=$SLURM_SUBMIT_DIR/..
export TMPDIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/fv3_grid.$gtype
export TEMP_DIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/fv3_grid.$gtype
export out_dir=/lfs4/HFIP/emcda/$LOGNAME/stmp/my_grids

#-----------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions driver_scripts/driver_grid.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# 7) For "regional_esg" grids, set center lat/lon of grid,
# - "target_lat/lon" - the i/j dimensions - "i/jdim", the
# x/y grid spacing - "delx/y", and halo.
# 8) Set working directory - TMPDIR - and path to the repository
# 8) Set working directory - TEMP_DIR - and path to the repository
# clone - home_dir.
# 9) Submit script: "sbatch $script".
# 10) All files will be placed in "out_dir".
Expand Down Expand Up @@ -108,12 +108,12 @@ fi
#-----------------------------------------------------------------------
# Check paths.
# home_dir - location of repository.
# TMPDIR - working directory.
# TEMP_DIR - working directory.
# out_dir - where files will be placed upon completion.
#-----------------------------------------------------------------------

export home_dir=$SLURM_SUBMIT_DIR/..
export TMPDIR=/work/noaa/stmp/$LOGNAME/fv3_grid.$gtype
export TEMP_DIR=/work/noaa/stmp/$LOGNAME/fv3_grid.$gtype
export out_dir=/work/noaa/stmp/$LOGNAME/my_grids

#-----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions modulefiles/build.hera
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ module load landsfcutil/2.4.1
module load wgrib2/2.0.8

module use /scratch1/NCEPDEV/nems/emc.nemspara/soft/modulefiles
module load hdf5_parallel/1.10.6
module load netcdf_parallel/4.7.4
module load hdf5_parallel/1.10.6.release
module load netcdf_parallel/4.7.4.release
module load esmf/8.0.0_ParallelNetCDF
2 changes: 1 addition & 1 deletion reg_tests/chgres_cube/driver.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C

sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \
--open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF
#!/bin/sh
#!/bin/bash
grep -a '<<<' $LOG_FILE > $SUM_FILE
EOF

Expand Down
2 changes: 1 addition & 1 deletion reg_tests/chgres_cube/driver.jet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ TEST8=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05

sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \
--open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF
#!/bin/sh
#!/bin/bash
grep -a '<<<' $LOG_FILE > $SUM_FILE
EOF

Expand Down
2 changes: 1 addition & 1 deletion reg_tests/chgres_cube/driver.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_C

sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \
--open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF
#!/bin/sh
#!/bin/bash
grep -a '<<<' $LOG_FILE > $SUM_FILE
EOF

Expand Down
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/c96.uniform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

set -x

export TMPDIR=${WORK_DIR}/c96.uniform.work
export TEMP_DIR=${WORK_DIR}/c96.uniform.work
export out_dir=${WORK_DIR}/c96.uniform

export res=96
Expand Down
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/driver.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_

sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \
--open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF
#!/bin/sh
#!/bin/bash
grep -a '<<<' $LOG_FILE > $SUM_FILE
EOF
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/driver.jet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_

sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \
--open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF
#!/bin/sh
#!/bin/bash
grep -a '<<<' $LOG_FILE > $SUM_FILE
EOF
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/driver.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_

sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \
--open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF
#!/bin/sh
#!/bin/bash
grep -a '<<<' $LOG_FILE > $SUM_FILE
EOF
2 changes: 1 addition & 1 deletion reg_tests/grid_gen/gfdl.regional.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

set -x

export TMPDIR=${WORK_DIR}/gfdl.regional.work
export TEMP_DIR=${WORK_DIR}/gfdl.regional.work
export out_dir=${WORK_DIR}/gfdl.regional

export res=96 # global resolution in which grid is embedded.
Expand Down
2 changes: 1 addition & 1 deletion scripts/exemcsfc_global_sfc_prep.sh.ecf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

#### UNIX Script Documentation Block ###################################
# . .
Expand Down
1 change: 1 addition & 0 deletions sorc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ add_subdirectory(grid_tools.fd)
add_subdirectory(chgres_cube.fd)
add_subdirectory(orog_mask_tools.fd)
add_subdirectory(sfc_climo_gen.fd)
add_subdirectory(vcoord_gen.fd)
15 changes: 15 additions & 0 deletions sorc/vcoord_gen.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
set(fortran_src
driver.f90
matrix_utils.f90
vcoord_gen.f90)

if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8")
endif()

set(exe_name vcoord_gen)
add_executable(${exe_name} ${fortran_src})

install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir})
13 changes: 13 additions & 0 deletions sorc/vcoord_gen.fd/driver.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
program driver
implicit none
integer levs,lupp,k
real pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop,pmin
real,allocatable:: ak(:),bk(:)
write(0,*) 'Enter levs,lupp,pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop'
read *,levs,lupp,pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop
allocate(ak(0:levs),bk(0:levs))
call vcoord_gen(levs,lupp,pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop,pmin,ak,bk)
write(0,*) 'pmin=',pmin
print '(2i6)',2,levs
print '(f12.3,f12.8)',(ak(k),bk(k),k=0,levs)
end program
158 changes: 158 additions & 0 deletions sorc/vcoord_gen.fd/matrix_utils.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
!-------------------------------------------------------------------------------
!$$$ Subprogram documentation block
!
! Subprogram: ludcmp lower and upper triangular decomposition
! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01
!
! Abstract: This subprogram decomposes a matrix into a product of
! lower and upper triangular matrices.
!
! Program history log:
! 2008-08-01 Mark Iredell
!
! Usage: call ludcmp(a,n,np,indx,d)
! Input argument list:
! a real(np,np) matrix (will be overwritten)
! n integer order of matrix
! np integer dimension of matrix
!
! Output argument list:
! a real(np,np) LU-decomposed matrix
! (U is upper part of A, including diagonal;
! L is lower part of A, with 1 as diagonal;
! L*U equals original A after permuting)
! indx integer(n) pivot indices
! (original A rows are permuted in order i with indx(i))
! d real determinant permutation (1 or -1, or 0 if singular)
! (determinant is output diagonal product times d)
!
! Attributes:
! Language: Fortran 90
!
!$$$
subroutine ludcmp(a,n,np,indx,d)
implicit none
integer,intent(in):: n,np
real,intent(inout):: a(np,np)
integer,intent(out):: indx(n)
real,intent(out):: d
integer i,j,k,imax
real aamax,sum,dum
real vv(n)
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
d=1
do i=1,n
aamax=0
do j=1,n
if(abs(a(i,j))>aamax) aamax=abs(a(i,j))
enddo
if(aamax==0) then
d=0
return
endif
vv(i)=1/aamax
enddo
do j=1,n
do i=1,j-1
sum=a(i,j)
do k=1,i-1
sum=sum-a(i,k)*a(k,j)
enddo
a(i,j)=sum
enddo
aamax=0.
do i=j,n
sum=a(i,j)
do k=1,j-1
sum=sum-a(i,k)*a(k,j)
enddo
a(i,j)=sum
dum=vv(i)*abs(sum)
if(dum>=aamax) then
imax=i
aamax=dum
endif
enddo
if (j/=imax)then
do k=1,n
dum=a(imax,k)
a(imax,k)=a(j,k)
a(j,k)=dum
enddo
d=-d
vv(imax)=vv(j)
endif
indx(j)=imax
if(a(j,j)==0) then
d=0
return
endif
if(j/=n)then
dum=1/a(j,j)
do i=j+1,n
a(i,j)=a(i,j)*dum
enddo
endif
enddo
end subroutine
!-------------------------------------------------------------------------------
!$$$ Subprogram documentation block
!
! Subprogram: lubksb lower and upper triangular back substitution
! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01
!
! Abstract: This subprogram back substitutes to solve decomposed
! lower and upper triangular matrices as outputted by ludcmp.
!
! Program history log:
! 2008-08-01 Mark Iredell
!
! Usage: call lubksb(a,n,np,indx,b)
! Input argument list:
! a real(np,np) LU-decomposed matrix
! (from ludcmp)
! n integer order of matrix
! np integer dimension of matrix
! indx integer(n) pivot indices
! (from ludcmp)
! b real(n) rhs vector of linear problem (will be overwritten)
!
! Output argument list:
! b real(n) solution of linear problem
! (original A times output B equals original B)
!
! Attributes:
! Language: Fortran 90
!
!$$$
subroutine lubksb(a,n,np,indx,b)
implicit none
integer,intent(in):: n,np
real,intent(in):: a(np,np)
integer,intent(in):: indx(n)
real,intent(inout):: b(n)
integer i,j,ii,ll
real sum
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ii=0
do i=1,n
ll=indx(i)
sum=b(ll)
b(ll)=b(i)
if (ii/=0)then
do j=ii,i-1
sum=sum-a(i,j)*b(j)
enddo
elseif(sum/=0) then
ii=i
endif
b(i)=sum
enddo
do i=n,1,-1
sum=b(i)
do j=i+1,n
sum=sum-a(i,j)*b(j)
enddo
b(i)=sum/a(i,i)
enddo
end subroutine
Loading

0 comments on commit 619cbbc

Please sign in to comment.