Skip to content

Commit 26bedd0

Browse files
committed
Replace allocatable variable with parameter-declared (stack) variable.
1 parent 59e8699 commit 26bedd0

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/utils/std_atm_profile.F90

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,22 @@ module std_atm_profile
5454

5555
subroutine std_atm_pres(height, pstd, user_specified_ps)
5656

57-
! use statements
58-
use cam_abortutils, only: handle_allocate_error
59-
6057
! arguments
6158
real(r8), intent(in) :: height(:) ! height above sea level in meters
6259
real(r8), intent(out) :: pstd(:) ! std pressure in Pa
6360
real(r8), optional, intent(in) :: user_specified_ps
6461

65-
integer :: i, ii, k, nlev
66-
integer :: ierr
62+
integer :: i, ii, k, nlev
63+
integer :: ierr
64+
real(r8) :: pb_local(nreg)
65+
6766
character(len=*), parameter :: routine = 'std_atm_pres'
68-
real(r8), allocatable :: pb_local(:)
6967
!----------------------------------------------------------------------------
70-
allocate(pb_local(nreg), stat=ierr)
71-
call handle_allocate_error(ierr, routine, 'pb_local(nreg)')
7268

69+
! Initialize local standard pressure values array
7370
pb_local = pb
71+
72+
! Set new surface pressure value if provided by the caller
7473
if (present(user_specified_ps)) then
7574
pb_local(1) = user_specified_ps
7675
end if
@@ -97,7 +96,6 @@ subroutine std_atm_pres(height, pstd, user_specified_ps)
9796
end if
9897

9998
end do
100-
deallocate(pb_local)
10199
end subroutine std_atm_pres
102100

103101
!=========================================================================================

0 commit comments

Comments
 (0)