next up previous contents
Next: 4 Utility Modules Up: phys-interface Previous: 2 Requirements   Contents

Subsections

3 Physics Driver and Data Structures

The top level physics driver is physpkg. This subroutine manages the SMP parallelism of the physics packages which are split into two groups, each having its own high level driver. The first group, managed by the driver tphysbc, is called before the coupling with surface processes, while the second group, managed by the driver tphysac, is called after the surface processes.

The fundamental data structure used by the physics driver contains an arbitrary collection of vertical columns, and is referred to as a ``chunk.'' There are no assumptions about the horizonal location of the columns, e.g., they are not necessarily neighbors in the global grid. The chunks are defined in the module phys_grid which provides query functions that return the latitude, longitude coordinates of the individual columns.

The state data is passed to physpkg as a collection of chunks. physpkg performs SMP parallelism by assigning these chunks to the available threads. A single call to tphysbc or tphysac passes a single chunk for the physics packages to operate on.

3.1 Array dimensions

Array dimensions for chunks (pcols and pver) are from the module ppgrid. Array dimensions for constituents (pcnst and ppcnst) are from the module constituents. Currently the parameters pcols, pver, pcnst and ppcnst are set by the cpp macros PCOLS, PLEV, PCNST and PNATS during the build process.

integer, parameter ::&
   pcols = PCOLS, &! maximum number of columns in a chunk
   pver  = PLEV,  &! number of vertical levels
   pcnst = PCNST, &! number of advected constituents (including water vapor)
   ppcnst= PCNST+PNATS ! number of constituents operated on by physics

Physics packages that initialize constituent values must access the dimensions used by the dynamics grid. Those parameters are plon, plev and plat and are contained in module pmgrid. The parameters are set by the cpp macros PLON, PLEV and PLAT during the build process.

integer, parameter ::&
   plon = PLON, &! number of longitudes in the global dynamics grid
   plev = PLEV, &! number of levels in the global dynamics grid
   plat = PLAT, &! number of latitudes in the global dynamics grid

Note that currently CAM uses the same number of vertical levels in both the dynamics and physics grid. But the data structures allow the flexibility to change this in the future.

3.2 Precision of real data

The precision of real data passing through the interface is specified by the kind parameter shr_kind_r8 in module shr_kind_mod. This value is set to give 8-byte floating point representations.

3.3 Derived data types

The argument lists of the public interface methods are insulated from changes in the specific fields that may need to be passed through them by encapsulating the fields in several derived data types. The components of these types use the chunk data structure.

3.3.1 physics_state

The physics driver represents the physics state using a global state structure (physics_state) which is defined in the physics_types module. The physics_state type stores the state variables that are passed between the physics and dynamics.

Memory for the physics state is allocated in stepon, set in d_p_coupling, passed as input (with intent(inout)) to the top level physics driver (physpkg), and may provide return values for the dynamics p_d_coupling (time split case). The state variable passed to physpkg is subsequently passed through the interface subroutines of the individual physics packages. A package is not allowed to change the values of these fields. A package which is designed to directly change the input state must use a local copy of the appropriate input fields.

type physics_state
   integer ::&
      lchnk,  &! chunk index
      ncol     ! Number of columns
   real(r8) ::&
      calday   ! calendar day at end of current timestep
   real(r8), dimension(pcols) ::&
      lat,    &! latitude (radians)
      lon,    &! longitude (radians)
      ps,     &! surface pressure (Pa)
      phis     ! surface geopotential
   real(r8), dimension(pcols,pver) ::&
      t,      &! temperature (K)
      u,      &! zonal velocity (m/s)
      v,      &! meridional velocity (m/s)
      dse,    &! dry static energy (J/kg)
      omega,  &! vertical velocity (Pa/s)
      pmid,   &! pressure at midpoints (Pa)
      pdel,   &! pdel(k) = pint(k+1) - pint(k)
      rpdel,  &! 1./pdel(k)
      lnpmid, &! ln(pmid)
      zm,     &! geopotential height above surface, at midpoint (m)
      exner    ! inverse exner func w.r.t. surface pressure (ps/p)^(R/cp)
   real(r8), dimension(pcols,pver+1) ::&
      pint,   &! pressure at interface (Pa)
      lnpint, &! ln(pint)
      zi      &! geopotential height above surface, at interface (m)
   real(r8), dimension(pcols,pver,ppcnst) ::&
      q        ! constituent mixing ratio (kg/kg moist air)
end type physics_state

Dependent variables, such as zm, zi, T are determined from updated values of dse and q.

3.3.2 physics_tend

The physics driver represents the global tendencies of the physics state using a global tendency structure (physics_tend) which is defined in the physics_types module. The physics_tend type stores the tendencies that are passed from the physics to the dynamics.

Memory for the physics tendency is allocated in stepon, set in the top level physics driver (physpkg), and passed as input to the dynamics (p_d_coupling). The global tendency structure is not passed to individual physics packages. It is set by a function that updates the state structure and/or global tendency structure based on the flags in the local tendency structure and global control variables. This allows process or time splitting of the physics parameterizations.

type physics_tend
   real(r8), dimension(pcols,pver)             :: dtdt, dudt, dvdt
   real(r8), dimension(pcols     )             :: flx_net
end type physics_tend

3.3.3 physics_ptend

The physics_ptend type stores tendencies and their associated boundary fluxes for a single package. A variable of this type is allocated in each of tphysbc and tphysac, and is passed to each physics package.

type physics_ptend

   character*24 :: name    ! name of parameterization which produced tendencies.

! flags specifying which tendencies are returned

   logical ::&
      ls,     &! true if heating rate is returned
      lu,     &! true if u momentum tendency is returned
      lv      &! true if v momentum tendency is returned
   logical, dimension(ppcnst) ::&
      lq      &! true if constituent mixing ratio tendency is returned

! tendencies

   real(r8), dimension(pcols,pver) ::&
      s,   &! heating rate (dry static energy tendency) (J/kg/s)
      u,   &! u momentum tendency (m/s2)
      v    &! v momentum tendency (m/s2)
   real(r8), dimension(pcols,pver,ppcnst) ::&
      q     ! constituent mixing ratio tendency (kg/kg/s, moist air basis)

! boundary fluxes

   real(r8), dimension(pcols) ::&
      hflux_srf,     &! net heat flux at surface (W/m2)
      hflux_top,     &! net heat flux at top of model (W/m2)
      taux_srf,      &! net zonal stress at surface (Pa)
      taux_top,      &! net zonal stress at top of model (Pa)
      tauy_srf,      &! net meridional stress at surface (Pa)
      tauy_top,      &! net meridional stress at top of model (Pa)
   real(r8), dimension(pcols,ppcnst) ::&
      cflx_srf,      &! constituent flux at surface (kg/m2/s)
      cflx_top        ! constituent flux top of model (kg/m2/s)
end type physics_ptend

The removal of water vapor from a column by a precipitation process would be recorded using cflx_srf for constituent $1$.

3.3.4 surface_input

Interaction between the atmosphere and surface models is managed by the surface interface module. It contains two types, each of which has predefined components that use the chunk data structure. The surface_input type contains fields that are set by the atmosphere and passed as input to the surface models.

type surface_input
   real(r8), dimension(pcols) ::&
      precsc,   &! convective snow-fall rate (kg/m2/s)
      precsl,   &! large-scale snow-fall rate (kg/m2/s)
      precc,    &! convective precip rate (kg/m2/s)
      precl,    &! large-scale precip rate (kg/m2/s)
      soll,     &! direct beam solar radiation onto srf (W/m2)
      sols,     &! direct beam solar radiation onto srf (W/m2)
      solld,    &! diffuse solar radiation (lw) onto srf (W/m2)
      solsd,    &! diffuse solar radiation (sw) onto srf (W/m2)
      flwds,    &! downward longwave radiation at surface
      srfrad     ! surface net radiative flux
   real(r8), dimension(pcols,plevmx) ::&
      tssub      ! cam surface/subsurface temperatures (K)
end type surface_input

3.3.5 surface_output

The surface_output type is part of the surface interface module and contains fields that have been set by the surface models and are inputs to the atmosphere.

type surface_output
   integer ::&
      lchnk,    &! chunk index
      ncol       ! number of active columns
   real(r8), dimension(pcols) ::&
      asdir,    &! albedo: shortwave, direct
      asdif,    &! albedo: shortwave, diffuse
      aldir,    &! albedo: longwave, direct
      aldif,    &! albedo: longwave, diffuse
      lwup,     &! longwave up radiative flux
      lhf,      &! latent heat flux
      shf,      &! sensible heat flux
      wsx,      &! surface u-stress (N/m2)
      wsy,      &! surface v-stress (N/m2)
      tref,     &! ref height air temp (K)
      ts         ! sfc temp (merged w/ocean if coupled) (K)
   real(r8), dimension(pcols,ppcnst) ::&
      cflx       ! constituent flux (kg/m2/s)
end type surface_output


next up previous contents
Next: 4 Utility Modules Up: phys-interface Previous: 2 Requirements   Contents
Brian Eaton 2002-09-18