Skip to content

Commit

Permalink
single precision testing: force initialization of pressure to be done…
Browse files Browse the repository at this point in the history
… in single precision regardless of build type
  • Loading branch information
scrasmussen committed May 24, 2024
1 parent 4bb36cd commit af9c2c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scm/src/scm_vgrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module scm_vgrid

use scm_kinds, only: sp, dp, qp, kind_scm_dp
use scm_kinds, only: sp, dp, qp, kind_scm_dp, kind_scm_sp
use scm_physical_constants, only : con_cp, con_rocp, con_fvirt, con_g, con_rd

implicit none
Expand Down Expand Up @@ -51,6 +51,9 @@ subroutine get_FV3_vgrid(scm_input, scm_state)
integer :: nx, ny
real(kind_scm_dp), allocatable :: pres_l_row(:), pres_i(:,:)
real(kind_scm_dp), parameter :: zero = 0.0
! added for forcing initialized pressure to be single precision for
! single and double precision runs
real(kind_scm_sp), allocatable :: pres_l_row_sp(:)

#include "fv_eta.h"

Expand Down Expand Up @@ -555,11 +558,12 @@ subroutine get_FV3_vgrid(scm_input, scm_state)

!> - Calculate layer center pressures, sigma, and exner function.
allocate(pres_l_row(nx), source=zero)
allocate(pres_l_row_sp(nx), source=zero)
do k=1, km
pres_l_row = ((1.0/(con_rocp+1.0))*&
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))/ &
(pres_i(:,k) - pres_i(:,k+1)))**(1.0/con_rocp)
scm_state%pres_l(:,k) = pres_l_row
scm_state%pres_l(:,k) = pres_l_row_sp
scm_state%sl(:,k) = 0.5*(scm_state%si(:,k) + scm_state%si(:,k+1))

scm_state%exner_l(:,k) = (scm_state%pres_l(:,k)/1.0E5)**con_rocp
Expand Down

0 comments on commit af9c2c7

Please sign in to comment.