diff --git a/scm/etc/scripts/precision_analysis.py b/scm/etc/scripts/precision_analysis.py index 53f77737b..2e4f8afd5 100644 --- a/scm/etc/scripts/precision_analysis.py +++ b/scm/etc/scripts/precision_analysis.py @@ -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'] @@ -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) diff --git a/scm/src/scm_vgrid.F90 b/scm/src/scm_vgrid.F90 index 2223851ff..12ac24fc0 100644 --- a/scm/src/scm_vgrid.F90 +++ b/scm/src/scm_vgrid.F90 @@ -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" @@ -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) @@ -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))/ &