| 1 | #define WRF_PORT |
|---|
| 2 | |
|---|
| 3 | module upper_bc |
|---|
| 4 | |
|---|
| 5 | !--------------------------------------------------------------------------------- |
|---|
| 6 | ! Module to compute the upper boundary condition for temperature (dry static energy) |
|---|
| 7 | ! and trace gases. The standard CAM version does nothing. |
|---|
| 8 | ! |
|---|
| 9 | ! original code by Stacy Walters |
|---|
| 10 | ! adapted by B. A. Boville |
|---|
| 11 | !--------------------------------------------------------------------------------- |
|---|
| 12 | |
|---|
| 13 | use shr_kind_mod, only: r8 => shr_kind_r8 |
|---|
| 14 | #ifndef WRF_PORT |
|---|
| 15 | use ppgrid, only: pcols, pverp |
|---|
| 16 | use constituents, only: pcnst |
|---|
| 17 | #else |
|---|
| 18 | use module_cam_support, only: pcols, pverp, pcnst |
|---|
| 19 | #endif |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | implicit none |
|---|
| 23 | private |
|---|
| 24 | save |
|---|
| 25 | ! |
|---|
| 26 | ! Public interfaces |
|---|
| 27 | ! |
|---|
| 28 | public :: ubc_defaultopts ! set default values of namelist variables |
|---|
| 29 | public :: ubc_setopts ! get namelist input |
|---|
| 30 | public :: ubc_init ! global initialization |
|---|
| 31 | #ifndef WRF_PORT |
|---|
| 32 | public :: ubc_timestep_init ! time step initialization |
|---|
| 33 | #endif |
|---|
| 34 | public :: ubc_get_vals ! get ubc values for this step |
|---|
| 35 | |
|---|
| 36 | !================================================================================================ |
|---|
| 37 | contains |
|---|
| 38 | !================================================================================================ |
|---|
| 39 | |
|---|
| 40 | subroutine ubc_defaultopts(tgcm_ubc_file_out, snoe_ubc_file_out) |
|---|
| 41 | !----------------------------------------------------------------------- |
|---|
| 42 | ! Purpose: Return default runtime options |
|---|
| 43 | !----------------------------------------------------------------------- |
|---|
| 44 | |
|---|
| 45 | character(len=*), intent(out), optional :: tgcm_ubc_file_out |
|---|
| 46 | character(len=*), intent(out), optional :: snoe_ubc_file_out |
|---|
| 47 | !----------------------------------------------------------------------- |
|---|
| 48 | |
|---|
| 49 | end subroutine ubc_defaultopts |
|---|
| 50 | |
|---|
| 51 | !================================================================================================ |
|---|
| 52 | |
|---|
| 53 | subroutine ubc_setopts(tgcm_ubc_file_in, snoe_ubc_file_in) |
|---|
| 54 | !----------------------------------------------------------------------- |
|---|
| 55 | ! Purpose: Set runtime options |
|---|
| 56 | !----------------------------------------------------------------------- |
|---|
| 57 | |
|---|
| 58 | character(len=*), intent(in), optional :: tgcm_ubc_file_in |
|---|
| 59 | character(len=*), intent(in), optional :: snoe_ubc_file_in |
|---|
| 60 | !----------------------------------------------------------------------- |
|---|
| 61 | |
|---|
| 62 | end subroutine ubc_setopts |
|---|
| 63 | |
|---|
| 64 | !=============================================================================== |
|---|
| 65 | |
|---|
| 66 | subroutine ubc_init |
|---|
| 67 | !----------------------------------------------------------------------- |
|---|
| 68 | ! Initialization of time independent fields for the upper boundary condition |
|---|
| 69 | ! Calls initialization routine for MSIS, TGCM and SNOE |
|---|
| 70 | !----------------------------------------------------------------------- |
|---|
| 71 | |
|---|
| 72 | end subroutine ubc_init |
|---|
| 73 | |
|---|
| 74 | !=============================================================================== |
|---|
| 75 | #ifndef WRF_PORT |
|---|
| 76 | subroutine ubc_timestep_init(state) |
|---|
| 77 | use physics_types,only : physics_state |
|---|
| 78 | use ppgrid, only : begchunk, endchunk |
|---|
| 79 | |
|---|
| 80 | !----------------------------------------------------------------------- |
|---|
| 81 | ! timestep dependent setting |
|---|
| 82 | !----------------------------------------------------------------------- |
|---|
| 83 | |
|---|
| 84 | type(physics_state), intent(in):: state(begchunk:endchunk) |
|---|
| 85 | |
|---|
| 86 | end subroutine ubc_timestep_init |
|---|
| 87 | #endif |
|---|
| 88 | |
|---|
| 89 | !=============================================================================== |
|---|
| 90 | |
|---|
| 91 | subroutine ubc_get_vals (lchnk, ncol, ntop_molec, pint, zi, msis_temp, ubc_mmr) |
|---|
| 92 | !----------------------------------------------------------------------- |
|---|
| 93 | ! interface routine for vertical diffusion and pbl scheme |
|---|
| 94 | !----------------------------------------------------------------------- |
|---|
| 95 | |
|---|
| 96 | !------------------------------Arguments-------------------------------- |
|---|
| 97 | integer, intent(in) :: lchnk ! chunk identifier |
|---|
| 98 | integer, intent(in) :: ncol ! number of atmospheric columns |
|---|
| 99 | integer, intent(in) :: ntop_molec ! top of molecular diffusion region (=1) |
|---|
| 100 | real(r8), intent(in) :: pint(pcols,pverp) ! interface pressures |
|---|
| 101 | real(r8), intent(in) :: zi(pcols,pverp) ! interface geoptl height above sfc |
|---|
| 102 | |
|---|
| 103 | real(r8), intent(out) :: ubc_mmr(pcols,pcnst) ! upper bndy mixing ratios (kg/kg) |
|---|
| 104 | real(r8), intent(out) :: msis_temp(pcols) ! upper bndy temperature (K) |
|---|
| 105 | |
|---|
| 106 | end subroutine ubc_get_vals |
|---|
| 107 | |
|---|
| 108 | end module upper_bc |
|---|