Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/chemistry/aerosol/wetdep.F90
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ subroutine wetdep_init()
!==============================================================================
subroutine wetdep_inputs_set( state, pbuf, inputs )
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx
use physics_buffer, only: physics_buffer_desc, pbuf_get_field

! args

Expand All @@ -122,12 +122,11 @@ subroutine wetdep_inputs_set( state, pbuf, inputs )
real(r8) :: rainmr(pcols,pver) ! mixing ratio of rain within cloud volume
real(r8) :: cldst(pcols,pver) ! Stratiform cloud fraction

integer :: itim, ncol
integer :: ncol

ncol = state%ncol
itim = pbuf_old_tim_idx()

call pbuf_get_field(pbuf, cld_idx, inputs%cldt, start=(/1,1,itim/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, cld_idx, inputs%cldt )
call pbuf_get_field(pbuf, qme_idx, inputs%qme )
call pbuf_get_field(pbuf, prain_idx, inputs%prain )
call pbuf_get_field(pbuf, nevapr_idx, inputs%evapr )
Expand Down
6 changes: 2 additions & 4 deletions src/chemistry/geoschem/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
use mo_neu_wetdep, only : neu_wetdep_tend
use mo_setinv, only : setinv
use orbit, only : zenith ! For computing SZA
use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx
use physics_buffer, only : physics_buffer_desc, pbuf_get_field
use physics_buffer, only : pbuf_get_chunk, pbuf_get_index
use perf_mod, only : t_startf, t_stopf
use phys_grid, only : get_ncols_p, get_rlat_all_p, get_rlon_all_p
Expand Down Expand Up @@ -2141,7 +2141,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
REAL(r8), POINTER :: pbuf_i(:) ! ptr to pbuf data (/pcols/) horizontal only (horiz_only)
INTEGER :: tmpIdx ! pbuf field id

INTEGER :: TIM_NDX
INTEGER :: IERR

INTEGER, SAVE :: iStep = 0
Expand Down Expand Up @@ -2660,11 +2659,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dT, pbuf, fh2o )
CALL Zenith( Calday, Rlats, Rlons, CSZA, nY )

! Get all required data from physics buffer
TIM_NDX = pbuf_old_tim_idx()
CALL pbuf_get_field( pbuf, NDX_PBLH, PblH )
CALL pbuf_get_field( pbuf, NDX_FSDS, Fsds )
CALL pbuf_get_field( pbuf, NDX_CLDTOP, cldTop )
CALL pbuf_get_field( pbuf, NDX_CLDFRC, cldFrc, START=(/1,1,TIM_NDX/), KOUNT=(/NCOL,PVER,1/) )
CALL pbuf_get_field( pbuf, NDX_CLDFRC, cldFrc )
CALL pbuf_get_field( pbuf, NDX_NEVAPR, NEvapr, START=(/1,1/), KOUNT=(/NCOL,PVER/))
CALL pbuf_get_field( pbuf, NDX_PRAIN, PRain, START=(/1,1/), KOUNT=(/NCOL,PVER/))
CALL pbuf_get_field( pbuf, NDX_LSFLXPRC, LsFlxPrc, START=(/1,1/), KOUNT=(/NCOL,PVERP/))
Expand Down
6 changes: 2 additions & 4 deletions src/chemistry/mozart/chemistry.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dt, pbuf, fh2o)
!
!-----------------------------------------------------------------------

use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx
use physics_buffer, only : physics_buffer_desc, pbuf_get_field
use cam_history, only : outfld
use time_manager, only : get_curr_calday
use mo_gas_phase_chemdr, only : gas_phase_chemdr
Expand Down Expand Up @@ -1214,7 +1214,6 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dt, pbuf, fh2o)
real(r8) :: nhx_nitrogen_flx(pcols)
real(r8) :: noy_nitrogen_flx(pcols)

integer :: tim_ndx

logical :: lq(pcnst)

Expand Down Expand Up @@ -1260,11 +1259,10 @@ subroutine chem_timestep_tend( state, ptend, cam_in, cam_out, dt, pbuf, fh2o)
call tropopause_findChemTrop(state, tropLevChem)
endif

tim_ndx = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, ndx_fsds, fsds)
call pbuf_get_field(pbuf, ndx_pblh, pblh)
call pbuf_get_field(pbuf, ndx_prain, prain, start=(/1,1/), kount=(/ncol,pver/))
call pbuf_get_field(pbuf, ndx_cld, cldfr, start=(/1,1,tim_ndx/), kount=(/ncol,pver,1/) )
call pbuf_get_field(pbuf, ndx_cld, cldfr )
call pbuf_get_field(pbuf, ndx_cmfdqr, cmfdqr, start=(/1,1/), kount=(/ncol,pver/))
call pbuf_get_field(pbuf, ndx_nevapr, nevapr, start=(/1,1/), kount=(/ncol,pver/))
call pbuf_get_field(pbuf, ndx_cldtop, cldtop )
Expand Down
6 changes: 2 additions & 4 deletions src/chemistry/mozart/mo_gas_phase_chemdr.F90
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ subroutine gas_phase_chemdr(state, lchnk, ncol, imozart, q, &
use mo_chm_diags, only : chm_diags, het_diags
use perf_mod, only : t_startf, t_stopf
use gas_wetdep_opts, only : gas_wetdep_method
use physics_buffer, only : physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx
use physics_buffer, only : physics_buffer_desc, pbuf_get_field
use physics_types, only : physics_state
use infnan, only : nan, assignment(=)
use rate_diags, only : rate_diags_calc, rate_diags_o3s_loss
Expand Down Expand Up @@ -398,7 +398,6 @@ subroutine gas_phase_chemdr(state, lchnk, ncol, imozart, q, &
real(r8), pointer :: cldtop(:)

integer :: i, k, m, n
integer :: tim_ndx
real(r8) :: delt_inverse
real(r8) :: esfact
real(r8) :: invariants(ncol,pver,nfs)
Expand Down Expand Up @@ -530,9 +529,8 @@ subroutine gas_phase_chemdr(state, lchnk, ncol, imozart, q, &
!-----------------------------------------------------------------------
call get_rlat_all_p( lchnk, ncol, rlats )
call get_rlon_all_p( lchnk, ncol, rlons )
tim_ndx = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, ndx_prain, prain, start=(/1,1/), kount=(/ncol,pver/))
call pbuf_get_field(pbuf, ndx_cldfr, cldfr, start=(/1,1,tim_ndx/), kount=(/ncol,pver,1/) )
call pbuf_get_field(pbuf, ndx_cldfr, cldfr )
call pbuf_get_field(pbuf, ndx_cmfdqr, cmfdqr, start=(/1,1/), kount=(/ncol,pver/))
call pbuf_get_field(pbuf, ndx_nevapr, nevapr, start=(/1,1/), kount=(/ncol,pver/))
call pbuf_get_field(pbuf, ndx_cldtop, cldtop )
Expand Down
2 changes: 1 addition & 1 deletion src/chemistry/utils/modal_aero_calcsize.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module modal_aero_calcsize

use ppgrid, only: pcols, pver
use physics_types, only: physics_state, physics_ptend
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_old_tim_idx, pbuf_get_field
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field

use phys_control, only: phys_getopts
use aerosol_properties_mod, only: aerosol_properties
Expand Down
6 changes: 2 additions & 4 deletions src/chemistry/utils/modal_aero_wateruptake.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module modal_aero_wateruptake
use physconst, only: pi, rhoh2o, rair
use ppgrid, only: pcols, pver
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_old_tim_idx, pbuf_get_field
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field

use wv_saturation, only: qsat_water
use aerosol_properties_mod, only: aerosol_properties
Expand Down Expand Up @@ -204,7 +204,6 @@ subroutine modal_aero_wateruptake_dr(state, pbuf, aero_props, aero_state, &
integer :: stat

integer :: i, k, l, m
integer :: itim_old
integer :: nmodes
integer :: nspec
integer :: tropLev(pcols)
Expand Down Expand Up @@ -419,8 +418,7 @@ subroutine modal_aero_wateruptake_dr(state, pbuf, aero_props, aero_state, &

! relative humidity calc

itim_old = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, cld_idx, cldn, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, cld_idx, cldn )

do k = top_lev, pver
call qsat_water(t(1:ncol,k), pmid(1:ncol,k), es(1:ncol), qs(1:ncol), ncol)
Expand Down
2 changes: 0 additions & 2 deletions src/dynamics/fv/dyn_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ module dyn_grid
integer, parameter, public :: dyn_vstag_decomp = 103
integer, parameter, public :: dyn_zonal_decomp = 104

integer, parameter, public :: ptimelevels = 2 ! number of time levels in the dycore

integer :: ngcols_d = 0 ! number of dynamics columns

type(t_fvdycore_grid), pointer :: grid
Expand Down
2 changes: 0 additions & 2 deletions src/dynamics/mpas/dyn_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ module dyn_grid
! uses ncol, lat, lon
integer, parameter :: edge_decomp = 102 ! edge node grid
integer, parameter :: vertex_decomp = 103 ! vertex node grid
integer, parameter :: ptimelevels = 2

public :: &
dyn_decomp, &
ptimelevels, &
dyn_grid_init, &
get_dyn_grid_info, &
get_horiz_grid_dim_d, &
Expand Down
3 changes: 0 additions & 3 deletions src/dynamics/se/dyn_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ module dyn_grid
! Name of horizontal grid dimension in initial file.
character(len=6), protected :: ini_grid_hdim_name = ''

integer, parameter :: ptimelevels = 2

type (TimeLevel_t) :: TimeLevel ! main time level struct (used by tracers)
type (hvcoord_t) :: hvcoord
type(element_t), pointer :: elem(:) => null() ! local GLL elements for this task
Expand All @@ -75,7 +73,6 @@ module dyn_grid
public :: dyn_decomp
public :: ini_grid_name
public :: ini_grid_hdim_name
public :: ptimelevels
public :: TimeLevel
public :: hvcoord
public :: elem
Expand Down
45 changes: 20 additions & 25 deletions src/physics/cam/cam_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module cam_diagnostics
use physics_types, only: physics_state, physics_tend, physics_ptend
use ppgrid, only: pcols, pver, begchunk, endchunk
use physics_buffer, only: physics_buffer_desc, pbuf_add_field, dtype_r8
use physics_buffer, only: dyn_time_lvls, pbuf_get_field, pbuf_get_index, pbuf_old_tim_idx
use physics_buffer, only: pbuf_get_field, pbuf_get_index

use cam_history, only: outfld, write_inithist, hist_fld_active, inithist_all, write_camiop
use cam_history_support, only: max_fieldname_len
Expand Down Expand Up @@ -164,9 +164,9 @@ subroutine diag_register_dry()
call pbuf_add_field('PSL', 'physpkg', dtype_r8, (/pcols/), psl_idx)

! Request physics buffer space for fields that persist across timesteps.
call pbuf_add_field('T_TTEND', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), t_ttend_idx)
call pbuf_add_field('T_UTEND', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), t_utend_idx)
call pbuf_add_field('T_VTEND', 'global', dtype_r8, (/pcols,pver,dyn_time_lvls/), t_vtend_idx)
call pbuf_add_field('T_TTEND', 'global', dtype_r8, (/pcols,pver/), t_ttend_idx)
call pbuf_add_field('T_UTEND', 'global', dtype_r8, (/pcols,pver/), t_utend_idx)
call pbuf_add_field('T_VTEND', 'global', dtype_r8, (/pcols,pver/), t_vtend_idx)
end subroutine diag_register_dry

subroutine diag_register_moist()
Expand Down Expand Up @@ -899,14 +899,12 @@ subroutine diag_conv_tend_ini(state,pbuf)

!! initialize to pbuf T_TTEND to temperature at first timestep
if (is_first_step()) then
do m = 1, dyn_time_lvls
call pbuf_get_field(pbuf, t_ttend_idx, t_ttend, start=(/1,1,m/), kount=(/pcols,pver,1/))
t_ttend(:ncol,:) = state%t(:ncol,:)
call pbuf_get_field(pbuf, t_utend_idx, t_utend, start=(/1,1,m/), kount=(/pcols,pver,1/))
t_utend(:ncol,:) = state%u(:ncol,:)
call pbuf_get_field(pbuf, t_vtend_idx, t_vtend, start=(/1,1,m/), kount=(/pcols,pver,1/))
t_vtend(:ncol,:) = state%v(:ncol,:)
end do
call pbuf_get_field(pbuf, t_ttend_idx, t_ttend)
t_ttend(:ncol,:) = state%t(:ncol,:)
call pbuf_get_field(pbuf, t_utend_idx, t_utend)
t_utend(:ncol,:) = state%u(:ncol,:)
call pbuf_get_field(pbuf, t_vtend_idx, t_vtend)
t_vtend(:ncol,:) = state%v(:ncol,:)
end if

end subroutine diag_conv_tend_ini
Expand Down Expand Up @@ -1950,7 +1948,6 @@ subroutine diag_physvar_ic (lchnk, pbuf, cam_out, cam_in)
!
!---------------------------Local workspace-----------------------------
!
integer :: itim_old ! indices

real(r8), pointer, dimension(:,:) :: cwat_var
real(r8), pointer, dimension(:,:) :: conv_var_3d
Expand All @@ -1964,35 +1961,34 @@ subroutine diag_physvar_ic (lchnk, pbuf, cam_out, cam_in)
!
! Associate pointers with physics buffer fields
!
itim_old = pbuf_old_tim_idx()

if (qcwat_idx > 0) then
call pbuf_get_field(pbuf, qcwat_idx, cwat_var, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, qcwat_idx, cwat_var )
call outfld('QCWAT&IC ',cwat_var, pcols,lchnk)
end if

if (tcwat_idx > 0) then
call pbuf_get_field(pbuf, tcwat_idx, cwat_var, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, tcwat_idx, cwat_var )
call outfld('TCWAT&IC ',cwat_var, pcols,lchnk)
end if

if (lcwat_idx > 0) then
call pbuf_get_field(pbuf, lcwat_idx, cwat_var, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, lcwat_idx, cwat_var )
call outfld('LCWAT&IC ',cwat_var, pcols,lchnk)
end if

if (cld_idx > 0) then
call pbuf_get_field(pbuf, cld_idx, cwat_var, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, cld_idx, cwat_var )
call outfld('CLOUD&IC ',cwat_var, pcols,lchnk)
end if

if (concld_idx > 0) then
call pbuf_get_field(pbuf, concld_idx, cwat_var, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, concld_idx, cwat_var )
call outfld('CONCLD&IC ',cwat_var, pcols,lchnk)
end if

if (cush_idx > 0) then
call pbuf_get_field(pbuf, cush_idx, conv_var_2d ,(/1,itim_old/), (/pcols,1/))
call pbuf_get_field(pbuf, cush_idx, conv_var_2d )
call outfld('CUSH&IC ',conv_var_2d, pcols,lchnk)

end if
Expand Down Expand Up @@ -2064,7 +2060,7 @@ subroutine diag_phys_tend_writeout_dry(state, pbuf, tend, ztodt)
real(r8), pointer, dimension(:,:) :: t_ttend
real(r8), pointer, dimension(:,:) :: t_utend
real(r8), pointer, dimension(:,:) :: t_vtend
integer :: itim_old,m
integer :: m

!-----------------------------------------------------------------------

Expand Down Expand Up @@ -2093,10 +2089,9 @@ subroutine diag_phys_tend_writeout_dry(state, pbuf, tend, ztodt)
! Total (physics+dynamics, everything!) tendency for Temperature

!! get temperature, U, and V stored in physics buffer
itim_old = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, t_ttend_idx, t_ttend, start=(/1,1,itim_old/), kount=(/pcols,pver,1/))
call pbuf_get_field(pbuf, t_utend_idx, t_utend, start=(/1,1,itim_old/), kount=(/pcols,pver,1/))
call pbuf_get_field(pbuf, t_vtend_idx, t_vtend, start=(/1,1,itim_old/), kount=(/pcols,pver,1/))
call pbuf_get_field(pbuf, t_ttend_idx, t_ttend)
call pbuf_get_field(pbuf, t_utend_idx, t_utend)
call pbuf_get_field(pbuf, t_vtend_idx, t_vtend)

!! calculate and outfld the total temperature, U, and V tendencies
ftem3(:ncol,:) = (state%t(:ncol,:) - t_ttend(:ncol,:))/ztodt
Expand Down
12 changes: 6 additions & 6 deletions src/physics/cam/check_energy.F90
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,20 @@ subroutine check_energy_register()
!
!-----------------------------------------------------------------------

use physics_buffer, only : pbuf_add_field, dtype_r8, dyn_time_lvls
use physics_buffer, only : pbuf_add_field, dtype_r8
use physics_buffer, only : pbuf_register_subcol
use subcol_utils, only : is_subcol_on

!-----------------------------------------------------------------------

! Request physics buffer space for fields that persist across timesteps.

call pbuf_add_field('TEOUT', 'global',dtype_r8 , (/pcols,dyn_time_lvls/), teout_idx)
call pbuf_add_field('DTCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dtcore_idx)
call pbuf_add_field('TEOUT', 'global',dtype_r8 , (/pcols/), teout_idx)
call pbuf_add_field('DTCORE','global',dtype_r8, (/pcols,pver/),dtcore_idx)
! DQCORE refers to dycore tendency of water vapor
call pbuf_add_field('DQCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dqcore_idx)
call pbuf_add_field('DUCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),ducore_idx)
call pbuf_add_field('DVCORE','global',dtype_r8, (/pcols,pver,dyn_time_lvls/),dvcore_idx)
call pbuf_add_field('DQCORE','global',dtype_r8, (/pcols,pver/),dqcore_idx)
call pbuf_add_field('DUCORE','global',dtype_r8, (/pcols,pver/),ducore_idx)
call pbuf_add_field('DVCORE','global',dtype_r8, (/pcols,pver/),dvcore_idx)
if(is_subcol_on()) then
call pbuf_register_subcol('TEOUT', 'phys_register', teout_idx)
call pbuf_register_subcol('DTCORE', 'phys_register', dtcore_idx)
Expand Down
6 changes: 2 additions & 4 deletions src/physics/cam/cloud_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ subroutine cloud_diagnostics_calc(state, pbuf)
! **** mixes interface and physics code temporarily
!-----------------------------------------------------------------------
use physics_types, only: physics_state
use physics_buffer,only: physics_buffer_desc, pbuf_get_field, pbuf_old_tim_idx
use physics_buffer,only: physics_buffer_desc, pbuf_get_field
use cloud_optical_properties, only: cldovrlap, cldclw, cldems_rk, cldems
use conv_water, only: conv_water_in_rad, conv_water_4rad
use radiation, only: radiation_do
Expand Down Expand Up @@ -257,7 +257,6 @@ subroutine cloud_diagnostics_calc(state, pbuf)
real(r8), pointer :: totg_ice(:,:) ! grid box total cloud ice mixing ratio
real(r8), pointer :: totg_liq(:,:) ! grid box total cloud liquid mixing ratio

integer :: itim_old

real(r8) :: cwp (pcols,pver) ! in-cloud cloud (total) water path
real(r8) :: gicewp(pcols,pver) ! grid-box cloud ice water path
Expand Down Expand Up @@ -307,8 +306,7 @@ subroutine cloud_diagnostics_calc(state, pbuf)
ncol = state%ncol
lchnk = state%lchnk

itim_old = pbuf_old_tim_idx()
call pbuf_get_field(pbuf, cld_idx, cld, start=(/1,1,itim_old/), kount=(/pcols,pver,1/) )
call pbuf_get_field(pbuf, cld_idx, cld )

call pbuf_get_field(pbuf, gb_totcldicemr_idx, totg_ice)
call pbuf_get_field(pbuf, gb_totcldliqmr_idx, totg_liq)
Expand Down
2 changes: 1 addition & 1 deletion src/physics/cam/cloud_rad_props.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module cloud_rad_props
use shr_kind_mod, only: r8 => shr_kind_r8
use ppgrid, only: pcols, pver, pverp
use physics_types, only: physics_state
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field, pbuf_old_tim_idx
use physics_buffer, only: physics_buffer_desc, pbuf_get_index, pbuf_get_field
use constituents, only: cnst_get_ind
use radconstants, only: nswbands, nlwbands, idx_sw_diag
use rad_constituents, only: iceopticsfile, liqopticsfile
Expand Down
Loading
Loading