Skip to content

Commit

Permalink
Replace allocatable variable with parameter-declared (stack) variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
nusbaume committed Oct 21, 2024
1 parent 59e8699 commit 26bedd0
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/utils/std_atm_profile.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,22 @@ module std_atm_profile

subroutine std_atm_pres(height, pstd, user_specified_ps)

! use statements
use cam_abortutils, only: handle_allocate_error

! arguments
real(r8), intent(in) :: height(:) ! height above sea level in meters
real(r8), intent(out) :: pstd(:) ! std pressure in Pa
real(r8), optional, intent(in) :: user_specified_ps

integer :: i, ii, k, nlev
integer :: ierr
integer :: i, ii, k, nlev
integer :: ierr
real(r8) :: pb_local(nreg)

character(len=*), parameter :: routine = 'std_atm_pres'
real(r8), allocatable :: pb_local(:)
!----------------------------------------------------------------------------
allocate(pb_local(nreg), stat=ierr)
call handle_allocate_error(ierr, routine, 'pb_local(nreg)')

! Initialize local standard pressure values array
pb_local = pb

! Set new surface pressure value if provided by the caller
if (present(user_specified_ps)) then
pb_local(1) = user_specified_ps
end if
Expand All @@ -97,7 +96,6 @@ subroutine std_atm_pres(height, pstd, user_specified_ps)
end if

end do
deallocate(pb_local)
end subroutine std_atm_pres

!=========================================================================================
Expand Down

0 comments on commit 26bedd0

Please sign in to comment.