Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scrasmussen committed May 24, 2024
1 parent af9c2c7 commit 1ecde40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 1 addition & 3 deletions scm/etc/scripts/precision_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

# TODO:
# - [ ] add user argument to cmake "$@" in configure{32,64}
# - [ ] add run function
# - [ ] run through all cases compiled
suites = ['SCM_RAP']
cases = ['twpice']

Expand All @@ -34,7 +32,7 @@ def run_cmd(command):
# Function to run configuration step
def configure32():
print("Running single precision configuration step")
command = ["cmake", "src/", "-B", "build32", "-D32BIT=1"]
command = ["cmake", "src/", "-B", "build32", "-D32BIT=ON"]
run_cmd(command)


Expand Down
9 changes: 5 additions & 4 deletions scm/src/scm_vgrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ subroutine get_FV3_vgrid(scm_input, scm_state)
character(len=16) :: file_format
integer :: nx, ny
real(kind_scm_dp), allocatable :: pres_l_row(:), pres_i(:,:)
real(kind_scm_dp), parameter :: zero = 0.0
real(kind_scm_dp), parameter :: zero_dp = 0.0
! added for forcing initialized pressure to be single precision for
! single and double precision runs
real(kind_scm_sp), parameter :: zero_sp = 0.0
real(kind_scm_sp), allocatable :: pres_l_row_sp(:)

#include "fv_eta.h"
Expand Down Expand Up @@ -548,7 +549,7 @@ subroutine get_FV3_vgrid(scm_input, scm_state)

nx = size(scm_state%pres_i, 1)
ny = size(scm_state%pres_i, 2)
allocate(pres_i(nx,ny), source=zero)
allocate(pres_i(nx,ny), source=zero_dp)
do k=1, km+1
pres_i(:,k) = scm_state%a_k(k) + scm_state%b_k(k)*p_ref
scm_state%si(:,k) = scm_state%a_k(k)*pres_sfc_inv + scm_state%b_k(k)
Expand All @@ -557,8 +558,8 @@ subroutine get_FV3_vgrid(scm_input, scm_state)
scm_state%pres_i = pres_i

!> - Calculate layer center pressures, sigma, and exner function.
allocate(pres_l_row(nx), source=zero)
allocate(pres_l_row_sp(nx), source=zero)
allocate(pres_l_row(nx), source=zero_dp)
allocate(pres_l_row_sp(nx), source=zero_sp)
do k=1, km
pres_l_row_sp = ((1.0/(con_rocp+1.0))*&
(pres_i(:,k)**(con_rocp+1.0) - pres_i(:,k+1)**(con_rocp+1.0))/ &
Expand Down

0 comments on commit 1ecde40

Please sign in to comment.